src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/PartialEscapeAnalysisIterationTest.java
changeset 58877 aec7bf35d6f5
parent 51436 091c0d22e735
equal deleted inserted replaced
58876:1a8d65e71a66 58877:aec7bf35d6f5
     1 /*
     1 /*
     2  * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2017, 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.nodes.extended.BoxNode;
    30 import org.graalvm.compiler.nodes.extended.BoxNode;
    31 import org.graalvm.compiler.nodes.extended.UnboxNode;
    31 import org.graalvm.compiler.nodes.extended.UnboxNode;
    32 import org.graalvm.compiler.nodes.java.StoreFieldNode;
    32 import org.graalvm.compiler.nodes.java.StoreFieldNode;
    33 import org.graalvm.compiler.nodes.virtual.CommitAllocationNode;
    33 import org.graalvm.compiler.nodes.virtual.CommitAllocationNode;
    34 import org.graalvm.compiler.phases.common.CanonicalizerPhase;
       
    35 import org.graalvm.compiler.virtual.phases.ea.PartialEscapePhase;
    34 import org.graalvm.compiler.virtual.phases.ea.PartialEscapePhase;
    36 import org.junit.Assert;
    35 import org.junit.Assert;
    37 import org.junit.Test;
    36 import org.junit.Test;
    38 
    37 
    39 public class PartialEscapeAnalysisIterationTest extends EATestBase {
    38 public class PartialEscapeAnalysisIterationTest extends EATestBase {
   145         // test with a normal object (needs one iteration to replace NewInstance with
   144         // test with a normal object (needs one iteration to replace NewInstance with
   146         // CommitAllocation)
   145         // CommitAllocation)
   147         for (String name : new String[]{"noLoopIterationEmpty", "noLoopIteration"}) {
   146         for (String name : new String[]{"noLoopIterationEmpty", "noLoopIteration"}) {
   148             prepareGraph(name, false);
   147             prepareGraph(name, false);
   149             List<CommitAllocationNode> allocations = graph.getNodes().filter(CommitAllocationNode.class).snapshot();
   148             List<CommitAllocationNode> allocations = graph.getNodes().filter(CommitAllocationNode.class).snapshot();
   150             new PartialEscapePhase(true, false, new CanonicalizerPhase(), null, graph.getOptions()).apply(graph, context);
   149             new PartialEscapePhase(true, false, createCanonicalizerPhase(), null, graph.getOptions()).apply(graph, context);
   151             Assert.assertEquals(1, allocations.size());
   150             Assert.assertEquals(1, allocations.size());
   152             Assert.assertTrue(allocations.get(0).isAlive());
   151             Assert.assertTrue(allocations.get(0).isAlive());
   153         }
   152         }
   154     }
   153     }
   155 }
   154 }