@Override public String getName() { return root.getName(); }
@Override boolean isRootIncluded(Set<Class<?>> providedTags, SourceSection rootSourceSection, RootNode rootNode, int rootNodeBits) { return predicate.test(rootNode.getName()); }
@Override boolean isRootIncluded(Set<Class<?>> providedTags, SourceSection rootSourceSection, RootNode rootNode, int rootNodeBits) { return predicate.test(rootNode.getName()); }
private String getName0() { RootNode root = findCurrentRoot(); if (root == null) { return null; } try { return root.getName(); } catch (ThreadDeath td) { throw td; } catch (Throwable ex) { return null; } }
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); } }
String name = rootNode.getName(); boolean included = includes.isEmpty(); if (name != null) {
/** * A description of the AST (expected to be a method or procedure name in most languages) that * identifies the AST for the benefit of guest language programmers using tools; it might * appear, for example in the context of a stack dump or trace and is not expected to be called * often. If the language does not provide such a description then <code>null</code> is * returned. * * <p> * This method is thread-safe. * * @since 0.17 */ public String getName() { verifyValidState(true); RootNode root = findCurrentRoot(); if (root == null) { return null; } try { return root.getName(); } catch (Throwable e) { /* Throw error if assertions are enabled. */ try { assert false; } catch (AssertionError e1) { throw e; } return null; } }
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); } }
if (target instanceof RootCallTarget) { RootNode root = ((RootCallTarget) target).getRootNode(); String name = root.getName(); if (name == null) { builder.append("unnamed-root");
/** * A description of the trace element. If the language does not provide such a description then * <code>null</code> is returned. * * @since 1.0 */ public String getName() { RootNode root = findCurrentRoot(); if (root == null) { return null; } try { return root.getName(); } catch (ThreadDeath td) { throw td; } catch (Throwable ex) { throw new DebugException(session, ex, root.getLanguageInfo(), null, true, null); } }
static Iterable<Scope> lexicalScope(Node node, Frame frame) { RootNode root = node.getRootNode(); String name = root.getName(); if (name == null) { name = "local"; } return Collections.singletonList(Scope.newBuilder(name, getVariables(root, frame)).node(root).arguments(getArguments(frame)).build()); }
static Iterable<Scope> lexicalScope(Node node, Frame frame) { RootNode root = node.getRootNode(); String name = root.getName(); if (name == null) { name = "local"; } return Collections.singletonList(Scope.newBuilder(name, getVariables(root, frame)).node(root).arguments(getArguments(frame)).build()); }
private static void dumpInlinedTrees(TruffleDebugContext debug, GraphOutput<AST, ?> output, final RootCallTarget callTarget, TruffleInlining inlining, List<RootCallTarget> dumped) throws IOException { for (DirectCallNode callNode : NodeUtil.findAllNodeInstances(callTarget.getRootNode(), DirectCallNode.class)) { CallTarget inlinedCallTarget = callNode.getCurrentCallTarget(); if (inlinedCallTarget instanceof RootCallTarget && callNode instanceof OptimizedDirectCallNode) { TruffleInliningDecision decision = inlining.findByCall((OptimizedDirectCallNode) callNode); if (decision != null && decision.shouldInline()) { final RootCallTarget rootCallTarget = (RootCallTarget) inlinedCallTarget; if (!dumped.contains(rootCallTarget)) { AST ast = new AST(rootCallTarget); output.beginGroup(ast, inlinedCallTarget.toString(), rootCallTarget.getRootNode().getName(), null, 0, debug.getVersionProperties()); output.print(ast, Collections.emptyMap(), 0, AFTER_PROFILING); output.endGroup(); dumped.add(rootCallTarget); dumpInlinedTrees(debug, output, (OptimizedCallTarget) inlinedCallTarget, decision, dumped); } } } } }
/** * A description of the AST (expected to be a method or procedure name in most languages) that * identifies the AST for the benefit of guest language programmers using tools; it might * appear, for example in the context of a stack dump or trace and is not expected to be called * often. If the language does not provide such a description then <code>null</code> is * returned. * * <p> * This method is thread-safe. * * @since 0.17 */ public String getName() throws DebugException { verifyValidState(true); RootNode root = findCurrentRoot(); if (root == null) { return null; } try { return root.getName(); } catch (ThreadDeath td) { throw td; } catch (Throwable ex) { throw new DebugException(event.getSession(), ex, root.getLanguageInfo(), null, true, null); } }
static PolyglotExceptionFrame createGuest(PolyglotExceptionImpl exception, TruffleStackTraceElement frame, boolean first) { if (frame == null) { return null; } RootNode targetRoot = frame.getTarget().getRootNode(); if (targetRoot.isInternal()) { return null; } LanguageInfo info = targetRoot.getLanguageInfo(); if (info == null) { return null; } PolyglotEngineImpl engine = exception.getEngine(); PolyglotLanguage language = engine.idToLanguage.get(info.getId()); String rootName = targetRoot.getName(); SourceSection location; Node callNode = frame.getLocation(); if (callNode != null) { com.oracle.truffle.api.source.SourceSection section = callNode.getEncapsulatingSourceSection(); if (section != null) { Source source = engine.getAPIAccess().newSource(language.getId(), section.getSource()); location = engine.getAPIAccess().newSourceSection(source, section); } else { location = null; } } else { location = first ? exception.getSourceLocation() : null; } return new PolyglotExceptionFrame(exception, language, location, rootName, false, null); }
static PolyglotExceptionFrame createGuest(PolyglotExceptionImpl exception, TruffleStackTraceElement frame, boolean first) { if (frame == null) { return null; } RootNode targetRoot = frame.getTarget().getRootNode(); if (targetRoot.isInternal()) { return null; } LanguageInfo info = targetRoot.getLanguageInfo(); if (info == null) { return null; } PolyglotEngineImpl engine = exception.context.getEngine(); PolyglotLanguage language = engine.idToLanguage.get(info.getId()); String rootName = targetRoot.getName(); SourceSection location; Node callNode = frame.getLocation(); if (callNode != null) { com.oracle.truffle.api.source.SourceSection section = callNode.getEncapsulatingSourceSection(); if (section != null) { Source source = engine.getAPIAccess().newSource(language.getId(), section.getSource()); location = engine.getAPIAccess().newSourceSection(source, section); } else { location = null; } } else { location = first ? exception.getSourceLocation() : null; } return new PolyglotExceptionFrame(exception, language, location, rootName, false, null); }