changeset 18197:850b874592fa

Truffle: factor out assumption invalidate into a truffle boundary.
author Christian Humer <christian.humer@gmail.com>
date Mon, 27 Oct 2014 13:42:21 +0100
parents ff1f1481b367
children d7e40b20b030
files graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedAssumption.java
diffstat 1 files changed, 22 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedAssumption.java	Thu Oct 30 18:14:41 2014 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedAssumption.java	Mon Oct 27 13:42:21 2014 +0100
@@ -30,6 +30,7 @@
 
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.debug.*;
+import com.oracle.truffle.api.CompilerDirectives.*;
 import com.oracle.truffle.api.impl.*;
 import com.oracle.truffle.api.nodes.*;
 
@@ -57,27 +58,31 @@
     @Override
     public synchronized void invalidate() {
         if (isValid) {
-            boolean invalidatedInstalledCode = false;
-            Entry e = first;
-            while (e != null) {
-                InstalledCode installedCode = e.installedCode.get();
-                if (installedCode != null && installedCode.getVersion() == e.version) {
-                    installedCode.invalidate();
+            invalidateImpl();
+        }
+    }
 
-                    invalidatedInstalledCode = true;
-                    if (TraceTruffleAssumptions.getValue()) {
-                        logInvalidatedInstalledCode(installedCode);
-                    }
+    @TruffleBoundary
+    private void invalidateImpl() {
+        boolean invalidatedInstalledCode = false;
+        Entry e = first;
+        while (e != null) {
+            InstalledCode installedCode = e.installedCode.get();
+            if (installedCode != null && installedCode.getVersion() == e.version) {
+                installedCode.invalidate();
+                invalidatedInstalledCode = true;
+                if (TraceTruffleAssumptions.getValue()) {
+                    logInvalidatedInstalledCode(installedCode);
                 }
-                e = e.next;
             }
-            first = null;
-            isValid = false;
+            e = e.next;
+        }
+        first = null;
+        isValid = false;
 
-            if (TraceTruffleAssumptions.getValue()) {
-                if (invalidatedInstalledCode) {
-                    logStackTrace();
-                }
+        if (TraceTruffleAssumptions.getValue()) {
+            if (invalidatedInstalledCode) {
+                logStackTrace();
             }
         }
     }