From 34ff953e37b9a96be57d73bb3c73d8c22c2ac98e Mon Sep 17 00:00:00 2001 From: ko1 Date: Fri, 27 Oct 2017 01:22:01 +0000 Subject: [PATCH] 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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- insns.def | 4 ++-- vm.c | 4 ++-- vm_insnhelper.c | 30 +++++++++++++++--------------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/insns.def b/insns.def index 6883e1df79..01bac33336 100644 --- a/insns.def +++ b/insns.def @@ -138,7 +138,7 @@ getspecial () (VALUE val) { - val = vm_getspecial(th, GET_LEP(), key, type); + val = vm_getspecial(th->ec, GET_LEP(), key, type); } /** @@ -152,7 +152,7 @@ setspecial (VALUE obj) () { - lep_svar_set(th, GET_LEP(), key, obj); + lep_svar_set(th->ec, GET_LEP(), key, obj); } /** diff --git a/vm.c b/vm.c index a75d94f8cc..03bf61ff60 100644 --- a/vm.c +++ b/vm.c @@ -1205,14 +1205,14 @@ static VALUE 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 diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 8210c9dac3..de5e4f48b1 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -387,15 +387,15 @@ vm_svar_valid_p(VALUE svar) #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 *lep) } 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) } 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 VALUE *lep, rb_num_t key, VALUE val) } 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_frame_t *reg_cfp, rb_num_t op_type, VALUE } 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;