comparison graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ArraysSubstitutionsTest.java @ 19410:61d3cb8e1280

Add generic parameter to NodeClass. Change Graph#getNodes(Class) to Graph#getNodes(NodeClass).
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 16 Feb 2015 17:47:43 +0100
parents a0a760b0fb5f
children 2fd45bb25118
comparison
equal deleted inserted replaced
19409:a16f1bbe2965 19410:61d3cb8e1280
333 StructuredGraph graph = parseEager("testCanonicalLengthSnippet", AllowAssumptions.NO); 333 StructuredGraph graph = parseEager("testCanonicalLengthSnippet", AllowAssumptions.NO);
334 HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); 334 HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL);
335 new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); 335 new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context);
336 new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); 336 new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders()));
337 337
338 Assert.assertTrue(graph.getNodes(ReturnNode.class).first().result().asJavaConstant().asLong() == 0); 338 Assert.assertTrue(graph.getNodes(ReturnNode.TYPE).first().result().asJavaConstant().asLong() == 0);
339 } 339 }
340 340
341 public static final int[] constantArray3 = new int[]{1, 2, 3}; 341 public static final int[] constantArray3 = new int[]{1, 2, 3};
342 342
343 public static boolean testCanonicalLengthSnippet() { 343 public static boolean testCanonicalLengthSnippet() {
349 StructuredGraph graph = parseEager("testCanonicalEqualSnippet", AllowAssumptions.NO); 349 StructuredGraph graph = parseEager("testCanonicalEqualSnippet", AllowAssumptions.NO);
350 HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); 350 HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL);
351 new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); 351 new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context);
352 new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); 352 new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders()));
353 353
354 Assert.assertTrue(graph.getNodes(ReturnNode.class).first().result().asJavaConstant().asLong() == 1); 354 Assert.assertTrue(graph.getNodes(ReturnNode.TYPE).first().result().asJavaConstant().asLong() == 1);
355 } 355 }
356 356
357 public static boolean testCanonicalEqualSnippet() { 357 public static boolean testCanonicalEqualSnippet() {
358 return Arrays.equals(constantArray1, constantArray1); 358 return Arrays.equals(constantArray1, constantArray1);
359 } 359 }
365 new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); 365 new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context);
366 new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); 366 new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders()));
367 new PartialEscapePhase(false, new CanonicalizerPhase(false)).apply(graph, context); 367 new PartialEscapePhase(false, new CanonicalizerPhase(false)).apply(graph, context);
368 new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); 368 new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders()));
369 369
370 Assert.assertTrue(graph.getNodes(ReturnNode.class).first().result().asJavaConstant().asLong() == 1); 370 Assert.assertTrue(graph.getNodes(ReturnNode.TYPE).first().result().asJavaConstant().asLong() == 1);
371 } 371 }
372 372
373 public static boolean testVirtualEqualSnippet() { 373 public static boolean testVirtualEqualSnippet() {
374 int[] array1 = new int[]{1, 2, 3, 4}; 374 int[] array1 = new int[]{1, 2, 3, 4};
375 int[] array2 = new int[]{1, 2, 3, 4}; 375 int[] array2 = new int[]{1, 2, 3, 4};
383 new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); 383 new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context);
384 new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); 384 new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders()));
385 new PartialEscapePhase(false, new CanonicalizerPhase(false)).apply(graph, context); 385 new PartialEscapePhase(false, new CanonicalizerPhase(false)).apply(graph, context);
386 new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); 386 new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders()));
387 387
388 Assert.assertTrue(graph.getNodes(ReturnNode.class).first().result().asJavaConstant().asLong() == 0); 388 Assert.assertTrue(graph.getNodes(ReturnNode.TYPE).first().result().asJavaConstant().asLong() == 0);
389 } 389 }
390 390
391 public static boolean testVirtualNotEqualSnippet(int x) { 391 public static boolean testVirtualNotEqualSnippet(int x) {
392 int[] array1 = new int[]{1, 2, 100, x}; 392 int[] array1 = new int[]{1, 2, 100, x};
393 int[] array2 = new int[]{1, 2, 3, 4}; 393 int[] array2 = new int[]{1, 2, 3, 4};