comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/instrument/SLStatementWrapper.java @ 16961:a1427e40deaf

Truffle/Instrumentation: some Javadoc revistions; minor code cleanups; remove one redundant operation; add tracing to the LineLocation maps.
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Tue, 26 Aug 2014 13:54:53 -0700
parents 7661cc464239
children 5d16da2ca0c8
comparison
equal deleted inserted replaced
16955:7ef0a2355540 16961:a1427e40deaf
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.runtime.*; 30 import com.oracle.truffle.sl.runtime.*;
31 31
32 /** 32 /**
33 * SLStatmentWrapper is a Truffle AST node that gets inserted as the parent to the node that it is 33 * A Truffle node that can be inserted into a Simple AST (assumed not to have executed yet) to
34 * wrapping. Any debugging instruments are attached to this wrapper through {@link Probe}s (which 34 * enable "instrumentation" of a {@link SLStatementNode}. Tools wishing to interact with AST
35 * themselves contain the instruments). It is through this mechanism that tools can interact 35 * execution may attach {@link Instrument}s to the {@link Probe} uniquely associated with the
36 * directly with the AST. <br/> 36 * wrapper, and to which this wrapper routes {@link ExecutionEvents}.
37 * SLStatmentWrapper specifically wraps {@link SLStatementWrapper}s and overrides the executeVoid
38 * function of {@link SLStatementNode} to operate on the child of the wrapper instead of the wrapper
39 * itself.
40 *
41 */ 37 */
42 public final class SLStatementWrapper extends SLStatementNode implements Wrapper { 38 public final class SLStatementWrapper extends SLStatementNode implements Wrapper {
43 39
44 @Child private SLStatementNode child; 40 @Child private SLStatementNode child;
45 41
48 public SLStatementWrapper(SLContext context, SLStatementNode child) { 44 public SLStatementWrapper(SLContext context, SLStatementNode child) {
49 super(child.getSourceSection()); 45 super(child.getSourceSection());
50 assert !(child instanceof SLStatementWrapper); 46 assert !(child instanceof SLStatementWrapper);
51 this.probe = context.createProbe(child.getSourceSection()); 47 this.probe = context.createProbe(child.getSourceSection());
52 this.child = child; 48 this.child = child;
53 // The child should only be inserted after a replace, so we defer inserting the child to the
54 // creator of the wrapper.
55 } 49 }
56 50
57 @Override 51 @Override
58 public SLStatementNode getNonWrapperNode() { 52 public SLStatementNode getNonWrapperNode() {
59 return child; 53 return child;
96 probe.leaveExceptional(child, frame, e); 90 probe.leaveExceptional(child, frame, e);
97 throw (e); 91 throw (e);
98 } 92 }
99 } 93 }
100 94
101 /**
102 * Sets the parent pointer of this wrapper's child.
103 */
104 public void insertChild() {
105 insert(this.child);
106 }
107 } 95 }