Mercurial > hg > graal-compiler
changeset 12711:fb4658e16b5d
Truffle: some regression fixes to previous cleanup
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Thu, 07 Nov 2013 20:47:11 +0100 |
parents | 60142b15ed42 |
children | 882a0aadfed6 |
files | graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java |
diffstat | 1 files changed, 22 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java Thu Nov 07 19:07:41 2013 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java Thu Nov 07 20:47:11 2013 +0100 @@ -75,10 +75,6 @@ return callHelper(caller, args); } - public CompilationProfile getCompilationProfile() { - return compilationProfile; - } - private Object callHelper(PackedFrame caller, Arguments args) { if (installedCode != null && installedCode.isValid()) { TruffleRuntime runtime = Truffle.getRuntime(); @@ -102,6 +98,10 @@ } } + public CompilationProfile getCompilationProfile() { + return compilationProfile; + } + private Object compiledCodeInvalidated(PackedFrame caller, Arguments args) { invalidate(); return call(caller, args); @@ -130,9 +130,12 @@ private Object interpreterCall(PackedFrame caller, Arguments args) { CompilerAsserts.neverPartOfCompilation(); compilationProfile.reportInterpreterCall(); - if (compilationEnabled) { + if (compilationEnabled && shouldCompile()) { + if (isCompiling()) { + return waitForCompilation(caller, args); + } boolean inlined = shouldInline() && inline(); - if (!inlined && shouldCompile()) { + if (!inlined) { compile(); } } @@ -147,26 +150,31 @@ return TruffleFunctionInlining.getValue(); } - public void compile() { - CompilerAsserts.neverPartOfCompilation(); + private boolean isCompiling() { if (installedCodeTask != null) { - // There is already a compilation running. if (installedCodeTask.isCancelled()) { installedCodeTask = null; - } else { - if (installedCodeTask.isDone()) { - installedCode = receiveInstalledCode(); - } - return; + return false; } + return true; } + return false; + } + public void compile() { this.installedCodeTask = compiler.compile(this); if (!TruffleBackgroundCompilation.getValue()) { installedCode = receiveInstalledCode(); } } + private Object waitForCompilation(PackedFrame caller, Arguments args) { + if (installedCodeTask.isDone()) { + installedCode = receiveInstalledCode(); + } + return executeHelper(caller, args); + } + private InstalledCode receiveInstalledCode() { try { return installedCodeTask.get();