From 86bf94933368d25739fa5348ca8ff6e2c0d11353 Mon Sep 17 00:00:00 2001 From: ko1 Date: Tue, 14 Mar 2017 06:52:44 +0000 Subject: Fiber also has same issue. [Bug #13313] * thread.c (rb_vm_proc_local_ep): added. * cont.c (rb_fiber_start): use rb_vm_proc_local_ep(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'thread.c') diff --git a/thread.c b/thread.c index fffce53675..705b456ccb 100644 --- a/thread.c +++ b/thread.c @@ -550,16 +550,28 @@ ruby_thread_init_stack(rb_thread_t *th) native_thread_init_stack(th); } +const VALUE * +rb_vm_proc_local_ep(VALUE proc) +{ + const VALUE *ep = vm_proc_ep(proc); + + if (ep) { + return rb_vm_ep_local_ep(ep); + } + else { + return NULL; + } +} + static void thread_do_start(rb_thread_t *th, VALUE args) { native_set_thread_name(th); if (!th->first_func) { - const VALUE *ep = vm_proc_ep(th->first_proc); rb_proc_t *proc; GetProcPtr(th->first_proc, proc); th->errinfo = Qnil; - th->root_lep = ep ? rb_vm_ep_local_ep(ep) : NULL; + th->root_lep = rb_vm_proc_local_ep(th->first_proc); th->root_svar = Qfalse; EXEC_EVENT_HOOK(th, RUBY_EVENT_THREAD_BEGIN, th->self, 0, 0, 0, Qundef); th->value = rb_vm_invoke_proc(th, proc, -- cgit v1.2.3