@Specialization public RubyString fullTree() { notDesignedForCompilation(); return getContext() .makeString( NodeUtil.printTreeToString( Truffle.getRuntime().getCallerFrame().getCallNode().getRootNode())); }
@Test public void test() { TruffleRuntime runtime = Truffle.getRuntime(); TestRootNode rootNode = new TestRootNode(new TestArgumentNode[] {new TestArgumentNode(0), new TestArgumentNode(1)}); CallTarget target = runtime.createCallTarget(rootNode); Object result = target.call(new TestArguments(20, 22)); Assert.assertEquals(42, result); }
/** * Slow-path code for a call, used when the polymorphic inline cache exceeded its maximum size. Such * calls are not optimized any further, e.g., no method inlining is performed. */ final class LlvmGenericDispatchNode extends LlvmAbstractDispatchNode { /** * {@link IndirectCallNode} is part of the Truffle API and handles all the steps necessary for * calling a megamorphic call-site. The Graal specific version of this node performs additional * optimizations for the fast access of the SimpleLanguage stack trace. */ @Child private IndirectCallNode callNode = Truffle.getRuntime().createIndirectCallNode(); @Override protected Object executeDispatch(VirtualFrame frame, LlvmFunction function, Object[] arguments) { /* * Llvm has a quite simple call lookup: just ask the function for the current call target, * and call it. */ return callNode.call(frame, function.getCallTarget(), arguments); } }