Mercurial > hg > graal-compiler
comparison 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 |
comparison
equal
deleted
inserted
replaced
16955:7ef0a2355540 | 16958:997899955e72 |
---|---|
22 */ | 22 */ |
23 package com.oracle.truffle.sl.nodes; | 23 package com.oracle.truffle.sl.nodes; |
24 | 24 |
25 import java.io.*; | 25 import java.io.*; |
26 | 26 |
27 import com.oracle.truffle.api.*; | |
28 import com.oracle.truffle.api.frame.*; | 27 import com.oracle.truffle.api.frame.*; |
29 import com.oracle.truffle.api.instrument.*; | 28 import com.oracle.truffle.api.instrument.*; |
30 import com.oracle.truffle.api.nodes.*; | 29 import com.oracle.truffle.api.nodes.*; |
31 import com.oracle.truffle.api.source.*; | 30 import com.oracle.truffle.api.source.*; |
32 import com.oracle.truffle.sl.nodes.instrument.*; | 31 import com.oracle.truffle.sl.nodes.instrument.*; |
85 return String.format("%s:%d%s", sourceName, startLine, estimated ? "~" : ""); | 84 return String.format("%s:%d%s", sourceName, startLine, estimated ? "~" : ""); |
86 } | 85 } |
87 } | 86 } |
88 | 87 |
89 @Override | 88 @Override |
90 public Probe probe(ExecutionContext context) { | 89 public Probe probe() { |
91 Node parent = getParent(); | 90 Node parent = getParent(); |
92 | 91 |
93 if (parent == null) | 92 if (parent == null) |
94 throw new IllegalStateException("Cannot probe a node without a parent"); | 93 throw new IllegalStateException("Cannot probe a node without a parent"); |
95 | 94 |
96 if (parent instanceof SLStatementWrapper) | 95 if (parent instanceof SLStatementWrapper) |
97 return ((SLStatementWrapper) parent).getProbe(); | 96 return ((SLStatementWrapper) parent).getProbe(); |
98 | 97 |
99 SLStatementWrapper wrapper = new SLStatementWrapper((SLContext) context, this); | 98 SLStatementWrapper wrapper = new SLStatementWrapper(getRootNodeSLContext(this), this); |
100 this.replace(wrapper); | 99 this.replace(wrapper); |
101 wrapper.insertChild(); | 100 wrapper.insertChild(); |
102 return wrapper.getProbe(); | 101 return wrapper.getProbe(); |
103 } | 102 } |
103 | |
104 protected SLContext getRootNodeSLContext(Node node) { | |
105 assert node != null; | |
106 | |
107 if (node instanceof SLRootNode) | |
108 return ((SLRootNode) node).getSLContext(); | |
109 return getRootNodeSLContext(node.getParent()); | |
110 } | |
104 } | 111 } |