com.oracle.truffle.api.instrumentation.Tag Java Examples

The following examples show how to use com.oracle.truffle.api.instrumentation.Tag. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RawEventsTracingSupport.java    From nodeprof.js with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public static final String getTagNames(JavaScriptNode node) {
    String tags = "";

    if (node.hasTag(StandardTags.StatementTag.class)) {
        tags += "STMT ";
    }
    if (node.hasTag(StandardTags.RootTag.class)) {
        tags += "ROOT ";
    }
    if (node.hasTag(StandardTags.RootBodyTag.class)) {
        tags += "BODY ";
    }
    for (Class<?> c : ALL) {
        if (node.hasTag((Class<? extends Tag>) c)) {
            tags += c.getSimpleName() + " ";
        }
    }
    return tags;
}
 
Example #2
Source File: HashemStatementNode.java    From mr-hashemi with Universal Permissive License v1.0 5 votes vote down vote up
public boolean hasTag(Class<? extends Tag> tag) {
    if (tag == StandardTags.StatementTag.class) {
        return hasStatementTag;
    } else if (tag == StandardTags.RootTag.class || tag == StandardTags.RootBodyTag.class) {
        return hasRootTag;
    }
    return false;
}
 
Example #3
Source File: HashemDebuggerNode.java    From mr-hashemi with Universal Permissive License v1.0 5 votes vote down vote up
@Override
public boolean hasTag(Class<? extends Tag> tag) {
    if (tag == DebuggerTags.AlwaysHalt.class) {
        return true;
    }
    return super.hasTag(tag);
}
 
Example #4
Source File: HashemInvokeNode.java    From mr-hashemi with Universal Permissive License v1.0 5 votes vote down vote up
@Override
public boolean hasTag(Class<? extends Tag> tag) {
    if (tag == StandardTags.CallTag.class) {
        return true;
    }
    return super.hasTag(tag);
}
 
Example #5
Source File: HashemExpressionNode.java    From mr-hashemi with Universal Permissive License v1.0 5 votes vote down vote up
@Override
public boolean hasTag(Class<? extends Tag> tag) {
    if (tag == StandardTags.ExpressionTag.class) {
        return hasExpressionTag;
    }
    return super.hasTag(tag);
}
 
Example #6
Source File: NodeProfAnalysis.java    From nodeprof.js with Apache License 2.0 5 votes vote down vote up
@TruffleBoundary
public void onSingleTagCallback(Class<? extends Tag> tag, ExecutionEventNodeFactory factory,
                SourcePredicate sourcePredicate) {
    getInstrumenter().attachExecutionEventFactory(
                    SourceSectionFilter.newBuilder().tagIs(tag).sourceIs(sourcePredicate).build(),
                    SourceSectionFilter.newBuilder().tagIs(StandardTags.ExpressionTag.class, JSTags.InputNodeTag.class).build(),
                    factory);
}
 
Example #7
Source File: SendBytecodes.java    From trufflesqueak with MIT License 5 votes vote down vote up
@Override
public final boolean hasTag(final Class<? extends Tag> tag) {
    if (tag == StandardTags.CallTag.class) {
        return true;
    }
    if (tag == DebuggerTags.AlwaysHalt.class) {
        return PrimExitToDebuggerNode.SELECTOR_NAME.equals(selector.asStringUnsafe());
    }
    return super.hasTag(tag);
}
 
Example #8
Source File: NodeProfAnalysis.java    From nodeprof.js with Apache License 2.0 4 votes vote down vote up
@TruffleBoundary
public void onSingleTagCallback(Class<? extends Tag> tag, ExecutionEventNodeFactory factory) {
    onSingleTagCallback(tag, factory, getFilter());
}
 
Example #9
Source File: TruffleAST.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static void fillNode(Node node, StringBuilder nodes) {
    nodes.append(node.getClass().getName());
    nodes.append('\n');
    nodes.append(node.getDescription());
    nodes.append('\n');
    SourceSection ss = node.getSourceSection();
    if (ss == null) {
        nodes.append('\n');
    } else {
        nodes.append(ss.getSource().getURI().toString());
        nodes.append('\n');
        nodes.append(Integer.toString(ss.getStartLine()));
        nodes.append(':');
        nodes.append(Integer.toString(ss.getStartColumn()));
        nodes.append('-');
        nodes.append(Integer.toString(ss.getEndLine()));
        nodes.append(':');
        nodes.append(Integer.toString(ss.getEndColumn()));
        nodes.append('\n');
        //nodes.add(ss.getCode());
    }
    // TAGS:
    try {
        StringBuilder tags = new StringBuilder();
        if (node instanceof InstrumentableNode) {
            InstrumentableNode inode = (InstrumentableNode) node;
            for (Class<?> tag : StandardTags.class.getDeclaredClasses()) {
                if (Tag.class.isAssignableFrom(tag)) {
                    if (inode.hasTag(tag.asSubclass(Tag.class))) {
                        if (tags.length() > 0) {
                            tags.append(',');
                        }
                        tags.append(tag.getSimpleName());
                    }
                }
            }
        }
        nodes.append(tags);
    } catch (Throwable t) {
    }
    nodes.append('\n');
    List<Node> ch = NodeUtil.findNodeChildren(node);
    nodes.append(Integer.toString(ch.size()));
    nodes.append('\n');
    for (Node n : ch) {
        fillNode(n, nodes);
    }
}
 
Example #10
Source File: ExecuteContextNode.java    From trufflesqueak with MIT License 4 votes vote down vote up
@Override
public boolean hasTag(final Class<? extends Tag> tag) {
    return StandardTags.RootTag.class == tag;
}
 
Example #11
Source File: PushBytecodes.java    From trufflesqueak with MIT License 4 votes vote down vote up
@Override
public boolean hasTag(final Class<? extends Tag> tag) {
    return tag == StandardTags.StatementTag.class;
}
 
Example #12
Source File: AbstractInstrumentableBytecodeNode.java    From trufflesqueak with MIT License 4 votes vote down vote up
@Override
public boolean hasTag(final Class<? extends Tag> tag) {
    return tag == StandardTags.StatementTag.class;
}