ec->th for vm_cref_push() and constify.

* vm_insnhelper.c (vm_cref_push): accepts `ec` instead of `th`.

* vm_insnhelper.c: consitfy the first parameter (ec):
  * lep_svar
  * lep_svar_write
  * lep_svar_get
  * lep_svar_set
  * vm_getspecial
  and added vm_cref_push.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2017-10-27 01:31:15 +00:00
Родитель 34ff953e37
Коммит 84e6a3d31c
3 изменённых файлов: 11 добавлений и 11 удалений

Просмотреть файл

@ -837,7 +837,7 @@ defineclass
/* enter scope */ /* enter scope */
vm_push_frame(th->ec, class_iseq, VM_FRAME_MAGIC_CLASS | VM_ENV_FLAG_LOCAL, klass, vm_push_frame(th->ec, class_iseq, VM_FRAME_MAGIC_CLASS | VM_ENV_FLAG_LOCAL, klass,
GET_BLOCK_HANDLER(), GET_BLOCK_HANDLER(),
(VALUE)vm_cref_push(th, klass, NULL, FALSE), (VALUE)vm_cref_push(th->ec, klass, NULL, FALSE),
class_iseq->body->iseq_encoded, GET_SP(), class_iseq->body->iseq_encoded, GET_SP(),
class_iseq->body->local_table_size, class_iseq->body->local_table_size,
class_iseq->body->stack_max); class_iseq->body->stack_max);

Просмотреть файл

@ -1583,7 +1583,7 @@ yield_under(VALUE under, VALUE self, int argc, const VALUE *argv)
VM_FORCE_WRITE_SPECIAL_CONST(&VM_CF_LEP(th->ec->cfp)[VM_ENV_DATA_INDEX_SPECVAL], new_block_handler); VM_FORCE_WRITE_SPECIAL_CONST(&VM_CF_LEP(th->ec->cfp)[VM_ENV_DATA_INDEX_SPECVAL], new_block_handler);
} }
cref = vm_cref_push(th, under, ep, TRUE); cref = vm_cref_push(th->ec, under, ep, TRUE);
return vm_yield_with_cref(th, argc, argv, cref, is_lambda); return vm_yield_with_cref(th, argc, argv, cref, is_lambda);
} }
@ -1601,7 +1601,7 @@ rb_yield_refine_block(VALUE refinement, VALUE refinements)
struct rb_captured_block new_captured = *captured; struct rb_captured_block new_captured = *captured;
VALUE new_block_handler = VM_BH_FROM_ISEQ_BLOCK(&new_captured); VALUE new_block_handler = VM_BH_FROM_ISEQ_BLOCK(&new_captured);
const VALUE *ep = captured->ep; const VALUE *ep = captured->ep;
rb_cref_t *cref = vm_cref_push(th, refinement, ep, TRUE); rb_cref_t *cref = vm_cref_push(th->ec, refinement, ep, TRUE);
CREF_REFINEMENTS_SET(cref, refinements); CREF_REFINEMENTS_SET(cref, refinements);
VM_FORCE_WRITE_SPECIAL_CONST(&VM_CF_LEP(th->ec->cfp)[VM_ENV_DATA_INDEX_SPECVAL], new_block_handler); VM_FORCE_WRITE_SPECIAL_CONST(&VM_CF_LEP(th->ec->cfp)[VM_ENV_DATA_INDEX_SPECVAL], new_block_handler);
new_captured.self = refinement; new_captured.self = refinement;
@ -1613,7 +1613,7 @@ rb_yield_refine_block(VALUE refinement, VALUE refinements)
static VALUE static VALUE
eval_under(VALUE under, VALUE self, VALUE src, VALUE file, int line) eval_under(VALUE under, VALUE self, VALUE src, VALUE file, int line)
{ {
rb_cref_t *cref = vm_cref_push(GET_THREAD(), under, NULL, SPECIAL_CONST_P(self) && !NIL_P(under)); rb_cref_t *cref = vm_cref_push(GET_EC(), under, NULL, SPECIAL_CONST_P(self) && !NIL_P(under));
SafeStringValue(src); SafeStringValue(src);
return eval_string_with_cref(self, src, Qnil, cref, file, line); return eval_string_with_cref(self, src, Qnil, cref, file, line);
} }

Просмотреть файл

@ -387,7 +387,7 @@ vm_svar_valid_p(VALUE svar)
#endif #endif
static inline struct vm_svar * static inline struct vm_svar *
lep_svar(rb_execution_context_t *ec, const VALUE *lep) lep_svar(const rb_execution_context_t *ec, const VALUE *lep)
{ {
VALUE svar; VALUE svar;
@ -404,7 +404,7 @@ lep_svar(rb_execution_context_t *ec, const VALUE *lep)
} }
static inline void static inline void
lep_svar_write(rb_execution_context_t *ec, const VALUE *lep, const struct vm_svar *svar) lep_svar_write(const 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));
@ -417,7 +417,7 @@ lep_svar_write(rb_execution_context_t *ec, const VALUE *lep, const struct vm_sva
} }
static VALUE static VALUE
lep_svar_get(rb_execution_context_t *ec, const VALUE *lep, rb_num_t key) lep_svar_get(const rb_execution_context_t *ec, const VALUE *lep, rb_num_t key)
{ {
const struct vm_svar *svar = lep_svar(ec, lep); const struct vm_svar *svar = lep_svar(ec, lep);
@ -448,7 +448,7 @@ svar_new(VALUE obj)
} }
static void static void
lep_svar_set(rb_execution_context_t *ec, const VALUE *lep, rb_num_t key, VALUE val) lep_svar_set(const rb_execution_context_t *ec, const VALUE *lep, rb_num_t key, VALUE val)
{ {
struct vm_svar *svar = lep_svar(ec, lep); struct vm_svar *svar = lep_svar(ec, lep);
@ -475,7 +475,7 @@ lep_svar_set(rb_execution_context_t *ec, const VALUE *lep, rb_num_t key, VALUE v
} }
static inline VALUE static inline VALUE
vm_getspecial(rb_execution_context_t *ec, const VALUE *lep, rb_num_t key, rb_num_t type) vm_getspecial(const rb_execution_context_t *ec, const VALUE *lep, rb_num_t key, rb_num_t type)
{ {
VALUE val; VALUE val;
@ -734,7 +734,7 @@ rb_vm_rewrite_cref(rb_cref_t *cref, VALUE old_klass, VALUE new_klass, rb_cref_t
} }
static rb_cref_t * static rb_cref_t *
vm_cref_push(rb_thread_t *th, VALUE klass, const VALUE *ep, int pushed_by_eval) vm_cref_push(const rb_execution_context_t *ec, VALUE klass, const VALUE *ep, int pushed_by_eval)
{ {
rb_cref_t *prev_cref = NULL; rb_cref_t *prev_cref = NULL;
@ -742,7 +742,7 @@ vm_cref_push(rb_thread_t *th, VALUE klass, const VALUE *ep, int pushed_by_eval)
prev_cref = vm_env_cref(ep); prev_cref = vm_env_cref(ep);
} }
else { else {
rb_control_frame_t *cfp = vm_get_ruby_level_caller_cfp(th->ec, th->ec->cfp); rb_control_frame_t *cfp = vm_get_ruby_level_caller_cfp(ec, ec->cfp);
if (cfp) { if (cfp) {
prev_cref = vm_env_cref(cfp->ep); prev_cref = vm_env_cref(cfp->ep);