/** * 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]; }
/** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getBoolean(FrameSlot) * @since 0.8 or earlier */ public static boolean getBooleanSafe(Frame frame, FrameSlot frameSlot) { try { return frame.getBoolean(frameSlot); } catch (FrameSlotTypeException e) { throw new IllegalStateException(); } }
/** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getByte(FrameSlot) * @since 0.8 or earlier */ public static byte getByteSafe(Frame frame, FrameSlot frameSlot) { try { return frame.getByte(frameSlot); } catch (FrameSlotTypeException e) { throw new IllegalStateException(); } }
@SuppressWarnings("deprecation") public final Frame getFrame(FrameAccess access) { if (access == FrameAccess.NONE) { return null; } Frame localFrame = this.frame; switch (access) { case READ_ONLY: /* Verify that it is really used read only. */ return new ReadOnlyFrame(localFrame); case READ_WRITE: return localFrame; case MATERIALIZE: return localFrame.materialize(); } throw new AssertionError(); }
slots = root.getFrameDescriptor().getSlots(); } else { slots = frame.getFrameDescriptor().getSlots(); if (frame.getValue(slots.get(i)) == null) { if (nonNulls == null) { nonNulls = new ArrayList<>(slots.size());
/** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getObject(FrameSlot) */ public static Object getObjectSafe(Frame frame, FrameSlot frameSlot) { try { return frame.getObject(frameSlot); } catch (FrameSlotTypeException e) { throw new IllegalStateException(); } }
/** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getLong(FrameSlot) * @since 0.8 or earlier */ public static long getLongSafe(Frame frame, FrameSlot frameSlot) { try { return frame.getLong(frameSlot); } catch (FrameSlotTypeException e) { throw new IllegalStateException(); } }
/** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getFloat(FrameSlot) */ public static float getFloatSafe(Frame frame, FrameSlot frameSlot) { try { return frame.getFloat(frameSlot); } catch (FrameSlotTypeException e) { throw new IllegalStateException(); } } }
/** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getInt(FrameSlot) */ public static int getIntSafe(Frame frame, FrameSlot frameSlot) { try { return frame.getInt(frameSlot); } catch (FrameSlotTypeException e) { throw new IllegalStateException(); } }
/** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getDouble(FrameSlot) */ public static double getDoubleSafe(Frame frame, FrameSlot frameSlot) { try { return frame.getDouble(frameSlot); } catch (FrameSlotTypeException e) { throw new IllegalStateException(); } }
@Override @TruffleBoundary public FrameDescriptor getFrameDescriptor() { return delegate.getFrameDescriptor(); }
@SuppressWarnings("deprecation") public final Frame getFrame(FrameAccess access) { if (access == FrameAccess.NONE) { return null; } Frame localFrame = this.frame; switch (access) { case READ_ONLY: /* Verify that it is really used read only. */ return new ReadOnlyFrame(localFrame); case READ_WRITE: return localFrame; case MATERIALIZE: return localFrame.materialize(); } throw new AssertionError(); }
slots = root.getFrameDescriptor().getSlots(); } else { slots = frame.getFrameDescriptor().getSlots(); for (int i = 0; i < slots.size(); i++) { FrameSlot slot = slots.get(i); if (frame.getValue(slot) == null || isInternal(slot)) { if (nonNulls == null) { nonNulls = new ArrayList<>(slots.size());
/** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getObject(FrameSlot) * @since 0.8 or earlier */ public static Object getObjectSafe(Frame frame, FrameSlot frameSlot) { try { return frame.getObject(frameSlot); } catch (FrameSlotTypeException e) { throw new IllegalStateException(); } }
/** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getLong(FrameSlot) */ public static long getLongSafe(Frame frame, FrameSlot frameSlot) { try { return frame.getLong(frameSlot); } catch (FrameSlotTypeException e) { throw new IllegalStateException(); } }
/** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getFloat(FrameSlot) * @since 0.8 or earlier */ public static float getFloatSafe(Frame frame, FrameSlot frameSlot) { try { return frame.getFloat(frameSlot); } catch (FrameSlotTypeException e) { throw new IllegalStateException(); } } }
/** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getInt(FrameSlot) * @since 0.8 or earlier */ public static int getIntSafe(Frame frame, FrameSlot frameSlot) { try { return frame.getInt(frameSlot); } catch (FrameSlotTypeException e) { throw new IllegalStateException(); } }
/** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getDouble(FrameSlot) * @since 0.8 or earlier */ public static double getDoubleSafe(Frame frame, FrameSlot frameSlot) { try { return frame.getDouble(frameSlot); } catch (FrameSlotTypeException e) { throw new IllegalStateException(); } }
@Override @TruffleBoundary public FrameDescriptor getFrameDescriptor() { return delegate.getFrameDescriptor(); }
MaterializedFrame findTruffleFrame() { if (currentFrame == null) { return event.getMaterializedFrame(); } else { return currentFrame.getFrame(FrameAccess.MATERIALIZE).materialize(); } }