# HG changeset patch # User Gilles Duboscq # Date 1382447414 -7200 # Node ID b2882f4ab612d1804d05c380a6c4a37e024d752a # Parent 2ae2862187211dc3427487f0bba1328a142f7ee9 Add an optional name to HotSpotNmethod. Print it during deopt. Use it when installing a Truffle compilation diff -r 2ae286218721 -r b2882f4ab612 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java Tue Oct 22 15:08:23 2013 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java Tue Oct 22 15:10:14 2013 +0200 @@ -326,6 +326,8 @@ private int customStackAreaOffset = -1; private int registerRestoreEpilogueOffset = -1; + private final String name; + /** * The buffer containing the emitted machine code. */ @@ -347,6 +349,14 @@ */ private long[] leafGraphIds; + public CompilationResult() { + this(null); + } + + public CompilationResult(String name) { + this.name = name; + } + public void setAssumptions(Assumptions assumptions) { this.assumptions = assumptions; } @@ -620,4 +630,8 @@ } return unmodifiableList(marks); } + + public String getName() { + return name; + } } diff -r 2ae286218721 -r b2882f4ab612 graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotCryptoSubstitutionTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotCryptoSubstitutionTest.java Tue Oct 22 15:08:23 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotCryptoSubstitutionTest.java Tue Oct 22 15:10:14 2013 +0200 @@ -48,7 +48,7 @@ @Override protected InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult) { HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) method; - HotSpotNmethod installedCode = new HotSpotNmethod(hsMethod, true); + HotSpotNmethod installedCode = new HotSpotNmethod(hsMethod, compResult.getName(), true); HotSpotCompiledNmethod compiledNmethod = new HotSpotCompiledNmethod(hsMethod, StructuredGraph.INVOCATION_ENTRY_BCI, compResult); CodeInstallResult result = runtime().getCompilerToVM().installCode(compiledNmethod, installedCode, null); Assert.assertEquals("Error installing method " + method + ": " + result, result, CodeInstallResult.OK); diff -r 2ae286218721 -r b2882f4ab612 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 Tue Oct 22 15:08:23 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java Tue Oct 22 15:10:14 2013 +0200 @@ -157,7 +157,7 @@ } public HotSpotInstalledCode installMethod(HotSpotResolvedJavaMethod method, int entryBCI, CompilationResult compResult) { - HotSpotInstalledCode installedCode = new HotSpotNmethod(method, true); + HotSpotInstalledCode installedCode = new HotSpotNmethod(method, compResult.getName(), true); runtime.getCompilerToVM().installCode(new HotSpotCompiledNmethod(method, entryBCI, compResult), installedCode, method.getSpeculationLog()); return installedCode; } @@ -165,7 +165,7 @@ @Override public InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult) { HotSpotResolvedJavaMethod hotspotMethod = (HotSpotResolvedJavaMethod) method; - HotSpotInstalledCode code = new HotSpotNmethod(hotspotMethod, false); + HotSpotInstalledCode code = new HotSpotNmethod(hotspotMethod, compResult.getName(), false); CodeInstallResult result = runtime.getCompilerToVM().installCode(new HotSpotCompiledNmethod(hotspotMethod, -1, compResult), code, null); if (result != CodeInstallResult.OK) { return null; @@ -176,7 +176,7 @@ public InstalledCode addExternalMethod(ResolvedJavaMethod method, CompilationResult compResult) { HotSpotResolvedJavaMethod javaMethod = (HotSpotResolvedJavaMethod) method; - HotSpotInstalledCode icode = new HotSpotNmethod(javaMethod, false, true); + HotSpotInstalledCode icode = new HotSpotNmethod(javaMethod, compResult.getName(), false, true); HotSpotCompiledNmethod compiled = new HotSpotCompiledNmethod(javaMethod, -1, compResult); CompilerToVM vm = runtime.getCompilerToVM(); CodeInstallResult result = vm.installCode(compiled, icode, null); diff -r 2ae286218721 -r b2882f4ab612 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotNmethod.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotNmethod.java Tue Oct 22 15:08:23 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotNmethod.java Tue Oct 22 15:10:14 2013 +0200 @@ -46,17 +46,17 @@ private final HotSpotResolvedJavaMethod method; private final boolean isDefault; private final boolean isExternal; + private final String name; - public HotSpotNmethod(HotSpotResolvedJavaMethod method, boolean isDefault) { - this.method = method; - this.isDefault = isDefault; - this.isExternal = false; + public HotSpotNmethod(HotSpotResolvedJavaMethod method, String name, boolean isDefault) { + this(method, name, isDefault, false); } - public HotSpotNmethod(HotSpotResolvedJavaMethod method, boolean isDefault, boolean isExternal) { + public HotSpotNmethod(HotSpotResolvedJavaMethod method, String name, boolean isDefault, boolean isExternal) { this.method = method; this.isDefault = isDefault; this.isExternal = isExternal; + this.name = name; } public boolean isDefault() { @@ -84,7 +84,7 @@ @Override public String toString() { - return String.format("InstalledNmethod[method=%s, codeBlob=0x%x, isDefault=%b]", method, getCodeBlob(), isDefault); + return String.format("InstalledNmethod[method=%s, codeBlob=0x%x, isDefault=%b, name=]", method, getCodeBlob(), isDefault, name); } @Override diff -r 2ae286218721 -r b2882f4ab612 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Tue Oct 22 15:08:23 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Tue Oct 22 15:10:14 2013 +0200 @@ -154,7 +154,7 @@ CodeCacheProvider codeCache = providers.getCodeCache(); CallingConvention cc = getCallingConvention(codeCache, Type.JavaCallee, graph.method(), false); return GraalCompiler.compileGraph(graph, cc, graph.method(), providers, backend, codeCache.getTarget(), null, plan, OptimisticOptimizations.ALL, new SpeculationLog(), suites, - new CompilationResult()); + new CompilationResult(compilable.toString())); } } }); diff -r 2ae286218721 -r b2882f4ab612 src/share/tools/IdealGraphVisualizer/nbproject/project.properties --- a/src/share/tools/IdealGraphVisualizer/nbproject/project.properties Tue Oct 22 15:08:23 2013 +0200 +++ b/src/share/tools/IdealGraphVisualizer/nbproject/project.properties Tue Oct 22 15:10:14 2013 +0200 @@ -40,5 +40,5 @@ # Disable assertions for RequestProcessor to prevent annoying messages in case # of multiple SceneAnimator update tasks in the default RequestProcessor. -run.args.extra = -J-server -J-da:org.openide.util.RequestProcessor -J-Xms2g -J-Xmx4g +run.args.extra = -J-server -J-da:org.openide.util.RequestProcessor -J-Xms2g -J-Xmx8g debug.args.extra = -J-server -J-da:org.openide.util.RequestProcessor diff -r 2ae286218721 -r b2882f4ab612 src/share/vm/graal/graalJavaAccess.hpp --- a/src/share/vm/graal/graalJavaAccess.hpp Tue Oct 22 15:08:23 2013 +0200 +++ b/src/share/vm/graal/graalJavaAccess.hpp Tue Oct 22 15:10:14 2013 +0200 @@ -85,6 +85,7 @@ start_class(HotSpotNmethod) \ boolean_field(HotSpotNmethod, isDefault) \ boolean_field(HotSpotNmethod, isExternal) \ + oop_field(HotSpotNmethod, name, "Ljava/lang/String;") \ end_class \ start_class(HotSpotCompiledCode) \ oop_field(HotSpotCompiledCode, comp, "Lcom/oracle/graal/api/code/CompilationResult;") \ diff -r 2ae286218721 -r b2882f4ab612 src/share/vm/runtime/deoptimization.cpp --- a/src/share/vm/runtime/deoptimization.cpp Tue Oct 22 15:08:23 2013 +0200 +++ b/src/share/vm/runtime/deoptimization.cpp Tue Oct 22 15:10:14 2013 +0200 @@ -89,6 +89,7 @@ #ifdef GRAAL #include "graal/graalCompiler.hpp" +#include "graal/graalJavaAccess.hpp" #endif @@ -1420,6 +1421,19 @@ if (TraceDeoptimization) { // make noise on the tty tty->print("Uncommon trap occurred in"); nm->method()->print_short_name(tty); +#ifdef GRAAL + oop installedCode = nm->graal_installed_code(); + if (installedCode != NULL) { + oop installedCodeName = HotSpotNmethod::name(installedCode); + if (installedCodeName != NULL) { + tty->print(" (Graal: installedCodeName=%s) ", java_lang_String::as_utf8_string(installedCodeName)); + } else { + tty->print(" (Graal: installed code has no name) "); + } + } else { + tty->print(" (Graal: no installed code) "); + } +#endif //GRAAL tty->print(" (@" INTPTR_FORMAT ") thread=" UINTX_FORMAT " reason=%s action=%s unloaded_class_index=%d", fr.pc(), os::current_thread_id(),