changeset 15174:20cd3e31b87d

Truffle: Fix regression happening when methods are invalidated.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Wed, 16 Apr 2014 22:52:43 +0200
parents fc7f2bbd4edd
children 78f1a1a70628
files graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InstalledCode.java graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotOptimizedCallTarget.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/CompilationProfile.java
diffstat 3 files changed, 19 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InstalledCode.java	Wed Apr 16 20:37:53 2014 +0200
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InstalledCode.java	Wed Apr 16 22:52:43 2014 +0200
@@ -80,7 +80,7 @@
      * {@link InvalidInstalledCodeException}.
      */
     public void invalidate() {
-
+        throw new UnsupportedOperationException();
     }
 
     /**
@@ -91,6 +91,6 @@
      */
     @SuppressWarnings("unused")
     public Object executeVarargs(Object... args) throws InvalidInstalledCodeException {
-        return null;
+        throw new UnsupportedOperationException();
     }
 }
--- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotOptimizedCallTarget.java	Wed Apr 16 20:37:53 2014 +0200
+++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotOptimizedCallTarget.java	Wed Apr 16 22:52:43 2014 +0200
@@ -22,6 +22,7 @@
  */
 package com.oracle.graal.truffle.hotspot;
 
+import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
 import static com.oracle.graal.truffle.TruffleCompilerOptions.*;
 import static com.oracle.graal.truffle.OptimizedCallTargetLog.*;
 
@@ -86,6 +87,16 @@
     }
 
     @Override
+    public void invalidate() {
+        runtime().getCompilerToVM().invalidateInstalledCode(this);
+    }
+
+    @Override
+    public Object executeVarargs(Object... args) throws InvalidInstalledCodeException {
+        return runtime().getCompilerToVM().executeCompiledMethodVarargs(args, this);
+    }
+
+    @Override
     protected void invalidate(Node oldNode, Node newNode, CharSequence reason) {
         if (isValid()) {
             CompilerAsserts.neverPartOfCompilation();
@@ -128,7 +139,7 @@
     private boolean isCompiling() {
         Future<InstalledCode> codeTask = this.installedCodeTask;
         if (codeTask != null) {
-            if (codeTask.isCancelled()) {
+            if (codeTask.isCancelled() || codeTask.isDone()) {
                 installedCodeTask = null;
                 return false;
             }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/CompilationProfile.java	Wed Apr 16 20:37:53 2014 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/CompilationProfile.java	Wed Apr 16 22:52:43 2014 +0200
@@ -59,6 +59,11 @@
         this.name = name;
     }
 
+    @Override
+    public String toString() {
+        return String.format("CompilationProfile(callCount=%d/%d, callAndLoopCount=%d/%d)", callCount, compilationCallThreshold, callAndLoopCount, compilationCallAndLoopThreshold);
+    }
+
     public Map<String, Object> getDebugProperties() {
         Map<String, Object> properties = new LinkedHashMap<>();
         String callsThreshold = String.format("%7d/%5d", getCallCount(), getCompilationCallThreshold());