hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/org/graalvm/compiler/microbenchmarks/graal/GraphCopyBenchmark.java
changeset 46640 70bdce04c59b
parent 43972 1ade39b8381b
equal deleted inserted replaced
46638:3c5c50af29a7 46640:70bdce04c59b
    30 import org.graalvm.compiler.microbenchmarks.graal.util.GraphState;
    30 import org.graalvm.compiler.microbenchmarks.graal.util.GraphState;
    31 import org.graalvm.compiler.microbenchmarks.graal.util.MethodSpec;
    31 import org.graalvm.compiler.microbenchmarks.graal.util.MethodSpec;
    32 import org.graalvm.compiler.nodes.StructuredGraph;
    32 import org.graalvm.compiler.nodes.StructuredGraph;
    33 
    33 
    34 /**
    34 /**
    35  * Benchmarks the performance of {@link Graph#copy()}.
    35  * Benchmarks the performance of {@link Graph#copy(org.graalvm.compiler.debug.DebugContext)}.
    36  */
    36  */
    37 public class GraphCopyBenchmark extends GraalBenchmark {
    37 public class GraphCopyBenchmark extends GraalBenchmark {
    38 
    38 
    39     @MethodSpec(declaringClass = ConditionalEliminationBenchmark.class, name = "nullnessSnippet")
    39     @MethodSpec(declaringClass = ConditionalEliminationBenchmark.class, name = "nullnessSnippet")
    40     public static class Nullness extends GraphState {
    40     public static class Nullness extends GraphState {
    73         }
    73         }
    74     }
    74     }
    75 
    75 
    76     @Benchmark
    76     @Benchmark
    77     @Warmup(iterations = 20)
    77     @Warmup(iterations = 20)
    78     public StructuredGraph nullness(Nullness s, @SuppressWarnings("unused") GraalState g) {
    78     public StructuredGraph nullness(Nullness s, GraalState g) {
    79         return (StructuredGraph) s.graph.copy();
    79         return (StructuredGraph) s.graph.copy(g.debug);
    80     }
    80     }
    81 
    81 
    82     @MethodSpec(declaringClass = GraphCopyBenchmark.class, name = "searchSnippet")
    82     @MethodSpec(declaringClass = GraphCopyBenchmark.class, name = "searchSnippet")
    83     public static class Search extends GraphState {
    83     public static class Search extends GraphState {
    84     }
    84     }
   125         } while (true);
   125         } while (true);
   126     }
   126     }
   127 
   127 
   128     @Benchmark
   128     @Benchmark
   129     @Warmup(iterations = 20)
   129     @Warmup(iterations = 20)
   130     public StructuredGraph search(Search s, @SuppressWarnings("unused") GraalState g) {
   130     public StructuredGraph search(Search s, GraalState g) {
   131         return (StructuredGraph) s.graph.copy();
   131         return (StructuredGraph) s.graph.copy(g.debug);
   132     }
   132     }
   133 }
   133 }