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
This commit is contained in:
ko1 2017-10-27 01:22:01 +00:00
parent 9d41e74398
commit 34ff953e37
3 changed files with 19 additions and 19 deletions

View File

@ -138,7 +138,7 @@ getspecial
() ()
(VALUE val) (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) (VALUE obj)
() ()
{ {
lep_svar_set(th, GET_LEP(), key, obj); lep_svar_set(th->ec, GET_LEP(), key, obj);
} }
/** /**

4
vm.c
View File

@ -1205,14 +1205,14 @@ static VALUE
vm_cfp_svar_get(rb_thread_t *th, rb_control_frame_t *cfp, VALUE key) vm_cfp_svar_get(rb_thread_t *th, rb_control_frame_t *cfp, VALUE key)
{ {
cfp = vm_normal_frame(th, cfp); 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 static void
vm_cfp_svar_set(rb_thread_t *th, rb_control_frame_t *cfp, VALUE key, const VALUE val) vm_cfp_svar_set(rb_thread_t *th, rb_control_frame_t *cfp, VALUE key, const VALUE val)
{ {
cfp = vm_normal_frame(th, cfp); 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 static VALUE

View File

@ -387,15 +387,15 @@ vm_svar_valid_p(VALUE svar)
#endif #endif
static inline struct vm_svar * 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; 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]; svar = lep[VM_ENV_DATA_INDEX_ME_CREF];
} }
else { else {
svar = th->ec->root_svar; svar = ec->root_svar;
} }
VM_ASSERT(svar == Qfalse || vm_svar_valid_p(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 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)); 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); vm_env_write(lep, VM_ENV_DATA_INDEX_ME_CREF, (VALUE)svar);
} }
else { 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 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; if ((VALUE)svar == Qfalse || imemo_type((VALUE)svar) != imemo_svar) return Qnil;
@ -448,12 +448,12 @@ svar_new(VALUE obj)
} }
static void 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) { 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) { 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 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; VALUE val;
if (type == 0) { if (type == 0) {
val = lep_svar_get(th, lep, key); val = lep_svar_get(ec, lep, key);
} }
else { else {
VALUE backref = lep_svar_get(th, lep, VM_SVAR_BACKREF); VALUE backref = lep_svar_get(ec, lep, VM_SVAR_BACKREF);
if (type & 0x01) { if (type & 0x01) {
switch (type >> 1) { 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; break;
case DEFINED_REF:{ 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; expr_type = DEFINED_GVAR;
} }
break; break;