summaryrefslogtreecommitdiff
path: root/ICSharpCode.Decompiler/Tests/IL/StackTests.il
blob: 51cee3754923fe9fc311b6559108e212122b74f1 (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
.assembly extern mscorlib
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
  .ver 4:0:0:0
}
.assembly StackTests
{
  .hash algorithm 0x00008004
  .ver 1:0:4059:39717
}
.module StackTests.exe
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003       // WINDOWS_CUI
.corflags 0x00000003    //  ILONLY 32BITREQUIRED

.class private auto ansi beforefieldinit StackTests.Program extends [mscorlib]System.Object
{
  .method public hidebysig static void  Main(string[] args) cil managed
  {
    .entrypoint
    .maxstack  8
	
	ldc.i4.0
	call string StackTests.Program::Test1(bool cond)
	call void [mscorlib]System.Console::WriteLine(string) // false
	
	ldc.i4.1
	call string StackTests.Program::Test1(bool cond)
	call void [mscorlib]System.Console::WriteLine(string) // true
	
	ldc.i4.0
	ldc.i4.0
	ldc.i4.0
	call int32 StackTests.Program::Test2(int32 switch1, int32 br1, int32 br2)
	call void [mscorlib]System.Console::WriteLine(int32)  // 11
	
	ldc.i4.0
	ldc.i4.1
	ldc.i4.0
	call int32 StackTests.Program::Test2(int32 switch1, int32 br1, int32 br2)
	call void [mscorlib]System.Console::WriteLine(int32)  // 21
	
	ldc.i4.1
	ldc.i4.1
	ldc.i4.1
	call int32 StackTests.Program::Test2(int32 switch1, int32 br1, int32 br2)
	call void [mscorlib]System.Console::WriteLine(int32)  // 32
	
	ldc.i4.2
	ldc.i4.1
	ldc.i4.0
	call int32 StackTests.Program::Test2(int32 switch1, int32 br1, int32 br2)
	call void [mscorlib]System.Console::WriteLine(int32)  // 23
	
	ret
  }

  .method public hidebysig static string Test1(bool cond) cil managed
  {
	ldarg.0
	brtrue TRUE
	
	FALSE:
	ldstr "false"
	br EXIT
		
	TRUE:
	ldstr "true"
		
	EXIT:
	ret
  }

  .method public hidebysig static int32 Test2(int32 switch1, int32 br1, int32 br2) cil managed
  {
    ldarg.0
    switch (ENTRY1, ENTRY2, ENTRY3)
	ldc.i4.0
    ret

    ENTRY1:
	ldc.i4.1
    br BRANCH1

    ENTRY2:
	ldc.i4.2
    br BRANCH1

    ENTRY3:
	ldc.i4.3
    br BRANCH2
	
	BRANCH1:
	ldarg.1
	brtrue BRANCH2
	
	EXIT1:
	ldc.i4 10
	add
	ret
	
	BRANCH2:
	ldarg.2
	brtrue.s EXIT3
	
	EXIT2:
	ldc.i4 20
	add
	ret
	
	EXIT3:
	ldc.i4 30
	add
	ret
  }

  .method public hidebysig specialname rtspecialname 
          instance void  .ctor() cil managed
  {
    // Code size       7 (0x7)
    .maxstack  8
    IL_0000:  ldarg.0
    IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
    IL_0006:  ret
  } // end of method Program::.ctor

} // end of class StackTests.Program


// =============================================================