diff options
-rw-r--r-- | cont.c | 13 | ||||
-rw-r--r-- | vm_core.h | 10 |
2 files changed, 8 insertions, 15 deletions
@@ -110,7 +110,6 @@ typedef struct rb_context_struct { rb_jmpbuf_t jmpbuf; rb_ensure_entry_t *ensure_array; rb_ensure_list_t *ensure_list; - rb_thread_t *thread_ptr; } rb_context_t; @@ -267,7 +266,7 @@ NOINLINE(static VALUE cont_capture(volatile int *volatile stat)); static VALUE cont_thread_value(const rb_context_t *cont) { - return cont->thread_ptr->self; + return cont->saved_ec.thread_ptr->self; } static void @@ -396,12 +395,6 @@ cont_memsize(const void *ptr) return size; } -rb_thread_t * -rb_fiberptr_thread_ptr(const rb_fiber_t *fib) -{ - return fib->cont.thread_ptr; -} - void rb_fiber_mark_self(const rb_fiber_t *fib) { @@ -550,7 +543,7 @@ cont_init(rb_context_t *cont, rb_thread_t *th) { /* save thread context */ cont_save_thread(cont, th); - cont->thread_ptr = th; + cont->saved_ec.thread_ptr = th; cont->saved_ec.local_storage = NULL; cont->saved_ec.local_storage_recursive_hash = Qnil; cont->saved_ec.local_storage_recursive_hash_for_trace = Qnil; @@ -1474,7 +1467,7 @@ rb_threadptr_root_fiber_setup(rb_thread_t *th) MEMZERO(fib, rb_fiber_t, 1); fib->cont.type = ROOT_FIBER_CONTEXT; fib->cont.saved_ec.fiber = fib; - fib->cont.thread_ptr = th; + fib->cont.saved_ec.thread_ptr = th; fiber_status_set(fib, FIBER_RESUMED); /* skip CREATED */ th->ec = &fib->cont.saved_ec; #if FIBER_USE_NATIVE @@ -771,6 +771,8 @@ typedef struct rb_execution_context_struct { /* for bmethod */ const rb_callable_method_entry_t *passed_bmethod_me; + struct rb_thread_struct *thread_ptr; + /* for GC */ struct { VALUE *stack_start; @@ -1594,20 +1596,18 @@ RUBY_SYMBOL_EXPORT_END #define GET_THREAD() ruby_current_thread() #define GET_EC() ruby_current_execution_context() -rb_thread_t *rb_fiberptr_thread_ptr(const rb_fiber_t *fib); - static inline rb_thread_t * rb_ec_thread_ptr(const rb_execution_context_t *ec) { - return rb_fiberptr_thread_ptr(ec->fiber); + return ec->thread_ptr; } static inline rb_vm_t * rb_ec_vm_ptr(const rb_execution_context_t *ec) { - const rb_thread_t *th = rb_fiberptr_thread_ptr(ec->fiber); + const rb_thread_t *th = rb_ec_thread_ptr(ec); if (th) { - return rb_fiberptr_thread_ptr(ec->fiber)->vm; + return th->vm; } else { return NULL; |