# HG changeset patch # User Doug Simon # Date 1415801270 -3600 # Node ID df7243c22bade272df1d1b1c08b69072c08daf1b # Parent 12741288374cc4cf267a891fc7f7c028290c8493 use separate scope for capturing and replay compilations diff -r 12741288374c -r df7243c22bad graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Wed Nov 12 15:07:16 2014 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Wed Nov 12 15:07:50 2014 +0100 @@ -736,27 +736,34 @@ lastCompiledGraph = graphToCompile; CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graphToCompile.method(), false); - try (Context c = new Context(); Debug.Scope s = Debug.scope("ReplayCompiling", new DebugDumpScope("REPLAY", true))) { + try (Context c = new Context()) { // Need to use an 'in context' copy of the original result when comparing for // equality against other 'in context' results so that proxies are compared // against proxies CompilationResult originalResultInContext = c.get(originalResult); // Capturing compilation - Request capturingRequest = c.get(new GraalCompiler.Request<>(graphToCompile, null, cc, installedCodeOwner, getProviders(), getBackend(), getCodeCache().getTarget(), - null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, getProfilingInfo(graphToCompile), getSpeculationLog(), getSuites(), new CompilationResult(), - CompilationResultBuilderFactory.Default)); - assertCompilationResultsEqual(c, "Capturing", originalResultInContext, GraalCompiler.compile(capturingRequest), installedCodeOwner); + Request capturingRequest = null; + try (Debug.Scope s = Debug.scope("CapturingCompiling", new DebugDumpScope("CAPTURE", true))) { + capturingRequest = c.get(new GraalCompiler.Request<>(graphToCompile, null, cc, installedCodeOwner, getProviders(), getBackend(), getCodeCache().getTarget(), null, + getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, getProfilingInfo(graphToCompile), getSpeculationLog(), getSuites(), new CompilationResult(), + CompilationResultBuilderFactory.Default)); + assertCompilationResultsEqual(c, "Capturing", originalResultInContext, GraalCompiler.compile(capturingRequest), installedCodeOwner); + } catch (Throwable e) { + throw Debug.handle(e); + } // Replay compilation - Request replyRequest = c.get(new GraalCompiler.Request<>(graphToCompile.copy(), null, cc, capturingRequest.installedCodeOwner, capturingRequest.providers, - capturingRequest.backend, capturingRequest.target, null, capturingRequest.graphBuilderSuite, capturingRequest.optimisticOpts, capturingRequest.profilingInfo, - capturingRequest.speculationLog, capturingRequest.suites, new CompilationResult(), capturingRequest.factory)); - c.setMode(Mode.Replaying); + try (Debug.Scope s = Debug.scope("ReplayCompiling", new DebugDumpScope("REPLAY", true))) { + Request replyRequest = c.get(new GraalCompiler.Request<>(graphToCompile.copy(), null, cc, capturingRequest.installedCodeOwner, capturingRequest.providers, + capturingRequest.backend, capturingRequest.target, null, capturingRequest.graphBuilderSuite, capturingRequest.optimisticOpts, capturingRequest.profilingInfo, + capturingRequest.speculationLog, capturingRequest.suites, new CompilationResult(), capturingRequest.factory)); + c.setMode(Mode.Replaying); - assertCompilationResultsEqual(c, "Replay", originalResultInContext, GraalCompiler.compile(replyRequest), installedCodeOwner); - } catch (Throwable e) { - throw Debug.handle(e); + assertCompilationResultsEqual(c, "Replay", originalResultInContext, GraalCompiler.compile(replyRequest), installedCodeOwner); + } catch (Throwable e) { + throw Debug.handle(e); + } } }