From 4f0c9a5cc49cf36f15af85f644982fbb847f0dca 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 --- vm.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'vm.c') diff --git a/vm.c b/vm.c index 5569b87182..9054293b64 100644 --- a/vm.c +++ b/vm.c @@ -2390,6 +2390,15 @@ rb_execution_context_mark(const rb_execution_context_t *ec) } } + /* mark machine stack */ + if (&GET_THREAD()->ec != ec && + ec->machine.stack_start && ec->machine.stack_end) { + rb_gc_mark_machine_stack(ec); + rb_gc_mark_locations((VALUE *)&ec->machine.regs, + (VALUE *)(&ec->machine.regs) + + sizeof(ec->machine.regs) / sizeof(VALUE)); + } + RUBY_MARK_UNLESS_NULL(ec->errinfo); RUBY_MARK_UNLESS_NULL(ec->root_svar); rb_mark_tbl(ec->local_storage); @@ -2406,14 +2415,6 @@ rb_thread_mark(void *ptr) rb_execution_context_mark(&th->ec); - /* mark machine stack */ - if (GET_THREAD() != th && th->machine.stack_start && th->machine.stack_end) { - rb_gc_mark_machine_stack(th); - rb_gc_mark_locations((VALUE *)&th->machine.regs, - (VALUE *)(&th->machine.regs) + - sizeof(th->machine.regs) / sizeof(VALUE)); - } - /* mark ruby objects */ RUBY_MARK_UNLESS_NULL(th->first_proc); if (th->first_proc) RUBY_MARK_UNLESS_NULL(th->first_args); -- cgit v1.2.3