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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
.assembly extern System.Console
{
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
.ver 4:0:0:0
}
.assembly extern mscorlib
{
}
.assembly 'test'
{
}
.module 'test.exe'
.namespace JitTest
{
.class private auto ansi Test
extends [mscorlib]System.Object
{
.method private hidebysig static int32
try_index(int32[-5...] arr,
int32 idx,
int32 expected) il managed
{
.maxstack 5
.locals (int32)
ldstr "Trying index "
call void [System.Console]System.Console::Write(string)
ldarga.s idx
call instance string [mscorlib]System.Int32::ToString()
call void [System.Console]System.Console::Write(string)
.try
{
ldarg.0
ldarg.1
ldarg.1
callvirt instance void int32[-5...]::Set(int32, int32)
ldarg.0
ldarg.1
callvirt instance int32 int32[-5...]::Get(int32)
ldarg.1
ceq
brtrue aaa
ldstr "READ-WRITE FAILED"
call void [System.Console]System.Console::WriteLine(string)
newobj instance void [mscorlib]System.Exception::.ctor()
throw
aaa:
ldstr ": OK"
call void [System.Console]System.Console::WriteLine(string)
ldc.i4.1
stloc.0
leave.s IL_0029
} // end .try
catch [mscorlib]System.Object
{
IL_001c: pop
IL_001d: ldstr ": exception!"
IL_0022: call void [System.Console]System.Console::WriteLine(string)
ldc.i4.0
stloc.0
IL_0027: leave.s IL_0029
} // end handler
IL_0029:
ldloc.0
ldarg.2
ceq
ret
} // end of method 'Test::try_index'
.method private hidebysig static int32
Main() il managed
{
.entrypoint
.maxstack 4
.locals (int32[-5...] V_0,
int32 V_1,
int32 V_2)
ldstr "Creating array of 16 elements"
call void [System.Console]System.Console::WriteLine(string)
ldc.i4.s -5
ldc.i4.s 16
newobj instance void int32[-5...]::.ctor(int32,int32)
stloc.0
ldstr "Reported array size is "
call void [System.Console]System.Console::Write(string)
ldloc.0
ldlen
call void [System.Console]System.Console::WriteLine(int32)
ldstr "[mscorlib]System.Array::get_Rank returned "
call void [System.Console]System.Console::Write(string)
ldloc.0
callvirt instance int32 [mscorlib]System.Array::get_Rank()
call void [System.Console]System.Console::WriteLine(int32)
ldstr "[mscorlib]System.Array::GetLowerBound returned "
call void [System.Console]System.Console::Write(string)
ldloc.0
ldc.i4.0
callvirt instance int32 [mscorlib]System.Array::GetLowerBound(int32)
call void [System.Console]System.Console::WriteLine(int32)
ldstr "[mscorlib]System.Array::GetUpperBound returned "
call void [System.Console]System.Console::Write(string)
ldloc.0
ldc.i4.0
callvirt instance int32 [mscorlib]System.Array::GetUpperBound(int32)
call void [System.Console]System.Console::WriteLine(int32)
ldloc.0
ldc.i4 -10000
ldc.i4.0
call int32 JitTest.Test::try_index(int32[-5...], int32, int32)
brfalse Failure
ldloc.0
ldc.i4 -6
ldc.i4.0
call int32 JitTest.Test::try_index(int32[-5...], int32, int32)
brfalse Failure
ldloc.0
ldc.i4 -5
ldc.i4.1
call int32 JitTest.Test::try_index(int32[-5...], int32, int32)
brfalse Failure
ldloc.0
ldc.i4.0
ldc.i4.1
call int32 JitTest.Test::try_index(int32[-5...], int32, int32)
brfalse Failure
ldloc.0
ldc.i4 9
ldc.i4.1
call int32 JitTest.Test::try_index(int32[-5...], int32, int32)
brfalse Failure
ldloc.0
ldc.i4 10
ldc.i4.1
call int32 JitTest.Test::try_index(int32[-5...], int32, int32)
brfalse Failure
ldloc.0
ldc.i4 11
ldc.i4.0
call int32 JitTest.Test::try_index(int32[-5...], int32, int32)
brfalse Failure
ldloc.0
ldc.i4 17
ldc.i4.0
call int32 JitTest.Test::try_index(int32[-5...], int32, int32)
brfalse Failure
ldloc.0
ldc.i4 1000
ldc.i4.0
call int32 JitTest.Test::try_index(int32[-5...], int32, int32)
brfalse Failure
ldloc.0
ldc.i4 1000000
ldc.i4.0
call int32 JitTest.Test::try_index(int32[-5...], int32, int32)
brfalse Failure
ldloc.0
ldc.i4 1300000
ldc.i4.0
call int32 JitTest.Test::try_index(int32[-5...], int32, int32)
brfalse Failure
ldc.i4 0x64
ldstr "**** PASSED ****"
call void [System.Console]System.Console::WriteLine(string)
br Escape
Failure:
ldc.i4.1
ldstr "**** FAILED ****"
call void [System.Console]System.Console::WriteLine(string)
Escape:
ret
} // end of method 'Test::Main'
.method public hidebysig specialname rtspecialname
instance void .ctor() il managed
{
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method 'Test::.ctor'
} // end of class 'Test'
} // end of namespace 'JitTest'
|