Skip to content

Commit

Permalink
provide more detail when Graal code installation fails due to a faile…
Browse files Browse the repository at this point in the history
…d dependency check
  • Loading branch information
dougxc committed Feb 17, 2015
1 parent 0a9bf3f commit 45d2ea1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import com.oracle.graal.api.code.*;
import com.oracle.graal.hotspot.meta.*;

import edu.umd.cs.findbugs.annotations.*;

/**
* {@link HotSpotCompiledCode} destined for installation as an nmethod.
*/
Expand All @@ -36,6 +38,12 @@ public final class HotSpotCompiledNmethod extends HotSpotCompiledCode {
public final int id;
public final long graalEnv;

/**
* May be set by VM if code installation fails. It will describe in more detail why installation
* failed (e.g., exactly which dependency failed).
*/
@SuppressFBWarnings("UWF_UNWRITTEN_FIELD") private String installationFailureMessage;

public HotSpotCompiledNmethod(HotSpotResolvedJavaMethod method, CompilationResult compResult) {
this(method, compResult, 0L);
}
Expand All @@ -52,4 +60,8 @@ public HotSpotCompiledNmethod(HotSpotResolvedJavaMethod method, CompilationResul
public String toString() {
return getClass().getSimpleName() + "[" + id + ":" + method.format("%H.%n(%p)%r@") + entryBCI + "]";
}

public String getInstallationFailureMessage() {
return installationFailureMessage;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,13 @@ public InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult comp
HotSpotInstalledCode code = new HotSpotNmethod(hotspotMethod, compResult.getName(), false);
installedCode = code;
}
CodeInstallResult result = runtime.getCompilerToVM().installCode(new HotSpotCompiledNmethod(hotspotMethod, compResult), installedCode, log);
HotSpotCompiledNmethod compiledCode = new HotSpotCompiledNmethod(hotspotMethod, compResult);
CodeInstallResult result = runtime.getCompilerToVM().installCode(compiledCode, installedCode, log);
if (result != CodeInstallResult.OK) {
String msg = compiledCode.getInstallationFailureMessage();
if (msg != null) {
throw new BailoutException(result != CodeInstallResult.DEPENDENCIES_FAILED, "Code installation failed: %s%n%s", result, msg);
}
throw new BailoutException(result != CodeInstallResult.DEPENDENCIES_FAILED, "Code installation failed: %s", result);
}
return logOrDump(installedCode, compResult);
Expand Down

0 comments on commit 45d2ea1

Please sign in to comment.