当前位置: 首页>>代码示例>>Java>>正文


Java Node类代码示例

本文整理汇总了Java中com.oracle.truffle.api.nodes.Node的典型用法代码示例。如果您正苦于以下问题:Java Node类的具体用法?Java Node怎么用?Java Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Node类属于com.oracle.truffle.api.nodes包,在下文中一共展示了Node类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findCallsTo

import com.oracle.truffle.api.nodes.Node; //导入依赖的package包/类
/**
 * Finds all {@link DirectCallNode} instances calling a certain original {@link CallTarget} in a
 * given {@link RootNode}.
 */
@TruffleBoundary
protected static final Set<DirectCallNode> findCallsTo(RootNode root, OptimizedCallTarget originalCallTarget) {
    final Set<DirectCallNode> allCallNodes = new HashSet<>();
    root.accept(new NodeVisitor() {
        @Override
        public boolean visit(Node node) {
            if (node instanceof DirectCallNode) {
                DirectCallNode callNode = (DirectCallNode) node;
                if (callNode.getCallTarget() == originalCallTarget || callNode.getClonedCallTarget() == originalCallTarget) {
                    allCallNodes.add(callNode);
                }
            }
            return true;
        }
    });
    return allCallNodes;
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:22,代码来源:SLGraalRuntimeBuiltin.java

示例2: notifyCompilationSuccess

import com.oracle.truffle.api.nodes.Node; //导入依赖的package包/类
@Override
public void notifyCompilationSuccess(OptimizedCallTarget target, TruffleInlining inliningDecision, StructuredGraph graph, CompilationResult result,
                Map<OptimizedCallTarget, Object> compilationMap) {
    super.notifyCompilationSuccess(target, inliningDecision, graph, result, compilationMap);

    for (Node node : target.nodeIterable(inliningDecision)) {
        if (node != null && (node.getCost() == NodeCost.MEGAMORPHIC || node.getCost() == NodeCost.POLYMORPHIC)) {
            NodeCost cost = node.getCost();
            Map<String, Object> props = new LinkedHashMap<>();
            props.put("simpleName", node.getClass().getSimpleName());
            props.put("subtree", "\n" + NodeUtil.printCompactTreeToString(node));
            String msg = cost == NodeCost.MEGAMORPHIC ? "megamorphic" : "polymorphic";
            log(0, msg, node.toString(), props);
        }
    }
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:17,代码来源:TraceCompilationPolymorphismListener.java

示例3: visit

import com.oracle.truffle.api.nodes.Node; //导入依赖的package包/类
@Override
public boolean visit(Node node) {
    if (node instanceof OptimizedDirectCallNode) {
        OptimizedDirectCallNode callNode = (OptimizedDirectCallNode) node;
        TruffleInlining inlining = stack.get(stack.size() - 1);
        if (inlining != null) {
            TruffleInliningDecision childInlining = inlining.findByCall(callNode);
            if (childInlining != null) {
                stack.add(childInlining);
                continueTraverse = visitNode(node);
                if (continueTraverse && childInlining.isInline()) {
                    childInlining.getTarget().getRootNode().accept(this);
                }
                stack.remove(stack.size() - 1);
            }
        }
        return continueTraverse;
    } else {
        continueTraverse = visitNode(node);
        return continueTraverse;
    }
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:23,代码来源:TruffleInlining.java

示例4: nodeReplaced

import com.oracle.truffle.api.nodes.Node; //导入依赖的package包/类
@Override
public boolean nodeReplaced(Node oldNode, Node newNode, CharSequence reason) {
    CompilerAsserts.neverPartOfCompilation();
    if (isValid()) {
        invalidate(newNode, reason);
    }
    /* Notify compiled method that have inlined this call target that the tree changed. */
    invalidateNodeRewritingAssumption();

    OptimizedCompilationProfile profile = this.compilationProfile;
    if (profile != null) {
        profile.reportNodeReplaced();
        if (cancelInstalledTask(newNode, reason)) {
            profile.reportInvalidated();
        }
    }
    return false;
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:19,代码来源:OptimizedCallTarget.java

示例5: onLoopCount

import com.oracle.truffle.api.nodes.Node; //导入依赖的package包/类
@Override
public void onLoopCount(Node source, int count) {
    Node node = source;
    Node parentNode = source != null ? source.getParent() : null;
    while (node != null) {
        if (node instanceof OptimizedOSRLoopNode) {
            ((OptimizedOSRLoopNode) node).reportChildLoopCount(count);
        }
        parentNode = node;
        node = node.getParent();
    }
    if (parentNode != null && parentNode instanceof RootNode) {
        CallTarget target = ((RootNode) parentNode).getCallTarget();
        if (target instanceof OptimizedCallTarget) {
            ((OptimizedCallTarget) target).onLoopCount(count);
        }
    }
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:19,代码来源:GraalTVMCI.java

示例6: doLoop

import com.oracle.truffle.api.nodes.Node; //导入依赖的package包/类
public static long doLoop(final DirectCallNode value,
    final Node loopNode, final long receiver, final long limit, final long step,
    final SBlock block) {
  try {
    if (receiver <= limit) {
      value.call(new Object[] {block, receiver});
    }
    for (long i = receiver + step; i <= limit; i += step) {
      value.call(new Object[] {block, i});
      ObjectTransitionSafepoint.INSTANCE.checkAndPerformSafepoint();
    }
  } finally {
    if (CompilerDirectives.inInterpreter()) {
      long loopCount = limit - receiver;
      if (loopCount > 0) {
        SomLoop.reportLoopCount(loopCount, loopNode);
      }
    }
  }
  return receiver;
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:22,代码来源:IntToByDoMessageNode.java

示例7: create

import com.oracle.truffle.api.nodes.Node; //导入依赖的package包/类
public ExecutionEventNode create(final EventContext ec) {
            final PrintStream out = new PrintStream(env.out());

            return new ExecutionEventNode() {
                /*@Override
                protected void onReturnValue(VirtualFrame frame, Object result) {
                    out.println("return" + this);
                }*/

                @Override
                protected void onEnter(VirtualFrame frame) {
                    Node node = ec.getInstrumentedNode();
                    out.println("node: " + node);
                    out.println("-> " + node.getEncapsulatingSourceSection().toString());
//                    if (node instanceof InvokeNode) {
//                        InvokeNode invokeNode = (InvokeNode) node;
//                        out.println("invoke: " + invokeNode.getForm());
//                    } else if (node instanceof EvalFactory.EvalNodeGen) {
//                        EvalFactory.EvalNodeGen evalNode = (EvalFactory.EvalNodeGen) node;
//                        out.println("eval: " + evalNode);
//                    } else if (node instanceof RootNode) {
//                        RootNode rootNode = (RootNode) node;
//                        out.println("root: " + rootNode);
//                    }
                }

            };
        }
 
开发者ID:ragnard,项目名称:shen-truffle,代码行数:29,代码来源:TraceInstrument.java

示例8: evaluateCondition

import com.oracle.truffle.api.nodes.Node; //导入依赖的package包/类
private boolean evaluateCondition(VirtualFrame frame) {
    Object ret = conditionNode.executeGeneric(frame);
    if (ret == Symbol.TRUE) {
        return true;
    } else if (ret == Symbol.FALSE) {
        return false;
    } else {
        throw new UnsupportedSpecializationException(this, new Node[]{conditionNode}, ret);
    }
}
 
开发者ID:ragnard,项目名称:shen-truffle,代码行数:11,代码来源:IfNode.java

示例9: formatStackFrame

import com.oracle.truffle.api.nodes.Node; //导入依赖的package包/类
private static String formatStackFrame(FrameInstance frameInstance, CallTarget target) {
    StringBuilder builder = new StringBuilder();
    if (target instanceof RootCallTarget) {
        RootNode root = ((RootCallTarget) target).getRootNode();
        String name = root.getName();
        if (name == null) {
            builder.append("unnamed-root");
        } else {
            builder.append(name);
        }
        Node callNode = frameInstance.getCallNode();
        SourceSection sourceSection = null;
        if (callNode != null) {
            sourceSection = callNode.getEncapsulatingSourceSection();
        }
        if (sourceSection == null) {
            sourceSection = root.getSourceSection();
        }

        if (sourceSection == null || sourceSection.getSource() == null) {
            builder.append("(Unknown)");
        } else {
            builder.append("(").append(formatPath(sourceSection)).append(":").append(sourceSection.getStartLine()).append(")");
        }

        if (target instanceof OptimizedCallTarget) {
            OptimizedCallTarget callTarget = ((OptimizedCallTarget) target);
            if (callTarget.isValid()) {
                builder.append(" <opt>");
            }
            if (callTarget.getSourceCallTarget() != null) {
                builder.append(" <split-" + Integer.toHexString(callTarget.hashCode()) + ">");
            }
        }

    } else {
        builder.append(target.toString());
    }
    return builder.toString();
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:41,代码来源:HotSpotTruffleRuntime.java

示例10: InlineTestRootNode

import com.oracle.truffle.api.nodes.Node; //导入依赖的package包/类
InlineTestRootNode(int size, String name) {
    super(null);

    children = new Node[size];
    for (int i = 0; i < children.length; i++) {
        children[i] = new InlineTestRootNode(0, "");
    }
    this.name = name;
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:10,代码来源:TruffleInliningTest.java

示例11: execute

import com.oracle.truffle.api.nodes.Node; //导入依赖的package包/类
@Override
public Object execute(VirtualFrame frame) {

    int maxRecursionDepth = (int) frame.getArguments()[0];
    if (maxRecursionDepth < 100) {
        for (Node child : children) {
            if (child instanceof OptimizedDirectCallNode) {
                OptimizedDirectCallNode callNode = (OptimizedDirectCallNode) child;
                frame.getArguments()[0] = maxRecursionDepth + 1;
                callNode.call(frame.getArguments());
            }
        }
    }
    return null;
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:16,代码来源:TruffleInliningTest.java

示例12: executeAndSpecialize

import com.oracle.truffle.api.nodes.Node; //导入依赖的package包/类
private synchronized Object executeAndSpecialize(Object arg0Value) {
    if (arg0Value instanceof AbstractType) {
        AbstractType arg0Value0 = (AbstractType) arg0Value;
        CachedData s1 = cached;
        AbstractType cachedOperand = (arg0Value0);
        s1 = new CachedData(cached, cachedOperand);
        this.cached = s1;
        return s1.cachedOperand.someMethod();
    }
    CompilerDirectives.transferToInterpreterAndInvalidate();
    throw new UnsupportedSpecializationException(this, new Node[]{});
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:13,代码来源:ExplodeLoopBlockDuplicationTest.java

示例13: findOSRTarget

import com.oracle.truffle.api.nodes.Node; //导入依赖的package包/类
private static OptimizedCallTarget findOSRTarget(Node loopNode) {
    if (loopNode instanceof OptimizedOSRLoopNode) {
        return ((OptimizedOSRLoopNode) loopNode).getCompiledOSRLoop();
    }

    for (Node child : loopNode.getChildren()) {
        OptimizedCallTarget target = findOSRTarget(child);
        if (target != null) {
            return target;
        }
    }

    return null;
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:15,代码来源:OptimizedCallTargetTest.java

示例14: compileImpl

import com.oracle.truffle.api.nodes.Node; //导入依赖的package包/类
private OptimizedCallTarget compileImpl(VirtualFrame frame) {
    RootNode root = getRootNode();
    Node parent = getParent();
    if (speculationLog == null) {
        speculationLog = GraalTruffleRuntime.getRuntime().createSpeculationLog();
    }
    OptimizedCallTarget osrTarget = (OptimizedCallTarget) GraalTruffleRuntime.getRuntime().createCallTarget(createRootNodeImpl(root, frame.getClass()));
    osrTarget.setSpeculationLog(speculationLog);
    // let the old parent re-adopt the children
    parent.adoptChildren();
    osrTarget.compile();
    return osrTarget;
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:14,代码来源:OptimizedOSRLoopNode.java

示例15: nodeClasses

import com.oracle.truffle.api.nodes.Node; //导入依赖的package包/类
private static Collection<Class<?>> nodeClasses(StructuredGraph graph) {
    Collection<Class<?>> classes = new ArrayList<>();
    for (org.graalvm.compiler.graph.Node node : graph.getNodes()) {
        classes.add(node.getClass());
    }
    return classes;
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:8,代码来源:CompilationStatisticsListener.java


注:本文中的com.oracle.truffle.api.nodes.Node类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。