Skip to content

Instantly share code, notes, and snippets.

@chrisseaton
Created May 16, 2018 22:48
Show Gist options
  • Save chrisseaton/606ea22146ed91324d20ae70584517c8 to your computer and use it in GitHub Desktop.
Save chrisseaton/606ea22146ed91324d20ae70584517c8 to your computer and use it in GitHub Desktop.
public long readLong(VirtualFrame vframe) {
return readLongHelper(vframe.materialize());
}
@TruffleBoundary
public long readLongHelper(MaterializedFrame vframe) {
try {
return vframe.getLong(getSlot());
} catch (FrameSlotTypeException e) { }
MaterializedFrame frame = getLexicalScope(vframe);
while (true) {
try {
return frame.getLong(getSlot());
} catch (FrameSlotTypeException e) {
frame = getLexicalScope(frame);
if (frame == null) {
throw new RuntimeException("Undefined variable " + getSlot().getIdentifier());
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment