From 6a0b05f413931cf24c149c29cc317d2b9c623885 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Thu, 22 Feb 2024 22:35:54 +1300 Subject: [PATCH] Remove `SAVE_ROOT_JMPBUF` as it no longer has any effect. (#10066) --- eval.c | 16 +++++++--------- eval_intern.h | 8 -------- thread.c | 2 +- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/eval.c b/eval.c index c538755c7d..c22b028473 100644 --- a/eval.c +++ b/eval.c @@ -115,7 +115,7 @@ ruby_options(int argc, char **argv) EC_PUSH_TAG(ec); if ((state = EC_EXEC_TAG()) == TAG_NONE) { - SAVE_ROOT_JMPBUF(GET_THREAD(), iseq = ruby_process_options(argc, argv)); + iseq = ruby_process_options(argc, argv); } else { rb_ec_clear_current_thread_trace_func(ec); @@ -197,7 +197,7 @@ rb_ec_cleanup(rb_execution_context_t *ec, enum ruby_tag_type ex) EC_PUSH_TAG(ec); if ((state = EC_EXEC_TAG()) == TAG_NONE) { - SAVE_ROOT_JMPBUF(th, { RUBY_VM_CHECK_INTS(ec); }); + RUBY_VM_CHECK_INTS(ec); step_0: step++; save_error = ec->errinfo; @@ -205,7 +205,7 @@ rb_ec_cleanup(rb_execution_context_t *ec, enum ruby_tag_type ex) /* exits with failure but silently when an exception raised * here */ - SAVE_ROOT_JMPBUF(th, rb_ec_teardown(ec)); + rb_ec_teardown(ec); step_1: step++; VALUE err = ec->errinfo; @@ -223,7 +223,7 @@ rb_ec_cleanup(rb_execution_context_t *ec, enum ruby_tag_type ex) mode1 = exiting_split(err, (mode0 & EXITING_WITH_STATUS) ? NULL : &sysex, &signaled); if (mode1 & EXITING_WITH_MESSAGE) { buf = rb_str_new(NULL, 0); - SAVE_ROOT_JMPBUF(th, rb_ec_error_print_detailed(ec, err, buf, Qundef)); + rb_ec_error_print_detailed(ec, err, buf, Qundef); message = buf; } } @@ -232,7 +232,7 @@ rb_ec_cleanup(rb_execution_context_t *ec, enum ruby_tag_type ex) /* protect from Thread#raise */ th->status = THREAD_KILLED; - SAVE_ROOT_JMPBUF(th, rb_ractor_terminate_all()); + rb_ractor_terminate_all(); step_3: step++; if (!NIL_P(buf = message)) { @@ -280,9 +280,7 @@ rb_ec_exec_node(rb_execution_context_t *ec, void *n) EC_PUSH_TAG(ec); if ((state = EC_EXEC_TAG()) == TAG_NONE) { rb_thread_t *const th = rb_ec_thread_ptr(ec); - SAVE_ROOT_JMPBUF(th, { - rb_iseq_eval_main(iseq); - }); + rb_iseq_eval_main(iseq); } EC_POP_TAG(); return state; @@ -974,7 +972,7 @@ rb_protect(VALUE (* proc) (VALUE), VALUE data, int *pstate) EC_PUSH_TAG(ec); if ((state = EC_EXEC_TAG()) == TAG_NONE) { - SAVE_ROOT_JMPBUF(rb_ec_thread_ptr(ec), result = (*proc) (data)); + result = (*proc)(data); } else { rb_vm_rewind_cfp(ec, cfp); diff --git a/eval_intern.h b/eval_intern.h index d008b17ca1..4ea23068bb 100644 --- a/eval_intern.h +++ b/eval_intern.h @@ -95,14 +95,6 @@ extern int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval #include - -#define SAVE_ROOT_JMPBUF(th, stmt) do \ - if (true) { \ - stmt; \ - } \ - else if (th) { /* suppress unused-variable warning */ \ - } while (0) - #define EC_PUSH_TAG(ec) do { \ rb_execution_context_t * const _ec = (ec); \ struct rb_vm_tag _tag; \ diff --git a/thread.c b/thread.c index 5dd26543ff..1ef4849c22 100644 --- a/thread.c +++ b/thread.c @@ -664,7 +664,7 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start) if ((state = EC_EXEC_TAG()) == TAG_NONE) { EXEC_EVENT_HOOK(th->ec, RUBY_EVENT_THREAD_BEGIN, th->self, 0, 0, 0, Qundef); - SAVE_ROOT_JMPBUF(th, result = thread_do_start(th)); + result = thread_do_start(th); } if (!fiber_scheduler_closed) {