@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(); } }
assert probe.getContext().validEventContext();
assert probe.getContext().validEventContext();
@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") 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()); }
EventChainNode createParentEventChainCallback(VirtualFrame frame, EventBinding.Source<?> binding, RootNode rootNode, Set<Class<?>> providedTags) { EventChainNode parent = findParentChain(frame, binding); if (!(parent instanceof EventProviderWithInputChainNode)) { // this event is unreachable because nobody is listening to it. return null; } EventContext parentContext = parent.findProbe().getContext(); EventProviderWithInputChainNode parentChain = (EventProviderWithInputChainNode) parent; int index = indexOfChild(binding, rootNode, providedTags, parentContext.getInstrumentedNode(), parentContext.getInstrumentedSourceSection(), context.getInstrumentedNode()); if (index < 0 || index >= parentChain.inputCount) { // not found. a child got replaced? // TODO what to do if child was not found? // we should not continue with an out of bounds child index. assert false; return null; } ProbeNode probe = parent.findProbe(); return new InputValueChainNode(binding, probe, context, index); }
EventChainNode createParentEventChainCallback(VirtualFrame frame, EventBinding.Source<?> binding, RootNode rootNode, Set<Class<?>> providedTags) { EventChainNode parent = findParentChain(frame, binding); if (!(parent instanceof EventProviderWithInputChainNode)) { // this event is unreachable because nobody is listening to it. return null; } EventContext parentContext = parent.findProbe().getContext(); EventProviderWithInputChainNode parentChain = (EventProviderWithInputChainNode) parent; int index = indexOfChild(binding, rootNode, providedTags, parentContext.getInstrumentedNode(), parentContext.getInstrumentedSourceSection(), context.getInstrumentedNode()); if (index < 0 || index >= parentChain.inputCount) { // not found. a child got replaced? // probe should have been notified about this with notifyInserted assert throwIllegalASTAssertion(parentChain, parentContext, binding, rootNode, providedTags, index); return null; } ProbeNode probe = parent.findProbe(); return new InputValueChainNode(binding, probe, context, index); }
EventChainNode createBindings(VirtualFrame frame, ProbeNode probeNodeImpl) { EventContext context = probeNodeImpl.getContext(); SourceSection sourceSection = context.getInstrumentedSourceSection(); if (TRACE) { Node instrumentedNode = probeNodeImpl.getContext().getInstrumentedNode(); Set<Class<?>> providedTags = getProvidedTags(rootNode); EventChainNode root = null;
EventChainNode createBindings(VirtualFrame frame, ProbeNode probeNodeImpl) { EventContext context = probeNodeImpl.getContext(); SourceSection sourceSection = context.getInstrumentedSourceSection(); if (TRACE) { Node instrumentedNode = probeNodeImpl.getContext().getInstrumentedNode(); Set<Class<?>> providedTags = getProvidedTags(rootNode); EventChainNode root = null;
baseInput = 0; } else { EventContext parentContext = parentChain.findProbe().getContext(); int childIndex = indexOfChild(binding, rootNode, providedTags, parentContext.getInstrumentedNode(), parentContext.getInstrumentedSourceSection(), instrumentedNode); int inputBaseIndex = parentChain.inputBaseIndex;
baseInput = 0; } else { EventContext parentContext = parentChain.findProbe().getContext(); int childIndex = indexOfChild(binding, rootNode, providedTags, parentContext.getInstrumentedNode(), parentContext.getInstrumentedSourceSection(), instrumentedNode); int inputBaseIndex = parentChain.inputBaseIndex;