@SuppressWarnings("deprecation") private EventChainNode findParentChain(VirtualFrame frame, EventBinding<?> binding) { Node node = getParent().getParent(); while (node != null) { // TODO we should avoid materializing the source section here if (node instanceof com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode) { ProbeNode probe = ((com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode) node).getProbeNode(); EventChainNode c = probe.lazyUpdate(frame); if (c != null) { c = c.find(binding); } if (c != null) { return c; } } else if (node instanceof RootNode) { break; } node = node.getParent(); } if (node == null) { throw new IllegalStateException("The AST node is not yet adopted. "); } return null; }
@SuppressWarnings("deprecation") @Override protected boolean visitChild(Node child) { Node parent = child.getParent(); if (parent instanceof com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode) { ProbeNode probe = ((com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode) parent).getProbeNode(); if (index < foundContexts.length) { foundContexts[index] = probe.context; } else { assert false; foundContexts = null; return false; } } else { // not yet materialized assert false; foundContexts = null; return false; } index++; return true; } }
@SuppressWarnings("deprecation") private EventChainNode findParentChain(VirtualFrame frame, EventBinding<?> binding) { Node node = getParent().getParent(); while (node != null) { // TODO we should avoid materializing the source section here if (node instanceof com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode) { ProbeNode probe = ((com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode) node).getProbeNode(); EventChainNode c = probe.lazyUpdate(frame); if (c != null) { c = c.find(binding); } if (c != null) { return c; } } else if (node instanceof RootNode) { break; } node = node.getParent(); } if (node == null) { throw new IllegalStateException("The AST node is not yet adopted. "); } return null; }
@SuppressWarnings("deprecation") @Override protected boolean visitChild(Node child) { Node parent = child.getParent(); if (parent instanceof com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode) { ProbeNode probe = ((com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode) parent).getProbeNode(); if (index < foundContexts.length) { foundContexts[index] = probe.context; } else { assert false; foundContexts = null; return false; } } else { // not yet materialized assert false; foundContexts = null; return false; } index++; return true; } }
/** * Accessor to the instrumented node at which the event occurred. The returned AST must not be * mutated by the user. * <p> * <b>Performance note:</b> this is method may be invoked in compiled code and is guaranteed to * always return a compilation constant . * </p> * * @since 0.12 */ @SuppressWarnings("deprecation") public Node getInstrumentedNode() { com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode wrapper = probeNode.findWrapper(); return wrapper != null ? wrapper.getDelegateNode() : null; }
/** * Accessor to the instrumented node at which the event occurred. The returned AST must not be * mutated by the user. * <p> * <b>Performance note:</b> this is method may be invoked in compiled code and is guaranteed to * always return a compilation constant . * </p> * * @since 0.12 */ @SuppressWarnings("deprecation") public Node getInstrumentedNode() { com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode wrapper = probeNode.findWrapper(); return wrapper != null ? wrapper.getDelegateNode() : null; }
@Override @SuppressWarnings("deprecation") public final ExecutionEventNode lookupExecutionEventNode(Node node, EventBinding<?> binding) { if (!InstrumentationHandler.isInstrumentableNode(node, node.getSourceSection())) { return null; } Node p = node.getParent(); if (p instanceof InstrumentableFactory.WrapperNode) { InstrumentableFactory.WrapperNode w = (InstrumentableFactory.WrapperNode) p; return w.getProbeNode().lookupExecutionEventNode(binding); } else { return null; } }
@SuppressWarnings("deprecation") static void removeWrapper(ProbeNode node) { if (TRACE) { trace("Remove wrapper for %s%n", node.getContext().getInstrumentedSourceSection()); } com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode wrapperNode = node.findWrapper(); ((Node) wrapperNode).replace(wrapperNode.getDelegateNode()); }
@SuppressWarnings("deprecation") private static void invalidateWrapperImpl(com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode parent, Node node) { ProbeNode probeNode = parent.getProbeNode(); if (TRACE) { SourceSection section = probeNode.getContext().getInstrumentedSourceSection(); trace("Invalidate wrapper for %s, section %s %n", node, section); } if (probeNode != null) { probeNode.invalidate(); } }
@SuppressWarnings("deprecation") private static void invalidateWrapperImpl(com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode parent, Node node) { ProbeNode probeNode = parent.getProbeNode(); if (TRACE) { SourceSection section = probeNode.getContext().getInstrumentedSourceSection(); trace("Invalidate wrapper for %s, section %s %n", node, section); } if (probeNode != null) { probeNode.invalidate(); } }
@SuppressWarnings("deprecation") static void removeWrapper(ProbeNode node) { if (TRACE) { trace("Remove wrapper for %s%n", node.getContext().getInstrumentedSourceSection()); } com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode wrapperNode = node.findWrapper(); ((Node) wrapperNode).replace(wrapperNode.getDelegateNode()); }