com.oracle.truffle.api.instrumentation.InstrumentableNode Java Examples
The following examples show how to use
com.oracle.truffle.api.instrumentation.InstrumentableNode.
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: BaseEventHandlerNode.java From nodeprof.js with Apache License 2.0 | 5 votes |
/** * * get the node-specific attribute, in case of missing such attributes report an error * * @param key of the current InstrumentableNode * @return the value of this key */ public Object getAttribute(String key) { Object result = null; try { result = InteropLibrary.getFactory().getUncached().readMember(((InstrumentableNode) context.getInstrumentedNode()).getNodeObject(), key); } catch (Exception e) { reportAttributeMissingError(key, e); } return result; }
Example #2
Source File: BaseEventHandlerNode.java From nodeprof.js with Apache License 2.0 | 5 votes |
/** * * get the node-specific attribute, in case of missing such attributes, return null * * @param key of the current InstrumentableNode * @return the value of this key */ public Object getAttributeNoReport(String key) { Object result = null; try { result = InteropLibrary.getFactory().getUncached().readMember(((InstrumentableNode) context.getInstrumentedNode()).getNodeObject(), key); } catch (Exception e) { return null; } return result; }
Example #3
Source File: TruffleAST.java From netbeans with Apache License 2.0 | 4 votes |
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); } }