Skip to content

Instantly share code, notes, and snippets.

@jnthn
Last active July 16, 2018 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnthn/f3a15e2902b43535f002d4ff60cdea4f to your computer and use it in GitHub Desktop.
Save jnthn/f3a15e2902b43535f002d4ff60cdea4f to your computer and use it in GitHub Desktop.
MVMSpeshFrameWalker fw;
MVM_spesh_frame_walker_init(tc, &fw, cur_caller_frame, 1); /* Or 0 to exclude lexical chains */
while (MVM_spesh_frame_walker_next(tc, &fw)) {
MVMRegister *found;
MVMuint16 found_kind;
if (MVM_spesh_frame_walker_get_lex(tc, &fw, name, &found, &found_kind)) {
if (found_kind == MVM_reg_obj) {
return found;
}
else {
char *c_name = MVM_string_utf8_encode_C_string(tc, name);
char *waste[] = { c_name, NULL };
MVM_exception_throw_adhoc_free(tc, waste,
"Lexical with name '%s' has wrong type",
c_name);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment