diff graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/SLStatementNode.java @ 16958:997899955e72

Instrumentation: removed ExecutionContext parameter from probe method in Instrumentable SL/Instrumentation: SLRootNode's now store SLContext. New method added to SLStatementNode to find the root node and get its SLContext
author David Piorkowski <david.piorkowski@oracle.com>
date Tue, 26 Aug 2014 11:00:30 -0700
parents 826c172a048f
children f0c3de09f12a
line wrap: on
line diff
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/SLStatementNode.java	Tue Aug 26 09:35:08 2014 -0700
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/SLStatementNode.java	Tue Aug 26 11:00:30 2014 -0700
@@ -24,7 +24,6 @@
 
 import java.io.*;
 
-import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.frame.*;
 import com.oracle.truffle.api.instrument.*;
 import com.oracle.truffle.api.nodes.*;
@@ -87,7 +86,7 @@
     }
 
     @Override
-    public Probe probe(ExecutionContext context) {
+    public Probe probe() {
         Node parent = getParent();
 
         if (parent == null)
@@ -96,9 +95,17 @@
         if (parent instanceof SLStatementWrapper)
             return ((SLStatementWrapper) parent).getProbe();
 
-        SLStatementWrapper wrapper = new SLStatementWrapper((SLContext) context, this);
+        SLStatementWrapper wrapper = new SLStatementWrapper(getRootNodeSLContext(this), this);
         this.replace(wrapper);
         wrapper.insertChild();
         return wrapper.getProbe();
     }
+
+    protected SLContext getRootNodeSLContext(Node node) {
+        assert node != null;
+
+        if (node instanceof SLRootNode)
+            return ((SLRootNode) node).getSLContext();
+        return getRootNodeSLContext(node.getParent());
+    }
 }