@Override public OptimizedCallTarget getCurrentCallTarget() { return (OptimizedCallTarget) super.getCurrentCallTarget(); }
/** @since 0.8 or earlier */ @Override public String toString() { return String.format("%s(target=%s)", getClass().getSimpleName(), getCurrentCallTarget()); }
@Override public String toString() { return String.format("%s(target=%s)", getClass().getSimpleName(), getCurrentCallTarget()); }
/** @since 0.8 or earlier */ @Override public String toString() { return String.format("%s(target=%s)", getClass().getSimpleName(), getCurrentCallTarget()); }
/** * Returns the {@link RootNode} associated with {@link CallTarget} returned by * {@link #getCurrentCallTarget()}. If the stored {@link CallTarget} does not contain a * {@link RootNode} this method returns <code>null</code>. * * @see #getCurrentCallTarget() * @return the root node of the used call target */ public final RootNode getCurrentRootNode() { CallTarget target = getCurrentCallTarget(); if (target instanceof RootCallTarget) { return ((RootCallTarget) target).getRootNode(); } return null; }
/** * Returns the {@link RootNode} associated with {@link CallTarget} returned by * {@link #getCurrentCallTarget()}. If the stored {@link CallTarget} does not contain a * {@link RootNode} this method returns <code>null</code>. * * @see #getCurrentCallTarget() * @return the root node of the used call target * @since 0.8 or earlier */ public final RootNode getCurrentRootNode() { CallTarget target = getCurrentCallTarget(); if (target instanceof RootCallTarget) { return ((RootCallTarget) target).getRootNode(); } return null; }
/** * Returns the {@link RootNode} associated with {@link CallTarget} returned by * {@link #getCurrentCallTarget()}. If the stored {@link CallTarget} does not contain a * {@link RootNode} this method returns <code>null</code>. * * @see #getCurrentCallTarget() * @return the root node of the used call target * @since 0.8 or earlier */ public final RootNode getCurrentRootNode() { CallTarget target = getCurrentCallTarget(); if (target instanceof RootCallTarget) { return ((RootCallTarget) target).getRootNode(); } return null; }
private static void build(RootCallTarget target, CallTreeNode parent, TruffleInlining inlining, CallTree graph) { if (inlining == null) { for (DirectCallNode callNode : NodeUtil.findAllNodeInstances((target).getRootNode(), DirectCallNode.class)) { CallTarget inlinedCallTarget = callNode.getCurrentCallTarget(); final CallTreeNode callTreeNode = graph.makeCallTreeNode(inlinedCallTarget); parent.edges.add(new CallTreeEdge(callTreeNode, "")); List<TruffleInlining> furtherDecisions = new ArrayList<>(); for (DirectCallNode callNode : NodeUtil.findAllNodeInstances((target).getRootNode(), DirectCallNode.class)) { CallTarget inlinedCallTarget = callNode.getCurrentCallTarget(); if (inlinedCallTarget instanceof OptimizedCallTarget && callNode instanceof OptimizedDirectCallNode) { TruffleInliningDecision decision = inlining.findByCall((OptimizedDirectCallNode) callNode);
private static void handleCallNodes(AST ast, TruffleInlining inliningDecisions, Node node, ASTNode astNode, ASTBlock currentBlock) { // Has this call node been handled already? if (astNode.edges.size() > 0) { return; } if (inliningDecisions != null) { if (node instanceof DirectCallNode) { final DirectCallNode callNode = (DirectCallNode) node; final CallTarget inlinedCallTarget = callNode.getCurrentCallTarget(); if (inlinedCallTarget instanceof OptimizedCallTarget && callNode instanceof OptimizedDirectCallNode) { TruffleInliningDecision decision = inliningDecisions.findByCall((OptimizedDirectCallNode) callNode); if (decision != null && decision.shouldInline()) { final RootNode targetRootNode = ((OptimizedCallTarget) inlinedCallTarget).getRootNode(); final ASTNode astTargetRootNode = ast.makeASTNode(targetRootNode); astNode.edges.add(new ASTEdge(astTargetRootNode, inlinedCallTarget.toString())); astNode.setNewClass(); final ASTBlock newBlock = ast.makeASTBlock(); if (currentBlock != null) { currentBlock.successors.add(newBlock); } newBlock.nodes.add(astTargetRootNode); traverseNodes(targetRootNode, astTargetRootNode, ast, decision, newBlock); } } } } } }
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); } } } } }