From cbb33ac42331f790e8cd44184ef4de0ae189a877 Mon Sep 17 00:00:00 2001 From: Jonathan Worthington Date: Thu, 4 Nov 2021 12:09:05 +0100 Subject: [PATCH] Don't set thunked on finalizer run Since we no longer check the flag in remove_one_frame, it should quite easily be possible to avoid setting it here. --- src/core/callstack.c | 4 ++-- src/gc/finalize.c | 8 +++----- src/gc/finalize.h | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/core/callstack.c b/src/core/callstack.c index 57c1c517f0..e784573440 100644 --- a/src/core/callstack.c +++ b/src/core/callstack.c @@ -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; } diff --git a/src/gc/finalize.c b/src/gc/finalize.c index 2e3f826d1f..2858c7f455 100644 --- a/src/gc/finalize.c +++ b/src/gc/finalize.c @@ -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. */ @@ -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; } diff --git a/src/gc/finalize.h b/src/gc/finalize.h index 933005a488..bdcbb9dfdc 100644 --- a/src/gc/finalize.h +++ b/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);