summaryrefslogtreecommitdiff
path: root/tests/src/JIT/Methodical/cctor/simple/prefldinit2.il
blob: f96cd7423597e255cda8800a1a3e5ee0fb2fcd24 (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
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.



.assembly extern mscorlib
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .ver 1:0:5000:0
}
.assembly precise2
{
  // --- The following custom attribute is added automatically, do not uncomment -------
  //  .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(bool,
  //                                                                                bool) = ( 01 00 00 01 00 00 ) 
  .hash algorithm 0x00008004
  .ver 0:0:0:0
}
.module precise2.exe
// MVID: {C486E388-5E60-42FA-B093-89857CB047D8}
.imagebase 0x00400000
.subsystem 0x00000003
.file alignment 512
.corflags 0x00000001
// Image base: 0x076c0000
//
// ============== CLASS STRUCTURE DECLARATION ==================
//
.class private auto ansi beforefieldinit measure
       extends [mscorlib]System.Object
{
} // end of class measure

.class private auto ansi test
       extends [mscorlib]System.Object
{
} // end of class test

.class private auto ansi beforefieldinit Driver
       extends [mscorlib]System.Object
{
} // end of class Driver


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


// =============== GLOBAL FIELDS AND METHODS ===================


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


// =============== CLASS MEMBERS DECLARATION ===================
//   note that class flags, 'extends' and 'implements' clauses
//          are provided here for information only

.class private auto ansi beforefieldinit measure
       extends [mscorlib]System.Object
{
  .field public static int32 a
  .method private hidebysig specialname rtspecialname static 
          void  .cctor() cil managed
  {
    // Code size       11 (0xb)
    .maxstack  1
    IL_0000:  ldc.i4     0xcc
    IL_0005:  stsfld     int32 measure::a
    IL_000a:  ret
  } // end of method measure::.cctor

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

} // end of class measure

.class private auto ansi beforefieldinit test
       extends [mscorlib]System.Object
{
  .method private hidebysig specialname rtspecialname static 
          void  .cctor() cil managed
  {
    // Code size       139 (0x8b)
    .maxstack  2
    IL_0000:  ldsfld     int32 measure::a
    IL_0005:  ldc.i4     0xcc
    IL_000a:  beq.s      IL_0030

    IL_000c:  ldstr      "in .cctor(), measure.a is {0}"
    IL_0011:  ldsfld     int32 measure::a
    IL_0016:  box        [mscorlib]System.Int32
    IL_001b:  call       void [mscorlib]System.Console::WriteLine(string,
                                                                  object)
    IL_0020:  ldstr      "FAILED"
    IL_0025:  call       void [mscorlib]System.Console::WriteLine(string)
    IL_002a:  newobj     instance void [mscorlib]System.Exception::.ctor()
    IL_002f:  throw

    IL_0030:  ldstr      "in .cctor(), measure.a is {0}"
    IL_0035:  ldsfld     int32 measure::a
    IL_003a:  box        [mscorlib]System.Int32
    IL_003f:  call       void [mscorlib]System.Console::WriteLine(string,
                                                                  object)
    IL_0044:  ldc.i4.8
    IL_0045:  stsfld     int32 measure::a
    IL_004a:  ldsfld     int32 measure::a
    IL_004f:  ldc.i4.8
    IL_0050:  beq.s      IL_0076

    IL_0052:  ldstr      "in .cctor() after measure.a=8, measure.a is {0}"
    IL_0057:  ldsfld     int32 measure::a
    IL_005c:  box        [mscorlib]System.Int32
    IL_0061:  call       void [mscorlib]System.Console::WriteLine(string,
                                                                  object)
    IL_0066:  ldstr      "FAILED"
    IL_006b:  call       void [mscorlib]System.Console::WriteLine(string)
    IL_0070:  newobj     instance void [mscorlib]System.Exception::.ctor()
    IL_0075:  throw

    IL_0076:  ldstr      "in .cctor() after measure.a=8, measure.a is {0}"
    IL_007b:  ldsfld     int32 measure::a
    IL_0080:  box        [mscorlib]System.Int32
    IL_0085:  call       void [mscorlib]System.Console::WriteLine(string,
                                                                  object)
    IL_008a:  ret
  } // end of method test::.cctor

  .method public hidebysig specialname rtspecialname 
          instance void  .ctor() cil managed
  {
    // Code size       7 (0x7)
    .maxstack  1
    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

.class private auto ansi beforefieldinit Driver
       extends [mscorlib]System.Object
{
  .method public hidebysig static int32  Main() cil managed
  {
    .entrypoint
    // Code size       169 (0xa9)
    .maxstack  2
    .locals init (class test V_0,
             class [mscorlib]System.Exception V_1,
             int32 V_2)
    .try
    {
      IL_0000:  ldstr      "Testing .cctor() invocation by calling instance method"
      IL_0005:  call       void [mscorlib]System.Console::WriteLine(string)
      ldstr "We have beforefieldinit set and we are accessing instance method rather than static method or static field, test may fail by design?"
      call       void [mscorlib]System.Console::WriteLine(string)
      IL_000a:  call       void [mscorlib]System.Console::WriteLine()
      IL_000f:  ldstr      "Before calling instance method"
      IL_0014:  call       void [mscorlib]System.Console::WriteLine(string)
      IL_0019:  ldsfld     int32 measure::a
      IL_001e:  ldc.i4     0xcc
      IL_0023:  beq.s      IL_0047

      IL_0025:  ldstr      "in Main(), measure.a is {0}"
      IL_002a:  ldsfld     int32 measure::a
      IL_002f:  box        [mscorlib]System.Int32
      IL_0034:  call       void [mscorlib]System.Console::WriteLine(string,
                                                                    object)
      IL_0039:  ldstr      "FAILED"
      IL_003e:  call       void [mscorlib]System.Console::WriteLine(string)
      IL_0043:  ldc.i4.1
      IL_0044:  stloc.2
      IL_0045:  leave.s    IL_00a7

      IL_0047:  newobj     instance void test::.ctor()
      IL_004c:  stloc.0
      IL_004d:  ldstr      "After calling instance method"
      IL_0052:  call       void [mscorlib]System.Console::WriteLine(string)
      IL_0057:  ldsfld     int32 measure::a
      IL_005c:  ldc.i4.8
      IL_005d:  beq.s      IL_0081

      IL_005f:  ldstr      "in Main() after new test(), measure.a is {0}"
      IL_0064:  ldsfld     int32 measure::a
      IL_0069:  box        [mscorlib]System.Int32
      IL_006e:  call       void [mscorlib]System.Console::WriteLine(string,
                                                                    object)
      IL_0073:  ldstr      "FAILED"
      IL_0078:  call       void [mscorlib]System.Console::WriteLine(string)
      IL_007d:  ldc.i4.m1
      IL_007e:  stloc.2
      IL_007f:  leave.s    IL_00a7

      IL_0081:  leave.s    IL_0093

    }  // end .try
    catch [mscorlib]System.Exception 
    {
      IL_0083:  stloc.1
      IL_0084:  ldloc.1
      IL_0085:  callvirt   instance string [mscorlib]System.Exception::get_StackTrace()
      IL_008a:  call       void [mscorlib]System.Console::WriteLine(string)
      IL_008f:  ldc.i4.m1
      IL_0090:  stloc.2
      IL_0091:  leave.s    IL_00a7

    }  // end handler
    IL_0093:  call       void [mscorlib]System.Console::WriteLine()
    IL_0098:  ldstr      "PASSED"
    IL_009d:  call       void [mscorlib]System.Console::WriteLine(string)
    IL_00a2:  ldc.i4.s   100
    IL_00a4:  stloc.2
    IL_00a5:  br.s       IL_00a7

    IL_00a7:  ldloc.2
    IL_00a8:  ret
  } // end of method Driver::Main

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

} // end of class Driver


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

//*********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file prefldinit2.res