Mercurial > hg > graal-jvmci-8
changeset 12690:c3bdd186e6cf
fix possible NPE in TruffleCompiler with TraceTruffleCompilation and background compilation enabled.
With background compilation, the installed code can already be invalidated when compiledMethod.getCode() is called, in which case it returns null.
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Wed, 06 Nov 2013 13:31:28 +0100 |
parents | 697ef4cf18c0 |
children | 426786412db6 |
files | graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Tue Nov 05 19:10:52 2013 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Wed Nov 06 13:31:28 2013 +0100 @@ -160,12 +160,16 @@ if (compiledMethod == null) { throw new BailoutException("Could not install method, code cache is full!"); } + if (!compiledMethod.isValid()) { + return null; + } if (TraceTruffleCompilation.getValue()) { int nodeCountTruffle = NodeUtil.countNodes(compilable.getRootNode()); - OUT.printf("[truffle] optimized %-50s %d |Nodes %7d |Time %5.0f(%4.0f+%-4.0f)ms |Nodes %5d/%5d |CodeSize %d\n", compilable.getRootNode(), compilable.hashCode(), nodeCountTruffle, + byte[] code = compiledMethod.getCode(); + OUT.printf("[truffle] optimized %-50s %x |Nodes %7d |Time %5.0f(%4.0f+%-4.0f)ms |Nodes %5d/%5d |CodeSize %d\n", compilable.getRootNode(), compilable.hashCode(), nodeCountTruffle, (timeCompilationFinished - timeCompilationStarted) / 1e6, (timePartialEvaluationFinished - timeCompilationStarted) / 1e6, - (timeCompilationFinished - timePartialEvaluationFinished) / 1e6, nodeCountPartialEval, nodeCountLowered, compiledMethod.getCode().length); + (timeCompilationFinished - timePartialEvaluationFinished) / 1e6, nodeCountPartialEval, nodeCountLowered, code != null ? code.length : 0); } return compiledMethod; }