Skip to content

Commit

Permalink
Don't set thunked on finalizer run
Browse files Browse the repository at this point in the history
Since we no longer check the flag in remove_one_frame, it should quite
easily be possible to avoid setting it here.
  • Loading branch information
jnthn committed Nov 4, 2021
1 parent 80894e0 commit cbb33ac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/core/callstack.c
Expand Up @@ -736,8 +736,8 @@ MVMFrame * MVM_callstack_unwind_frame(MVMThreadContext *tc, MVMuint8 exceptional
MVM_panic(1, "Unknown call stack record type in unwind");
}
} while (tc->stack_top && !is_bytecode_frame(tc->stack_top->kind));
if (tc->num_finalizing && !exceptional && (!thunked || !*thunked) && MVM_gc_finalize_run_handler(tc))
*thunked = 1;
if (tc->num_finalizing && !exceptional && (!thunked || !*thunked))
MVM_gc_finalize_run_handler(tc);
return tc->stack_top ? MVM_callstack_record_to_frame(tc->stack_top) : NULL;
}

Expand Down
8 changes: 3 additions & 5 deletions src/gc/finalize.c
Expand Up @@ -83,14 +83,14 @@ void MVM_finalize_walk_queues(MVMThreadContext *tc, MVMuint8 gen) {
}

/* Try to run a finalization handler. Returns a true value if we do so */
MVMint32 MVM_gc_finalize_run_handler(MVMThreadContext *tc) {
void MVM_gc_finalize_run_handler(MVMThreadContext *tc) {
/* Make sure there is a current frame, that we aren't hanging on to an
* exception handler result (which the finalizer could overwrite), and
* that there's a HLL handler to run. */
if (!tc->cur_frame)
return 0;
return;
if (tc->last_handler_result)
return 0;
return;
MVMCode *handler = MVM_hll_current(tc)->finalize_handler;
if (handler) {
/* Drain the finalizing queue to an array. */
Expand All @@ -106,7 +106,5 @@ MVMint32 MVM_gc_finalize_run_handler(MVMThreadContext *tc) {
MVM_callsite_get_common(tc, MVM_CALLSITE_ID_OBJ));
args_record->args.source[0].o = drain;
MVM_frame_dispatch_from_c(tc, handler, args_record, NULL, MVM_RETURN_VOID);
return 1;
}
return 0;
}
2 changes: 1 addition & 1 deletion src/gc/finalize.h
@@ -1,4 +1,4 @@
void MVM_gc_finalize_set(MVMThreadContext *tc, MVMObject *type, MVMint64 finalize);
void MVM_gc_finalize_add_to_queue(MVMThreadContext *tc, MVMObject *obj);
void MVM_finalize_walk_queues(MVMThreadContext *tc, MVMuint8 gen);
MVMint32 MVM_gc_finalize_run_handler(MVMThreadContext *tc);
void MVM_gc_finalize_run_handler(MVMThreadContext *tc);

0 comments on commit cbb33ac

Please sign in to comment.