changeset 18127:7cefdad149ad

enable a GraalCompilerTest to override how a method is parsed to produce a graph as well as being able to interpose on the method that is parsed/compiled
author Doug Simon <doug.simon@oracle.com>
date Mon, 20 Oct 2014 23:11:40 +0200
parents 12c6c5a5bd88
children 7b6a4ae58de4
files graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/PTXTest.java graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryArithmeticTest.java graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/CompiledMethodTest.java graal/com.oracle.graal.hotspot.amd64.test/src/com/oracle/graal/hotspot/amd64/test/AMD64HotSpotFrameOmissionTest.java graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ArrayCopyIntrinsificationTest.java graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompressedOopTest.java graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ExplicitExceptionTest.java graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotCryptoSubstitutionTest.java graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotNmethodTest.java graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/InstalledCodeExecuteHelperTest.java graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/LambdaEagerTest.java graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/MethodSubstitutionTest.java graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/NewMultiArrayTest.java graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StringSubstitutionsTest.java graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/TypeCheckTest.java graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/UnsafeSubstitutionsTest.java
diffstat 19 files changed, 101 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/PTXTest.java	Mon Oct 20 23:09:46 2014 +0200
+++ b/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/PTXTest.java	Mon Oct 20 23:11:40 2014 +0200
@@ -64,12 +64,12 @@
     }
 
     @Override
-    protected InstalledCode getCode(ResolvedJavaMethod method, StructuredGraph graph) {
+    protected InstalledCode getCode(ResolvedJavaMethod installedCodeOwner, StructuredGraph graph) {
         PTXHotSpotBackend ptxBackend = getPTXBackend();
-        ExternalCompilationResult ptxCode = compileKernel(method);
+        ExternalCompilationResult ptxCode = compileKernel(installedCodeOwner);
         Assume.assumeTrue(ptxBackend.isDeviceInitialized());
-        HotSpotNmethod installedPTXCode = installKernel(method, ptxCode);
-        StructuredGraph wrapper = new PTXWrapperBuilder(method, installedPTXCode, (HotSpotProviders) getProviders()).getGraph();
+        HotSpotNmethod installedPTXCode = installKernel(installedCodeOwner, ptxCode);
+        StructuredGraph wrapper = new PTXWrapperBuilder(installedCodeOwner, installedPTXCode, (HotSpotProviders) getProviders()).getGraph();
 
         // The PTX C++ layer expects a 1:1 relationship between kernel compilation
         // and kernel execution as it creates a cuContext in the former and
@@ -78,7 +78,7 @@
         // TODO: do cuContext management properly
         boolean forceCompile = true;
 
-        return getCode(method, wrapper, forceCompile);
+        return getCode(installedCodeOwner, wrapper, forceCompile);
     }
 
     protected static void compileAndPrintCode(PTXTest test) {
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Mon Oct 20 23:09:46 2014 +0200
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Mon Oct 20 23:11:40 2014 +0200
@@ -40,6 +40,7 @@
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.baseline.*;
+import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.target.*;
 import com.oracle.graal.debug.*;
@@ -414,7 +415,7 @@
         if (UseBaselineCompiler.getValue()) {
             compiledMethod = getCodeBaseline(method);
         } else {
-            compiledMethod = getCode(method, parseEager(method));
+            compiledMethod = getCode(method);
         }
         try {
             return new Result(compiledMethod.executeVarargs(executeArgs), null);
@@ -589,21 +590,36 @@
     private Map<ResolvedJavaMethod, InstalledCode> cache = new HashMap<>();
 
     /**
-     * Gets installed code for a given method and graph, compiling it first if necessary.
+     * Gets installed code for a given method, compiling it first if necessary. The graph is parsed
+     * {@link #parseEager(ResolvedJavaMethod) eagerly}.
      */
-    protected InstalledCode getCode(final ResolvedJavaMethod method, final StructuredGraph graph) {
-        return getCode(method, graph, false);
+    protected InstalledCode getCode(ResolvedJavaMethod method) {
+        return getCode(method, null);
+    }
+
+    /**
+     * Gets installed code for a given method, compiling it first if necessary.
+     *
+     * @param installedCodeOwner the method the compiled code will be associated with when installed
+     * @param graph the graph to be compiled. If null, a graph will be obtained from
+     *            {@code installedCodeOwner} via {@link #parseForCompile(ResolvedJavaMethod)}.
+     */
+    protected InstalledCode getCode(ResolvedJavaMethod installedCodeOwner, StructuredGraph graph) {
+        return getCode(installedCodeOwner, graph, false);
     }
 
     /**
      * Gets installed code for a given method and graph, compiling it first if necessary.
      *
+     * @param installedCodeOwner the method the compiled code will be associated with when installed
+     * @param graph the graph to be compiled. If null, a graph will be obtained from
+     *            {@code installedCodeOwner} via {@link #parseForCompile(ResolvedJavaMethod)}.
      * @param forceCompile specifies whether to ignore any previous code cached for the (method,
      *            key) pair
      */
-    protected InstalledCode getCode(final ResolvedJavaMethod method, final StructuredGraph graph, boolean forceCompile) {
+    protected InstalledCode getCode(final ResolvedJavaMethod installedCodeOwner, StructuredGraph graph, boolean forceCompile) {
         if (!forceCompile) {
-            InstalledCode cached = cache.get(method);
+            InstalledCode cached = cache.get(installedCodeOwner);
             if (cached != null) {
                 if (cached.isValid()) {
                     return cached;
@@ -614,21 +630,21 @@
         final int id = compilationId.incrementAndGet();
 
         InstalledCode installedCode = null;
-        try (AllocSpy spy = AllocSpy.open(method); Scope ds = Debug.scope("Compiling", new DebugDumpScope(String.valueOf(id), true))) {
+        try (AllocSpy spy = AllocSpy.open(installedCodeOwner); Scope ds = Debug.scope("Compiling", new DebugDumpScope(String.valueOf(id), true))) {
             final boolean printCompilation = PrintCompilation.getValue() && !TTY.isSuppressed();
             if (printCompilation) {
-                TTY.println(String.format("@%-6d Graal %-70s %-45s %-50s ...", id, method.getDeclaringClass().getName(), method.getName(), method.getSignature()));
+                TTY.println(String.format("@%-6d Graal %-70s %-45s %-50s ...", id, installedCodeOwner.getDeclaringClass().getName(), installedCodeOwner.getName(), installedCodeOwner.getSignature()));
             }
             long start = System.currentTimeMillis();
-            CompilationResult compResult = compile(method, graph);
+            CompilationResult compResult = compile(installedCodeOwner, graph);
             if (printCompilation) {
                 TTY.println(String.format("@%-6d Graal %-70s %-45s %-50s | %4dms %5dB", id, "", "", "", System.currentTimeMillis() - start, compResult.getTargetCodeSize()));
             }
 
-            try (Scope s = Debug.scope("CodeInstall", getCodeCache(), method)) {
-                installedCode = addMethod(method, compResult);
+            try (Scope s = Debug.scope("CodeInstall", getCodeCache(), installedCodeOwner)) {
+                installedCode = addMethod(installedCodeOwner, compResult);
                 if (installedCode == null) {
-                    throw new GraalInternalError("Could not install code for " + method.format("%H.%n(%p)"));
+                    throw new GraalInternalError("Could not install code for " + installedCodeOwner.format("%H.%n(%p)"));
                 }
             } catch (Throwable e) {
                 throw Debug.handle(e);
@@ -638,17 +654,41 @@
         }
 
         if (!forceCompile) {
-            cache.put(method, installedCode);
+            cache.put(installedCodeOwner, installedCode);
         }
         return installedCode;
     }
 
-    protected CompilationResult compile(ResolvedJavaMethod method, final StructuredGraph graph) {
-        CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false);
-        return compileGraph(graph, null, cc, method, getProviders(), getBackend(), getCodeCache().getTarget(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL,
-                        getProfilingInfo(graph), getSpeculationLog(), getSuites(), new CompilationResult(), CompilationResultBuilderFactory.Default);
+    /**
+     * Used to produce a graph for a method about to be compiled by
+     * {@link #compile(ResolvedJavaMethod, StructuredGraph)} if the second parameter to that method
+     * is null.
+     *
+     * The default implementation in {@link GraalCompilerTest} is to call
+     * {@link #parseEager(ResolvedJavaMethod)}.
+     */
+    protected StructuredGraph parseForCompile(ResolvedJavaMethod method) {
+        return parseEager(method);
     }
 
+    /**
+     * Compiles a given method.
+     *
+     * @param installedCodeOwner the method the compiled code will be associated with when installed
+     * @param graph the graph to be compiled for {@code installedCodeOwner}. If null, a graph will
+     *            be obtained from {@code installedCodeOwner} via
+     *            {@link #parseForCompile(ResolvedJavaMethod)}.
+     */
+    protected CompilationResult compile(ResolvedJavaMethod installedCodeOwner, StructuredGraph graph) {
+        StructuredGraph graphToCompile = graph == null ? parseForCompile(installedCodeOwner) : graph;
+        lastCompiledGraph = graphToCompile;
+        CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graphToCompile.method(), false);
+        return GraalCompiler.compileGraph(graphToCompile, null, cc, installedCodeOwner, getProviders(), getBackend(), getCodeCache().getTarget(), null, getDefaultGraphBuilderSuite(),
+                        OptimisticOptimizations.ALL, getProfilingInfo(graphToCompile), getSpeculationLog(), getSuites(), new CompilationResult(), CompilationResultBuilderFactory.Default);
+    }
+
+    protected StructuredGraph lastCompiledGraph;
+
     protected SpeculationLog getSpeculationLog() {
         return null;
     }
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryArithmeticTest.java	Mon Oct 20 23:09:46 2014 +0200
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryArithmeticTest.java	Mon Oct 20 23:11:40 2014 +0200
@@ -32,7 +32,7 @@
 
     @Override
     protected InstalledCode getCode(ResolvedJavaMethod method, StructuredGraph graph) {
-        return super.getCode(method, graph, true);
+        return getCode(method, graph, true);
     }
 
     /**
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/CompiledMethodTest.java	Mon Oct 20 23:09:46 2014 +0200
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/CompiledMethodTest.java	Mon Oct 20 23:11:40 2014 +0200
@@ -73,8 +73,7 @@
     @Test
     public void test3() {
         final ResolvedJavaMethod javaMethod = getResolvedJavaMethod("testMethod");
-        final StructuredGraph graph = parseEager(javaMethod);
-        InstalledCode compiledMethod = getCode(javaMethod, graph);
+        InstalledCode compiledMethod = getCode(javaMethod);
         try {
             Object result = compiledMethod.executeVarargs("1", "2", "3");
             Assert.assertEquals("1 2 3", result);
@@ -86,8 +85,7 @@
     @Test
     public void test4() {
         final ResolvedJavaMethod javaMethod = getResolvedJavaMethod("testMethodVirtual");
-        final StructuredGraph graph = parseEager(javaMethod);
-        InstalledCode compiledMethod = getCode(javaMethod, graph);
+        InstalledCode compiledMethod = getCode(javaMethod);
         try {
             f1 = "0";
             Object result = compiledMethod.executeVarargs(this, "1", "2", "3");
--- a/graal/com.oracle.graal.hotspot.amd64.test/src/com/oracle/graal/hotspot/amd64/test/AMD64HotSpotFrameOmissionTest.java	Mon Oct 20 23:09:46 2014 +0200
+++ b/graal/com.oracle.graal.hotspot.amd64.test/src/com/oracle/graal/hotspot/amd64/test/AMD64HotSpotFrameOmissionTest.java	Mon Oct 20 23:11:40 2014 +0200
@@ -102,7 +102,7 @@
 
     private void testHelper(String name, CodeGenerator gen) {
         ResolvedJavaMethod javaMethod = getResolvedJavaMethod(name);
-        InstalledCode installedCode = getCode(javaMethod, parseEager(javaMethod));
+        InstalledCode installedCode = getCode(javaMethod);
 
         TargetDescription target = getCodeCache().getTarget();
         RegisterConfig registerConfig = getCodeCache().getRegisterConfig();
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ArrayCopyIntrinsificationTest.java	Mon Oct 20 23:09:46 2014 +0200
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ArrayCopyIntrinsificationTest.java	Mon Oct 20 23:11:40 2014 +0200
@@ -41,7 +41,8 @@
 public class ArrayCopyIntrinsificationTest extends GraalCompilerTest {
 
     @Override
-    protected InstalledCode getCode(ResolvedJavaMethod method, StructuredGraph graph) {
+    protected InstalledCode getCode(ResolvedJavaMethod method, StructuredGraph g) {
+        StructuredGraph graph = g == null ? parseForCompile(method) : g;
         int nodeCount = graph.getNodeCount();
         InstalledCode result = super.getCode(method, graph);
         boolean graphWasProcessed = nodeCount != graph.getNodeCount();
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompressedOopTest.java	Mon Oct 20 23:09:46 2014 +0200
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompressedOopTest.java	Mon Oct 20 23:11:40 2014 +0200
@@ -40,7 +40,7 @@
 
     private HotSpotInstalledCode getInstalledCode(String name, Class<?>... parameterTypes) throws Exception {
         final ResolvedJavaMethod javaMethod = getResolvedJavaMethod(getClass(), name, parameterTypes);
-        final HotSpotInstalledCode installedBenchmarkCode = (HotSpotInstalledCode) getCode(javaMethod, parseEager(javaMethod));
+        final HotSpotInstalledCode installedBenchmarkCode = (HotSpotInstalledCode) getCode(javaMethod);
         return installedBenchmarkCode;
     }
 
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ExplicitExceptionTest.java	Mon Oct 20 23:09:46 2014 +0200
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ExplicitExceptionTest.java	Mon Oct 20 23:11:40 2014 +0200
@@ -27,7 +27,6 @@
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
-import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 
 public class ExplicitExceptionTest extends GraalCompilerTest {
@@ -35,9 +34,9 @@
     private int expectedForeignCallCount;
 
     @Override
-    protected InstalledCode getCode(ResolvedJavaMethod method, StructuredGraph graph) {
-        InstalledCode installedCode = super.getCode(method, graph);
-        assertDeepEquals(expectedForeignCallCount, graph.getNodes().filter(ForeignCallNode.class).count());
+    protected InstalledCode getCode(ResolvedJavaMethod method) {
+        InstalledCode installedCode = super.getCode(method);
+        assertDeepEquals(expectedForeignCallCount, lastCompiledGraph.getNodes().filter(ForeignCallNode.class).count());
         return installedCode;
     }
 
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotCryptoSubstitutionTest.java	Mon Oct 20 23:09:46 2014 +0200
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotCryptoSubstitutionTest.java	Mon Oct 20 23:11:40 2014 +0200
@@ -75,7 +75,7 @@
         aesExpected.write(runEncryptDecrypt(aesKey, "AES/CBC/NoPadding", input));
         aesExpected.write(runEncryptDecrypt(aesKey, "AES/CBC/PKCS5Padding", input));
 
-        if (compiledAndInstall("com.sun.crypto.provider.AESCrypt", "encryptBlock", "decryptBlock")) {
+        if (compileAndInstall("com.sun.crypto.provider.AESCrypt", "encryptBlock", "decryptBlock")) {
             ByteArrayOutputStream actual = new ByteArrayOutputStream();
             actual.write(runEncryptDecrypt(aesKey, "AES/CBC/NoPadding", input));
             actual.write(runEncryptDecrypt(aesKey, "AES/CBC/PKCS5Padding", input));
@@ -86,7 +86,7 @@
         desExpected.write(runEncryptDecrypt(desKey, "DESede/CBC/NoPadding", input));
         desExpected.write(runEncryptDecrypt(desKey, "DESede/CBC/PKCS5Padding", input));
 
-        if (compiledAndInstall("com.sun.crypto.provider.CipherBlockChaining", "encrypt", "decrypt")) {
+        if (compileAndInstall("com.sun.crypto.provider.CipherBlockChaining", "encrypt", "decrypt")) {
             ByteArrayOutputStream actual = new ByteArrayOutputStream();
             actual.write(runEncryptDecrypt(aesKey, "AES/CBC/NoPadding", input));
             actual.write(runEncryptDecrypt(aesKey, "AES/CBC/PKCS5Padding", input));
@@ -102,20 +102,20 @@
     /**
      * Compiles and installs the substitution for some specified methods. Once installed, the next
      * execution of the methods will use the newly installed code.
-     * 
+     *
      * @param className the name of the class for which substitutions are available
      * @param methodNames the names of the substituted methods
      * @return true if at least one substitution was compiled and installed
      */
-    private boolean compiledAndInstall(String className, String... methodNames) {
+    private boolean compileAndInstall(String className, String... methodNames) {
         boolean atLeastOneCompiled = false;
         for (String methodName : methodNames) {
             Method method = lookup(className, methodName);
             if (method != null) {
                 ResolvedJavaMethod installedCodeOwner = getMetaAccess().lookupJavaMethod(method);
-                StructuredGraph graph = getReplacements().getMethodSubstitution(installedCodeOwner);
-                if (graph != null) {
-                    graph = graph.copy();
+                StructuredGraph subst = getReplacements().getMethodSubstitution(installedCodeOwner);
+                if (subst != null) {
+                    StructuredGraph graph = subst.copy();
                     Assert.assertNotNull(getCode(installedCodeOwner, graph, true));
                     atLeastOneCompiled = true;
                 } else {
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotNmethodTest.java	Mon Oct 20 23:09:46 2014 +0200
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotNmethodTest.java	Mon Oct 20 23:11:40 2014 +0200
@@ -28,7 +28,6 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.hotspot.meta.*;
-import com.oracle.graal.nodes.*;
 
 public class HotSpotNmethodTest extends GraalCompilerTest {
 
@@ -37,8 +36,7 @@
     @Test
     public void testInstallCodeInvalidation() {
         final ResolvedJavaMethod testJavaMethod = getResolvedJavaMethod("foo");
-        final StructuredGraph graph = parseEager("otherFoo");
-        final HotSpotNmethod nmethod = (HotSpotNmethod) getCode(testJavaMethod, graph);
+        final HotSpotNmethod nmethod = (HotSpotNmethod) getCode(testJavaMethod, parseEager("otherFoo"));
         Assert.assertTrue(nmethod.isValid());
         Object result;
         try {
@@ -61,8 +59,7 @@
     @Test
     public void testInstallCodeInvalidationWhileRunning() {
         final ResolvedJavaMethod testJavaMethod = getResolvedJavaMethod("foo");
-        final StructuredGraph graph = parseEager("otherFoo");
-        final HotSpotNmethod nmethod = (HotSpotNmethod) getCode(testJavaMethod, graph);
+        final HotSpotNmethod nmethod = (HotSpotNmethod) getCode(testJavaMethod, parseEager("otherFoo"));
         Object result;
         try {
             result = nmethod.executeVarargs(nmethod, null, null);
@@ -76,8 +73,7 @@
     @Test
     public void testInstalledCodeCalledFromCompiledCode() {
         final ResolvedJavaMethod testJavaMethod = getResolvedJavaMethod("foo");
-        final StructuredGraph graph = parseEager("otherFoo");
-        final HotSpotNmethod nmethod = (HotSpotNmethod) getCode(testJavaMethod, graph);
+        final HotSpotNmethod nmethod = (HotSpotNmethod) getCode(testJavaMethod, parseEager("otherFoo"));
         Assert.assertTrue(nmethod.isValid());
         try {
             for (int i = 0; i < ITERATION_COUNT; ++i) {
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/InstalledCodeExecuteHelperTest.java	Mon Oct 20 23:09:46 2014 +0200
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/InstalledCodeExecuteHelperTest.java	Mon Oct 20 23:11:40 2014 +0200
@@ -40,12 +40,12 @@
     @Test
     public void test1() throws InvalidInstalledCodeException {
         final ResolvedJavaMethod fooMethod = getResolvedJavaMethod("foo");
-        final HotSpotInstalledCode fooCode = (HotSpotInstalledCode) getCode(fooMethod, parseEager(fooMethod));
+        final HotSpotInstalledCode fooCode = (HotSpotInstalledCode) getCode(fooMethod);
 
         argsToBind = new Object[]{fooCode};
 
         final ResolvedJavaMethod benchmarkMethod = getResolvedJavaMethod("benchmark");
-        final HotSpotInstalledCode installedBenchmarkCode = (HotSpotInstalledCode) getCode(benchmarkMethod, parseEager(benchmarkMethod));
+        final HotSpotInstalledCode installedBenchmarkCode = (HotSpotInstalledCode) getCode(benchmarkMethod);
 
         Assert.assertEquals(Integer.valueOf(42), benchmark(fooCode));
 
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java	Mon Oct 20 23:09:46 2014 +0200
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java	Mon Oct 20 23:11:40 2014 +0200
@@ -233,7 +233,7 @@
 
     private HotSpotInstalledCode getInstalledCode(String name) throws Exception {
         final ResolvedJavaMethod javaMethod = getResolvedJavaMethod(WriteBarrierAdditionTest.class, name, Object.class, Object.class, Object.class);
-        final HotSpotInstalledCode installedBenchmarkCode = (HotSpotInstalledCode) getCode(javaMethod, parseEager(javaMethod));
+        final HotSpotInstalledCode installedBenchmarkCode = (HotSpotInstalledCode) getCode(javaMethod);
         return installedBenchmarkCode;
     }
 
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/LambdaEagerTest.java	Mon Oct 20 23:09:46 2014 +0200
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/LambdaEagerTest.java	Mon Oct 20 23:11:40 2014 +0200
@@ -78,9 +78,9 @@
     }
 
     @Override
-    protected InstalledCode getCode(ResolvedJavaMethod method, StructuredGraph graph, boolean forceCompile) {
+    protected InstalledCode getCode(ResolvedJavaMethod installedCodeOwner, StructuredGraph graph, boolean forceCompile) {
         try (OverrideScope scope = OptionValue.override(GraalOptions.InlineEverything, true)) {
-            return super.getCode(method, graph, forceCompile);
+            return super.getCode(installedCodeOwner, graph, forceCompile);
         }
     }
 }
\ No newline at end of file
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/MethodSubstitutionTest.java	Mon Oct 20 23:09:46 2014 +0200
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/MethodSubstitutionTest.java	Mon Oct 20 23:11:40 2014 +0200
@@ -85,7 +85,7 @@
         }
 
         // Force compilation
-        InstalledCode code = getCode(testMethod, parseEager(testMethod));
+        InstalledCode code = getCode(testMethod);
         assert optional || code != null;
 
         for (int i = 0; i < args1.length; i++) {
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/NewMultiArrayTest.java	Mon Oct 20 23:09:46 2014 +0200
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/NewMultiArrayTest.java	Mon Oct 20 23:11:40 2014 +0200
@@ -48,7 +48,8 @@
     }
 
     @Override
-    protected InstalledCode getCode(final ResolvedJavaMethod method, final StructuredGraph graph) {
+    protected InstalledCode getCode(final ResolvedJavaMethod method, StructuredGraph g) {
+        StructuredGraph graph = g == null ? parseForCompile(method) : g;
         boolean forceCompile = false;
         if (bottomType != null) {
             List<NewMultiArrayNode> snapshot = graph.getNodes().filter(NewMultiArrayNode.class).snapshot();
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java	Mon Oct 20 23:09:46 2014 +0200
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java	Mon Oct 20 23:11:40 2014 +0200
@@ -75,7 +75,7 @@
         }
 
         // Force compilation
-        InstalledCode code = getCode(testJavaMethod, parseEager(testJavaMethod));
+        InstalledCode code = getCode(testJavaMethod);
         assert optional || code != null;
         for (Object l : args) {
             // Verify that the original method and the substitution produce the same value
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StringSubstitutionsTest.java	Mon Oct 20 23:09:46 2014 +0200
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StringSubstitutionsTest.java	Mon Oct 20 23:11:40 2014 +0200
@@ -47,7 +47,7 @@
         }
 
         // Force compilation
-        InstalledCode code = getCode(testMethod, parseEager(testMethod));
+        InstalledCode code = getCode(testMethod);
         assert optional || code != null;
 
         for (int i = 0; i < args1.length; i++) {
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/TypeCheckTest.java	Mon Oct 20 23:09:46 2014 +0200
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/TypeCheckTest.java	Mon Oct 20 23:11:40 2014 +0200
@@ -39,13 +39,17 @@
     protected JavaTypeProfile currentProfile;
 
     @Override
-    protected InstalledCode getCode(final ResolvedJavaMethod method, final StructuredGraph graph) {
-        boolean forceCompile = false;
+    protected StructuredGraph parseForCompile(ResolvedJavaMethod method) {
+        StructuredGraph graph = super.parseForCompile(method);
         if (currentProfile != null) {
             replaceProfile(graph, currentProfile);
-            forceCompile = true;
         }
-        return super.getCode(method, graph, forceCompile);
+        return graph;
+    }
+
+    @Override
+    protected InstalledCode getCode(final ResolvedJavaMethod method, final StructuredGraph graph) {
+        return getCode(method, graph, currentProfile != null);
     }
 
     protected JavaTypeProfile profile(Class<?>... types) {
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/UnsafeSubstitutionsTest.java	Mon Oct 20 23:09:46 2014 +0200
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/UnsafeSubstitutionsTest.java	Mon Oct 20 23:11:40 2014 +0200
@@ -46,7 +46,7 @@
         ResolvedJavaMethod originalMethod = getResolvedJavaMethod(holder, methodName, parameterTypes);
 
         // Force compilation
-        InstalledCode code = getCode(testMethod, parseEager(testMethod));
+        InstalledCode code = getCode(testMethod);
         assert code != null;
 
         // Verify that the original method and the substitution produce the same value