Skip to content

Commit

Permalink
Fix another possible access to fromspace in boot_code
Browse files Browse the repository at this point in the history
We also need to protect code from getting moved by the GC during the allocation
in MVM_disp_program_record_track_arg.
  • Loading branch information
niner committed Jul 19, 2021
1 parent 2bd4155 commit 1db0f3b
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/disp/boot.c
Expand Up @@ -96,17 +96,19 @@ static void boot_code(MVMThreadContext *tc, MVMArgs arg_info) {
MVMROOT(tc, args_capture, {
/* Work out what the callee is, and set us up to invoke it. */
MVMObject *code = MVM_capture_arg_pos_o(tc, capture, 0);
MVMObject *tracked_code = MVM_disp_program_record_track_arg(tc, capture, 0);
if (REPR(code)->ID == MVM_REPR_ID_MVMCode && IS_CONCRETE(code)) {
MVM_disp_program_record_tracked_code(tc, tracked_code, args_capture);
}
else if (REPR(code)->ID == MVM_REPR_ID_MVMCFunction && IS_CONCRETE(code)) {
MVM_disp_program_record_tracked_c_code(tc, tracked_code, args_capture);
}
else {
MVM_exception_throw_adhoc(tc,
"boot-code dispatcher only works with MVMCode or MVMCFunction");
}
MVMROOT(tc, code, {
MVMObject *tracked_code = MVM_disp_program_record_track_arg(tc, capture, 0);
if (REPR(code)->ID == MVM_REPR_ID_MVMCode && IS_CONCRETE(code)) {
MVM_disp_program_record_tracked_code(tc, tracked_code, args_capture);
}
else if (REPR(code)->ID == MVM_REPR_ID_MVMCFunction && IS_CONCRETE(code)) {
MVM_disp_program_record_tracked_c_code(tc, tracked_code, args_capture);
}
else {
MVM_exception_throw_adhoc(tc,
"boot-code dispatcher only works with MVMCode or MVMCFunction");
}
});
});
});

Expand Down

0 comments on commit 1db0f3b

Please sign in to comment.