Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
kekyo committed Apr 30, 2024
1 parent eef39e0 commit 665afc7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@

// ================== GLOBAL METHODS =========================

.method assembly static void _start() cil managed
.method assembly static int32 _start() cil managed
{
.entrypoint
// Code size 6 (0x6)
.maxstack 8
IL_0000: call void C.text::main()
IL_0000: call int32 C.text::main()
IL_0005: ret
} // end of global method _start

Expand All @@ -43,13 +43,14 @@
.class public abstract auto ansi sealed C.text
extends [mscorlib]System.Object
{
.method public static void main() cil managed
.method public static int32 main() cil managed
{
// Code size 11 (0xb)
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldstr "Hello world"
IL_0005: call void [mscorlib]System.Console::WriteLine(string)
IL_000a: ret
IL_000a: ldc.i4.0
IL_000b: ret
} // end of method text::main

} // end of class C.text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@

// ================== GLOBAL METHODS =========================

.method assembly static void _start() cil managed
.method assembly static int32 _start() cil managed
{
.entrypoint
// Code size 6 (0x6)
.maxstack 8
IL_0000: call void C.text::main()
IL_0000: call int32 C.text::main()
IL_0005: ret
} // end of global method _start

Expand All @@ -43,17 +43,18 @@
.class public abstract auto ansi sealed C.text
extends [mscorlib]System.Object
{
.method public static void main() cil managed
.method public static int32 main() cil managed
{
// Code size 14 (0xe)
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldc.i4.1
IL_0001: box [mscorlib]System.Int32
IL_0006: ldc.i4.3
IL_0007: call valuetype [mscorlib]System.Runtime.InteropServices.GCHandle [mscorlib]System.Runtime.InteropServices.GCHandle::Alloc(object,
valuetype [mscorlib]System.Runtime.InteropServices.GCHandleType)
IL_000c: pop
IL_000d: ret
IL_000d: ldc.i4.0
IL_000e: ret
} // end of method text::main

} // end of class C.text
Expand Down
6 changes: 4 additions & 2 deletions chibild/chibild.core.Tests/LinkerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1507,9 +1507,10 @@ call void(System.RuntimeArgumentHandle) System.ArgIterator..ctor
public Task CallDotNetAssemblyMethod()
{
var actual = Run(@"
.function public void() main
.function public int32() main
ldstr ""Hello world""
call void(string) System.Console.WriteLine
ldc.i4.0
ret",
new[] { typeof(System.Console).Assembly.Location },
AssemblyTypes.Exe);
Expand All @@ -1520,12 +1521,13 @@ call void(string) System.Console.WriteLine
public Task CallDotNetAssemblyMethod2()
{
var actual = Run(@"
.function public void() main
.function public int32() main
ldc.i4.1
box int32
ldc.i4.3
call System.Runtime.InteropServices.GCHandle(object,System.Runtime.InteropServices.GCHandleType) System.Runtime.InteropServices.GCHandle.Alloc
pop
ldc.i4.0
ret",
new[] { typeof(System.Console).Assembly.Location },
AssemblyTypes.Exe);
Expand Down

0 comments on commit 665afc7

Please sign in to comment.