ruby-changes:67110
From: Nobuyoshi <ko1@a...>
Date: Tue, 10 Aug 2021 19:08:55 +0900 (JST)
Subject: [ruby-changes:67110] 28d03ee776 (master): Remove root_jmpbuf in rb_thread_struct
https://git.ruby-lang.org/ruby.git/commit/?id=28d03ee776 From 28d03ee776af4d630556fcaad7305340cbcf9cde Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Mon, 9 Aug 2021 13:21:05 +0900 Subject: Remove root_jmpbuf in rb_thread_struct It has not been used since 1b82c877dfa72e8505ded149fd0e3ba956529d3f. --- cont.c | 2 -- eval.c | 3 --- eval_intern.h | 32 ++------------------------------ vm_core.h | 1 - 4 files changed, 2 insertions(+), 36 deletions(-) diff --git a/cont.c b/cont.c index 2c0a92e..51d77c6 100644 --- a/cont.c +++ b/cont.c @@ -711,8 +711,6 @@ fiber_pool_stack_release(struct fiber_pool_stack * stack) https://github.com/ruby/ruby/blob/trunk/cont.c#L711 #endif } -void rb_fiber_start(rb_fiber_t*); - static inline void ec_switch(rb_thread_t *th, rb_fiber_t *fiber) { diff --git a/eval.c b/eval.c index bf57d0f..885e1ae 100644 --- a/eval.c +++ b/eval.c @@ -1112,17 +1112,14 @@ rb_protect(VALUE (* proc) (VALUE), VALUE data, int *pstate) https://github.com/ruby/ruby/blob/trunk/eval.c#L1112 volatile enum ruby_tag_type state; rb_execution_context_t * volatile ec = GET_EC(); rb_control_frame_t *volatile cfp = ec->cfp; - rb_jmpbuf_t org_jmpbuf; EC_PUSH_TAG(ec); - MEMCPY(&org_jmpbuf, &rb_ec_thread_ptr(ec)->root_jmpbuf, rb_jmpbuf_t, 1); if ((state = EC_EXEC_TAG()) == TAG_NONE) { SAVE_ROOT_JMPBUF(rb_ec_thread_ptr(ec), result = (*proc) (data)); } else { rb_vm_rewind_cfp(ec, cfp); } - MEMCPY(&rb_ec_thread_ptr(ec)->root_jmpbuf, &org_jmpbuf, rb_jmpbuf_t, 1); EC_POP_TAG(); if (pstate != NULL) *pstate = state; diff --git a/eval_intern.h b/eval_intern.h index d3a0d58..58400b5 100644 --- a/eval_intern.h +++ b/eval_intern.h @@ -91,40 +91,12 @@ extern int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval https://github.com/ruby/ruby/blob/trunk/eval_intern.h#L91 #include <sys/stat.h> -#ifdef _MSC_VER -#define SAVE_ROOT_JMPBUF_BEFORE_STMT \ - __try { -#define SAVE_ROOT_JMPBUF_AFTER_STMT \ - } \ - __except (GetExceptionCode() == EXCEPTION_STACK_OVERFLOW ? \ - (rb_ec_raised_set(GET_EC(), RAISED_STACKOVERFLOW), \ - raise(SIGSEGV), \ - EXCEPTION_EXECUTE_HANDLER) : \ - EXCEPTION_CONTINUE_SEARCH) { \ - /* never reaches here */ \ - } -#elif defined(__MINGW32__) -LONG WINAPI rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *); -#define SAVE_ROOT_JMPBUF_BEFORE_STMT \ - do { \ - PVOID _handler = AddVectoredExceptionHandler(1, rb_w32_stack_overflow_handler); - -#define SAVE_ROOT_JMPBUF_AFTER_STMT \ - RemoveVectoredExceptionHandler(_handler); \ - } while (0); -#else -#define SAVE_ROOT_JMPBUF_BEFORE_STMT -#define SAVE_ROOT_JMPBUF_AFTER_STMT -#endif #define SAVE_ROOT_JMPBUF(th, stmt) do \ - if (ruby_setjmp((th)->root_jmpbuf) == 0) { \ - SAVE_ROOT_JMPBUF_BEFORE_STMT \ + if (true) { \ stmt; \ - SAVE_ROOT_JMPBUF_AFTER_STMT \ } \ - else { \ - rb_fiber_start(th->ec->fiber_ptr); \ + else if (th) { /* suppress unused-variable warning */ \ } while (0) #define EC_PUSH_TAG(ec) do { \ diff --git a/vm_core.h b/vm_core.h index 8ec03d7..5db3080 100644 --- a/vm_core.h +++ b/vm_core.h @@ -1023,7 +1023,6 @@ typedef struct rb_thread_struct { https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1023 /* fiber */ rb_fiber_t *root_fiber; - rb_jmpbuf_t root_jmpbuf; VALUE scheduler; unsigned blocking; -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/