blob: 56c23f111e93d74c71231ba0018dbe5a08fff707 (
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
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly valuetypes
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 )
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module valuetypes.exe
// MVID: {E191F723-B724-4D70-B3A8-CEA89FD033D3}
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x01170000
// =============== CLASS MEMBERS DECLARATION ===================
.class interface private abstract auto ansi IValue
{
.method public hidebysig newslot abstract virtual
instance int32 GetValue() cil managed
{
} // end of method IValue::GetValue
.method public hidebysig newslot abstract virtual
instance void SetValue(int32 a) cil managed
{
} // end of method IValue::SetValue
.method public hidebysig newslot virtual
instance int32 Add(int32 a) cil managed
{
// Code size 26 (0x1a)
.maxstack 2
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance int32 IValue::GetValue()
IL_0007: stloc.0
IL_0008: ldloc.0
IL_0009: ldarg.1
IL_000a: add
IL_000b: stloc.0
IL_000c: ldarg.0
IL_000d: ldloc.0
IL_000e: call instance void IValue::SetValue(int32)
IL_0013: nop
IL_0014: ldloc.0
IL_0015: stloc.1
IL_0016: br.s IL_0018
IL_0018: ldloc.1
IL_0019: ret
} // end of method IValue::Add
} // end of class IValue
.class private sequential ansi sealed beforefieldinit FooBarStruct
extends [mscorlib]System.ValueType
implements IValue
{
.field public int32 _val
.method public hidebysig newslot virtual final
instance int32 GetValue() cil managed
{
// Code size 12 (0xc)
.maxstack 1
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldfld int32 FooBarStruct::_val
IL_0007: stloc.0
IL_0008: br.s IL_000a
IL_000a: ldloc.0
IL_000b: ret
} // end of method FooBarStruct::GetValue
.method public hidebysig newslot virtual final
instance void SetValue(int32 val) cil managed
{
// Code size 9 (0x9)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldarg.1
IL_0003: stfld int32 FooBarStruct::_val
IL_0008: ret
} // end of method FooBarStruct::SetValue
} // end of class FooBarStruct
.class private auto ansi beforefieldinit Program
extends [mscorlib]System.Object
{
.method public hidebysig static int32 Main() cil managed
{
.entrypoint
.maxstack 2
.locals init (valuetype FooBarStruct V_0,
class IValue V_1,
int32 V_2)
IL_0000: nop
IL_0001: ldloca.s V_0
IL_0003: initobj FooBarStruct
IL_0009: ldloca.s V_0
IL_000b: ldc.i4.s 10
IL_000d: stfld int32 FooBarStruct::_val
IL_0012: ldloc.0
IL_0013: box FooBarStruct
IL_0018: stloc.1
IL_0019: ldstr "Calling IFoo.Foo on FooBarStruct"
IL_001e: call void [mscorlib]System.Console::WriteLine(string)
IL_0023: nop
IL_0024: ldloc.1
IL_0025: ldc.i4.s 10
IL_0027: callvirt instance int32 IValue::Add(int32)
IL_002c: ldc.i4.s 20
IL_002e: ceq
IL_0030: ldstr "Calling default method IValue.Add on FooBarStruct "
+ "failed"
IL_0035: call void Test::Assert(bool,
string)
IL_003a: nop
IL_003b: ldloca V_0
callvirt instance int32 FooBarStruct::GetValue()
ldc.i4.s 10
ceq
ldstr "FooBarStruct value should remain unchanged"
call void Test::Assert(bool,
string)
nop
call int32 Test::Ret()
ret
} // end of method Program::Main
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method Program::.ctor
} // end of class Program
.class private auto ansi beforefieldinit Test
extends [mscorlib]System.Object
{
.field private static bool Pass
.method public hidebysig static int32 Ret() cil managed
{
// Code size 19 (0x13)
.maxstack 1
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldsfld bool Test::Pass
IL_0006: brtrue.s IL_000c
IL_0008: ldc.i4.s 101
IL_000a: br.s IL_000e
IL_000c: ldc.i4.s 100
IL_000e: stloc.0
IL_000f: br.s IL_0011
IL_0011: ldloc.0
IL_0012: ret
} // end of method Test::Ret
.method public hidebysig static void Assert(bool cond,
string msg) cil managed
{
// Code size 47 (0x2f)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: stloc.0
IL_0003: ldloc.0
IL_0004: brfalse.s IL_0015
IL_0006: nop
IL_0007: ldstr "PASS"
IL_000c: call void [mscorlib]System.Console::WriteLine(string)
IL_0011: nop
IL_0012: nop
IL_0013: br.s IL_002e
IL_0015: nop
IL_0016: ldstr "FAIL: "
IL_001b: ldarg.1
IL_001c: call string [mscorlib]System.String::Concat(string,
string)
IL_0021: call void [mscorlib]System.Console::WriteLine(string)
IL_0026: nop
IL_0027: ldc.i4.0
IL_0028: stsfld bool Test::Pass
IL_002d: nop
IL_002e: ret
} // end of method Test::Assert
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method Test::.ctor
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldc.i4.1
IL_0001: stsfld bool Test::Pass
IL_0006: ret
} // end of method Test::.cctor
} // end of class Test
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file valuetypes.res
|