Mercurial > hg > truffle
comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/instrument/SLInstrumenter.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 | 54696f15ac93 |
children | f0c3de09f12a |
comparison
equal
deleted
inserted
replaced
16955:7ef0a2355540 | 16958:997899955e72 |
---|---|
27 import com.oracle.truffle.api.instrument.*; | 27 import com.oracle.truffle.api.instrument.*; |
28 import com.oracle.truffle.api.nodes.*; | 28 import com.oracle.truffle.api.nodes.*; |
29 import com.oracle.truffle.sl.nodes.*; | 29 import com.oracle.truffle.sl.nodes.*; |
30 import com.oracle.truffle.sl.nodes.controlflow.*; | 30 import com.oracle.truffle.sl.nodes.controlflow.*; |
31 import com.oracle.truffle.sl.nodes.local.*; | 31 import com.oracle.truffle.sl.nodes.local.*; |
32 import com.oracle.truffle.sl.runtime.*; | |
33 | 32 |
34 /** | 33 /** |
35 * This is a general purpose visitor which traverses a completely parsed Simple AST and instruments | 34 * This is a general purpose visitor which traverses a completely parsed Simple AST and instruments |
36 * all the nodes within it. This visitor is designed to visit the tree immediately after it has been | 35 * all the nodes within it. This visitor is designed to visit the tree immediately after it has been |
37 * parsed. | 36 * parsed. |
38 * | 37 * |
39 */ | 38 */ |
40 public class SLInstrumenter implements NodeVisitor { | 39 public class SLInstrumenter implements NodeVisitor { |
41 | 40 |
42 private final SLContext context; | 41 public SLInstrumenter() { |
43 | |
44 public SLInstrumenter(SLContext context) { | |
45 this.context = context; | |
46 } | 42 } |
47 | 43 |
48 /** | 44 /** |
49 * Instruments and tags all relevant {@link SLStatementNode}s and {@link SLExpressionNode}s. | 45 * Instruments and tags all relevant {@link SLStatementNode}s and {@link SLExpressionNode}s. |
50 * Currently, only SLStatementNodes that are not SLExpressionNodes are tagged as statements. | 46 * Currently, only SLStatementNodes that are not SLExpressionNodes are tagged as statements. |
55 // SLExpressionNodes are a subclass of SLStatementNode, we check if something is an | 51 // SLExpressionNodes are a subclass of SLStatementNode, we check if something is an |
56 // SLExpressionNode first. | 52 // SLExpressionNode first. |
57 if (node instanceof SLExpressionNode && node.getParent() != null) { | 53 if (node instanceof SLExpressionNode && node.getParent() != null) { |
58 SLExpressionNode expressionNode = (SLExpressionNode) node; | 54 SLExpressionNode expressionNode = (SLExpressionNode) node; |
59 if (expressionNode.getSourceSection() != null) { | 55 if (expressionNode.getSourceSection() != null) { |
60 Probe probe = expressionNode.probe(context); | 56 Probe probe = expressionNode.probe(); |
61 // probe.tagAs(STATEMENT); | 57 // probe.tagAs(STATEMENT); |
62 | 58 |
63 if (node instanceof SLWriteLocalVariableNode) | 59 if (node instanceof SLWriteLocalVariableNode) |
64 probe.tagAs(ASSIGNMENT); | 60 probe.tagAs(ASSIGNMENT); |
65 } | 61 } |
66 } else if (node instanceof SLStatementNode && node.getParent() != null) { | 62 } else if (node instanceof SLStatementNode && node.getParent() != null) { |
67 | 63 |
68 SLStatementNode statementNode = (SLStatementNode) node; | 64 SLStatementNode statementNode = (SLStatementNode) node; |
69 if (statementNode.getSourceSection() != null) { | 65 if (statementNode.getSourceSection() != null) { |
70 Probe probe = statementNode.probe(context); | 66 Probe probe = statementNode.probe(); |
71 probe.tagAs(STATEMENT); | 67 probe.tagAs(STATEMENT); |
72 | 68 |
73 if (node instanceof SLWhileNode) | 69 if (node instanceof SLWhileNode) |
74 probe.tagAs(START_LOOP); | 70 probe.tagAs(START_LOOP); |
75 } | 71 } |