private static void clearFrame(MaterializedFrame frame) { FrameDescriptor descriptor = frame.getFrameDescriptor(); Object value = descriptor.getDefaultValue(); for (FrameSlot slot : descriptor.getSlots()) { frame.setObject(slot, value); } }
public FrameSlot findOrAddFrameSlot(Object identifier) { FrameSlot result = findFrameSlot(identifier); if (result != null) { return result; } return addFrameSlot(identifier); }
protected static MaterializedFrame getLexicalScope(Frame frame) { Object[] args = frame.getArguments(); if (args.length > 0) { return (MaterializedFrame) frame.getArguments()[0]; } else { return null; } } }
@Override public Object execute(VirtualFrame frame) { return frame.getArguments()[0]; } }
public Namespace(String name, Namespace parent) { this.functionName = name; this.parent = parent; this.frameDescriptor = new FrameDescriptor(); }
private void verifyGet(FrameSlot slot, FrameSlotKind accessKind) throws FrameSlotTypeException { int slotIndex = getSlotIndexChecked(slot); byte tag = tags[slotIndex]; if (accessKind == FrameSlotKind.Object ? tag != 0 : tag != accessKind.ordinal()) { throw new FrameSlotTypeException(); } }
MaterializedFrame findTruffleFrame() { if (currentFrame == null) { return event.getMaterializedFrame(); } else { return currentFrame.getFrame(FrameAccess.MATERIALIZE).materialize(); } }
@SuppressWarnings("deprecation") private static int getFrameSlotIndex(FrameSlot slot) { return slot.getIndex(); }
/** @since 0.8 or earlier */ FrameSlotKind() { this.tag = (byte) ordinal(); } }
GuardedExecutableNode(TruffleLanguage<?> languageSPI, ExecutableNode fragment, MaterializedFrame frameLocation) { super(languageSPI); this.frameDescriptor = (frameLocation != null) ? frameLocation.getFrameDescriptor() : null; this.fragment = fragment; }
/** * Accesses the underlying frame using a specified {@link FrameAccess access mode}. * * @see FrameAccess * @since 0.23 */ default Frame getFrame(FrameAccess access) { return getFrame(access, true); }
/** * Retrieve the list of all the identifiers associated with this frame descriptor. * * @return the list of all the identifiers in this frame descriptor * @since 0.8 or earlier */ public Set<Object> getIdentifiers() { return unmodifiableSetFromEconomicMap(identifierToSlotMap); }
/** * Invalidates the current, and create a new version assumption. */ private void updateVersion() { invalidateVersion(this); newVersion(this); }
public FrameSlot findOrAddFrameSlot(Object identifier, Object info, FrameSlotKind kind) { FrameSlot result = findFrameSlot(identifier); if (result != null) { return result; } return addFrameSlot(identifier, info, kind); }
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); } } }
@Override public Object execute(VirtualFrame frame) { Object[] args = frame.getArguments(); if (index < args.length) { return args[index]; } else { return LuaNull.SINGLETON; } }
/** * The foreign receiver in the frame. * * @param frame the frame that was called via * {@link #send(com.oracle.truffle.api.nodes.Node, com.oracle.truffle.api.interop.TruffleObject, java.lang.Object...) } * @return the receiver used when invoking the frame * @since 0.8 or earlier */ public static TruffleObject getReceiver(Frame frame) { return (TruffleObject) frame.getArguments()[InteropAccessNode.ARG0_RECEIVER]; }
/** @since 0.8 or earlier */ FrameSlotKind() { this.tag = (byte) ordinal(); } }
/** * Accesses the underlying frame using a specified {@link FrameAccess access mode}. * * @see FrameAccess * @since 0.23 */ default Frame getFrame(FrameAccess access) { return getFrame(access, true); }
public FrameSlot findOrAddFrameSlot(Object identifier, FrameSlotKind kind) { FrameSlot result = findFrameSlot(identifier); if (result != null) { return result; } return addFrameSlot(identifier, kind); }