# HG changeset patch # User Doug Simon # Date 1412806819 -7200 # Node ID 58f45b63b80265426f398ac7e4a52b0a7ad149ea # Parent b3c10156d3d75cd98cb42230364fd996234b2a86 CompileTheWorld compilations are no longer installed as default nmethods diff -r b3c10156d3d7 -r 58f45b63b802 graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java Wed Oct 08 12:18:57 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java Thu Oct 09 00:20:19 2014 +0200 @@ -138,7 +138,7 @@ long ctask = 0L; try (MemoryUsageCloseable c = label == null ? null : new MemoryUsageCloseable(label)) { - CompilationTask task = new CompilationTask(backend, method, INVOCATION_ENTRY_BCI, ctask, id); + CompilationTask task = new CompilationTask(backend, method, INVOCATION_ENTRY_BCI, ctask, id, false); task.runCompilation(); } } @@ -154,7 +154,7 @@ int id = method.allocateCompileId(INVOCATION_ENTRY_BCI); long ctask = 0L; try (AllocSpy as = AllocSpy.open(methodName)) { - CompilationTask task = new CompilationTask(backend, method, INVOCATION_ENTRY_BCI, ctask, id); + CompilationTask task = new CompilationTask(backend, method, INVOCATION_ENTRY_BCI, ctask, id, false); task.runCompilation(); } } diff -r b3c10156d3d7 -r 58f45b63b802 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Wed Oct 08 12:18:57 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Thu Oct 09 00:20:19 2014 +0200 @@ -79,6 +79,12 @@ private final int entryBCI; private final int id; + /** + * Specifies whether the compilation result is installed as the + * {@linkplain HotSpotNmethod#isDefault() default} nmethod for the compiled method. + */ + private final boolean installAsDefault; + private StructuredGraph graph; /** @@ -93,12 +99,13 @@ */ private final long ctask; - public CompilationTask(HotSpotBackend backend, HotSpotResolvedJavaMethod method, int entryBCI, long ctask, int id) { + public CompilationTask(HotSpotBackend backend, HotSpotResolvedJavaMethod method, int entryBCI, long ctask, int id, boolean installAsDefault) { this.backend = backend; this.method = method; this.entryBCI = entryBCI; this.id = id; this.ctask = ctask; + this.installAsDefault = installAsDefault; } public ResolvedJavaMethod getMethod() { @@ -315,7 +322,7 @@ final HotSpotCodeCacheProvider codeCache = backend.getProviders().getCodeCache(); InstalledCode installedCode = null; try (Scope s = Debug.scope("CodeInstall", new DebugDumpScope(String.valueOf(id), true), codeCache, method)) { - installedCode = codeCache.installMethod(method, compResult, ctask); + installedCode = codeCache.installMethod(method, compResult, ctask, installAsDefault); } catch (Throwable e) { throw Debug.handle(e); } @@ -357,7 +364,7 @@ */ static void compileMethod(HotSpotResolvedJavaMethod method, int entryBCI, long ctask, int id) { HotSpotBackend backend = runtime().getHostBackend(); - CompilationTask task = new CompilationTask(backend, method, entryBCI, ctask, id); + CompilationTask task = new CompilationTask(backend, method, entryBCI, ctask, id, true); task.runCompilation(); return; } diff -r b3c10156d3d7 -r 58f45b63b802 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java Wed Oct 08 12:18:57 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java Thu Oct 09 00:20:19 2014 +0200 @@ -320,7 +320,7 @@ class CTWCompilationTask extends CompilationTask { CTWCompilationTask(HotSpotBackend backend, HotSpotResolvedJavaMethod method) { - super(backend, method, INVOCATION_ENTRY_BCI, 0L, method.allocateCompileId(INVOCATION_ENTRY_BCI)); + super(backend, method, INVOCATION_ENTRY_BCI, 0L, method.allocateCompileId(INVOCATION_ENTRY_BCI), false); } /** @@ -348,7 +348,6 @@ memoryUsed += getCurrentThreadAllocatedBytes() - allocatedAtStart; compileTime += (System.currentTimeMillis() - start); compiledMethodsCounter++; - method.reprofile(); // makes the method also not-entrant } catch (Throwable t) { // Catch everything and print a message println("CompileTheWorld (%d) : Error compiling method: %s", classFileCounter, method.format("%H.%n(%p):%r")); diff -r b3c10156d3d7 -r 58f45b63b802 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java Wed Oct 08 12:18:57 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java Thu Oct 09 00:20:19 2014 +0200 @@ -206,11 +206,11 @@ return installedCode; } - public InstalledCode installMethod(HotSpotResolvedJavaMethod method, CompilationResult compResult, long ctask) { + public InstalledCode installMethod(HotSpotResolvedJavaMethod method, CompilationResult compResult, long ctask, boolean isDefault) { if (compResult.getId() == -1) { compResult.setId(method.allocateCompileId(compResult.getEntryBCI())); } - HotSpotInstalledCode installedCode = new HotSpotNmethod(method, compResult.getName(), true); + HotSpotInstalledCode installedCode = new HotSpotNmethod(method, compResult.getName(), isDefault); runtime.getCompilerToVM().installCode(new HotSpotCompiledNmethod(target, method, compResult, ctask), installedCode, method.getSpeculationLog()); return logOrDump(installedCode, compResult); } @@ -236,7 +236,7 @@ @Override public InstalledCode setDefaultMethod(ResolvedJavaMethod method, CompilationResult compResult) { HotSpotResolvedJavaMethod hotspotMethod = (HotSpotResolvedJavaMethod) method; - return installMethod(hotspotMethod, compResult, 0L); + return installMethod(hotspotMethod, compResult, 0L, true); } public HotSpotNmethod addExternalMethod(ResolvedJavaMethod method, CompilationResult compResult) {