Mercurial > hg > truffle
diff graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/SLExpressionNode.java @ 16880:7661cc464239
Truffle/Instrumentation: Added Instrumentable interface and LineLocationToSourceSections map
SL: Updated implementation to use new Instrumentable interface
author | David Piorkowski <david.piorkowski@oracle.com> |
---|---|
date | Thu, 21 Aug 2014 13:28:22 -0700 |
parents | abe7128ca473 |
children | 997899955e72 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/SLExpressionNode.java Tue Aug 19 19:25:44 2014 +0200 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/SLExpressionNode.java Thu Aug 21 13:28:22 2014 -0700 @@ -24,10 +24,13 @@ import java.math.*; +import com.oracle.truffle.api.*; import com.oracle.truffle.api.dsl.*; import com.oracle.truffle.api.frame.*; +import com.oracle.truffle.api.instrument.*; import com.oracle.truffle.api.nodes.*; import com.oracle.truffle.api.source.*; +import com.oracle.truffle.sl.nodes.instrument.*; import com.oracle.truffle.sl.runtime.*; /** @@ -87,4 +90,20 @@ public SLNull executeNull(VirtualFrame frame) throws UnexpectedResultException { return SLTypesGen.SLTYPES.expectSLNull(executeGeneric(frame)); } + + @Override + public Probe probe(ExecutionContext context) { + Node parent = getParent(); + + if (parent == null) + throw new IllegalStateException("Cannot probe a node without a parent"); + + if (parent instanceof SLExpressionWrapper) + return ((SLExpressionWrapper) parent).getProbe(); + + SLExpressionWrapper wrapper = new SLExpressionWrapper((SLContext) context, this); + this.replace(wrapper); + wrapper.insertChild(); + return wrapper.getProbe(); + } }