Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/SLExpressionNode.java @ 18485:e3c95cbbb50c
Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Sun, 23 Nov 2014 16:07:23 -0800 |
parents | f0c3de09f12a |
children | ccb97347d874 |
comparison
equal
deleted
inserted
replaced
18484:e97e1f07a3d6 | 18485:e3c95cbbb50c |
---|---|
93 @Override | 93 @Override |
94 public Probe probe() { | 94 public Probe probe() { |
95 Node parent = getParent(); | 95 Node parent = getParent(); |
96 | 96 |
97 if (parent == null) { | 97 if (parent == null) { |
98 throw new IllegalStateException("Cannot probe a node without a parent"); | 98 throw new IllegalStateException("Cannot call probe() a node without a parent."); |
99 } | 99 } |
100 | 100 |
101 if (parent instanceof SLExpressionWrapper) { | 101 if (parent instanceof SLExpressionWrapperNode) { |
102 return ((SLExpressionWrapper) parent).getProbe(); | 102 return ((SLExpressionWrapperNode) parent).getProbe(); |
103 } | 103 } |
104 | 104 |
105 // Create a new wrapper/probe with this node as its child. | 105 // Create a new wrapper/probe with this node as its child. |
106 final SLExpressionWrapper wrapper = new SLExpressionWrapper(getRootNodeSLContext(this), this); | 106 final SLExpressionWrapperNode wrapper = new SLExpressionWrapperNode(this); |
107 | |
108 // Connect it to a Probe | |
109 final Probe probe = ProbeNode.insertProbe(wrapper); | |
107 | 110 |
108 // Replace this node in the AST with the wrapper | 111 // Replace this node in the AST with the wrapper |
109 this.replace(wrapper); | 112 this.replace(wrapper); |
110 | 113 |
111 return wrapper.getProbe(); | 114 return probe; |
115 } | |
116 | |
117 @Override | |
118 public void probeLite(TruffleEventReceiver eventReceiver) { | |
119 Node parent = getParent(); | |
120 | |
121 if (parent == null) { | |
122 throw new IllegalStateException("Cannot call probeLite() on a node without a parent."); | |
123 } | |
124 | |
125 if (parent instanceof SLExpressionWrapperNode) { | |
126 throw new IllegalStateException("Cannot call probeLite() on a node that already has a wrapper."); | |
127 } | |
128 final SLExpressionWrapperNode wrapper = new SLExpressionWrapperNode(this); | |
129 ProbeNode.insertProbeLite(wrapper, eventReceiver); | |
130 | |
131 this.replace(wrapper); | |
112 } | 132 } |
113 } | 133 } |