src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/org/graalvm/compiler/microbenchmarks/lir/GraalCompilerState.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/org/graalvm/compiler/microbenchmarks/lir/GraalCompilerState.java	Fri Jul  7 09:31:17 2017
--- new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/org/graalvm/compiler/microbenchmarks/lir/GraalCompilerState.java	Fri Jul  7 09:31:17 2017

*** 32,47 **** --- 32,41 ---- import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.lang.reflect.Field; import java.lang.reflect.Method; import org.openjdk.jmh.annotations.Level; import org.openjdk.jmh.annotations.Param; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; import org.graalvm.compiler.api.replacements.SnippetReflectionProvider; import org.graalvm.compiler.api.test.Graal; import org.graalvm.compiler.code.CompilationResult; import org.graalvm.compiler.core.GraalCompiler; import org.graalvm.compiler.core.GraalCompiler.Request;
*** 49,61 **** --- 43,54 ---- import org.graalvm.compiler.core.LIRGenerationPhase.LIRGenerationContext; import org.graalvm.compiler.core.common.CompilationIdentifier; import org.graalvm.compiler.core.common.alloc.ComputeBlockOrder; import org.graalvm.compiler.core.common.cfg.AbstractBlockBase; import org.graalvm.compiler.core.target.Backend; ! import org.graalvm.compiler.debug.DebugHandlersFactory; ! import org.graalvm.compiler.debug.DebugEnvironment; import org.graalvm.compiler.debug.internal.DebugScope; ! import org.graalvm.compiler.debug.DebugContext; import org.graalvm.compiler.lir.LIR; import org.graalvm.compiler.lir.asm.CompilationResultBuilderFactory; import org.graalvm.compiler.lir.framemap.FrameMapBuilder; import org.graalvm.compiler.lir.gen.LIRGenerationResult; import org.graalvm.compiler.lir.gen.LIRGeneratorTool;
*** 79,88 **** --- 72,86 ---- import org.graalvm.compiler.phases.tiers.HighTierContext; import org.graalvm.compiler.phases.tiers.Suites; import org.graalvm.compiler.phases.tiers.TargetProvider; import org.graalvm.compiler.phases.util.Providers; import org.graalvm.compiler.runtime.RuntimeProvider; + import org.openjdk.jmh.annotations.Level; + import org.openjdk.jmh.annotations.Param; + import org.openjdk.jmh.annotations.Scope; + import org.openjdk.jmh.annotations.Setup; + import org.openjdk.jmh.annotations.State; import jdk.vm.ci.code.CodeCacheProvider; import jdk.vm.ci.code.RegisterConfig; import jdk.vm.ci.code.TargetDescription; import jdk.vm.ci.meta.ConstantReflectionProvider;
*** 104,113 **** --- 102,112 ---- /** * The graph processed by the benchmark. */ private final OptionValues options; + private final DebugContext debug; private StructuredGraph graph; private final Backend backend; private final Providers providers; /**
*** 117,132 **** --- 116,126 ---- @SuppressWarnings("try") protected GraalCompilerState() { this.options = Graal.getRequiredCapability(OptionValues.class); this.backend = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend(); this.providers = backend.getProviders(); // Ensure a debug configuration for this thread is initialized if (Debug.isEnabled() && DebugScope.getConfig() == null) { DebugEnvironment.ensureInitialized(options); } + this.debug = DebugContext.create(options, DebugHandlersFactory.LOADER); } protected boolean useProfilingInfo() { return false; }
*** 134,147 **** --- 128,141 ---- @SuppressWarnings("try") protected void initializeMethod() { GraalState graal = new GraalState(); ResolvedJavaMethod method = graal.metaAccess.lookupJavaMethod(getMethod()); StructuredGraph structuredGraph = null; ! try (Debug.Scope s = Debug.scope("GraphState", method)) { ! try (DebugContext.Scope s = debug.scope("GraphState", method)) { structuredGraph = preprocessOriginal(getGraph(graal, method, useProfilingInfo())); } catch (Throwable t) { ! Debug.handle(t); ! debug.handle(t); } this.originalGraph = structuredGraph; } protected Method getMethod() {
*** 319,329 **** --- 313,323 ---- * be changed by overriding {@link #createLIRSuites}. */ protected final void prepareRequest() { assert originalGraph != null : "call initialzeMethod first"; CompilationIdentifier compilationId = backend.getCompilationIdentifier(originalGraph.method()); ! graph = originalGraph.copyWithIdentifier(compilationId, originalGraph.getDebug()); assert !graph.isFrozen(); ResolvedJavaMethod installedCodeOwner = graph.method(); request = new Request<>(graph, installedCodeOwner, getProviders(), getBackend(), getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, graph.getProfilingInfo(), createSuites(getOptions()), createLIRSuites(getOptions()), new CompilationResult(), CompilationResultBuilderFactory.Default); }
*** 374,394 **** --- 368,392 ---- assert startBlock.getPredecessorCount() == 0; codeEmittingOrder = ComputeBlockOrder.computeCodeEmittingOrder(blocks.length, startBlock); linearScanOrder = ComputeBlockOrder.computeLinearScanOrder(blocks.length, startBlock); ! LIR lir = new LIR(cfg, linearScanOrder, codeEmittingOrder, getGraphOptions(), getGraphDebug()); FrameMapBuilder frameMapBuilder = request.backend.newFrameMapBuilder(registerConfig); lirGenRes = request.backend.newLIRGenerationResult(graph.compilationId(), lir, frameMapBuilder, request.graph, stub); lirGenTool = request.backend.newLIRGenerator(lirGenRes); nodeLirGen = request.backend.newNodeLIRBuilder(request.graph, lirGenTool); } protected OptionValues getGraphOptions() { return graph.getOptions(); } + protected DebugContext getGraphDebug() { + return graph.getDebug(); + } + private static ControlFlowGraph deepCopy(ControlFlowGraph cfg) { return ControlFlowGraph.compute(cfg.graph, true, true, true, true); } /**

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/org/graalvm/compiler/microbenchmarks/lir/GraalCompilerState.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File