1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 public class Main {
18   /// CHECK-START: void Main.staticNop() inliner (before)
19   /// CHECK:                          InvokeStaticOrDirect
20 
21   /// CHECK-START: void Main.staticNop() inliner (after)
22   /// CHECK-NOT:                      InvokeStaticOrDirect
23 
staticNop()24   public static void staticNop() {
25     Second.staticNop(11);
26   }
27 
28   /// CHECK-START: void Main.nop(Second) inliner (before)
29   /// CHECK:                          InvokeVirtual
30 
31   /// CHECK-START: void Main.nop(Second) inliner (after)
32   /// CHECK-NOT:                      InvokeVirtual
33 
nop(Second s)34   public static void nop(Second s) {
35     s.nop();
36   }
37 
38   /// CHECK-START: java.lang.Object Main.staticReturnArg2(java.lang.String) inliner (before)
39   /// CHECK-DAG:  <<Value:l\d+>>      ParameterValue
40   /// CHECK-DAG:  <<Ignored:i\d+>>    IntConstant 77
41   /// CHECK-DAG:  <<ClinitCk:l\d+>>   ClinitCheck
42   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
43   /// CHECK-DAG:  <<Invoke:l\d+>>     InvokeStaticOrDirect [<<Ignored>>,<<Value>>{{(,[ij]\d+)?}},<<ClinitCk>>]
44   /// CHECK-DAG:                      Return [<<Invoke>>]
45 
46   /// CHECK-START: java.lang.Object Main.staticReturnArg2(java.lang.String) inliner (after)
47   /// CHECK-DAG:  <<Value:l\d+>>      ParameterValue
48   /// CHECK-DAG:                      Return [<<Value>>]
49 
50   /// CHECK-START: java.lang.Object Main.staticReturnArg2(java.lang.String) inliner (after)
51   /// CHECK-NOT:                      InvokeStaticOrDirect
52 
staticReturnArg2(String value)53   public static Object staticReturnArg2(String value) {
54     return Second.staticReturnArg2(77, value);
55   }
56 
57   /// CHECK-START: long Main.returnArg1(Second, long) inliner (before)
58   /// CHECK-DAG:  <<Second:l\d+>>     ParameterValue
59   /// CHECK-DAG:  <<Value:j\d+>>      ParameterValue
60   /// CHECK-DAG:  <<NullCk:l\d+>>     NullCheck [<<Second>>]
61   /// CHECK-DAG:  <<Invoke:j\d+>>     InvokeVirtual [<<NullCk>>,<<Value>>]
62   /// CHECK-DAG:                      Return [<<Invoke>>]
63 
64   /// CHECK-START: long Main.returnArg1(Second, long) inliner (after)
65   /// CHECK-DAG:  <<Value:j\d+>>      ParameterValue
66   /// CHECK-DAG:                      Return [<<Value>>]
67 
68   /// CHECK-START: long Main.returnArg1(Second, long) inliner (after)
69   /// CHECK-NOT:                      InvokeVirtual
70 
returnArg1(Second s, long value)71   public static long returnArg1(Second s, long value) {
72     return s.returnArg1(value);
73   }
74 
75   /// CHECK-START: int Main.staticReturn9() inliner (before)
76   /// CHECK:      {{i\d+}}            InvokeStaticOrDirect
77 
78   /// CHECK-START: int Main.staticReturn9() inliner (before)
79   /// CHECK-NOT:                      IntConstant 9
80 
81   /// CHECK-START: int Main.staticReturn9() inliner (after)
82   /// CHECK-DAG:  <<Const9:i\d+>>     IntConstant 9
83   /// CHECK-DAG:                      Return [<<Const9>>]
84 
85   /// CHECK-START: int Main.staticReturn9() inliner (after)
86   /// CHECK-NOT:                      InvokeStaticOrDirect
87 
staticReturn9()88   public static int staticReturn9() {
89     return Second.staticReturn9();
90   }
91 
92   /// CHECK-START: int Main.return7(Second) inliner (before)
93   /// CHECK:      {{i\d+}}            InvokeVirtual
94 
95   /// CHECK-START: int Main.return7(Second) inliner (before)
96   /// CHECK-NOT:                      IntConstant 7
97 
98   /// CHECK-START: int Main.return7(Second) inliner (after)
99   /// CHECK-DAG:  <<Const7:i\d+>>     IntConstant 7
100   /// CHECK-DAG:                      Return [<<Const7>>]
101 
102   /// CHECK-START: int Main.return7(Second) inliner (after)
103   /// CHECK-NOT:                      InvokeVirtual
104 
return7(Second s)105   public static int return7(Second s) {
106     return s.return7(null);
107   }
108 
109   /// CHECK-START: java.lang.String Main.staticReturnNull() inliner (before)
110   /// CHECK:      {{l\d+}}            InvokeStaticOrDirect
111 
112   /// CHECK-START: java.lang.String Main.staticReturnNull() inliner (before)
113   /// CHECK-NOT:                      NullConstant
114 
115   /// CHECK-START: java.lang.String Main.staticReturnNull() inliner (after)
116   /// CHECK-DAG:  <<Null:l\d+>>       NullConstant
117   /// CHECK-DAG:                      Return [<<Null>>]
118 
119   /// CHECK-START: java.lang.String Main.staticReturnNull() inliner (after)
120   /// CHECK-NOT:                      InvokeStaticOrDirect
121 
staticReturnNull()122   public static String staticReturnNull() {
123     return Second.staticReturnNull();
124   }
125 
126   /// CHECK-START: java.lang.Object Main.returnNull(Second) inliner (before)
127   /// CHECK:      {{l\d+}}            InvokeVirtual
128 
129   /// CHECK-START: java.lang.Object Main.returnNull(Second) inliner (before)
130   /// CHECK-NOT:                      NullConstant
131 
132   /// CHECK-START: java.lang.Object Main.returnNull(Second) inliner (after)
133   /// CHECK-DAG:  <<Null:l\d+>>       NullConstant
134   /// CHECK-DAG:                      Return [<<Null>>]
135 
136   /// CHECK-START: java.lang.Object Main.returnNull(Second) inliner (after)
137   /// CHECK-NOT:                      InvokeVirtual
138 
returnNull(Second s)139   public static Object returnNull(Second s) {
140     return s.returnNull();
141   }
142 
143   /// CHECK-START: int Main.getInt(Second) inliner (before)
144   /// CHECK:      {{i\d+}}            InvokeVirtual
145 
146   /// CHECK-START: int Main.getInt(Second) inliner (after)
147   /// CHECK:      {{i\d+}}            InstanceFieldGet
148 
149   /// CHECK-START: int Main.getInt(Second) inliner (after)
150   /// CHECK-NOT:                      InvokeVirtual
151 
getInt(Second s)152   public static int getInt(Second s) {
153     return s.getInstanceIntField();
154   }
155 
156   /// CHECK-START: double Main.getDouble(Second) inliner (before)
157   /// CHECK:      {{d\d+}}            InvokeVirtual
158 
159   /// CHECK-START: double Main.getDouble(Second) inliner (after)
160   /// CHECK:      {{d\d+}}            InstanceFieldGet
161 
162   /// CHECK-START: double Main.getDouble(Second) inliner (after)
163   /// CHECK-NOT:                      InvokeVirtual
164 
getDouble(Second s)165   public static double getDouble(Second s) {
166     return s.getInstanceDoubleField(22);
167   }
168 
169   /// CHECK-START: java.lang.Object Main.getObject(Second) inliner (before)
170   /// CHECK:      {{l\d+}}            InvokeVirtual
171 
172   /// CHECK-START: java.lang.Object Main.getObject(Second) inliner (after)
173   /// CHECK:      {{l\d+}}            InstanceFieldGet
174 
175   /// CHECK-START: java.lang.Object Main.getObject(Second) inliner (after)
176   /// CHECK-NOT:                      InvokeVirtual
177 
getObject(Second s)178   public static Object getObject(Second s) {
179     return s.getInstanceObjectField(-1L);
180   }
181 
182   /// CHECK-START: java.lang.String Main.getString(Second) inliner (before)
183   /// CHECK:      {{l\d+}}            InvokeVirtual
184 
185   /// CHECK-START: java.lang.String Main.getString(Second) inliner (after)
186   /// CHECK:      {{l\d+}}            InstanceFieldGet
187 
188   /// CHECK-START: java.lang.String Main.getString(Second) inliner (after)
189   /// CHECK-NOT:                      InvokeVirtual
190 
getString(Second s)191   public static String getString(Second s) {
192     return s.getInstanceStringField(null, "whatever", 1234L);
193   }
194 
195   /// CHECK-START: int Main.staticGetInt(Second) inliner (before)
196   /// CHECK:      {{i\d+}}            InvokeStaticOrDirect
197 
198   /// CHECK-START: int Main.staticGetInt(Second) inliner (after)
199   /// CHECK:      {{i\d+}}            InvokeStaticOrDirect
200 
201   /// CHECK-START: int Main.staticGetInt(Second) inliner (after)
202   /// CHECK-NOT:                      InstanceFieldGet
203 
staticGetInt(Second s)204   public static int staticGetInt(Second s) {
205     return Second.staticGetInstanceIntField(s);
206   }
207 
208   /// CHECK-START: double Main.getDoubleFromParam(Second) inliner (before)
209   /// CHECK:      {{d\d+}}            InvokeVirtual
210 
211   /// CHECK-START: double Main.getDoubleFromParam(Second) inliner (after)
212   /// CHECK:      {{d\d+}}            InvokeVirtual
213 
214   /// CHECK-START: double Main.getDoubleFromParam(Second) inliner (after)
215   /// CHECK-NOT:                      InstanceFieldGet
216 
getDoubleFromParam(Second s)217   public static double getDoubleFromParam(Second s) {
218     return s.getInstanceDoubleFieldFromParam(s);
219   }
220 
221   /// CHECK-START: int Main.getStaticInt(Second) inliner (before)
222   /// CHECK:      {{i\d+}}            InvokeVirtual
223 
224   /// CHECK-START: int Main.getStaticInt(Second) inliner (after)
225   /// CHECK:      {{i\d+}}            InvokeVirtual
226 
227   /// CHECK-START: int Main.getStaticInt(Second) inliner (after)
228   /// CHECK-NOT:                      InstanceFieldGet
229   /// CHECK-NOT:                      StaticFieldGet
230 
getStaticInt(Second s)231   public static int getStaticInt(Second s) {
232     return s.getStaticIntField();
233   }
234 
235   /// CHECK-START: long Main.setLong(Second, long) inliner (before)
236   /// CHECK:                          InvokeVirtual
237 
238   /// CHECK-START: long Main.setLong(Second, long) inliner (after)
239   /// CHECK:                          InstanceFieldSet
240 
241   /// CHECK-START: long Main.setLong(Second, long) inliner (after)
242   /// CHECK-NOT:                      InvokeVirtual
243 
setLong(Second s, long value)244   public static long setLong(Second s, long value) {
245     s.setInstanceLongField(-1, value);
246     return s.instanceLongField;
247   }
248 
249   /// CHECK-START: long Main.setLongReturnArg2(Second, long, int) inliner (before)
250   /// CHECK:                          InvokeVirtual
251 
252   /// CHECK-START: long Main.setLongReturnArg2(Second, long, int) inliner (after)
253   /// CHECK-DAG:  <<Second:l\d+>>     ParameterValue
254   /// CHECK-DAG:  <<Value:j\d+>>      ParameterValue
255   /// CHECK-DAG:  <<Arg2:i\d+>>       ParameterValue
256   /// CHECK-DAG:  <<NullCk:l\d+>>     NullCheck [<<Second>>]
257   /// CHECK-DAG:                      InstanceFieldSet [<<NullCk>>,<<Value>>]
258   /// CHECK-DAG:  <<NullCk2:l\d+>>    NullCheck [<<Second>>]
259   /// CHECK-DAG:  <<IGet:j\d+>>       InstanceFieldGet [<<NullCk2>>]
260   /// CHECK-DAG:  <<Conv:j\d+>>       TypeConversion [<<Arg2>>]
261   /// CHECK-DAG:  <<Add:j\d+>>        Add [<<IGet>>,<<Conv>>]
262   /// CHECK-DAG:                      Return [<<Add>>]
263 
264   /// CHECK-START: long Main.setLongReturnArg2(Second, long, int) inliner (after)
265   /// CHECK-NOT:                      InvokeVirtual
266 
setLongReturnArg2(Second s, long value, int arg2)267   public static long setLongReturnArg2(Second s, long value, int arg2) {
268     int result = s.setInstanceLongFieldReturnArg2(value, arg2);
269     return s.instanceLongField + result;
270   }
271 
272   /// CHECK-START: long Main.staticSetLong(Second, long) inliner (before)
273   /// CHECK:                          InvokeStaticOrDirect
274 
275   /// CHECK-START: long Main.staticSetLong(Second, long) inliner (after)
276   /// CHECK:                          InvokeStaticOrDirect
277 
278   /// CHECK-START: long Main.staticSetLong(Second, long) inliner (after)
279   /// CHECK-NOT:                      InstanceFieldSet
280 
staticSetLong(Second s, long value)281   public static long staticSetLong(Second s, long value) {
282     Second.staticSetInstanceLongField(s, value);
283     return s.instanceLongField;
284   }
285 
286   /// CHECK-START: long Main.setLongThroughParam(Second, long) inliner (before)
287   /// CHECK:                          InvokeVirtual
288 
289   /// CHECK-START: long Main.setLongThroughParam(Second, long) inliner (after)
290   /// CHECK:                          InvokeVirtual
291 
292   /// CHECK-START: long Main.setLongThroughParam(Second, long) inliner (after)
293   /// CHECK-NOT:                      InstanceFieldSet
294 
setLongThroughParam(Second s, long value)295   public static long setLongThroughParam(Second s, long value) {
296     s.setInstanceLongFieldThroughParam(s, value);
297     return s.instanceLongField;
298   }
299 
300   /// CHECK-START: float Main.setStaticFloat(Second, float) inliner (before)
301   /// CHECK:                          InvokeVirtual
302 
303   /// CHECK-START: float Main.setStaticFloat(Second, float) inliner (after)
304   /// CHECK:                          InvokeVirtual
305 
306   /// CHECK-START: float Main.setStaticFloat(Second, float) inliner (after)
307   /// CHECK-NOT:                      InstanceFieldSet
308   /// CHECK-NOT:                      StaticFieldSet
309 
setStaticFloat(Second s, float value)310   public static float setStaticFloat(Second s, float value) {
311     s.setStaticFloatField(value);
312     return s.staticFloatField;
313   }
314 
315   /// CHECK-START: java.lang.Object Main.newObject() inliner (before)
316   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
317   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
318   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>{{(,[ij]\d+)?}}] method_name:java.lang.Object.<init>
319 
320   /// CHECK-START: java.lang.Object Main.newObject() inliner (after)
321   /// CHECK-NOT:                      InvokeStaticOrDirect
322 
newObject()323   public static Object newObject() {
324     return new Object();
325   }
326 
327   /// CHECK-START: double Main.constructBase() inliner (before)
328   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
329   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
330   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>{{(,[ij]\d+)?}}] method_name:Base.<init>
331 
332   /// CHECK-START: double Main.constructBase() inliner (after)
333   /// CHECK-NOT:                      InvokeStaticOrDirect
334   /// CHECK-NOT:                      MemoryBarrier
335   /// CHECK-NOT:                      InstanceFieldSet
336 
constructBase()337   public static double constructBase() {
338     Base b = new Base();
339     return b.intField + b.doubleField;
340   }
341 
342   /// CHECK-START: double Main.constructBase(int) inliner (before)
343   /// CHECK-DAG:  <<Value:i\d+>>      ParameterValue
344   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
345   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
346   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:Base.<init>
347 
348   /// CHECK-START: double Main.constructBase(int) inliner (after)
349   /// CHECK-NOT:                      InvokeStaticOrDirect
350   /// CHECK-NOT:                      MemoryBarrier
351 
352   /// CHECK-START: double Main.constructBase(int) inliner (after)
353   /// CHECK-DAG:  <<Value:i\d+>>      ParameterValue
354   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
355   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<Value>>]
356 
357   /// CHECK-START: double Main.constructBase(int) inliner (after)
358   /// CHECK-DAG:                      InstanceFieldSet
359   /// CHECK-NOT:                      InstanceFieldSet
360 
constructBase(int intValue)361   public static double constructBase(int intValue) {
362     Base b = new Base(intValue);
363     return b.intField + b.doubleField;
364   }
365 
366   /// CHECK-START: double Main.constructBaseWith0() inliner (before)
367   /// CHECK-DAG:  <<Value:i\d+>>      IntConstant 0
368   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
369   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
370   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:Base.<init>
371 
372   /// CHECK-START: double Main.constructBaseWith0() inliner (after)
373   /// CHECK-NOT:                      InvokeStaticOrDirect
374   /// CHECK-NOT:                      MemoryBarrier
375   /// CHECK-NOT:                      InstanceFieldSet
376 
constructBaseWith0()377   public static double constructBaseWith0() {
378     Base b = new Base(0);
379     return b.intField + b.doubleField;
380   }
381 
382   /// CHECK-START: java.lang.String Main.constructBase(java.lang.String) inliner (before)
383   /// CHECK-DAG:  <<Value:l\d+>>      ParameterValue
384   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
385   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
386   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:Base.<init>
387 
388   /// CHECK-START: java.lang.String Main.constructBase(java.lang.String) inliner (after)
389   /// CHECK-NOT:                      InvokeStaticOrDirect
390   /// CHECK-NOT:                      MemoryBarrier
391 
392   /// CHECK-START: java.lang.String Main.constructBase(java.lang.String) inliner (after)
393   /// CHECK-DAG:  <<Value:l\d+>>      ParameterValue
394   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
395   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<Value>>]
396 
397   /// CHECK-START: java.lang.String Main.constructBase(java.lang.String) inliner (after)
398   /// CHECK-DAG:                      InstanceFieldSet
399   /// CHECK-NOT:                      InstanceFieldSet
400 
constructBase(String stringValue)401   public static String constructBase(String stringValue) {
402     Base b = new Base(stringValue);
403     return b.stringField;
404   }
405 
406   /// CHECK-START: java.lang.String Main.constructBaseWithNullString() inliner (before)
407   /// CHECK-DAG:  <<Null:l\d+>>       NullConstant
408   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
409   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
410   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Null>>{{(,[ij]\d+)?}}] method_name:Base.<init>
411 
412   /// CHECK-START: java.lang.String Main.constructBaseWithNullString() inliner (after)
413   /// CHECK-NOT:                      InvokeStaticOrDirect
414   /// CHECK-NOT:                      MemoryBarrier
415 
416   /// CHECK-START: java.lang.String Main.constructBaseWithNullString() inliner (after)
417   /// CHECK-NOT:                      InstanceFieldSet
418 
constructBaseWithNullString()419   public static String constructBaseWithNullString() {
420     String stringValue = null;
421     Base b = new Base(stringValue);
422     return b.stringField;
423   }
424 
425   /// CHECK-START: double Main.constructBase(double, java.lang.Object) inliner (before)
426   /// CHECK-DAG:  <<DValue:d\d+>>     ParameterValue
427   /// CHECK-DAG:  <<OValue:l\d+>>     ParameterValue
428   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
429   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
430   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<DValue>>,<<OValue>>{{(,[ij]\d+)?}}] method_name:Base.<init>
431 
432   /// CHECK-START: double Main.constructBase(double, java.lang.Object) inliner (after)
433   /// CHECK-NOT:                      InvokeStaticOrDirect
434   /// CHECK-NOT:                      MemoryBarrier
435 
436   /// CHECK-START: double Main.constructBase(double, java.lang.Object) inliner (after)
437   /// CHECK-DAG:  <<DValue:d\d+>>     ParameterValue
438   /// CHECK-DAG:  <<OValue:l\d+>>     ParameterValue
439   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
440   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<DValue>>]
441   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<OValue>>]
442 
443   /// CHECK-START: double Main.constructBase(double, java.lang.Object) inliner (after)
444   /// CHECK-DAG:                      InstanceFieldSet
445   /// CHECK-DAG:                      InstanceFieldSet
446   /// CHECK-NOT:                      InstanceFieldSet
447 
constructBase(double doubleValue, Object objectValue)448   public static double constructBase(double doubleValue, Object objectValue) {
449     Base b = new Base(doubleValue, objectValue);
450     return (b.objectField != null) ? b.doubleField : -b.doubleField;
451   }
452 
453   /// CHECK-START: double Main.constructBase(int, double, java.lang.Object) inliner (before)
454   /// CHECK-DAG:  <<IValue:i\d+>>     ParameterValue
455   /// CHECK-DAG:  <<DValue:d\d+>>     ParameterValue
456   /// CHECK-DAG:  <<OValue:l\d+>>     ParameterValue
457   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
458   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
459   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<IValue>>,<<DValue>>,<<OValue>>{{(,[ij]\d+)?}}] method_name:Base.<init>
460 
461   /// CHECK-START: double Main.constructBase(int, double, java.lang.Object) inliner (after)
462   /// CHECK-NOT:                      InvokeStaticOrDirect
463   /// CHECK-NOT:                      MemoryBarrier
464 
465   /// CHECK-START: double Main.constructBase(int, double, java.lang.Object) inliner (after)
466   /// CHECK-DAG:  <<IValue:i\d+>>     ParameterValue
467   /// CHECK-DAG:  <<DValue:d\d+>>     ParameterValue
468   /// CHECK-DAG:  <<OValue:l\d+>>     ParameterValue
469   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
470   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<IValue>>]
471   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<DValue>>]
472   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<OValue>>]
473 
474   /// CHECK-START: double Main.constructBase(int, double, java.lang.Object) inliner (after)
475   /// CHECK-DAG:                      InstanceFieldSet
476   /// CHECK-DAG:                      InstanceFieldSet
477   /// CHECK-DAG:                      InstanceFieldSet
478   /// CHECK-NOT:                      InstanceFieldSet
479 
constructBase(int intValue, double doubleValue, Object objectValue)480   public static double constructBase(int intValue, double doubleValue, Object objectValue) {
481     Base b = new Base(intValue, doubleValue, objectValue);
482     double tmp = b.intField + b.doubleField;
483     return (b.objectField != null) ? tmp : -tmp;
484   }
485 
486   /// CHECK-START: double Main.constructBaseWith0DoubleNull(double) inliner (before)
487   /// CHECK-DAG:  <<IValue:i\d+>>     IntConstant 0
488   /// CHECK-DAG:  <<DValue:d\d+>>     ParameterValue
489   /// CHECK-DAG:  <<OValue:l\d+>>     NullConstant
490   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
491   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
492   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<IValue>>,<<DValue>>,<<OValue>>{{(,[ij]\d+)?}}] method_name:Base.<init>
493 
494   /// CHECK-START: double Main.constructBaseWith0DoubleNull(double) inliner (after)
495   /// CHECK-NOT:                      InvokeStaticOrDirect
496   /// CHECK-NOT:                      MemoryBarrier
497 
498   /// CHECK-START: double Main.constructBaseWith0DoubleNull(double) inliner (after)
499   /// CHECK-DAG:  <<DValue:d\d+>>     ParameterValue
500   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
501   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<DValue>>]
502 
503   /// CHECK-START: double Main.constructBaseWith0DoubleNull(double) inliner (after)
504   /// CHECK-DAG:                      InstanceFieldSet
505   /// CHECK-NOT:                      InstanceFieldSet
506 
constructBaseWith0DoubleNull(double doubleValue)507   public static double constructBaseWith0DoubleNull(double doubleValue) {
508     Base b = new Base(0, doubleValue, null);
509     double tmp = b.intField + b.doubleField;
510     return (b.objectField != null) ? tmp : -tmp;
511   }
512 
513   /// CHECK-START: double Main.constructBase(int, double, java.lang.Object, java.lang.String) inliner (before)
514   /// CHECK-DAG:  <<IValue:i\d+>>     ParameterValue
515   /// CHECK-DAG:  <<DValue:d\d+>>     ParameterValue
516   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
517   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
518   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<IValue>>,<<DValue>>,{{l\d+}},{{l\d+}}{{(,[ij]\d+)?}}] method_name:Base.<init>
519 
520   /// CHECK-START: double Main.constructBase(int, double, java.lang.Object, java.lang.String) inliner (after)
521   /// CHECK-DAG:  <<IValue:i\d+>>     ParameterValue
522   /// CHECK-DAG:  <<DValue:d\d+>>     ParameterValue
523   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
524   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
525   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<IValue>>,<<DValue>>,{{l\d+}},{{l\d+}}{{(,[ij]\d+)?}}] method_name:Base.<init>
526 
527   /// CHECK-START: double Main.constructBase(int, double, java.lang.Object, java.lang.String) inliner (after)
528   /// CHECK-NOT:                      InstanceFieldSet
529 
constructBase( int intValue, double doubleValue, Object objectValue, String stringValue)530   public static double constructBase(
531       int intValue, double doubleValue, Object objectValue, String stringValue) {
532     Base b = new Base(intValue, doubleValue, objectValue, stringValue);
533     double tmp = b.intField + b.doubleField;
534     tmp = (b.objectField != null) ? tmp : -tmp;
535     return (b.stringField != null) ? 2.0 * tmp : 0.5 * tmp;
536   }
537 
538   /// CHECK-START: double Main.constructBase(double) inliner (before)
539   /// CHECK-DAG:  <<Value:d\d+>>      ParameterValue
540   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
541   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
542   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:Base.<init>
543 
544   /// CHECK-START: double Main.constructBase(double) inliner (after)
545   /// CHECK-NOT:                      InvokeStaticOrDirect
546   /// CHECK-NOT:                      MemoryBarrier
547 
548   /// CHECK-START: double Main.constructBase(double) inliner (after)
549   /// CHECK-DAG:  <<Value:d\d+>>      ParameterValue
550   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
551   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<Value>>]
552 
553   /// CHECK-START: double Main.constructBase(double) inliner (after)
554   /// CHECK-DAG:                      InstanceFieldSet
555   /// CHECK-NOT:                      InstanceFieldSet
556 
constructBase(double doubleValue)557   public static double constructBase(double doubleValue) {
558     Base b = new Base(doubleValue);
559     return b.intField + b.doubleField;
560   }
561 
562   /// CHECK-START: double Main.constructBaseWith0d() inliner (before)
563   /// CHECK-DAG:  <<Value:d\d+>>      DoubleConstant
564   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
565   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
566   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:Base.<init>
567 
568   /// CHECK-START: double Main.constructBaseWith0d() inliner (after)
569   /// CHECK-NOT:                      InvokeStaticOrDirect
570   /// CHECK-NOT:                      MemoryBarrier
571   /// CHECK-NOT:                      InstanceFieldSet
572 
constructBaseWith0d()573   public static double constructBaseWith0d() {
574     Base b = new Base(0.0);
575     return b.intField + b.doubleField;
576   }
577 
578   /// CHECK-START: double Main.constructBase(java.lang.Object) inliner (before)
579   /// CHECK-DAG:  <<OValue:l\d+>>     ParameterValue
580   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
581   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
582   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<OValue>>{{(,[ij]\d+)?}}] method_name:Base.<init>
583 
584   /// CHECK-START: double Main.constructBase(java.lang.Object) inliner (after)
585   /// CHECK-DAG:  <<OValue:l\d+>>     ParameterValue
586   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
587   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
588   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<OValue>>{{(,[ij]\d+)?}}] method_name:Base.<init>
589 
590   /// CHECK-START: double Main.constructBase(java.lang.Object) inliner (after)
591   /// CHECK-NOT:                      InstanceFieldSet
592 
constructBase(Object objectValue)593   public static double constructBase(Object objectValue) {
594     Base b = new Base(objectValue);
595     double tmp = b.intField + b.doubleField;
596     return (b.objectField != null) ? tmp + 1.0 : tmp - 1.0;
597   }
598 
599   /// CHECK-START: double Main.constructBase(int, long) inliner (before)
600   /// CHECK-DAG:  <<IValue:i\d+>>     ParameterValue
601   /// CHECK-DAG:  <<JValue:j\d+>>     ParameterValue
602   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
603   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
604   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<IValue>>,<<JValue>>{{(,[ij]\d+)?}}] method_name:Base.<init>
605 
606   /// CHECK-START: double Main.constructBase(int, long) inliner (after)
607   /// CHECK-NOT:                      InvokeStaticOrDirect
608   /// CHECK-NOT:                      MemoryBarrier
609 
610   /// CHECK-START: double Main.constructBase(int, long) inliner (after)
611   /// CHECK-DAG:  <<IValue:i\d+>>     ParameterValue
612   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
613   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<IValue>>]
614 
615   /// CHECK-START: double Main.constructBase(int, long) inliner (after)
616   /// CHECK-DAG:                      InstanceFieldSet
617   /// CHECK-NOT:                      InstanceFieldSet
618 
constructBase(int intValue, long dummy)619   public static double constructBase(int intValue, long dummy) {
620     Base b = new Base(intValue, dummy);
621     return b.intField + b.doubleField;
622   }
623 
624   /// CHECK-START: double Main.constructDerived() inliner (before)
625   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
626   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
627   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>{{(,[ij]\d+)?}}] method_name:Derived.<init>
628 
629   /// CHECK-START: double Main.constructDerived() inliner (after)
630   /// CHECK-NOT:                      InvokeStaticOrDirect
631   /// CHECK-NOT:                      MemoryBarrier
632   /// CHECK-NOT:                      InstanceFieldSet
633 
constructDerived()634   public static double constructDerived() {
635     Derived d = new Derived();
636     return d.intField + d.doubleField;
637   }
638 
639   /// CHECK-START: double Main.constructDerived(int) inliner (before)
640   /// CHECK-DAG:  <<Value:i\d+>>      ParameterValue
641   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
642   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
643   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:Derived.<init>
644 
645   /// CHECK-START: double Main.constructDerived(int) inliner (after)
646   /// CHECK-NOT:                      InvokeStaticOrDirect
647   /// CHECK-NOT:                      MemoryBarrier
648 
649   /// CHECK-START: double Main.constructDerived(int) inliner (after)
650   /// CHECK-DAG:  <<Value:i\d+>>      ParameterValue
651   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
652   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<Value>>]
653 
654   /// CHECK-START: double Main.constructDerived(int) inliner (after)
655   /// CHECK-DAG:                      InstanceFieldSet
656   /// CHECK-NOT:                      InstanceFieldSet
657 
constructDerived(int intValue)658   public static double constructDerived(int intValue) {
659     Derived d = new Derived(intValue);
660     return d.intField + d.doubleField;
661   }
662 
663   /// CHECK-START: double Main.constructDerivedWith0() inliner (before)
664   /// CHECK-DAG:  <<Value:i\d+>>      IntConstant 0
665   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
666   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
667   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:Derived.<init>
668 
669   /// CHECK-START: double Main.constructDerivedWith0() inliner (after)
670   /// CHECK-NOT:                      InvokeStaticOrDirect
671   /// CHECK-NOT:                      MemoryBarrier
672   /// CHECK-NOT:                      InstanceFieldSet
673 
constructDerivedWith0()674   public static double constructDerivedWith0() {
675     Derived d = new Derived(0);
676     return d.intField + d.doubleField;
677   }
678 
679   /// CHECK-START: java.lang.String Main.constructDerived(java.lang.String) inliner (before)
680   /// CHECK-DAG:  <<Value:l\d+>>      ParameterValue
681   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
682   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
683   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:Derived.<init>
684 
685   /// CHECK-START: java.lang.String Main.constructDerived(java.lang.String) inliner (after)
686   /// CHECK-NOT:                      InvokeStaticOrDirect
687   /// CHECK-NOT:                      MemoryBarrier
688 
689   /// CHECK-START: java.lang.String Main.constructDerived(java.lang.String) inliner (after)
690   /// CHECK-NOT:                      InstanceFieldSet
691 
constructDerived(String stringValue)692   public static String constructDerived(String stringValue) {
693     Derived d = new Derived(stringValue);
694     return d.stringField;
695   }
696 
697   /// CHECK-START: double Main.constructDerived(double) inliner (before)
698   /// CHECK-DAG:  <<Value:d\d+>>      ParameterValue
699   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
700   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
701   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:Derived.<init>
702 
703   /// CHECK-START: double Main.constructDerived(double) inliner (after)
704   /// CHECK-NOT:                      InvokeStaticOrDirect
705   /// CHECK-NOT:                      MemoryBarrier
706 
707   /// CHECK-START: double Main.constructDerived(double) inliner (after)
708   /// CHECK-DAG:  <<Value:d\d+>>      ParameterValue
709   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
710   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<Value>>]
711 
712   /// CHECK-START: double Main.constructDerived(double) inliner (after)
713   /// CHECK-DAG:                      InstanceFieldSet
714   /// CHECK-NOT:                      InstanceFieldSet
715 
constructDerived(double doubleValue)716   public static double constructDerived(double doubleValue) {
717     Derived d = new Derived(doubleValue);
718     return d.intField + d.doubleField;
719   }
720 
721   /// CHECK-START: double Main.constructDerivedWith0d() inliner (before)
722   /// CHECK-DAG:  <<Value:d\d+>>      DoubleConstant
723   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
724   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
725   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:Derived.<init>
726 
727   /// CHECK-START: double Main.constructDerivedWith0d() inliner (after)
728   /// CHECK-NOT:                      InvokeStaticOrDirect
729   /// CHECK-NOT:                      MemoryBarrier
730   /// CHECK-NOT:                      InstanceFieldSet
731 
constructDerivedWith0d()732   public static double constructDerivedWith0d() {
733     Derived d = new Derived(0.0);
734     return d.intField + d.doubleField;
735   }
736 
737   /// CHECK-START: double Main.constructDerived(int, double, java.lang.Object) inliner (before)
738   /// CHECK-DAG:  <<IValue:i\d+>>     ParameterValue
739   /// CHECK-DAG:  <<DValue:d\d+>>     ParameterValue
740   /// CHECK-DAG:  <<OValue:l\d+>>     ParameterValue
741   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
742   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
743   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<IValue>>,<<DValue>>,<<OValue>>{{(,[ij]\d+)?}}] method_name:Derived.<init>
744 
745   /// CHECK-START: double Main.constructDerived(int, double, java.lang.Object) inliner (after)
746   /// CHECK-NOT:                      InvokeStaticOrDirect
747   /// CHECK-NOT:                      MemoryBarrier
748 
749   /// CHECK-START: double Main.constructDerived(int, double, java.lang.Object) inliner (after)
750   /// CHECK-DAG:  <<DValue:d\d+>>     ParameterValue
751   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
752   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<DValue>>]
753 
754   /// CHECK-START: double Main.constructDerived(int, double, java.lang.Object) inliner (after)
755   /// CHECK-DAG:                      InstanceFieldSet
756   /// CHECK-NOT:                      InstanceFieldSet
757 
constructDerived(int intValue, double doubleValue, Object objectValue)758   public static double constructDerived(int intValue, double doubleValue, Object objectValue) {
759     Derived d = new Derived(intValue, doubleValue, objectValue);
760     double tmp = d.intField + d.doubleField;
761     return (d.objectField != null) ? tmp : -tmp;
762   }
763 
764   /// CHECK-START: double Main.constructDerived(int, double, java.lang.Object, java.lang.String) inliner (before)
765   /// CHECK-DAG:  <<IValue:i\d+>>     ParameterValue
766   /// CHECK-DAG:  <<DValue:d\d+>>     ParameterValue
767   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
768   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
769   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<IValue>>,<<DValue>>,{{l\d+}},{{l\d+}}{{(,[ij]\d+)?}}] method_name:Derived.<init>
770 
771   /// CHECK-START: double Main.constructDerived(int, double, java.lang.Object, java.lang.String) inliner (after)
772   /// CHECK-DAG:  <<IValue:i\d+>>     ParameterValue
773   /// CHECK-DAG:  <<DValue:d\d+>>     ParameterValue
774   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
775   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
776   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<IValue>>,<<DValue>>,{{l\d+}},{{l\d+}}{{(,[ij]\d+)?}}] method_name:Derived.<init>
777 
778   /// CHECK-START: double Main.constructDerived(int, double, java.lang.Object, java.lang.String) inliner (after)
779   /// CHECK-NOT:                      InstanceFieldSet
780 
constructDerived( int intValue, double doubleValue, Object objectValue, String stringValue)781   public static double constructDerived(
782       int intValue, double doubleValue, Object objectValue, String stringValue) {
783     Derived d = new Derived(intValue, doubleValue, objectValue, stringValue);
784     double tmp = d.intField + d.doubleField;
785     tmp = (d.objectField != null) ? tmp : -tmp;
786     return (d.stringField != null) ? 2.0 * tmp : 0.5 * tmp;
787   }
788 
789   /// CHECK-START: double Main.constructDerived(float) inliner (before)
790   /// CHECK-DAG:  <<Value:f\d+>>      ParameterValue
791   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
792   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
793   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:Derived.<init>
794 
795   /// CHECK-START: double Main.constructDerived(float) inliner (after)
796   /// CHECK-NOT:                      InvokeStaticOrDirect
797   /// CHECK-NOT:                      MemoryBarrier
798 
799   /// CHECK-START: double Main.constructDerived(float) inliner (after)
800   /// CHECK-DAG:  <<Value:f\d+>>      ParameterValue
801   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
802   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<Value>>]
803 
804   /// CHECK-START: double Main.constructDerived(float) inliner (after)
805   /// CHECK-DAG:                      InstanceFieldSet
806   /// CHECK-NOT:                      InstanceFieldSet
807 
constructDerived(float floatValue)808   public static double constructDerived(float floatValue) {
809     Derived d = new Derived(floatValue);
810     return d.intField + d.doubleField + d.floatField;
811   }
812 
813   /// CHECK-START: double Main.constructDerived(int, double, java.lang.Object, float) inliner (before)
814   /// CHECK-DAG:  <<IValue:i\d+>>     ParameterValue
815   /// CHECK-DAG:  <<DValue:d\d+>>     ParameterValue
816   /// CHECK-DAG:  <<OValue:l\d+>>     ParameterValue
817   /// CHECK-DAG:  <<FValue:f\d+>>     ParameterValue
818   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
819   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
820   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<IValue>>,<<DValue>>,<<OValue>>,<<FValue>>{{(,[ij]\d+)?}}] method_name:Derived.<init>
821 
822   /// CHECK-START: double Main.constructDerived(int, double, java.lang.Object, float) inliner (after)
823   /// CHECK-NOT:                      InvokeStaticOrDirect
824   /// CHECK-NOT:                      MemoryBarrier
825 
826   /// CHECK-START: double Main.constructDerived(int, double, java.lang.Object, float) inliner (after)
827   /// CHECK-DAG:  <<IValue:i\d+>>     ParameterValue
828   /// CHECK-DAG:  <<DValue:d\d+>>     ParameterValue
829   /// CHECK-DAG:  <<FValue:f\d+>>     ParameterValue
830   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
831   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<IValue>>]
832   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<DValue>>]
833   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<FValue>>]
834 
835   /// CHECK-START: double Main.constructDerived(int, double, java.lang.Object, float) inliner (after)
836   /// CHECK-DAG:                      InstanceFieldSet
837   /// CHECK-DAG:                      InstanceFieldSet
838   /// CHECK-DAG:                      InstanceFieldSet
839   /// CHECK-NOT:                      InstanceFieldSet
840 
constructDerived( int intValue, double doubleValue, Object objectValue, float floatValue)841   public static double constructDerived(
842       int intValue, double doubleValue, Object objectValue, float floatValue) {
843     Derived d = new Derived(intValue, doubleValue, objectValue, floatValue);
844     double tmp = d.intField + d.doubleField + d.floatField;
845     return (d.objectField != null) ? tmp : -tmp;
846   }
847 
848   /// CHECK-START: int Main.constructBaseWithFinalField() inliner (before)
849   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
850   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
851   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>{{(,[ij]\d+)?}}] method_name:BaseWithFinalField.<init>
852 
853   /// CHECK-START: int Main.constructBaseWithFinalField() inliner (after)
854   /// CHECK-NOT:                      InvokeStaticOrDirect
855   /// CHECK-NOT:                      MemoryBarrier
856   /// CHECK-NOT:                      InstanceFieldSet
857 
constructBaseWithFinalField()858   public static int constructBaseWithFinalField() {
859     BaseWithFinalField b = new BaseWithFinalField();
860     return b.intField;
861   }
862 
863   /// CHECK-START: int Main.constructBaseWithFinalField(int) inliner (before)
864   /// CHECK-DAG:  <<Value:i\d+>>      ParameterValue
865   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
866   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
867   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:BaseWithFinalField.<init>
868 
869   /// CHECK-START: int Main.constructBaseWithFinalField(int) inliner (after)
870   /// CHECK-NOT:                      InvokeStaticOrDirect
871 
872   /// CHECK-START: int Main.constructBaseWithFinalField(int) inliner (after)
873   /// CHECK-DAG:  <<Value:i\d+>>      ParameterValue
874   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
875   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<Value>>]
876   /// CHECK-DAG:                      MemoryBarrier
877 
878   /// CHECK-START: int Main.constructBaseWithFinalField(int) inliner (after)
879   /// CHECK-DAG:                      InstanceFieldSet
880   /// CHECK-NOT:                      InstanceFieldSet
881 
constructBaseWithFinalField(int intValue)882   public static int constructBaseWithFinalField(int intValue) {
883     BaseWithFinalField b = new BaseWithFinalField(intValue);
884     return b.intField;
885   }
886 
887   /// CHECK-START: int Main.constructBaseWithFinalFieldWith0() inliner (before)
888   /// CHECK-DAG:  <<Value:i\d+>>      IntConstant 0
889   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
890   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
891   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:BaseWithFinalField.<init>
892 
893   /// CHECK-START: int Main.constructBaseWithFinalFieldWith0() inliner (after)
894   /// CHECK-NOT:                      InvokeStaticOrDirect
895   /// CHECK-NOT:                      MemoryBarrier
896   /// CHECK-NOT:                      InstanceFieldSet
897 
constructBaseWithFinalFieldWith0()898   public static int constructBaseWithFinalFieldWith0() {
899     BaseWithFinalField b = new BaseWithFinalField(0);
900     return b.intField;
901   }
902 
903   /// CHECK-START: double Main.constructDerivedWithFinalField() inliner (before)
904   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
905   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
906   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>{{(,[ij]\d+)?}}] method_name:DerivedWithFinalField.<init>
907 
908   /// CHECK-START: double Main.constructDerivedWithFinalField() inliner (after)
909   /// CHECK-NOT:                      InvokeStaticOrDirect
910   /// CHECK-NOT:                      MemoryBarrier
911   /// CHECK-NOT:                      InstanceFieldSet
912 
constructDerivedWithFinalField()913   public static double constructDerivedWithFinalField() {
914     DerivedWithFinalField d = new DerivedWithFinalField();
915     return d.intField + d.doubleField;
916   }
917 
918   /// CHECK-START: double Main.constructDerivedWithFinalField(int) inliner (before)
919   /// CHECK-DAG:  <<Value:i\d+>>      ParameterValue
920   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
921   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
922   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:DerivedWithFinalField.<init>
923 
924   /// CHECK-START: double Main.constructDerivedWithFinalField(int) inliner (after)
925   /// CHECK-NOT:                      InvokeStaticOrDirect
926 
927   /// CHECK-START: double Main.constructDerivedWithFinalField(int) inliner (after)
928   /// CHECK-DAG:  <<Value:i\d+>>      ParameterValue
929   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
930   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<Value>>]
931   /// CHECK-DAG:                      MemoryBarrier
932 
933   /// CHECK-START: double Main.constructDerivedWithFinalField(int) inliner (after)
934   /// CHECK-DAG:                      InstanceFieldSet
935   /// CHECK-NOT:                      InstanceFieldSet
936 
constructDerivedWithFinalField(int intValue)937   public static double constructDerivedWithFinalField(int intValue) {
938     DerivedWithFinalField d = new DerivedWithFinalField(intValue);
939     return d.intField + d.doubleField;
940   }
941 
942   /// CHECK-START: double Main.constructDerivedWithFinalFieldWith0() inliner (before)
943   /// CHECK-DAG:  <<Value:i\d+>>      IntConstant 0
944   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
945   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
946   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:DerivedWithFinalField.<init>
947 
948   /// CHECK-START: double Main.constructDerivedWithFinalFieldWith0() inliner (after)
949   /// CHECK-NOT:                      InvokeStaticOrDirect
950   /// CHECK-NOT:                      MemoryBarrier
951   /// CHECK-NOT:                      InstanceFieldSet
952 
constructDerivedWithFinalFieldWith0()953   public static double constructDerivedWithFinalFieldWith0() {
954     DerivedWithFinalField d = new DerivedWithFinalField(0);
955     return d.intField + d.doubleField;
956   }
957 
958   /// CHECK-START: double Main.constructDerivedWithFinalField(double) inliner (before)
959   /// CHECK-DAG:  <<Value:d\d+>>      ParameterValue
960   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
961   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
962   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:DerivedWithFinalField.<init>
963 
964   /// CHECK-START: double Main.constructDerivedWithFinalField(double) inliner (after)
965   /// CHECK-NOT:                      InvokeStaticOrDirect
966 
967   /// CHECK-START: double Main.constructDerivedWithFinalField(double) inliner (after)
968   /// CHECK-DAG:  <<Value:d\d+>>      ParameterValue
969   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
970   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<Value>>]
971   /// CHECK-DAG:                      MemoryBarrier
972 
973   /// CHECK-START: double Main.constructDerivedWithFinalField(double) inliner (after)
974   /// CHECK-DAG:                      InstanceFieldSet
975   /// CHECK-NOT:                      InstanceFieldSet
976 
constructDerivedWithFinalField(double doubleValue)977   public static double constructDerivedWithFinalField(double doubleValue) {
978     DerivedWithFinalField d = new DerivedWithFinalField(doubleValue);
979     return d.intField + d.doubleField;
980   }
981 
982   /// CHECK-START: double Main.constructDerivedWithFinalFieldWith0d() inliner (before)
983   /// CHECK-DAG:  <<Value:d\d+>>      DoubleConstant
984   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
985   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
986   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:DerivedWithFinalField.<init>
987 
988   /// CHECK-START: double Main.constructDerivedWithFinalFieldWith0d() inliner (after)
989   /// CHECK-NOT:                      InvokeStaticOrDirect
990   /// CHECK-NOT:                      MemoryBarrier
991   /// CHECK-NOT:                      InstanceFieldSet
992 
constructDerivedWithFinalFieldWith0d()993   public static double constructDerivedWithFinalFieldWith0d() {
994     DerivedWithFinalField d = new DerivedWithFinalField(0.0);
995     return d.intField + d.doubleField;
996   }
997 
998   /// CHECK-START: double Main.constructDerivedWithFinalField(int, double) inliner (before)
999   /// CHECK-DAG:  <<IValue:i\d+>>     ParameterValue
1000   /// CHECK-DAG:  <<DValue:d\d+>>     ParameterValue
1001   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
1002   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
1003   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<IValue>>,<<DValue>>{{(,[ij]\d+)?}}] method_name:DerivedWithFinalField.<init>
1004 
1005   /// CHECK-START: double Main.constructDerivedWithFinalField(int, double) inliner (after)
1006   /// CHECK-NOT:                      InvokeStaticOrDirect
1007 
1008   /// CHECK-START: double Main.constructDerivedWithFinalField(int, double) inliner (after)
1009   /// CHECK-DAG:  <<Value:d\d+>>      ParameterValue
1010   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
1011   /// CHECK-DAG:                      InstanceFieldSet [<<Obj>>,<<Value>>]
1012   /// CHECK-DAG:                      MemoryBarrier
1013 
1014   /// CHECK-START: double Main.constructDerivedWithFinalField(int, double) inliner (after)
1015   /// CHECK-DAG:                      InstanceFieldSet
1016   /// CHECK-DAG:                      InstanceFieldSet
1017   /// CHECK-NOT:                      InstanceFieldSet
1018 
1019   /// CHECK-START: double Main.constructDerivedWithFinalField(int, double) inliner (after)
1020   /// CHECK-DAG:                      MemoryBarrier
1021   /// CHECK-NOT:                      MemoryBarrier
1022 
constructDerivedWithFinalField(int intValue, double doubleValue)1023   public static double constructDerivedWithFinalField(int intValue, double doubleValue) {
1024     DerivedWithFinalField d = new DerivedWithFinalField(intValue, doubleValue);
1025     return d.intField + d.doubleField;
1026   }
1027 
1028   /// CHECK-START: double Main.constructDerivedWithFinalFieldWith0And0d() inliner (before)
1029   /// CHECK-DAG:  <<IValue:i\d+>>     IntConstant 0
1030   /// CHECK-DAG:  <<DValue:d\d+>>     DoubleConstant
1031   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
1032   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
1033   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<IValue>>,<<DValue>>{{(,[ij]\d+)?}}] method_name:DerivedWithFinalField.<init>
1034 
1035   /// CHECK-START: double Main.constructDerivedWithFinalFieldWith0And0d() inliner (after)
1036   /// CHECK-NOT:                      InvokeStaticOrDirect
1037   /// CHECK-NOT:                      MemoryBarrier
1038   /// CHECK-NOT:                      InstanceFieldSet
1039 
constructDerivedWithFinalFieldWith0And0d()1040   public static double constructDerivedWithFinalFieldWith0And0d() {
1041     DerivedWithFinalField d = new DerivedWithFinalField(0, 0.0);
1042     return d.intField + d.doubleField;
1043   }
1044 
1045   /// CHECK-START: int Main.constructDerivedInSecondDex() inliner (before)
1046   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
1047   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
1048   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>{{(,[ij]\d+)?}}] method_name:DerivedInSecondDex.<init>
1049 
1050   /// CHECK-START: int Main.constructDerivedInSecondDex() inliner (after)
1051   /// CHECK-NOT:                      InvokeStaticOrDirect
1052   /// CHECK-NOT:                      MemoryBarrier
1053   /// CHECK-NOT:                      InstanceFieldSet
1054 
constructDerivedInSecondDex()1055   public static int constructDerivedInSecondDex() {
1056     DerivedInSecondDex d = new DerivedInSecondDex();
1057     return d.intField;
1058   }
1059 
1060   /// CHECK-START: int Main.constructDerivedInSecondDex(int) inliner (before)
1061   /// CHECK-DAG:  <<Value:i\d+>>      ParameterValue
1062   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
1063   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
1064   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:DerivedInSecondDex.<init>
1065 
1066   /// CHECK-START: int Main.constructDerivedInSecondDex(int) inliner (after)
1067   /// CHECK-DAG:  <<Value:i\d+>>      ParameterValue
1068   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
1069   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
1070   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:DerivedInSecondDex.<init>
1071 
1072   /// CHECK-START: int Main.constructDerivedInSecondDex(int) inliner (after)
1073   /// CHECK-NOT:                      MemoryBarrier
1074   /// CHECK-NOT:                      InstanceFieldSet
1075 
constructDerivedInSecondDex(int intValue)1076   public static int constructDerivedInSecondDex(int intValue) {
1077     DerivedInSecondDex d = new DerivedInSecondDex(intValue);
1078     return d.intField;
1079   }
1080 
1081   /// CHECK-START: int Main.constructDerivedInSecondDexWith0() inliner (before)
1082   /// CHECK-DAG:  <<Value:i\d+>>      IntConstant 0
1083   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
1084   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
1085   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:DerivedInSecondDex.<init>
1086 
1087   /// CHECK-START: int Main.constructDerivedInSecondDexWith0() inliner (after)
1088   /// CHECK-DAG:  <<Value:i\d+>>      IntConstant 0
1089   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
1090   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
1091   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:DerivedInSecondDex.<init>
1092 
1093   /// CHECK-START: int Main.constructDerivedInSecondDexWith0() inliner (after)
1094   /// CHECK-NOT:                      MemoryBarrier
1095   /// CHECK-NOT:                      InstanceFieldSet
1096 
constructDerivedInSecondDexWith0()1097   public static int constructDerivedInSecondDexWith0() {
1098     DerivedInSecondDex d = new DerivedInSecondDex(0);
1099     return d.intField;
1100   }
1101 
1102   /// CHECK-START: int Main.constructDerivedInSecondDex(long) inliner (before)
1103   /// CHECK-DAG:  <<Value:j\d+>>      ParameterValue
1104   /// CHECK-DAG:  <<Obj:l\d+>>        NewInstance
1105   // Note: The ArtMethod* (typed as int or long) is optional after sharpening.
1106   /// CHECK-DAG:                      InvokeStaticOrDirect [<<Obj>>,<<Value>>{{(,[ij]\d+)?}}] method_name:DerivedInSecondDex.<init>
1107 
1108   /// CHECK-START: int Main.constructDerivedInSecondDex(long) inliner (after)
1109   /// CHECK-NOT:                      InvokeStaticOrDirect
1110   /// CHECK-NOT:                      MemoryBarrier
1111   /// CHECK-NOT:                      InstanceFieldSet
1112 
constructDerivedInSecondDex(long dummy)1113   public static int constructDerivedInSecondDex(long dummy) {
1114     DerivedInSecondDex d = new DerivedInSecondDex(dummy);
1115     return d.intField;
1116   }
1117 
main(String[] args)1118   public static void main(String[] args) throws Exception {
1119     Second s = new Second();
1120 
1121     // Replaced NOP pattern.
1122     staticNop();
1123     nop(s);
1124     // Replaced "return arg" pattern.
1125     assertEquals("arbitrary string", staticReturnArg2("arbitrary string"));
1126     assertEquals(4321L, returnArg1(s, 4321L));
1127     // Replaced "return const" pattern.
1128     assertEquals(9, staticReturn9());
1129     assertEquals(7, return7(s));
1130     assertEquals(null, staticReturnNull());
1131     assertEquals(null, returnNull(s));
1132     // Replaced IGET pattern.
1133     assertEquals(42, getInt(s));
1134     assertEquals(-42.0, getDouble(s));
1135     assertEquals(null, getObject(s));
1136     assertEquals("dummy", getString(s));
1137     // Not replaced IGET pattern.
1138     assertEquals(42, staticGetInt(s));
1139     assertEquals(-42.0, getDoubleFromParam(s));
1140     // SGET.
1141     assertEquals(4242, getStaticInt(s));
1142     // Replaced IPUT pattern.
1143     assertEquals(111L, setLong(s, 111L));
1144     assertEquals(345L, setLongReturnArg2(s, 222L, 123));
1145     // Not replaced IPUT pattern.
1146     assertEquals(222L, staticSetLong(s, 222L));
1147     assertEquals(333L, setLongThroughParam(s, 333L));
1148     // SPUT.
1149     assertEquals(-11.5f, setStaticFloat(s, -11.5f));
1150 
1151     if (newObject() == null) {
1152       throw new AssertionError("new Object() cannot be null.");
1153     }
1154 
1155     assertEquals(0.0, constructBase());
1156     assertEquals(42.0, constructBase(42));
1157     assertEquals(0.0, constructBaseWith0());
1158     assertEquals("something", constructBase("something"));
1159     assertEquals(null, constructBaseWithNullString());
1160     assertEquals(11.0, constructBase(11.0, new Object()));
1161     assertEquals(-12.0, constructBase(12.0, null));
1162     assertEquals(30.0, constructBase(17, 13.0, new Object()));
1163     assertEquals(-34.0, constructBase(19, 15.0, null));
1164     assertEquals(-22.5, constructBaseWith0DoubleNull(22.5));
1165     assertEquals(-8.0, constructBase(2, 14.0, null, null));
1166     assertEquals(-64.0, constructBase(4, 28.0, null, "dummy"));
1167     assertEquals(13.0, constructBase(24, 2.0, new Object(), null));
1168     assertEquals(30.0, constructBase(11, 4.0, new Object(), "dummy"));
1169     assertEquals(43.0, constructBase(43.0));
1170     assertEquals(0.0, constructBaseWith0d());
1171     assertEquals(1.0, constructBase(new Object()));
1172     assertEquals(-1.0, constructBase((Object) null));
1173     assertEquals(123.0, constructBase(123, 65L));
1174 
1175     assertEquals(0.0, constructDerived());
1176     assertEquals(73.0, constructDerived(73));
1177     assertEquals(0.0, constructDerivedWith0());
1178     assertEquals(null, constructDerived("something else"));
1179     assertEquals(18.0, constructDerived(18.0));
1180     assertEquals(0.0, constructDerivedWith0d());
1181     assertEquals(-7.0, constructDerived(5, 7.0, new Object()));
1182     assertEquals(-4.0, constructDerived(9, 4.0, null));
1183     assertEquals(0.0, constructDerived(1, 9.0, null, null));
1184     assertEquals(0.0, constructDerived(2, 8.0, null, "dummy"));
1185     assertEquals(0.0, constructDerived(3, 7.0, new Object(), null));
1186     assertEquals(0.0, constructDerived(4, 6.0, new Object(), "dummy"));
1187     assertEquals(17.0, constructDerived(17.0f));
1188     assertEquals(-5.5, constructDerived(6, -7.0, new Object(), 6.5f));
1189 
1190     assertEquals(0, constructBaseWithFinalField());
1191     assertEquals(77, constructBaseWithFinalField(77));
1192     assertEquals(0, constructBaseWithFinalFieldWith0());
1193     assertEquals(0.0, constructDerivedWithFinalField());
1194     assertEquals(-33.0, constructDerivedWithFinalField(-33));
1195     assertEquals(0.0, constructDerivedWithFinalFieldWith0());
1196     assertEquals(-44.0, constructDerivedWithFinalField(-44.0));
1197     assertEquals(0.0, constructDerivedWithFinalFieldWith0d());
1198     assertEquals(88, constructDerivedWithFinalField(22, 66.0));
1199     assertEquals(0.0, constructDerivedWithFinalFieldWith0And0d());
1200 
1201     assertEquals(0, constructDerivedInSecondDex());
1202     assertEquals(123, constructDerivedInSecondDex(123));
1203     assertEquals(0, constructDerivedInSecondDexWith0());
1204     assertEquals(0, constructDerivedInSecondDex(7L));
1205   }
1206 
assertEquals(int expected, int actual)1207   private static void assertEquals(int expected, int actual) {
1208     if (expected != actual) {
1209       throw new AssertionError("Wrong result: " + expected + " != " + actual);
1210     }
1211   }
1212 
assertEquals(double expected, double actual)1213   private static void assertEquals(double expected, double actual) {
1214     if (expected != actual) {
1215       throw new AssertionError("Wrong result: " + expected + " != " + actual);
1216     }
1217   }
1218 
assertEquals(Object expected, Object actual)1219   private static void assertEquals(Object expected, Object actual) {
1220     if (expected != actual && (expected == null || !expected.equals(actual))) {
1221       throw new AssertionError("Wrong result: " + expected + " != " + actual);
1222     }
1223   }
1224 }
1225