diff --git a/vm_core.h b/vm_core.h index f9e4f04449..2bdb029941 100644 --- a/vm_core.h +++ b/vm_core.h @@ -1061,18 +1061,20 @@ extern rb_event_flag_t ruby_vm_event_flags; #define OPT_CALL_CFUNC_WITHOUT_FRAME 0 #endif -static inline rb_thread_t * -GET_THREAD(void) -{ - rb_thread_t *th = ruby_current_thread; +#define GET_THREAD() vm_thread_with_frame(ruby_current_thread) #if OPT_CALL_CFUNC_WITHOUT_FRAME +static inline rb_thread_t * +vm_thread_with_frame(rb_thread_t *th) +{ if (UNLIKELY(th->passed_ci != 0)) { void rb_vm_call_cfunc_push_frame(rb_thread_t *th); rb_vm_call_cfunc_push_frame(th); } -#endif return th; } +#else +#define vm_thread_with_frame(th) (th) +#endif #define rb_thread_set_current_raw(th) (void)(ruby_current_thread = (th)) #define rb_thread_set_current(th) do { \