diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java @ 18311:3343ed66de79

Truffle: RootNode#getExecutionContext.
author Chris Seaton <chris.seaton@oracle.com>
date Sun, 09 Nov 2014 00:54:15 +0000
parents be1316e633b5
children 656331a61829
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java	Sat Nov 08 22:22:00 2014 +0000
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java	Sun Nov 09 00:54:15 2014 +0000
@@ -107,4 +107,23 @@
         this.callTarget = callTarget;
     }
 
+    /**
+     * Returns the {@link ExecutionContext} associated with this <code>RootNode</code>. This allows
+     * the correct <code>ExecutionContext</code> to be determined for a <code>RootNode</code> (and
+     * so also for a {@link RootCallTarget} and a {@link FrameInstance} obtained from the call
+     * stack) without prior knowledge of the language it has come from.
+     *
+     * Used for instance to determine the language of a <code>RootNode<code>:
+     *
+     * <pre>
+     * <code>
+     * rootNode.getExecutionContext().getLanguageShortName();
+     * </code> </pre>
+     *
+     * Returns <code>null</code> by default.
+     */
+    public ExecutionContext getExecutionContext() {
+        return null;
+    }
+
 }