From 5baba8982eb3e3fc096a593d16d119e2f3c5279b Mon Sep 17 00:00:00 2001 From: ko1 Date: Sun, 10 Sep 2017 15:49:45 +0000 Subject: move th->machine to ec->machine. * vm_core.h: move rb_thread_t::machine to rb_execution_context_t::machine. * vm_core.h, gc.c (rb_gc_mark_machine_stack): accept ec instead of th. it enables to call this func from rb_execution_context_mark() in vm.c. * cont.c (fiber_setcontext): catch up this fix. fiber_restore_thread() restores machine stack information too. * gc.c: catch up structure layout changes. * thread.c: ditto. * thread_pthread.c: ditto. * thread_win32.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread_pthread.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'thread_pthread.c') diff --git a/thread_pthread.c b/thread_pthread.c index 242b48f15d..675a2ddbae 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -832,8 +832,8 @@ native_thread_init_stack(rb_thread_t *th) rb_nativethread_id_t curr = pthread_self(); if (pthread_equal(curr, native_main_thread.id)) { - th->machine.stack_start = native_main_thread.stack_start; - th->machine.stack_maxsize = native_main_thread.stack_maxsize; + th->ec.machine.stack_start = native_main_thread.stack_start; + th->ec.machine.stack_maxsize = native_main_thread.stack_maxsize; } else { #ifdef STACKADDR_AVAILABLE @@ -841,11 +841,11 @@ native_thread_init_stack(rb_thread_t *th) size_t size; if (get_stack(&start, &size) == 0) { - th->machine.stack_start = start; - th->machine.stack_maxsize = size; + th->ec.machine.stack_start = start; + th->ec.machine.stack_maxsize = size; } #elif defined get_stack_of - if (!th->machine.stack_maxsize) { + if (!th->ec.machine.stack_maxsize) { native_mutex_lock(&th->interrupt_lock); native_mutex_unlock(&th->interrupt_lock); } @@ -854,9 +854,9 @@ native_thread_init_stack(rb_thread_t *th) #endif } #ifdef __ia64 - th->machine.register_stack_start = native_main_thread.register_stack_start; - th->machine.stack_maxsize /= 2; - th->machine.register_stack_maxsize = th->machine.stack_maxsize; + th->ec.machine.register_stack_start = native_main_thread.register_stack_start; + th->ec.machine.stack_maxsize /= 2; + th->ec.machine.register_stack_maxsize = th->ec.machine.stack_maxsize; #endif return 0; } @@ -884,7 +884,7 @@ thread_start_func_1(void *th_ptr) native_thread_init(th); /* run */ #if defined USE_NATIVE_THREAD_INIT - thread_start_func_2(th, th->machine.stack_start, rb_ia64_bsp()); + thread_start_func_2(th, th->ec.machine.stack_start, rb_ia64_bsp()); #else thread_start_func_2(th, &stack_start, rb_ia64_bsp()); #endif @@ -1006,10 +1006,10 @@ native_thread_create(rb_thread_t *th) const size_t stack_size = th->vm->default_params.thread_machine_stack_size; const size_t space = space_size(stack_size); - th->machine.stack_maxsize = stack_size - space; + th->ec.machine.stack_maxsize = stack_size - space; #ifdef __ia64 - th->machine.stack_maxsize /= 2; - th->machine.register_stack_maxsize = th->machine.stack_maxsize; + th->ec.machine.stack_maxsize /= 2; + th->ec.machine.register_stack_maxsize = th->ec.machine.stack_maxsize; #endif #ifdef HAVE_PTHREAD_ATTR_INIT @@ -1032,8 +1032,8 @@ native_thread_create(rb_thread_t *th) #ifdef get_stack_of if (!err) { get_stack_of(th->thread_id, - &th->machine.stack_start, - &th->machine.stack_maxsize); + &th->ec.machine.stack_start, + &th->ec.machine.stack_maxsize); } native_mutex_unlock(&th->interrupt_lock); #endif @@ -1745,8 +1745,8 @@ ruby_stack_overflowed_p(const rb_thread_t *th, const void *addr) else #endif if (th) { - size = th->machine.stack_maxsize; - base = (char *)th->machine.stack_start - STACK_DIR_UPPER(0, size); + size = th->ec.machine.stack_maxsize; + base = (char *)th->ec.machine.stack_start - STACK_DIR_UPPER(0, size); } else { return 0; -- cgit v1.2.3