src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/PartialEscapeAnalysisTest.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2011, 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. |
42 import org.graalvm.compiler.nodes.java.LoadIndexedNode; |
42 import org.graalvm.compiler.nodes.java.LoadIndexedNode; |
43 import org.graalvm.compiler.nodes.java.NewArrayNode; |
43 import org.graalvm.compiler.nodes.java.NewArrayNode; |
44 import org.graalvm.compiler.nodes.java.NewInstanceNode; |
44 import org.graalvm.compiler.nodes.java.NewInstanceNode; |
45 import org.graalvm.compiler.nodes.java.StoreFieldNode; |
45 import org.graalvm.compiler.nodes.java.StoreFieldNode; |
46 import org.graalvm.compiler.nodes.virtual.CommitAllocationNode; |
46 import org.graalvm.compiler.nodes.virtual.CommitAllocationNode; |
47 import org.graalvm.compiler.phases.common.CanonicalizerPhase; |
|
48 import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase; |
47 import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase; |
49 |
48 |
50 /** |
49 /** |
51 * The PartialEscapeAnalysisPhase is expected to remove all allocations and return the correct |
50 * The PartialEscapeAnalysisPhase is expected to remove all allocations and return the correct |
52 * values. |
51 * values. |
285 prepareGraph(snippet, false); |
284 prepareGraph(snippet, false); |
286 for (AbstractMergeNode merge : graph.getNodes(AbstractMergeNode.TYPE)) { |
285 for (AbstractMergeNode merge : graph.getNodes(AbstractMergeNode.TYPE)) { |
287 merge.setStateAfter(null); |
286 merge.setStateAfter(null); |
288 } |
287 } |
289 new DeadCodeEliminationPhase().apply(graph); |
288 new DeadCodeEliminationPhase().apply(graph); |
290 new CanonicalizerPhase().apply(graph, context); |
289 createCanonicalizerPhase().apply(graph, context); |
291 try { |
290 try { |
292 Assert.assertTrue("partial escape analysis should have removed all NewInstanceNode allocations", graph.getNodes().filter(NewInstanceNode.class).isEmpty()); |
291 Assert.assertTrue("partial escape analysis should have removed all NewInstanceNode allocations", graph.getNodes().filter(NewInstanceNode.class).isEmpty()); |
293 Assert.assertTrue("partial escape analysis should have removed all NewArrayNode allocations", graph.getNodes().filter(NewArrayNode.class).isEmpty()); |
292 Assert.assertTrue("partial escape analysis should have removed all NewArrayNode allocations", graph.getNodes().filter(NewArrayNode.class).isEmpty()); |
294 |
293 |
295 ControlFlowGraph cfg = ControlFlowGraph.compute(graph, true, true, false, false); |
294 ControlFlowGraph cfg = ControlFlowGraph.compute(graph, true, true, false, false); |