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. |
31 import org.graalvm.compiler.graph.spi.SimplifierTool; |
31 import org.graalvm.compiler.graph.spi.SimplifierTool; |
32 import org.graalvm.compiler.java.ComputeLoopFrequenciesClosure; |
32 import org.graalvm.compiler.java.ComputeLoopFrequenciesClosure; |
33 import org.graalvm.compiler.nodes.LoopBeginNode; |
33 import org.graalvm.compiler.nodes.LoopBeginNode; |
34 import org.graalvm.compiler.nodes.StructuredGraph; |
34 import org.graalvm.compiler.nodes.StructuredGraph; |
35 import org.graalvm.compiler.nodes.ValueNode; |
35 import org.graalvm.compiler.nodes.ValueNode; |
|
36 import org.graalvm.compiler.nodes.spi.CoreProviders; |
36 import org.graalvm.compiler.phases.BasePhase; |
37 import org.graalvm.compiler.phases.BasePhase; |
37 import org.graalvm.compiler.phases.common.CanonicalizerPhase; |
38 import org.graalvm.compiler.phases.common.CanonicalizerPhase; |
38 import org.graalvm.compiler.phases.common.CanonicalizerPhase.CustomCanonicalizer; |
39 import org.graalvm.compiler.phases.common.CanonicalizerPhase.CustomCanonicalizer; |
39 import org.graalvm.compiler.phases.contract.NodeCostUtil; |
40 import org.graalvm.compiler.phases.contract.NodeCostUtil; |
40 import org.graalvm.compiler.phases.tiers.HighTierContext; |
41 import org.graalvm.compiler.phases.tiers.HighTierContext; |
41 import org.graalvm.compiler.phases.tiers.PhaseContext; |
|
42 import org.junit.Assert; |
42 import org.junit.Assert; |
43 import org.junit.Test; |
43 import org.junit.Test; |
44 |
44 |
45 public class NodePropertiesTest extends GraalCompilerTest { |
45 public class NodePropertiesTest extends GraalCompilerTest { |
46 |
46 |
316 } |
316 } |
317 } |
317 } |
318 } |
318 } |
319 } |
319 } |
320 |
320 |
321 private static class GraphCostPhase extends BasePhase<PhaseContext> { |
321 private static class GraphCostPhase extends BasePhase<CoreProviders> { |
322 private double finalCycles; |
322 private double finalCycles; |
323 private double finalSize; |
323 private double finalSize; |
324 |
324 |
325 @Override |
325 @Override |
326 protected void run(StructuredGraph graph, PhaseContext context) { |
326 protected void run(StructuredGraph graph, CoreProviders context) { |
327 finalCycles = NodeCostUtil.computeGraphCycles(graph, true); |
327 finalCycles = NodeCostUtil.computeGraphCycles(graph, true); |
328 finalSize = NodeCostUtil.computeGraphSize(graph); |
328 finalSize = NodeCostUtil.computeGraphSize(graph); |
329 } |
329 } |
330 |
330 |
331 } |
331 } |