changeset 15091:607e33885130

Truffle: Merge context sensitive inlining removal with stack trace support.
author Christian Humer <christian.humer@gmail.com>
date Mon, 14 Apr 2014 18:46:56 +0200
parents 07e7aae05983
children c73ce0dd3583
files graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotFrameInstance.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallNode.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleRuntime.java graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultCallNode.java
diffstat 5 files changed, 24 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotFrameInstance.java	Mon Apr 14 18:25:23 2014 +0200
+++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotFrameInstance.java	Mon Apr 14 18:46:56 2014 +0200
@@ -26,6 +26,7 @@
 
 import com.oracle.graal.api.code.stack.*;
 import com.oracle.graal.graph.*;
+import com.oracle.graal.truffle.*;
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.CompilerDirectives.SlowPath;
 import com.oracle.truffle.api.frame.*;
@@ -99,14 +100,14 @@
 
     /**
      * This class represents a frame that is taken from the
-     * {@link DefaultCallNode#callProxy(MaterializedFrameNotify, CallTarget, VirtualFrame, Object[])}
+     * {@link OptimizedCallNode#callProxy(MaterializedFrameNotify, OptimizedCallTarget, VirtualFrame, Object[], boolean)}
      * method.
      */
     public static final class CallNodeFrame extends HotSpotFrameInstance {
         public static final Method METHOD;
         static {
             try {
-                METHOD = DefaultCallNode.class.getDeclaredMethod("callProxy", MaterializedFrameNotify.class, CallTarget.class, VirtualFrame.class, Object[].class);
+                METHOD = OptimizedCallNode.class.getDeclaredMethod("callProxy", MaterializedFrameNotify.class, OptimizedCallTarget.class, VirtualFrame.class, Object[].class, boolean.class);
             } catch (NoSuchMethodException | SecurityException e) {
                 throw new GraalInternalError(e);
             }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallNode.java	Mon Apr 14 18:25:23 2014 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallNode.java	Mon Apr 14 18:46:56 2014 +0200
@@ -25,6 +25,7 @@
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
 import com.oracle.truffle.api.frame.*;
+import com.oracle.truffle.api.frame.FrameInstance.*;
 import com.oracle.truffle.api.impl.*;
 import com.oracle.truffle.api.nodes.*;
 import com.oracle.truffle.api.nodes.NodeUtil.NodeCountFilter;
@@ -73,11 +74,22 @@
         if (CompilerDirectives.inInterpreter()) {
             onInterpreterCall();
         }
-        OptimizedCallTarget target = getCurrentCallTarget();
-        if (inlined) {
-            return target.callInlined(arguments);
-        } else {
-            return super.call(frame, arguments);
+        return callProxy(this, getCurrentCallTarget(), frame, arguments, inlined);
+    }
+
+    public static Object callProxy(MaterializedFrameNotify notify, OptimizedCallTarget callTarget, VirtualFrame frame, Object[] arguments, boolean inlined) {
+        try {
+            if (notify.getOutsideFrameAccess() != FrameAccess.NONE) {
+                CompilerDirectives.materialize(frame);
+            }
+            if (inlined) {
+                return callTarget.callInlined(arguments);
+            } else {
+                return callTarget.call(arguments);
+            }
+        } finally {
+            // this assertion is needed to keep the values from being cleared as non-live locals
+            assert notify != null & callTarget != null & frame != null;
         }
     }
 
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java	Mon Apr 14 18:25:23 2014 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java	Mon Apr 14 18:46:56 2014 +0200
@@ -44,7 +44,7 @@
     @Option(help = "Restrict compilation to comma-separated list of includes (or excludes prefixed with tilde)")
     public static final OptionValue<String> TruffleCompileOnly = new OptionValue<>(null);
     @Option(help = "Compile call target when call count exceeds this threshold")
-    public static final OptionValue<Integer> TruffleCompilationThreshold = new OptionValue<>(1000);
+    public static final OptionValue<Integer> TruffleCompilationThreshold = new OptionValue<>(3);
     @Option(help = "Minimum number of calls before a call target is compiled")
     public static final OptionValue<Integer> TruffleMinInvokeThreshold = new OptionValue<>(3);
     @Option(help = "Delay compilation after an invalidation to allow for reprofiling")
@@ -70,7 +70,7 @@
     @Option(help = "Number of most recently used methods in truffle cache")
     public static final OptionValue<Integer> TruffleMaxCompilationCacheSize = new OptionValue<>(512);
     @Option(help = "Enable asynchronous truffle compilation in background thread")
-    public static final OptionValue<Boolean> TruffleBackgroundCompilation = new OptionValue<>(true);
+    public static final OptionValue<Boolean> TruffleBackgroundCompilation = new OptionValue<>(false);
     @Option(help = "")
     public static final OptionValue<Boolean> TruffleUseTimeForCompilationDecision = new OptionValue<>(false);
     @Option(help = "")
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleRuntime.java	Mon Apr 14 18:25:23 2014 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleRuntime.java	Mon Apr 14 18:46:56 2014 +0200
@@ -25,7 +25,6 @@
 package com.oracle.truffle.api;
 
 import com.oracle.truffle.api.frame.*;
-import com.oracle.truffle.api.impl.*;
 import com.oracle.truffle.api.nodes.*;
 
 /**
@@ -94,9 +93,7 @@
 
     /**
      * Accesses the current stack, i.e., the contents of the {@link Frame}s and the associated
-     * {@link CallTarget}s. For this functionality to work each call needs to go through
-     * {@link DefaultCallNode#callProxy(MaterializedFrameNotify, CallTarget, VirtualFrame, Object[])}
-     * instead of calling {@link CallTarget#call(Object[])} directly.
+     * {@link CallTarget}s.
      *
      * @return a lazy collection of {@link FrameInstance}.
      */
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultCallNode.java	Mon Apr 14 18:25:23 2014 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultCallNode.java	Mon Apr 14 18:46:56 2014 +0200
@@ -42,19 +42,7 @@
 
     @Override
     public Object call(VirtualFrame frame, Object[] arguments) {
-        return callProxy(this, getCurrentCallTarget(), frame, arguments);
-    }
-
-    public static Object callProxy(MaterializedFrameNotify notify, CallTarget callTarget, VirtualFrame frame, Object[] arguments) {
-        try {
-            if (notify.getOutsideFrameAccess() != FrameAccess.NONE) {
-                CompilerDirectives.materialize(frame);
-            }
-            return callTarget.call(arguments);
-        } finally {
-            // this assertion is needed to keep the values from being cleared as non-live locals
-            assert notify != null & callTarget != null & frame != null;
-        }
+        return getCurrentCallTarget().call(arguments);
     }
 
     @Override