changeset 18311:3343ed66de79

Truffle: RootNode#getExecutionContext.
author Chris Seaton <chris.seaton@oracle.com>
date Sun, 09 Nov 2014 00:54:15 +0000
parents 36fb9592c13b
children a968fd429ee5
files CHANGELOG.md graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/SLRootNode.java
diffstat 3 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG.md	Sat Nov 08 22:22:00 2014 +0000
+++ b/CHANGELOG.md	Sun Nov 09 00:54:15 2014 +0000
@@ -16,6 +16,7 @@
 * Renamed DirectCallNode#isSplit to DirectCallNode#isCallTargetCloned
 * Added PrimitiveValueProfile.
 * Added -G:TruffleTimeThreshold=5000 option to defer compilation for call targets
+* Added RootNode#getExecutionContext to identify nodes with languages
 * ...
 
 ## Version 0.5
--- 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;
+    }
+
 }
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/SLRootNode.java	Sat Nov 08 22:22:00 2014 +0000
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/SLRootNode.java	Sun Nov 09 00:54:15 2014 +0000
@@ -22,6 +22,7 @@
  */
 package com.oracle.truffle.sl.nodes;
 
+import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.CompilerDirectives.*;
 import com.oracle.truffle.api.frame.*;
 import com.oracle.truffle.api.nodes.*;
@@ -86,4 +87,9 @@
     public SLContext getSLContext() {
         return this.context;
     }
+
+    @Override
+    public ExecutionContext getExecutionContext() {
+        return this.context;
+    }
 }