src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/UnusedArray.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
29 |
29 |
30 import org.graalvm.compiler.graph.iterators.NodeIterable; |
30 import org.graalvm.compiler.graph.iterators.NodeIterable; |
31 import org.graalvm.compiler.nodes.StructuredGraph; |
31 import org.graalvm.compiler.nodes.StructuredGraph; |
32 import org.graalvm.compiler.nodes.java.NewArrayNode; |
32 import org.graalvm.compiler.nodes.java.NewArrayNode; |
33 import org.graalvm.compiler.phases.common.CanonicalizerPhase; |
33 import org.graalvm.compiler.phases.common.CanonicalizerPhase; |
34 import org.graalvm.compiler.phases.tiers.PhaseContext; |
|
35 import org.junit.Test; |
34 import org.junit.Test; |
36 |
35 |
37 public class UnusedArray extends GraalCompilerTest { |
36 public class UnusedArray extends GraalCompilerTest { |
38 @SuppressWarnings("unused") |
37 @SuppressWarnings("unused") |
39 public void smallArray() { |
38 public void smallArray() { |
65 test("unknownArray"); |
64 test("unknownArray"); |
66 } |
65 } |
67 |
66 |
68 public void test(String method) { |
67 public void test(String method) { |
69 StructuredGraph graph = parseEager(method, StructuredGraph.AllowAssumptions.YES); |
68 StructuredGraph graph = parseEager(method, StructuredGraph.AllowAssumptions.YES); |
70 new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders())); |
69 new CanonicalizerPhase().apply(graph, getProviders()); |
71 NodeIterable<NewArrayNode> newArrayNodes = graph.getNodes().filter(NewArrayNode.class); |
70 NodeIterable<NewArrayNode> newArrayNodes = graph.getNodes().filter(NewArrayNode.class); |
72 assertThat(newArrayNodes, isEmpty()); |
71 assertThat(newArrayNodes, isEmpty()); |
73 } |
72 } |
74 } |
73 } |