diff graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java @ 11643:2bd626188d31

Introduce TruffleMinInvokeThreshold flag.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 05 Sep 2013 16:36:40 +0200
parents 1b800f44ac0c
children 7a987d8147c2
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java	Thu Sep 05 10:59:01 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java	Thu Sep 05 16:36:40 2013 +0200
@@ -43,10 +43,10 @@
     private static final PrintStream OUT = TTY.out().out();
     private static final int MIN_INVOKES_AFTER_INLINING = 2;
 
-    protected OptimizedCallTarget(RootNode rootNode, FrameDescriptor descriptor, TruffleCompiler compiler, int compilationThreshold) {
+    protected OptimizedCallTarget(RootNode rootNode, FrameDescriptor descriptor, TruffleCompiler compiler, int invokeCounter, int compilationThreshold) {
         super(rootNode, descriptor);
         this.compiler = compiler;
-        this.invokeCounter = compilationThreshold >> 7;
+        this.invokeCounter = invokeCounter;
         this.loopAndInvokeCounter = compilationThreshold;
         this.originalInvokeCounter = compilationThreshold;
         this.rootNode.setCallTarget(this);
@@ -185,7 +185,7 @@
 
     @Override
     public void reportLoopCount(int count) {
-        loopAndInvokeCounter -= count;
+        loopAndInvokeCounter = Math.max(0, loopAndInvokeCounter - count);
     }
 
     @Override