Skip to content

Commit c26d397

Browse files
author
Jaroslav Tulach
committed
[GR-37080] Extract InstrumentableNode from a WrapperNode.
PullRequest: graal/11182
2 parents 15482d6 + 305ca0f commit c26d397

File tree

1 file changed

+16
-1
lines changed
  • tools/src/com.oracle.truffle.tools.agentscript/src/com/oracle/truffle/tools/agentscript/impl

1 file changed

+16
-1
lines changed

tools/src/com.oracle.truffle.tools.agentscript/src/com/oracle/truffle/tools/agentscript/impl/EventContextObject.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private static Object iterateFrames(Object[] args, EventContextObject obj) throw
129129
return null;
130130
}
131131
final Frame frame = frameInstance.getFrame(FrameInstance.FrameAccess.READ_WRITE);
132-
Node instrumentableNode = InstrumentableNode.findInstrumentableParent(n);
132+
Node instrumentableNode = findInstrumentableParent(n);
133133
if (instrumentableNode != null && lib.hasScope(instrumentableNode, frame)) {
134134
try {
135135
Object frameVars = new CurrentScopeView(lib.getScope(instrumentableNode, frame, false));
@@ -180,4 +180,19 @@ private String toStringImpl() {
180180
ss.getSource().getName() + ":" +
181181
ss.getStartLine() + ":" + ss.getStartColumn() + ")";
182182
}
183+
184+
static Node findInstrumentableParent(Node node) {
185+
Node p = node;
186+
while (p != null) {
187+
Node n = p;
188+
if (n instanceof InstrumentableNode.WrapperNode) {
189+
n = ((InstrumentableNode.WrapperNode) n).getDelegateNode();
190+
}
191+
if (n instanceof InstrumentableNode && ((InstrumentableNode) n).isInstrumentable()) {
192+
return n;
193+
}
194+
p = p.getParent();
195+
}
196+
return null;
197+
}
183198
}

0 commit comments

Comments
 (0)