blob: b4a7f1583062b37feb9fe43cf407650eb90eb2df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
.assembly extern System.Console
{
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
.ver 4:0:0:0
}
.assembly extern legacy library mscorlib {}
.assembly tailcall.exe{}
.method public static int32 main(string[]) {
.locals (class [mscorlib]System.IO.TextWriter,class _tailcall)
.entrypoint
call class [mscorlib]System.IO.TextWriter [System.Console]System.Console::get_Out()
stloc 0
newobj instance void _tailcall::.ctor()
stloc 1
ldloc 1
callvirt instance int32 _tailcall::method1()
ldc.i4 0x1234
bne.un fail
pass:
ldloc 0
ldstr "TAILCALL Tests PASS."
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldc.i4 100
br end
fail:
ldloc 0
ldstr "!!! FAILURE !!! - TAILCALL TESTS FAIL - !!! FAILURE !!!"
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldc.i4 0x0
br end
end:
ret
}
.class public _tailcall {
.method public void .ctor() {
.maxstack 10
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
call class [mscorlib]System.IO.TextWriter [System.Console]System.Console::get_Out()
ldstr "TAILCALL test initialized."
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ret
}
.method public int32 method1() {
.locals (int32,string)
call class [mscorlib]System.IO.TextWriter [System.Console]System.Console::get_Out()
ldstr "Beginning Test."
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldarg 0 //this ptr
tail.
callvirt instance int32 _tailcall::method2()
ret
}
.method public int32 method2() {
.locals ()
call class [mscorlib]System.IO.TextWriter [System.Console]System.Console::get_Out()
ldstr "Method2 has been called."
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldc.i4 0x1234
ret //we should return from here to main.
}
}
|