From fbf899e0204808fa2a01ade8ca8b69feb1bcc479 Mon Sep 17 00:00:00 2001 From: ko1 Date: Thu, 26 Oct 2017 08:32:49 +0000 Subject: Use rb_execution_context_t instead of rb_thread_t to represent execution context [Feature #14038] * vm_core.h (rb_thread_t): rb_thread_t::ec is now a pointer. There are many code using `th` to represent execution context (such as cfp, VM stack and so on). To access `ec`, they need to use `th->ec->...` (adding one indirection) so that we need to replace them by passing `ec` instead of `th`. * vm_core.h (GET_EC()): introduced to access current ec. Also remove `ruby_current_thread` global variable. * cont.c (rb_context_t): introduce rb_context_t::thread_ptr instead of rb_context_t::thread_value. * cont.c (ec_set_vm_stack): added to update vm_stack explicitly. * cont.c (ec_switch): added to switch ec explicitly. * cont.c (rb_fiber_close): added to terminate fibers explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- proc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'proc.c') diff --git a/proc.c b/proc.c index e8f2d411cd..3d943ba6f5 100644 --- a/proc.c +++ b/proc.c @@ -333,7 +333,7 @@ VALUE rb_binding_new(void) { rb_thread_t *th = GET_THREAD(); - return rb_vm_make_binding(th, th->ec.cfp); + return rb_vm_make_binding(th, th->ec->cfp); } /* @@ -698,7 +698,7 @@ proc_new(VALUE klass, int8_t is_lambda) { VALUE procval; rb_thread_t *th = GET_THREAD(); - rb_control_frame_t *cfp = th->ec.cfp; + rb_control_frame_t *cfp = th->ec->cfp; VALUE block_handler; if ((block_handler = rb_vm_frame_block_handler(cfp)) == VM_BLOCK_HANDLER_NONE) { @@ -1049,7 +1049,7 @@ rb_block_arity(void) { int min, max; rb_thread_t *th = GET_THREAD(); - rb_control_frame_t *cfp = th->ec.cfp; + rb_control_frame_t *cfp = th->ec->cfp; VALUE block_handler = rb_vm_frame_block_handler(cfp); struct rb_block block; @@ -1082,7 +1082,7 @@ int rb_block_min_max_arity(int *max) { rb_thread_t *th = GET_THREAD(); - rb_control_frame_t *cfp = th->ec.cfp; + rb_control_frame_t *cfp = th->ec->cfp; VALUE block_handler = rb_vm_frame_block_handler(cfp); struct rb_block block; @@ -1911,7 +1911,7 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod) body = rb_block_lambda(); #else rb_thread_t *th = GET_THREAD(); - VALUE block_handler = rb_vm_frame_block_handler(th->ec.cfp); + VALUE block_handler = rb_vm_frame_block_handler(th->ec->cfp); if (block_handler == VM_BLOCK_HANDLER_NONE) rb_raise(rb_eArgError, proc_without_block); switch (vm_block_handler_type(block_handler)) { -- cgit v1.2.3