CancelExecution(EventContext context) { this.node = context.getInstrumentedNode(); }
public Node getInstrumentedNode() { return eventContext.getInstrumentedNode(); }
public Node getInstrumentedNode() { return eventContext.getInstrumentedNode(); }
CancelExecution(EventContext context) { this.node = context.getInstrumentedNode(); }
StackTraceEntry(Instrumenter instrumenter, EventContext context, byte state) { this.tags = instrumenter.queryTags(context.getInstrumentedNode()); this.sourceSection = context.getInstrumentedSourceSection(); this.instrumentedNode = context.getInstrumentedNode(); this.rootName = extractRootName(instrumentedNode); this.state = state; }
private boolean isNullOrInteropValue(Object result) { if (!(context.getInstrumentedNode() instanceof InstrumentableNode)) { // legacy support return true; } if (result == null) { return true; } AccessorInstrumentHandler.interopAccess().checkInteropType(result); return true; }
private boolean isNullOrInteropValue(Object result) { if (!(context.getInstrumentedNode() instanceof InstrumentableNode)) { // legacy support return true; } if (result == null) { return true; } AccessorInstrumentHandler.interopAccess().checkInteropType(result); return true; }
public SourceSection getInstrumentedSourceSection() { SourceSection ss = eventContext.getInstrumentedSourceSection(); if (ss == null) { Node node = eventContext.getInstrumentedNode(); // Nodes tagged with standard tags should have a source section attached. PrintStream err = new PrintStream(env.err()); err.print("WARNING: Instrumented node " + node + " of class " + node.getClass() + " has null SourceSection."); ss = node.getEncapsulatingSourceSection(); if (ss == null) { RootNode root = node.getRootNode(); err.print("WARNING: and null encapsulating SourceSection under " + root + " of class = " + root.getClass()); } err.flush(); } return ss; }
public String getRootName() { RootNode rootNode = context.getInstrumentedNode().getRootNode(); if (rootNode == null) { // defensive check return null; } try { return rootNode.getName(); } catch (Throwable t) { throw wrapHostError(t); } }
public ExecutionEventNode create(EventContext context) { Node instrumentedNode = context.getInstrumentedNode(); if (instrumentedNode.getSourceSection() == null) { logger.warning("Instrumented node " + instrumentedNode + " has null SourceSection."); return null; } return new StackPushPopNode(ShadowStack.this, instrumenter, context, compiledOnly); } });
@Override protected void onDispose(VirtualFrame frame) { FrameDescriptor frameDescriptor = context.getInstrumentedNode().getRootNode().getFrameDescriptor(); if (frameDescriptor.getIdentifiers().contains(KEY_TIME_STARTED)) { frameDescriptor.removeFrameSlot(KEY_TIME_STARTED); } if (frameDescriptor.getIdentifiers().contains(KEY_PARENT_COUNTER)) { frameDescriptor.removeFrameSlot(KEY_PARENT_COUNTER); } }
private ExecutionEventNode createCountingNode(EventContext context) { SourceSection sourceSection = context.getInstrumentedSourceSection(); Counter counter = counters.get(sourceSection); if (counter == null) { final RootNode rootNode = context.getInstrumentedNode().getRootNode(); counter = new Counter(sourceSection, rootNode == null ? "<unknown>>" : rootNode.getName()); counters.put(sourceSection, counter); } if (isTiming) { return TimedCounterNode.create(this, counter, context); } else { return new CounterNode(this, counter); } }
@TruffleBoundary void doBreak(MaterializedFrame frame, DebuggerSession[] debuggerSessions, BreakpointConditionFailure conditionError, Throwable exception, BreakpointExceptionFilter.Match matched) { Node throwLocation = getContext().getInstrumentedNode(); getBreakpoint().doBreak(this, debuggerSessions, frame, false, null, exception, throwLocation, matched.isCatchNodeComputed, matched.catchLocation, conditionError); } }
TimedCounterNode(Profiler profiler, Counter counter, EventContext context) { super(profiler, counter); this.context = context; FrameDescriptor frameDescriptor = context.getInstrumentedNode().getRootNode().getFrameDescriptor(); this.timeStartedSlot = frameDescriptor.findOrAddFrameSlot(KEY_TIME_STARTED, "profiler:timeStarted", FrameSlotKind.Long); this.parentCounterSlot = frameDescriptor.findOrAddFrameSlot(KEY_PARENT_COUNTER, "profiler:parentCounter", FrameSlotKind.Object); }
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); }
final EventContext getInputContext(int index) { EventContext[] contexts = inputContexts; if (contexts == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); ProbeNode probe = findProbe(); EventContext thisContext = probe.context; RootNode rootNode = getRootNode(); Set<Class<?>> providedTags = probe.handler.getProvidedTags(rootNode); inputContexts = contexts = findChildContexts(getBinding(), rootNode, providedTags, thisContext.getInstrumentedNode(), thisContext.getInstrumentedSourceSection(), inputCount); } if (contexts == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); throw new IllegalStateException("Input event context not yet available. They are only available during event notifications."); } return contexts[index]; }
final EventContext getInputContext(int index) { EventContext[] contexts = inputContexts; if (contexts == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); ProbeNode probe = findProbe(); EventContext thisContext = probe.context; RootNode rootNode = getRootNode(); Set<Class<?>> providedTags = probe.handler.getProvidedTags(rootNode); inputContexts = contexts = findChildContexts(getBinding(), rootNode, providedTags, thisContext.getInstrumentedNode(), thisContext.getInstrumentedSourceSection(), inputCount); } if (contexts == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); throw new IllegalStateException("Input event context not yet available. They are only available during event notifications."); } return contexts[index]; }
/** * Test if language context of the source of the event is initialized. * * @since 0.26 */ public boolean isLanguageContextInitialized() { CompilerAsserts.neverPartOfCompilation(); Node node = getInstrumentedNode(); if (node == null) { return true; } RootNode root = node.getRootNode(); if (root == null) { return true; } LanguageInfo languageInfo = root.getLanguageInfo(); Env env = AccessorInstrumentHandler.engineAccess().getEnvForInstrument(languageInfo); return AccessorInstrumentHandler.langAccess().isContextInitialized(env); }
/** * Test if language context of the source of the event is initialized. * * @since 0.26 */ public boolean isLanguageContextInitialized() { CompilerAsserts.neverPartOfCompilation(); Node node = getInstrumentedNode(); if (node == null) { return true; } RootNode root = node.getRootNode(); if (root == null) { return true; } LanguageInfo languageInfo = root.getLanguageInfo(); Env env = AccessorInstrumentHandler.engineAccess().getEnvForInstrument(languageInfo); return AccessorInstrumentHandler.langAccess().isContextInitialized(env); }