private static void clearFrame(MaterializedFrame frame) { FrameDescriptor descriptor = frame.getFrameDescriptor(); Object value = descriptor.getDefaultValue(); for (FrameSlot slot : descriptor.getSlots()) { frame.setObject(slot, value); } }
GuardedExecutableNode(TruffleLanguage<?> languageSPI, ExecutableNode fragment, MaterializedFrame frameLocation) { super(languageSPI); this.frameDescriptor = (frameLocation != null) ? frameLocation.getFrameDescriptor() : null; this.fragment = fragment; }
@Specialization(rewriteOn = FrameSlotTypeException.class) protected long readLong(VirtualFrame virtualFrame) throws FrameSlotTypeException { return this.getGlobalFrame().getLong(this.getSlot()); }
@Specialization(rewriteOn = FrameSlotTypeException.class) protected Object readObject(VirtualFrame virtualFrame) throws FrameSlotTypeException { return this.getGlobalFrame().getObject(this.getSlot()); }
@Specialization(contains = { "readLong", "readBoolean", "readObject", }) protected Object read(VirtualFrame virtualFrame) { return this.getGlobalFrame().getValue(this.getSlot()); } }
@Specialization(rewriteOn = FrameSlotTypeException.class) protected boolean readBoolean(VirtualFrame virtualFrame) throws FrameSlotTypeException { return this.getGlobalFrame().getBoolean(this.getSlot()); }
GuardedExecutableNode(TruffleLanguage<?> languageSPI, ExecutableNode fragment, MaterializedFrame frameLocation) { super(languageSPI); this.frameDescriptor = (frameLocation != null) ? frameLocation.getFrameDescriptor() : null; this.fragment = fragment; }
private static void clearFrame(RootNode root, MaterializedFrame frame) { FrameDescriptor descriptor = frame.getFrameDescriptor(); if (root.getFrameDescriptor() == descriptor) { // Clear only those frames that correspond to the current root Object value = descriptor.getDefaultValue(); for (FrameSlot slot : descriptor.getSlots()) { frame.setObject(slot, value); } } }
private static Object execute(MumblerNode[] nodes, MaterializedFrame globalFrame) { MumblerFunction function = MumblerFunction.create(new FrameSlot[] {}, nodes, globalFrame.getFrameDescriptor()); return function.callTarget.call(new Object[] {globalFrame}); } }
@Override protected CallTarget parse(Source source, Node node, String... argumentNames) throws IOException { MumblerContext context = new MumblerContext(); ListSyntax sexp = Reader.read(source); Converter converter = new Converter(TAIL_CALL_OPTIMIZATION_ENABLED); MumblerNode[] nodes = converter.convertSexp(context, sexp); MumblerFunction function = MumblerFunction.create(new FrameSlot[] {}, nodes, context.getGlobalFrame().getFrameDescriptor()); return function.callTarget; }