ruby-changes:48351
From: ko1 <ko1@a...>
Date: Fri, 27 Oct 2017 10:22:05 +0900 (JST)
Subject: [ruby-changes:48351] ko1:r60465 (trunk): Some functions accept `ec` instead of `th`.
ko1 2017-10-27 10:22:01 +0900 (Fri, 27 Oct 2017) New Revision: 60465 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60465 Log: Some functions accept `ec` instead of `th`. * vm_insnhelper.c: The following functions accept `ec` instead of `th`. * lep_svar * lep_svar_write * lep_svar_get * lep_svar_set * vm_getspecial Modified files: trunk/insns.def trunk/vm.c trunk/vm_insnhelper.c Index: insns.def =================================================================== --- insns.def (revision 60464) +++ insns.def (revision 60465) @@ -138,7 +138,7 @@ getspecial https://github.com/ruby/ruby/blob/trunk/insns.def#L138 () (VALUE val) { - val = vm_getspecial(th, GET_LEP(), key, type); + val = vm_getspecial(th->ec, GET_LEP(), key, type); } /** @@ -152,7 +152,7 @@ setspecial https://github.com/ruby/ruby/blob/trunk/insns.def#L152 (VALUE obj) () { - lep_svar_set(th, GET_LEP(), key, obj); + lep_svar_set(th->ec, GET_LEP(), key, obj); } /** Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 60464) +++ vm_insnhelper.c (revision 60465) @@ -387,15 +387,15 @@ vm_svar_valid_p(VALUE svar) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L387 #endif static inline struct vm_svar * -lep_svar(rb_thread_t *th, const VALUE *lep) +lep_svar(rb_execution_context_t *ec, const VALUE *lep) { VALUE svar; - if (lep && (th == NULL || th->ec->root_lep != lep)) { + if (lep && (ec == NULL || ec->root_lep != lep)) { svar = lep[VM_ENV_DATA_INDEX_ME_CREF]; } else { - svar = th->ec->root_svar; + svar = ec->root_svar; } VM_ASSERT(svar == Qfalse || vm_svar_valid_p(svar)); @@ -404,22 +404,22 @@ lep_svar(rb_thread_t *th, const VALUE *l https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L404 } static inline void -lep_svar_write(rb_thread_t *th, const VALUE *lep, const struct vm_svar *svar) +lep_svar_write(rb_execution_context_t *ec, const VALUE *lep, const struct vm_svar *svar) { VM_ASSERT(vm_svar_valid_p((VALUE)svar)); - if (lep && (th == NULL || th->ec->root_lep != lep)) { + if (lep && (ec == NULL || ec->root_lep != lep)) { vm_env_write(lep, VM_ENV_DATA_INDEX_ME_CREF, (VALUE)svar); } else { - RB_OBJ_WRITE(th->self, &th->ec->root_svar, svar); + RB_OBJ_WRITE(rb_ec_thread_ptr(ec)->self, &ec->root_svar, svar); } } static VALUE -lep_svar_get(rb_thread_t *th, const VALUE *lep, rb_num_t key) +lep_svar_get(rb_execution_context_t *ec, const VALUE *lep, rb_num_t key) { - const struct vm_svar *svar = lep_svar(th, lep); + const struct vm_svar *svar = lep_svar(ec, lep); if ((VALUE)svar == Qfalse || imemo_type((VALUE)svar) != imemo_svar) return Qnil; @@ -448,12 +448,12 @@ svar_new(VALUE obj) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L448 } static void -lep_svar_set(rb_thread_t *th, const VALUE *lep, rb_num_t key, VALUE val) +lep_svar_set(rb_execution_context_t *ec, const VALUE *lep, rb_num_t key, VALUE val) { - struct vm_svar *svar = lep_svar(th, lep); + struct vm_svar *svar = lep_svar(ec, lep); if ((VALUE)svar == Qfalse || imemo_type((VALUE)svar) != imemo_svar) { - lep_svar_write(th, lep, svar = svar_new((VALUE)svar)); + lep_svar_write(ec, lep, svar = svar_new((VALUE)svar)); } switch (key) { @@ -475,15 +475,15 @@ lep_svar_set(rb_thread_t *th, const VALU https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L475 } static inline VALUE -vm_getspecial(rb_thread_t *th, const VALUE *lep, rb_num_t key, rb_num_t type) +vm_getspecial(rb_execution_context_t *ec, const VALUE *lep, rb_num_t key, rb_num_t type) { VALUE val; if (type == 0) { - val = lep_svar_get(th, lep, key); + val = lep_svar_get(ec, lep, key); } else { - VALUE backref = lep_svar_get(th, lep, VM_SVAR_BACKREF); + VALUE backref = lep_svar_get(ec, lep, VM_SVAR_BACKREF); if (type & 0x01) { switch (type >> 1) { @@ -2906,7 +2906,7 @@ vm_defined(rb_thread_t *th, rb_control_f https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2906 } break; case DEFINED_REF:{ - if (vm_getspecial(th, GET_LEP(), Qfalse, FIX2INT(obj)) != Qnil) { + if (vm_getspecial(th->ec, GET_LEP(), Qfalse, FIX2INT(obj)) != Qnil) { expr_type = DEFINED_GVAR; } break; Index: vm.c =================================================================== --- vm.c (revision 60464) +++ vm.c (revision 60465) @@ -1205,14 +1205,14 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/vm.c#L1205 vm_cfp_svar_get(rb_thread_t *th, rb_control_frame_t *cfp, VALUE key) { cfp = vm_normal_frame(th, cfp); - return lep_svar_get(th, cfp ? VM_CF_LEP(cfp) : 0, key); + return lep_svar_get(th->ec, cfp ? VM_CF_LEP(cfp) : 0, key); } static void vm_cfp_svar_set(rb_thread_t *th, rb_control_frame_t *cfp, VALUE key, const VALUE val) { cfp = vm_normal_frame(th, cfp); - lep_svar_set(th, cfp ? VM_CF_LEP(cfp) : 0, key, val); + lep_svar_set(th->ec, cfp ? VM_CF_LEP(cfp) : 0, key, val); } static VALUE -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/