diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java @ 13835:67e4e7f56911

Truffle: add a simple API to report loop counts
author Christian Wimmer <christian.wimmer@oracle.com>
date Thu, 30 Jan 2014 17:52:24 -0800
parents 641f22b1c6b8
children f46cab39a9a2
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java	Fri Jan 31 00:32:03 2014 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java	Thu Jan 30 17:52:24 2014 -0800
@@ -114,6 +114,16 @@
     }
 
     /**
+     * Reports the execution count of a loop that is a child of this node. The optimization
+     * heuristics can use the loop count to guide compilation and inlining.
+     */
+    public void reportLoopCount(int count) {
+        if (getCallTarget() instanceof LoopCountReceiver) {
+            ((LoopCountReceiver) getCallTarget()).reportLoopCount(count);
+        }
+    }
+
+    /**
      * Executes this function using the specified frame and returns the result value.
      * 
      * @param frame the frame of the currently executing guest language method