Skip to content

Commit

Permalink
Missing MVMROOT in Lexotic.
Browse files Browse the repository at this point in the history
Argument processing can cause boxing. If this caused a GC run (which
it did during debugging the "Undeclared variable..." heisenbug) then
we'd end up looking inside the wrong Lexotic, which most likely led to
corruption of the return value.
  • Loading branch information
jnthn committed Oct 11, 2013
1 parent 2db742c commit 6c409d9
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/6model/reprs/Lexotic.c
Expand Up @@ -8,12 +8,15 @@ static void invoke_handler(MVMThreadContext *tc, MVMObject *invokee, MVMCallsite
if (IS_CONCRETE(invokee)) {
MVMLexotic *lex = (MVMLexotic *)invokee;

/* Get argument and set as result. */
MVMArgProcContext arg_ctx; arg_ctx.named_used = NULL;
MVM_args_proc_init(tc, &arg_ctx, callsite, args);
MVM_ASSIGN_REF(tc, invokee, lex->body.result,
MVM_args_get_pos_obj(tc, &arg_ctx, 0, MVM_ARG_REQUIRED).arg.o);
MVM_args_proc_cleanup(tc, &arg_ctx);
/* Get argument and set as result. Need to root lex, as argument
* processing may box. */
MVMROOT(tc, lex, {
MVMArgProcContext arg_ctx; arg_ctx.named_used = NULL;
MVM_args_proc_init(tc, &arg_ctx, callsite, args);
MVM_ASSIGN_REF(tc, invokee, lex->body.result,
MVM_args_get_pos_obj(tc, &arg_ctx, 0, MVM_ARG_REQUIRED).arg.o);
MVM_args_proc_cleanup(tc, &arg_ctx);
});

/* Unwind to the lexotic handler. */
MVM_exception_gotolexotic(tc, lex->body.handler, lex->body.frame);
Expand Down

0 comments on commit 6c409d9

Please sign in to comment.