43972
|
1 |
/*
|
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation.
|
|
8 |
*
|
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
* accompanied this code).
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License version
|
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 |
*
|
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
20 |
* or visit www.oracle.com if you need additional information or have any
|
|
21 |
* questions.
|
|
22 |
*/
|
|
23 |
package org.graalvm.compiler.core.test;
|
|
24 |
|
|
25 |
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_IGNORED;
|
|
26 |
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_IGNORED;
|
|
27 |
|
|
28 |
import org.graalvm.compiler.api.directives.GraalDirectives;
|
|
29 |
import org.graalvm.compiler.graph.NodeClass;
|
|
30 |
import org.graalvm.compiler.loop.InductionVariable;
|
|
31 |
import org.graalvm.compiler.loop.LoopsData;
|
|
32 |
import org.graalvm.compiler.nodeinfo.NodeInfo;
|
49451
|
33 |
import org.graalvm.compiler.nodes.ConstantNode;
|
48861
|
34 |
import org.graalvm.compiler.nodes.NodeView;
|
43972
|
35 |
import org.graalvm.compiler.nodes.StructuredGraph;
|
|
36 |
import org.graalvm.compiler.nodes.ValueNode;
|
|
37 |
import org.graalvm.compiler.nodes.calc.FloatingNode;
|
|
38 |
import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext;
|
|
39 |
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin;
|
46459
|
40 |
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins;
|
43972
|
41 |
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration;
|
|
42 |
import org.graalvm.compiler.nodes.spi.LIRLowerable;
|
|
43 |
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
|
48861
|
44 |
import org.junit.Test;
|
43972
|
45 |
|
|
46 |
import jdk.vm.ci.meta.JavaKind;
|
|
47 |
import jdk.vm.ci.meta.ResolvedJavaMethod;
|
|
48 |
|
|
49 |
public class CountedLoopTest extends GraalCompilerTest {
|
|
50 |
|
|
51 |
@FunctionalInterface
|
|
52 |
private interface IVProperty {
|
|
53 |
ValueNode get(InductionVariable iv);
|
|
54 |
}
|
|
55 |
|
49451
|
56 |
@FunctionalInterface
|
|
57 |
private interface StaticIVProperty {
|
|
58 |
long get(InductionVariable iv);
|
|
59 |
}
|
|
60 |
|
|
61 |
@FunctionalInterface
|
|
62 |
private interface IVPredicate {
|
|
63 |
boolean test(InductionVariable iv);
|
|
64 |
}
|
|
65 |
|
43972
|
66 |
/**
|
|
67 |
* Get a property of an induction variable.
|
|
68 |
*/
|
49451
|
69 |
private static int get(@SuppressWarnings("unused") IVProperty property, @SuppressWarnings("unused") StaticIVProperty staticProperty, @SuppressWarnings("unused") IVPredicate constantCheck,
|
|
70 |
int iv) {
|
|
71 |
return iv;
|
|
72 |
}
|
|
73 |
|
|
74 |
private static int get(@SuppressWarnings("unused") IVProperty property, int iv) {
|
|
75 |
return iv;
|
|
76 |
}
|
|
77 |
|
|
78 |
private static long get(@SuppressWarnings("unused") IVProperty property, @SuppressWarnings("unused") StaticIVProperty staticProperty, @SuppressWarnings("unused") IVPredicate constantCheck,
|
|
79 |
long iv) {
|
|
80 |
return iv;
|
|
81 |
}
|
|
82 |
|
|
83 |
private static long get(@SuppressWarnings("unused") IVProperty property, long iv) {
|
43972
|
84 |
return iv;
|
|
85 |
}
|
|
86 |
|
|
87 |
private static class Result {
|
49451
|
88 |
public long extremum;
|
|
89 |
public long exitValue;
|
43972
|
90 |
|
|
91 |
@Override
|
|
92 |
public int hashCode() {
|
|
93 |
final int prime = 31;
|
|
94 |
int result = 1;
|
49451
|
95 |
result = prime * result + Long.hashCode(exitValue);
|
|
96 |
result = prime * result + Long.hashCode(extremum);
|
43972
|
97 |
return result;
|
|
98 |
}
|
|
99 |
|
|
100 |
@Override
|
|
101 |
public boolean equals(Object obj) {
|
|
102 |
if (!(obj instanceof Result)) {
|
|
103 |
return false;
|
|
104 |
}
|
|
105 |
Result other = (Result) obj;
|
|
106 |
return extremum == other.extremum && exitValue == other.exitValue;
|
|
107 |
}
|
|
108 |
|
|
109 |
@Override
|
|
110 |
public String toString() {
|
|
111 |
return String.format("extremum = %d, exitValue = %d", extremum, exitValue);
|
|
112 |
}
|
|
113 |
}
|
|
114 |
|
|
115 |
public static Result incrementSnippet(int start, int limit, int step) {
|
|
116 |
int i;
|
|
117 |
int inc = ((step - 1) & 0xFFFF) + 1; // make sure this value is always strictly positive
|
|
118 |
Result ret = new Result();
|
|
119 |
for (i = start; i < limit; i += inc) {
|
|
120 |
GraalDirectives.controlFlowAnchor();
|
49451
|
121 |
ret.extremum = get(InductionVariable::extremumNode, InductionVariable::constantExtremum, InductionVariable::isConstantExtremum, i);
|
43972
|
122 |
}
|
|
123 |
ret.exitValue = get(InductionVariable::exitValueNode, i);
|
|
124 |
return ret;
|
|
125 |
}
|
|
126 |
|
|
127 |
@Test
|
|
128 |
public void increment1() {
|
49451
|
129 |
testCounted("incrementSnippet", 0, 256, 1);
|
43972
|
130 |
}
|
|
131 |
|
|
132 |
@Test
|
|
133 |
public void increment2() {
|
49451
|
134 |
testCounted("incrementSnippet", 0, 256, 2);
|
43972
|
135 |
}
|
|
136 |
|
|
137 |
@Test
|
|
138 |
public void increment3() {
|
49451
|
139 |
testCounted("incrementSnippet", 0, 256, 3);
|
43972
|
140 |
}
|
|
141 |
|
48861
|
142 |
@Test
|
|
143 |
public void increment4() {
|
49451
|
144 |
testCounted("incrementSnippet", -10, 1, Integer.MAX_VALUE);
|
48861
|
145 |
}
|
|
146 |
|
|
147 |
@Test
|
|
148 |
public void increment5() {
|
49451
|
149 |
testCounted("incrementSnippet", 256, 256, 1);
|
48861
|
150 |
}
|
|
151 |
|
|
152 |
@Test
|
|
153 |
public void increment6() {
|
49451
|
154 |
testCounted("incrementSnippet", 257, 256, 1);
|
|
155 |
}
|
|
156 |
|
|
157 |
@Test
|
|
158 |
public void increment7() {
|
|
159 |
testCounted("incrementSnippet", -10, Integer.MAX_VALUE, 1);
|
|
160 |
}
|
|
161 |
|
|
162 |
@Test
|
|
163 |
public void increment8() {
|
|
164 |
testCounted("incrementSnippet", -10, Integer.MAX_VALUE - 1, 2);
|
48861
|
165 |
}
|
|
166 |
|
43972
|
167 |
public static Result incrementEqSnippet(int start, int limit, int step) {
|
|
168 |
int i;
|
|
169 |
int inc = ((step - 1) & 0xFFFF) + 1; // make sure this value is always strictly positive
|
|
170 |
Result ret = new Result();
|
|
171 |
for (i = start; i <= limit; i += inc) {
|
|
172 |
GraalDirectives.controlFlowAnchor();
|
49451
|
173 |
ret.extremum = get(InductionVariable::extremumNode, InductionVariable::constantExtremum, InductionVariable::isConstantExtremum, i);
|
43972
|
174 |
}
|
|
175 |
ret.exitValue = get(InductionVariable::exitValueNode, i);
|
|
176 |
return ret;
|
|
177 |
}
|
|
178 |
|
|
179 |
@Test
|
|
180 |
public void incrementEq1() {
|
49451
|
181 |
testCounted("incrementEqSnippet", 0, 256, 1);
|
43972
|
182 |
}
|
|
183 |
|
|
184 |
@Test
|
|
185 |
public void incrementEq2() {
|
49451
|
186 |
testCounted("incrementEqSnippet", 0, 256, 2);
|
43972
|
187 |
}
|
|
188 |
|
|
189 |
@Test
|
|
190 |
public void incrementEq3() {
|
49451
|
191 |
testCounted("incrementEqSnippet", 0, 256, 3);
|
43972
|
192 |
}
|
|
193 |
|
48861
|
194 |
@Test
|
|
195 |
public void incrementEq4() {
|
49451
|
196 |
testCounted("incrementEqSnippet", -10, 0, Integer.MAX_VALUE);
|
48861
|
197 |
}
|
|
198 |
|
|
199 |
@Test
|
|
200 |
public void incrementEq5() {
|
49451
|
201 |
testCounted("incrementEqSnippet", 256, 256, 1);
|
48861
|
202 |
}
|
|
203 |
|
|
204 |
@Test
|
|
205 |
public void incrementEq6() {
|
49451
|
206 |
testCounted("incrementEqSnippet", 257, 256, 1);
|
|
207 |
}
|
|
208 |
|
|
209 |
@Test
|
|
210 |
public void incrementEq7() {
|
|
211 |
testCounted("incrementEqSnippet", -10, Integer.MAX_VALUE - 1, 1);
|
|
212 |
}
|
|
213 |
|
|
214 |
@Test
|
|
215 |
public void incrementEq8() {
|
|
216 |
testCounted("incrementEqSnippet", -10, Integer.MAX_VALUE - 2, 2);
|
48861
|
217 |
}
|
|
218 |
|
43972
|
219 |
public static Result decrementSnippet(int start, int limit, int step) {
|
|
220 |
int i;
|
|
221 |
int dec = ((step - 1) & 0xFFFF) + 1; // make sure this value is always strictly positive
|
|
222 |
Result ret = new Result();
|
|
223 |
for (i = start; i > limit; i -= dec) {
|
|
224 |
GraalDirectives.controlFlowAnchor();
|
49451
|
225 |
ret.extremum = get(InductionVariable::extremumNode, InductionVariable::constantExtremum, InductionVariable::isConstantExtremum, i);
|
43972
|
226 |
}
|
|
227 |
ret.exitValue = get(InductionVariable::exitValueNode, i);
|
|
228 |
return ret;
|
|
229 |
}
|
|
230 |
|
|
231 |
@Test
|
|
232 |
public void decrement1() {
|
49451
|
233 |
testCounted("decrementSnippet", 256, 0, 1);
|
43972
|
234 |
}
|
|
235 |
|
|
236 |
@Test
|
|
237 |
public void decrement2() {
|
49451
|
238 |
testCounted("decrementSnippet", 256, 0, 2);
|
43972
|
239 |
}
|
|
240 |
|
|
241 |
@Test
|
|
242 |
public void decrement3() {
|
49451
|
243 |
testCounted("decrementSnippet", 256, 0, 3);
|
|
244 |
}
|
|
245 |
|
|
246 |
@Test
|
|
247 |
public void decrement4() {
|
|
248 |
testCounted("decrementSnippet", Integer.MAX_VALUE, -10, 1);
|
|
249 |
}
|
|
250 |
|
|
251 |
@Test
|
|
252 |
public void decrement5() {
|
|
253 |
testCounted("decrementSnippet", Integer.MAX_VALUE, -10, 2);
|
43972
|
254 |
}
|
|
255 |
|
|
256 |
public static Result decrementEqSnippet(int start, int limit, int step) {
|
|
257 |
int i;
|
|
258 |
int dec = ((step - 1) & 0xFFFF) + 1; // make sure this value is always strictly positive
|
|
259 |
Result ret = new Result();
|
|
260 |
for (i = start; i >= limit; i -= dec) {
|
|
261 |
GraalDirectives.controlFlowAnchor();
|
49451
|
262 |
ret.extremum = get(InductionVariable::extremumNode, InductionVariable::constantExtremum, InductionVariable::isConstantExtremum, i);
|
43972
|
263 |
}
|
|
264 |
ret.exitValue = get(InductionVariable::exitValueNode, i);
|
|
265 |
return ret;
|
|
266 |
}
|
|
267 |
|
|
268 |
@Test
|
|
269 |
public void decrementEq1() {
|
49451
|
270 |
testCounted("decrementEqSnippet", 256, 0, 1);
|
43972
|
271 |
}
|
|
272 |
|
|
273 |
@Test
|
|
274 |
public void decrementEq2() {
|
49451
|
275 |
testCounted("decrementEqSnippet", 256, 0, 2);
|
43972
|
276 |
}
|
|
277 |
|
|
278 |
@Test
|
|
279 |
public void decrementEq3() {
|
49451
|
280 |
testCounted("decrementEqSnippet", 256, 0, 3);
|
43972
|
281 |
}
|
|
282 |
|
48861
|
283 |
@Test
|
|
284 |
public void decrementEq4() {
|
49451
|
285 |
testCounted("decrementEqSnippet", -10, 0, Integer.MAX_VALUE);
|
|
286 |
}
|
|
287 |
|
|
288 |
@Test
|
|
289 |
public void decrementEq5() {
|
|
290 |
testCounted("decrementEqSnippet", Integer.MAX_VALUE, -10, 1);
|
|
291 |
}
|
|
292 |
|
|
293 |
@Test
|
|
294 |
public void decrementEq6() {
|
|
295 |
testCounted("decrementEqSnippet", Integer.MAX_VALUE, -10, 2);
|
48861
|
296 |
}
|
|
297 |
|
43972
|
298 |
public static Result twoVariablesSnippet() {
|
|
299 |
Result ret = new Result();
|
|
300 |
int j = 0;
|
|
301 |
for (int i = 0; i < 1024; i++) {
|
|
302 |
j += 5;
|
|
303 |
GraalDirectives.controlFlowAnchor();
|
49451
|
304 |
ret.extremum = get(InductionVariable::extremumNode, InductionVariable::constantExtremum, InductionVariable::isConstantExtremum, j);
|
43972
|
305 |
}
|
|
306 |
ret.exitValue = get(InductionVariable::exitValueNode, j);
|
|
307 |
return ret;
|
|
308 |
}
|
|
309 |
|
|
310 |
@Test
|
|
311 |
public void testTwoVariables() {
|
49451
|
312 |
testCounted("twoVariablesSnippet");
|
|
313 |
}
|
|
314 |
|
|
315 |
public static Result incrementNeqSnippet(int limit) {
|
|
316 |
int i;
|
|
317 |
int posLimit = ((limit - 1) & 0xFFFF) + 1; // make sure limit is always strictly positive
|
|
318 |
Result ret = new Result();
|
|
319 |
for (i = 0; i != posLimit; i++) {
|
|
320 |
GraalDirectives.controlFlowAnchor();
|
|
321 |
ret.extremum = get(InductionVariable::extremumNode, InductionVariable::constantExtremum, InductionVariable::isConstantExtremum, i);
|
|
322 |
}
|
|
323 |
ret.exitValue = get(InductionVariable::exitValueNode, i);
|
|
324 |
return ret;
|
|
325 |
}
|
|
326 |
|
|
327 |
@Test
|
|
328 |
public void decrementNeq() {
|
|
329 |
testCounted("decrementNeqSnippet", 256);
|
|
330 |
}
|
|
331 |
|
|
332 |
public static Result decrementNeqSnippet(int limit) {
|
|
333 |
int i;
|
|
334 |
int posLimit = ((limit - 1) & 0xFFFF) + 1; // make sure limit is always strictly positive
|
|
335 |
Result ret = new Result();
|
|
336 |
for (i = posLimit; i != 0; i--) {
|
|
337 |
GraalDirectives.controlFlowAnchor();
|
|
338 |
ret.extremum = get(InductionVariable::extremumNode, InductionVariable::constantExtremum, InductionVariable::isConstantExtremum, i);
|
|
339 |
}
|
|
340 |
ret.exitValue = get(InductionVariable::exitValueNode, i);
|
|
341 |
return ret;
|
|
342 |
}
|
|
343 |
|
|
344 |
@Test
|
|
345 |
public void incrementNeq() {
|
|
346 |
testCounted("incrementNeqSnippet", 256);
|
|
347 |
}
|
|
348 |
|
|
349 |
public static Result incrementLongSnippet(long start, long limit, long step) {
|
|
350 |
long i;
|
|
351 |
long inc = ((step - 1) & 0xFFFF) + 1; // make sure this value is always strictly positive
|
|
352 |
Result ret = new Result();
|
|
353 |
for (i = start; i < limit; i += inc) {
|
|
354 |
GraalDirectives.controlFlowAnchor();
|
|
355 |
ret.extremum = get(InductionVariable::extremumNode, InductionVariable::constantExtremum, InductionVariable::isConstantExtremum, i);
|
|
356 |
}
|
|
357 |
ret.exitValue = get(InductionVariable::exitValueNode, i);
|
|
358 |
return ret;
|
|
359 |
}
|
|
360 |
|
|
361 |
@Test
|
|
362 |
public void incrementLong1() {
|
|
363 |
testCounted("incrementLongSnippet", 0L, 256L, 1L);
|
|
364 |
}
|
|
365 |
|
|
366 |
@Test
|
|
367 |
public void incrementLong2() {
|
|
368 |
testCounted("incrementLongSnippet", 0L, 256L, 2L);
|
|
369 |
}
|
|
370 |
|
|
371 |
@Test
|
|
372 |
public void incrementLong3() {
|
|
373 |
testCounted("incrementLongSnippet", 0L, 256L, 3L);
|
|
374 |
}
|
|
375 |
|
|
376 |
@Test
|
|
377 |
public void incrementLong4() {
|
|
378 |
testCounted("incrementLongSnippet", -10L, 1L, Long.MAX_VALUE);
|
|
379 |
}
|
|
380 |
|
|
381 |
@Test
|
|
382 |
public void incrementLong5() {
|
|
383 |
testCounted("incrementLongSnippet", 256L, 256L, 1L);
|
|
384 |
}
|
|
385 |
|
|
386 |
@Test
|
|
387 |
public void incrementLong6() {
|
|
388 |
testCounted("incrementLongSnippet", 257L, 256L, 1L);
|
43972
|
389 |
}
|
|
390 |
|
|
391 |
@NodeInfo(cycles = CYCLES_IGNORED, size = SIZE_IGNORED)
|
|
392 |
private static class IVPropertyNode extends FloatingNode implements LIRLowerable {
|
|
393 |
|
|
394 |
public static final NodeClass<IVPropertyNode> TYPE = NodeClass.create(IVPropertyNode.class);
|
|
395 |
|
|
396 |
private final IVProperty property;
|
49451
|
397 |
private final StaticIVProperty staticProperty;
|
|
398 |
private final IVPredicate staticCheck;
|
43972
|
399 |
@Input private ValueNode iv;
|
|
400 |
|
49451
|
401 |
protected IVPropertyNode(IVProperty property, StaticIVProperty staticProperty, IVPredicate staticCheck, ValueNode iv) {
|
48190
|
402 |
super(TYPE, iv.stamp(NodeView.DEFAULT).unrestricted());
|
43972
|
403 |
this.property = property;
|
49451
|
404 |
this.staticProperty = staticProperty;
|
|
405 |
this.staticCheck = staticCheck;
|
43972
|
406 |
this.iv = iv;
|
|
407 |
}
|
|
408 |
|
|
409 |
public void rewrite(LoopsData loops) {
|
|
410 |
InductionVariable inductionVariable = loops.getInductionVariable(iv);
|
|
411 |
assert inductionVariable != null;
|
49451
|
412 |
ValueNode node = null;
|
|
413 |
if (staticCheck != null) {
|
|
414 |
assert staticProperty != null;
|
|
415 |
if (staticCheck.test(inductionVariable)) {
|
|
416 |
node = ConstantNode.forLong(staticProperty.get(inductionVariable), graph());
|
|
417 |
}
|
|
418 |
}
|
|
419 |
if (node == null) {
|
|
420 |
node = property.get(inductionVariable);
|
|
421 |
}
|
43972
|
422 |
replaceAtUsagesAndDelete(node);
|
|
423 |
}
|
|
424 |
|
|
425 |
@Override
|
|
426 |
public void generate(NodeLIRBuilderTool gen) {
|
|
427 |
gen.setResult(this, gen.operand(iv));
|
|
428 |
}
|
|
429 |
}
|
|
430 |
|
|
431 |
@Override
|
46459
|
432 |
protected void registerInvocationPlugins(InvocationPlugins invocationPlugins) {
|
|
433 |
Registration r = new Registration(invocationPlugins, CountedLoopTest.class);
|
49451
|
434 |
registerPlugins(r, JavaKind.Int);
|
|
435 |
registerPlugins(r, JavaKind.Long);
|
|
436 |
super.registerInvocationPlugins(invocationPlugins);
|
|
437 |
}
|
|
438 |
|
|
439 |
private void registerPlugins(Registration r, JavaKind ivKind) {
|
|
440 |
r.register2("get", IVProperty.class, ivKind.toJavaClass(), new InvocationPlugin() {
|
43972
|
441 |
@Override
|
|
442 |
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode arg1, ValueNode arg2) {
|
|
443 |
IVProperty property = null;
|
|
444 |
if (arg1.isConstant()) {
|
|
445 |
property = getSnippetReflection().asObject(IVProperty.class, arg1.asJavaConstant());
|
|
446 |
}
|
|
447 |
if (property != null) {
|
49451
|
448 |
b.addPush(ivKind, new IVPropertyNode(property, null, null, arg2));
|
43972
|
449 |
return true;
|
|
450 |
} else {
|
|
451 |
return false;
|
|
452 |
}
|
|
453 |
}
|
|
454 |
});
|
49451
|
455 |
r.register4("get", IVProperty.class, StaticIVProperty.class, IVPredicate.class, ivKind.toJavaClass(), new InvocationPlugin() {
|
|
456 |
@Override
|
|
457 |
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode arg1, ValueNode arg2, ValueNode arg3, ValueNode arg4) {
|
|
458 |
IVProperty property = null;
|
|
459 |
StaticIVProperty staticProperty = null;
|
|
460 |
IVPredicate staticCheck = null;
|
|
461 |
if (arg1.isConstant()) {
|
|
462 |
property = getSnippetReflection().asObject(IVProperty.class, arg1.asJavaConstant());
|
|
463 |
}
|
|
464 |
if (arg2.isConstant()) {
|
|
465 |
staticProperty = getSnippetReflection().asObject(StaticIVProperty.class, arg2.asJavaConstant());
|
|
466 |
}
|
|
467 |
if (arg3.isConstant()) {
|
|
468 |
staticCheck = getSnippetReflection().asObject(IVPredicate.class, arg3.asJavaConstant());
|
|
469 |
}
|
|
470 |
if (property != null && staticProperty != null && staticCheck != null) {
|
|
471 |
b.addPush(ivKind, new IVPropertyNode(property, staticProperty, staticCheck, arg4));
|
|
472 |
return true;
|
|
473 |
} else {
|
|
474 |
return false;
|
|
475 |
}
|
|
476 |
}
|
|
477 |
});
|
43972
|
478 |
}
|
|
479 |
|
|
480 |
@Override
|
48398
|
481 |
protected boolean checkHighTierGraph(StructuredGraph graph) {
|
43972
|
482 |
LoopsData loops = new LoopsData(graph);
|
|
483 |
loops.detectedCountedLoops();
|
|
484 |
for (IVPropertyNode node : graph.getNodes().filter(IVPropertyNode.class)) {
|
|
485 |
node.rewrite(loops);
|
|
486 |
}
|
|
487 |
assert graph.getNodes().filter(IVPropertyNode.class).isEmpty();
|
|
488 |
return true;
|
|
489 |
}
|
|
490 |
|
49451
|
491 |
private Object[] argsToBind;
|
43972
|
492 |
|
49451
|
493 |
@Override
|
|
494 |
protected Object[] getArgumentToBind() {
|
|
495 |
return argsToBind;
|
43972
|
496 |
}
|
|
497 |
|
49451
|
498 |
public void testCounted(String snippetName, Object... args) {
|
|
499 |
test(snippetName, args);
|
|
500 |
argsToBind = args;
|
|
501 |
test(snippetName, args);
|
|
502 |
argsToBind = null;
|
43972
|
503 |
}
|
|
504 |
}
|