Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 53 additions & 67 deletions src/coreclr/tests/src/JIT/Directed/IL/PInvokeTail/PInvokeTail.il
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
{
}


.class public auto ansi Wrapper
{
.method public static pinvokeimpl("msvcrt.dll" cdecl) int32 puts(int8* A_0) il managed preservesig{ }
Expand All @@ -28,78 +27,65 @@

} // end of class 'Wrapper'

.method public static int32 ?callputs1@@YAHXZ() il managed
.method public static pinvokeimpl("msvcrt.dll" cdecl) int32 puts(int8* A_0) il managed preservesig{ }

.method public static int32 callputs1(char&) il managed
{
.maxstack 1
.maxstack 1

IL_0000: ldstr bytearray(48 65 6C 6C 6F 20 57 6F 72 6C 64 21 00 00 00 00) //ldptr D_00003000
IL_0005: tail. call int32 puts(int8*)
IL_000a: ret
} // end of global method '?callputs1@@YAHXZ'
ldarg.0
conv.i
tail. call int32 puts(int8*)
ret
} // end of global method 'callputs1'

.method public static int32 ?callputs2@@YAHXZ() il managed
.method public static int32 callputs2(char&) il managed
{
.maxstack 1
.maxstack 1

IL_0000: ldstr bytearray(48 65 6C 6C 6F 20 57 6F 72 6C 64 21 00 00 00 00) //" " //ldptr D_00003010
IL_0005: tail. call int32 Wrapper::puts(int8*)
IL_000a: ret
} // end of global method '?callputs2@@YAHXZ'
ldarg.0
conv.i
tail. call int32 Wrapper::puts(int8*)
ret
} // end of global method 'callputs2'

.method public static int32 main() il managed
{
.entrypoint
.maxstack 2

IL_0000: call int32 ?callputs1@@YAHXZ()
IL_0005: ldc.i4 0x0
IL_000a: bge IL_0029

IL_000f: call class [mscorlib]System.IO.TextWriter [System.Console]System.Console::get_Out()
IL_0014: ldstr "Puts Failed" //ldptr D_00003020
IL_0019: //newobj instance void [mscorlib]System.String::.ctor(wchar*)
IL_001e: callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
IL_0023: ldc.i4 0x1
IL_0028: ret

IL_0029: call int32 ?callputs2@@YAHXZ()
IL_002e: ldc.i4 0x0
IL_0033: bge IL_0052

IL_0038: call class [mscorlib]System.IO.TextWriter [System.Console]System.Console::get_Out()
IL_003d: ldstr "wrapper: Puts failed"//ldptr D_00003040
IL_0042: //newobj instance void [mscorlib]System.String::.ctor(wchar*)
IL_0047: callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
IL_004c: ldc.i4 0x1
IL_0051: ret

IL_0052: call class [mscorlib]System.IO.TextWriter [System.Console]System.Console::get_Out()
IL_0057: ldstr "passed"//ldptr D_00003070
IL_005c: //newobj instance void [mscorlib]System.String::.ctor(wchar*)
IL_0061: callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
IL_0066: ldc.i4 0x64
IL_006b: ret
.entrypoint
.maxstack 4
.locals init (char& pinned)

ldstr bytearray(48 65 6C 6C 6F 20 57 6F 72 6C 64 21 00 00 00 00) // "Hello World!"
call instance char& modreq([mscorlib]System.Runtime.InteropServices.InAttribute) [mscorlib]System.String::GetPinnableReference()
stloc.0

ldloc.0
call int32 callputs1(char&)
ldc.i4 0x0
bge PASS_1

call class [mscorlib]System.IO.TextWriter [System.Console]System.Console::get_Out()
ldstr "puts() failed"
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldc.i4 0x1
ret

PASS_1:
ldloc.0
call int32 callputs2(char&)
ldc.i4 0x0
bge PASS_2

call class [mscorlib]System.IO.TextWriter [System.Console]System.Console::get_Out()
ldstr "puts() failed"
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldc.i4 0x1
ret

PASS_2:
call class [mscorlib]System.IO.TextWriter [System.Console]System.Console::get_Out()
ldstr "Passed"
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldc.i4 0x64
ret
} // end of global method 'main'

.method public static int32 _mainMSIL(int32 argc,int8** argv,int8** envp) il managed
{
.maxstack 1

IL_0000: tail. call int32 main()
IL_0005: ret
} // end of global method '_mainMSIL'

.method public static pinvokeimpl("msvcrt.dll" cdecl) int32 puts(int8* A_0) il managed preservesig{ }
.data D_00003000 = bytearray (
48 65 6C 6C 6F 20 57 6F 72 6C 64 21 00 00 00 00) // Hello World!....
.data D_00003010 = bytearray (
48 65 6C 6C 6F 20 57 6F 72 6C 64 21 00 00 00 00) // Hello World!....
.data D_00003020 = bytearray (
70 00 75 00 74 00 73 00 28 00 29 00 20 00 66 00 // p.u.t.s.(.). .f.
61 00 69 00 6C 00 65 00 64 00 2E 00 00 00 00 00) // a.i.l.e.d.......
.data D_00003040 = bytearray (
57 00 72 00 61 00 70 00 70 00 65 00 72 00 3A 00 // W.r.a.p.p.e.r.:.
3A 00 70 00 75 00 74 00 73 00 28 00 29 00 20 00 // :.p.u.t.s.(.). .
66 00 61 00 69 00 6C 00 65 00 64 00 2E 00 00 00) // f.a.i.l.e.d.....
.data D_00003070 = bytearray (
50 00 61 00 73 00 73 00 65 00 64 00 00 00) // P.a.s.s.e.d...
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ FAILURE3:
stloc.1

ldloc 1
conv.i
call int32 Pin1_Test::Ret_Ptr(void*)
stloc 3

Expand All @@ -148,6 +149,7 @@ FAILURE3:
stloc.2

ldloc 2
conv.i
call int32 Pin1_Test::Ret_Ptr(void*)
stloc 4

Expand All @@ -158,13 +160,15 @@ FAILURE3:

call void [mscorlib]System.GC::Collect()
ldloc 1
conv.i
call int32 Pin1_Test::Ret_Ptr(void*)
ldloc 3
conv.i
beq AA_1

SOFT2:
ldloc 2
conv.i
call int32 Pin1_Test::Ret_Ptr(void*)
ldloc 4
conv.i
Expand Down Expand Up @@ -202,6 +206,7 @@ AA_3:
stloc.1

ldloc 1
conv.i
call int32 Pin1_Test::Ret_Ptr(void*)
stloc 3

Expand All @@ -210,6 +215,7 @@ AA_3:
stloc.2

ldloc 2
conv.i
call int32 Pin1_Test::Ret_Ptr(void*)
stloc 4

Expand All @@ -220,13 +226,15 @@ AA_3:

call void [mscorlib]System.GC::Collect()
ldloc 1
conv.i
call int32 Pin1_Test::Ret_Ptr(void*)
ldloc 3
conv.i
beq AA_1

SOFT4:
ldloc 2
conv.i
call int32 Pin1_Test::Ret_Ptr(void*)
ldloc 4
conv.i
Expand Down Expand Up @@ -263,6 +271,7 @@ AA_3:
stloc.1

ldloc 1
conv.i
call int32 Pin1_Test::Ret_Ptr(void*)
stloc 3

Expand All @@ -271,6 +280,7 @@ AA_3:
stloc.2

ldloc 2
conv.i
call int32 Pin1_Test::Ret_Ptr(void*)
stloc 4

Expand All @@ -285,7 +295,8 @@ AA_3:
ldloc 5
stfld int32 Consume::yucko

ldloc 2
ldloc 2
conv.i
ldflda int32 Consume::yucko
ldc.i4 66
call void Pin1_Test::Set_Val(void*,int32)
Expand All @@ -301,7 +312,8 @@ Yippie1:
ldloc 5
stfld int32 Consume::yucko

ldloc 2
ldloc 2
conv.i
ldflda int32 Consume::yucko
ldc.i4 88
call void Pin1_Test::Set_Val(void*,int32)
Expand All @@ -314,13 +326,15 @@ Yippie1:
Yippie2:
call void [mscorlib]System.GC::Collect()
ldloc 1
conv.i
call int32 Pin1_Test::Ret_Ptr(void*)
ldloc 3
conv.i
beq AA_1

SOFT5:
ldloc 2
conv.i
call int32 Pin1_Test::Ret_Ptr(void*)
ldloc 4
conv.i
Expand Down