@@ -107,6 +107,16 @@ class Basics {
107107 Object obj3 ;
108108 Object obj4 ;
109109
110+ public class Helper {
111+ private String s ;
112+
113+ public Helper (String s , int i ) {
114+ this .s = s ;
115+ }
116+
117+ public String getString () { return s ; }
118+ }
119+
110120 @ Test
111121 @ IR (failOn = IRNode .STORE , phase = {CompilePhase .DEFAULT , CompilePhase .PRINT_IDEAL })
112122 @ ExpectedFailure (ruleId = 1 , failOn = 1 ) // Only one failure - remove duplicated phases after mapping DEFAULT
@@ -115,15 +125,16 @@ public void removeDuplicates() {
115125 }
116126
117127 @ Test
118- @ IR (failOn = {IRNode .STORE , IRNode .ALLOC , IRNode .COUNTED_LOOP },
119- counts = {IRNode .STORE , "3" , IRNode .ALLOC , "1 " , IRNode .COUNTED_LOOP , "2" })
128+ @ IR (failOn = {IRNode .STORE , IRNode .FIELD_ACCESS , IRNode .COUNTED_LOOP },
129+ counts = {IRNode .STORE , "3" , IRNode .FIELD_ACCESS , "2 " , IRNode .COUNTED_LOOP , "2" })
120130 @ ExpectedFailure (ruleId = 1 , phase = CompilePhase .PRINT_IDEAL , failOn = 1 , counts = {1 , 3 })
121- @ ExpectedFailure (ruleId = 1 , phase = CompilePhase .PRINT_OPTO_ASSEMBLY , counts = 2 )
131+ @ ExpectedFailure (ruleId = 1 , phase = CompilePhase .PRINT_OPTO_ASSEMBLY , failOn = 2 )
122132
123- @ IR (failOn = {IRNode .STORE , IRNode .ALLOC , IRNode .COUNTED_LOOP })
133+ @ IR (failOn = {IRNode .STORE , IRNode .FIELD_ACCESS , IRNode .COUNTED_LOOP })
124134 @ ExpectedFailure (ruleId = 2 , phase = CompilePhase .PRINT_IDEAL , failOn = 1 )
135+ @ ExpectedFailure (ruleId = 2 , phase = CompilePhase .PRINT_OPTO_ASSEMBLY , failOn = 2 )
125136
126- @ IR (counts = {IRNode .STORE , "3" , IRNode .ALLOC , "1" , IRNode .COUNTED_LOOP , "2" })
137+ @ IR (counts = {IRNode .STORE , "3" , IRNode .FIELD_ACCESS , "1" , IRNode .COUNTED_LOOP , "2" })
127138 @ ExpectedFailure (ruleId = 3 , phase = CompilePhase .PRINT_IDEAL , counts = {1 , 3 })
128139 @ ExpectedFailure (ruleId = 3 , phase = CompilePhase .PRINT_OPTO_ASSEMBLY , counts = 2 )
129140
@@ -135,52 +146,54 @@ public void defaultOnIdeal() {
135146 }
136147
137148 @ Test
138- @ IR (failOn = {IRNode .STORE_F , IRNode .ALLOC , IRNode .COUNTED_LOOP },
139- counts = {IRNode .STORE_F , "3" , IRNode .ALLOC , "1" , IRNode .COUNTED_LOOP , "2" })
149+ @ IR (failOn = {IRNode .STORE_F , IRNode .FIELD_ACCESS , IRNode .COUNTED_LOOP },
150+ counts = {IRNode .STORE_F , "3" , IRNode .FIELD_ACCESS , "1" , IRNode .COUNTED_LOOP , "2" })
140151 @ ExpectedFailure (ruleId = 1 , phase = CompilePhase .PRINT_OPTO_ASSEMBLY , failOn = 2 )
141152 @ ExpectedFailure (ruleId = 1 , phase = CompilePhase .PRINT_IDEAL , counts = {1 , 3 })
142153
143- @ IR (failOn = {IRNode .STORE_F , IRNode .ALLOC , IRNode .COUNTED_LOOP })
154+ @ IR (failOn = {IRNode .STORE_F , IRNode .FIELD_ACCESS , IRNode .COUNTED_LOOP })
144155 @ ExpectedFailure (ruleId = 2 , phase = CompilePhase .PRINT_OPTO_ASSEMBLY , failOn = 2 )
145156
146- @ IR (counts = {IRNode .STORE_F , "3" , IRNode .ALLOC , "1" , IRNode .COUNTED_LOOP , "2" })
157+ @ IR (counts = {IRNode .STORE_F , "3" , IRNode .FIELD_ACCESS , "1" , IRNode .COUNTED_LOOP , "2" })
147158 @ ExpectedFailure (ruleId = 3 , phase = CompilePhase .PRINT_IDEAL , counts = {1 , 3 })
148159
149- @ IR (failOn = {IRNode .STORE_F , IRNode .ALLOC , IRNode .COUNTED_LOOP },
150- counts = {IRNode .STORE_F , "3" , IRNode .ALLOC , "2" , IRNode .COUNTED_LOOP , "2" })
160+ @ IR (failOn = {IRNode .STORE_F , IRNode .FIELD_ACCESS , IRNode .COUNTED_LOOP },
161+ counts = {IRNode .STORE_F , "3" , IRNode .FIELD_ACCESS , "2" , IRNode .COUNTED_LOOP , "2" })
151162
152163 @ ExpectedFailure (ruleId = 4 , phase = CompilePhase .PRINT_OPTO_ASSEMBLY , failOn = 2 , counts = 2 )
153164 @ ExpectedFailure (ruleId = 4 , phase = CompilePhase .PRINT_IDEAL , counts = {1 , 3 })
154165
155- @ IR (counts = {IRNode .ALLOC , "2" })
166+ @ IR (counts = {IRNode .FIELD_ACCESS , "2" })
156167 @ ExpectedFailure (ruleId = 5 , phase = CompilePhase .PRINT_OPTO_ASSEMBLY , counts = 1 )
157- public Object defaultOnOptoAssembly () {
158- return new Object ();
168+ public Object defaultOnOptoAssembly (Helper h ) {
169+ return h . getString ();
159170 }
160171
161172 @ Test
162- @ IR (failOn = {IRNode .STORE , IRNode .ALLOC , IRNode . ALLOC_OF , "Object" , IRNode .COUNTED_LOOP },
163- counts = {IRNode .STORE , "20" , IRNode .ALLOC , "1" , IRNode . ALLOC_OF , "Object" , "1 " , IRNode .COUNTED_LOOP , "2" })
164- @ ExpectedFailure (ruleId = 1 , phase = CompilePhase .PRINT_OPTO_ASSEMBLY , failOn = { 2 , 3 } )
165- @ ExpectedFailure (ruleId = 1 , phase = CompilePhase .PRINT_IDEAL , failOn = 1 , counts = {1 , 4 })
173+ @ IR (failOn = {IRNode .STORE , IRNode .FIELD_ACCESS , IRNode .COUNTED_LOOP },
174+ counts = {IRNode .STORE , "20" , IRNode .FIELD_ACCESS , "3 " , IRNode .COUNTED_LOOP , "2" })
175+ @ ExpectedFailure (ruleId = 1 , phase = CompilePhase .PRINT_OPTO_ASSEMBLY , failOn = 2 )
176+ @ ExpectedFailure (ruleId = 1 , phase = CompilePhase .PRINT_IDEAL , failOn = 1 , counts = {1 , 3 })
166177
167- @ IR (failOn = {IRNode .STORE , IRNode .ALLOC , IRNode . ALLOC_OF , "Object" , IRNode .COUNTED_LOOP })
178+ @ IR (failOn = {IRNode .STORE , IRNode .FIELD_ACCESS , IRNode .COUNTED_LOOP })
168179 @ ExpectedFailure (ruleId = 2 , phase = CompilePhase .PRINT_IDEAL , failOn = 1 )
169- @ ExpectedFailure (ruleId = 2 , phase = CompilePhase .PRINT_OPTO_ASSEMBLY , failOn = { 2 , 3 } )
180+ @ ExpectedFailure (ruleId = 2 , phase = CompilePhase .PRINT_OPTO_ASSEMBLY , failOn = 2 )
170181
171- @ IR (counts = {IRNode .STORE , "20" , IRNode .ALLOC , "1" , IRNode . ALLOC_OF , "Object" , "2" , IRNode .COUNTED_LOOP , "2" })
172- @ ExpectedFailure (ruleId = 3 , phase = CompilePhase .PRINT_IDEAL , counts = {1 , 4 })
173- @ ExpectedFailure (ruleId = 3 , phase = CompilePhase .PRINT_OPTO_ASSEMBLY , counts = 3 )
182+ @ IR (counts = {IRNode .STORE , "20" , IRNode .FIELD_ACCESS , "2" , IRNode .COUNTED_LOOP , "2" })
183+ @ ExpectedFailure (ruleId = 3 , phase = CompilePhase .PRINT_IDEAL , counts = {1 , 3 })
184+ @ ExpectedFailure (ruleId = 3 , phase = CompilePhase .PRINT_OPTO_ASSEMBLY , counts = 2 )
174185
175- @ IR (failOn = {IRNode .STORE , IRNode .ALLOC , IRNode . ALLOC_OF , "Object" , IRNode .COUNTED_LOOP },
176- counts = {IRNode .STORE , "20" , IRNode .ALLOC , "2" , IRNode . ALLOC_OF , "Object" , "2" , IRNode .COUNTED_LOOP , "2" })
177- @ ExpectedFailure (ruleId = 4 , phase = CompilePhase .PRINT_OPTO_ASSEMBLY , failOn = { 2 , 3 }, counts = { 2 , 3 } )
178- @ ExpectedFailure (ruleId = 4 , phase = CompilePhase .PRINT_IDEAL , failOn = 1 , counts = {1 , 4 })
186+ @ IR (failOn = {IRNode .STORE , IRNode .FIELD_ACCESS , IRNode .COUNTED_LOOP },
187+ counts = {IRNode .STORE , "20" , IRNode .FIELD_ACCESS , "2" , IRNode .COUNTED_LOOP , "2" })
188+ @ ExpectedFailure (ruleId = 4 , phase = CompilePhase .PRINT_OPTO_ASSEMBLY , failOn = 2 , counts = 2 )
189+ @ ExpectedFailure (ruleId = 4 , phase = CompilePhase .PRINT_IDEAL , failOn = 1 , counts = {1 , 3 })
179190
180- @ IR (counts = {IRNode .ALLOC , "2" , IRNode . ALLOC_OF , "Object" , "1 " })
191+ @ IR (counts = {IRNode .FIELD_ACCESS , "2" })
181192 @ ExpectedFailure (ruleId = 5 , phase = CompilePhase .PRINT_OPTO_ASSEMBLY , counts = 1 )
182- public void defaultOnBoth () {
183- obj = new Object ();
193+ public Object defaultOnBoth (Helper h ) {
194+ i = 34 ;
195+ l = 34 ;
196+ return h .getString ();
184197 }
185198
186199 @ Test
@@ -202,7 +215,7 @@ public int removeLoopsWithMultipleCompilations(int k) {
202215 return x ;
203216 }
204217
205- @ Run (test = "removeLoopsWithMultipleCompilations" )
218+ @ Run (test = { "removeLoopsWithMultipleCompilations" , "defaultOnOptoAssembly" , "defaultOnBoth" } )
206219 @ Warmup (1 )
207220 public void run () {
208221 for (int i = 0 ; i < 10000 ; i ++) {
@@ -211,6 +224,8 @@ public void run() {
211224 for (int i = 0 ; i < 10000 ; i ++) {
212225 removeLoopsWithMultipleCompilations (3 );
213226 }
227+ defaultOnOptoAssembly (new Helper ("a" , 1 ));
228+ defaultOnBoth (new Helper ("a" , 1 ));
214229 }
215230
216231 @ Test
@@ -238,17 +253,17 @@ public int limit() {
238253 @ Test
239254 @ IR (failOn = {IRNode .ALLOC , IRNode .ALLOC_ARRAY },
240255 counts = {IRNode .ALLOC , "0" , IRNode .ALLOC_ARRAY , "0" },
241- phase = {CompilePhase .BEFORE_REMOVEUSELESS , CompilePhase .CCP1 , CompilePhase .PRINT_OPTO_ASSEMBLY , CompilePhase . DEFAULT })
256+ phase = {CompilePhase .BEFORE_REMOVEUSELESS , CompilePhase .CCP1 , CompilePhase .DEFAULT })
242257 @ ExpectedFailure (ruleId = 1 , failOn = {1 , 2 }, counts = {1 , 2 },
243- phase = {CompilePhase .BEFORE_REMOVEUSELESS , CompilePhase .CCP1 , CompilePhase .PRINT_OPTO_ASSEMBLY })
258+ phase = {CompilePhase .BEFORE_REMOVEUSELESS , CompilePhase .CCP1 , CompilePhase .BEFORE_MACRO_EXPANSION })
244259 public void alloc () {
245260 obj = new Object ();
246261 obj2 = new Object [1 ];
247262 }
248263
249264 @ Test
250265 @ IR (counts = {IRNode .ALLOC , "2" , IRNode .ALLOC_ARRAY , "2" }, // works for all phases
251- phase = {CompilePhase .BEFORE_REMOVEUSELESS , CompilePhase .CCP1 , CompilePhase .PRINT_OPTO_ASSEMBLY , CompilePhase . DEFAULT })
266+ phase = {CompilePhase .BEFORE_REMOVEUSELESS , CompilePhase .CCP1 , CompilePhase .DEFAULT })
252267 public void alloc2 () {
253268 obj = new Object ();
254269 obj2 = new Object [1 ];
0 commit comments