changeset 10659:63083745d390

Clean up OptimizedCallTarget and HotSpotNmethod.execute.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 08 Jul 2013 22:14:01 +0200
parents c79cf526508e
children 89efc9dd9f86
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotNmethod.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java
diffstat 2 files changed, 20 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotNmethod.java	Mon Jul 08 22:12:41 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotNmethod.java	Mon Jul 08 22:14:01 2013 +0200
@@ -97,15 +97,16 @@
 
     @Override
     public Object execute(Object arg1, Object arg2, Object arg3) throws InvalidInstalledCodeException {
+        assert checkThreeObjectArgs();
+        return CompilerToVMImpl.executeCompiledMethodIntrinsic(arg1, arg2, arg3, this);
+    }
+
+    protected boolean checkThreeObjectArgs() {
         assert method.getSignature().getParameterCount(!Modifier.isStatic(method.getModifiers())) == 3;
         assert method.getSignature().getParameterKind(0) == Kind.Object;
         assert method.getSignature().getParameterKind(1) == Kind.Object;
         assert !Modifier.isStatic(method.getModifiers()) || method.getSignature().getParameterKind(2) == Kind.Object;
-        return executeHelper(arg1, arg2, arg3, this);
-    }
-
-    private static Object executeHelper(Object arg1, Object arg2, Object arg3, HotSpotInstalledCode hotspotInstalledCode) throws InvalidInstalledCodeException {
-        return CompilerToVMImpl.executeCompiledMethodIntrinsic(arg1, arg2, arg3, hotspotInstalledCode);
+        return true;
     }
 
     private boolean checkArgs(Object... args) {
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java	Mon Jul 08 22:12:41 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java	Mon Jul 08 22:14:01 2013 +0200
@@ -71,25 +71,29 @@
 
     @Override
     public Object call(PackedFrame caller, Arguments args) {
-        if (compiledMethod != null) {
+        if (CompilerDirectives.injectBranchProbability(CompilerDirectives.FASTPATH_PROBABILITY, compiledMethod != null)) {
             try {
                 return compiledMethod.execute(this, caller, args);
             } catch (InvalidInstalledCodeException ex) {
-                compiledMethod = null;
-                invokeCounter = invalidationReprofileCount;
-                if (TruffleFunctionInlining.getValue()) {
-                    originalInvokeCounter += invalidationReprofileCount;
-                }
-                if (TraceTruffleCompilation.getValue()) {
-                    OUT.printf("[truffle] invalidated %-48s |Alive %5.0fms\n", rootNode, (System.nanoTime() - timeCompilationFinished) / 1e6);
-                }
-                return call(caller, args);
+                return compiledCodeInvalidated(caller, args);
             }
         } else {
             return interpreterCall(caller, args);
         }
     }
 
+    protected Object compiledCodeInvalidated(PackedFrame caller, Arguments args) {
+        compiledMethod = null;
+        invokeCounter = invalidationReprofileCount;
+        if (TruffleFunctionInlining.getValue()) {
+            originalInvokeCounter += invalidationReprofileCount;
+        }
+        if (TraceTruffleCompilation.getValue()) {
+            OUT.printf("[truffle] invalidated %-48s |Alive %5.0fms\n", rootNode, (System.nanoTime() - timeCompilationFinished) / 1e6);
+        }
+        return call(caller, args);
+    }
+
     private Object interpreterCall(PackedFrame caller, Arguments args) {
         invokeCounter--;
         loopAndInvokeCounter--;