Mercurial > hg > truffle
diff graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java @ 12779:f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 19 Nov 2013 01:31:19 +0100 |
parents | 47ac1df40fc2 |
children | c0b0974dd509 |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Tue Nov 19 01:12:27 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Tue Nov 19 01:31:19 2013 +0100 @@ -25,6 +25,7 @@ import static com.oracle.graal.api.code.CodeUtil.*; import static com.oracle.graal.nodes.StructuredGraph.*; import static com.oracle.graal.phases.GraalOptions.*; +import static com.oracle.graal.phases.common.InliningUtil.*; import java.lang.reflect.*; import java.util.concurrent.*; @@ -33,15 +34,15 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.code.CallingConvention.Type; import com.oracle.graal.api.meta.*; +import com.oracle.graal.compiler.CompilerThreadFactory.CompilerThread; import com.oracle.graal.compiler.*; -import com.oracle.graal.compiler.CompilerThreadFactory.CompilerThread; import com.oracle.graal.debug.*; import com.oracle.graal.debug.internal.*; +import com.oracle.graal.hotspot.bridge.*; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.phases.*; -import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; public final class CompilationTask implements Runnable { @@ -119,6 +120,11 @@ * no code must be outside this try/finally because it could happen otherwise that * clearQueuedForCompilation() is not executed */ + + HotSpotVMConfig config = backend.getRuntime().getConfig(); + long previousInlinedBytecodes = InlinedBytecodes.getCurrentValue(); + long previousCompilationTime = CompilationTime.getCurrentValue(); + HotSpotInstalledCode installedCode = null; try (TimerCloseable a = CompilationTime.start()) { if (!tryToChangeStatus(CompilationStatus.Queued, CompilationStatus.Running) || method.hasCompiledCode()) { return; @@ -155,7 +161,7 @@ // Compiling method substitution - must clone the graph graph = graph.copy(); } - InliningUtil.InlinedBytecodes.add(method.getCodeSize()); + InlinedBytecodes.add(method.getCodeSize()); CallingConvention cc = getCallingConvention(providers.getCodeCache(), Type.JavaCallee, graph.method(), false); Suites suites = providers.getSuites().getDefaultSuites(); return GraalCompiler.compileGraph(graph, cc, method, providers, backend, backend.getTarget(), graphCache, plan, optimisticOpts, method.getSpeculationLog(), suites, @@ -173,7 +179,7 @@ } try (TimerCloseable b = CodeInstallationTime.start()) { - installMethod(result); + installedCode = installMethod(result); } stats.finish(method); } catch (BailoutException bailout) { @@ -194,6 +200,14 @@ System.exit(-1); } } finally { + if (config.ciTime && installedCode != null) { + long processedBytes = InlinedBytecodes.getCurrentValue() - previousInlinedBytecodes; + long time = CompilationTime.getCurrentValue() - previousCompilationTime; + TimeUnit timeUnit = CompilationTime.getTimeUnit(); + VMToCompiler vm2c = backend.getRuntime().getVMToCompiler(); + vm2c.notifyCompilationDone(id, method, entryBCI != INVOCATION_ENTRY_BCI, (int) processedBytes, time, timeUnit, installedCode); + } + assert method.isQueuedForCompilation(); method.clearQueuedForCompilation(); } @@ -214,12 +228,12 @@ MetaUtil.format("%H::%n(%p)", method), isOSR ? "@ " + entryBCI + " " : "", method.getCodeSize())); } - private void installMethod(final CompilationResult compResult) { + private HotSpotInstalledCode installMethod(final CompilationResult compResult) { final HotSpotCodeCacheProvider codeCache = backend.getProviders().getCodeCache(); - Debug.scope("CodeInstall", new Object[]{new DebugDumpScope(String.valueOf(id), true), codeCache, method}, new Runnable() { + return Debug.scope("CodeInstall", new Object[]{new DebugDumpScope(String.valueOf(id), true), codeCache, method}, new Callable<HotSpotInstalledCode>() { @Override - public void run() { + public HotSpotInstalledCode call() { HotSpotInstalledCode installedCode = codeCache.installMethod(method, entryBCI, compResult); if (Debug.isDumpEnabled()) { Debug.dump(new Object[]{compResult, installedCode}, "After code installation"); @@ -227,6 +241,7 @@ if (Debug.isLogEnabled()) { Debug.log("%s", backend.getProviders().getDisassembler().disassemble(installedCode)); } + return installedCode; } });