Skip to content

Commit

Permalink
Avoid duplicate interp sync-up on return
Browse files Browse the repository at this point in the history
We only needed the case in remove_one_frame now because of lazy deopt,
so just move it there instead, now that unwind frame is doing the whole
thing.
  • Loading branch information
jnthn committed Nov 3, 2021
1 parent 94778d2 commit 22e1926
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 0 additions & 5 deletions src/core/frame.c
Expand Up @@ -903,11 +903,6 @@ static MVMuint64 remove_one_frame(MVMThreadContext *tc, MVMuint8 unwind) {

/* Switch back to the caller frame if there is one. */
if (caller && (returner != tc->thread_entry_frame || tc->nested_interpreter)) {
*(tc->interp_cur_op) = caller->return_address;
*(tc->interp_bytecode_start) = MVM_frame_effective_bytecode(caller);
*(tc->interp_reg_base) = caller->work;
*(tc->interp_cu) = caller->static_info->body.cu;

/* Handle any special return hooks. */
if (caller->extra) {
MVMFrameExtra *e = caller->extra;
Expand Down
8 changes: 7 additions & 1 deletion src/spesh/deopt.c
Expand Up @@ -422,10 +422,16 @@ void MVM_spesh_deopt_during_unwind(MVMThreadContext *tc) {
fprintf(stderr, " Deopt %u -> %u without uninlining\n", deopt_offset, deopt_target);
#endif
tc->cur_frame = top_frame;

finish_frame_deopt(tc, frame);
}

/* Sync interpreter so it's ready to continue running this deoptimized
* frame. */
*(tc->interp_cur_op) = tc->cur_frame->return_address;
*(tc->interp_bytecode_start) = MVM_frame_effective_bytecode(tc->cur_frame);
*(tc->interp_reg_base) = tc->cur_frame->work;
*(tc->interp_cu) = tc->cur_frame->static_info->body.cu;

/* Update the record to indicate we're no long in need of deopt. */
record->kind = record->orig_kind;
}

0 comments on commit 22e1926

Please sign in to comment.