summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-27 01:31:15 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-27 01:31:15 +0000
commit84e6a3d31c08d2302f8592ee07cc3bacb1f47d9d (patch)
tree45a51705f8ca9880fcebe596e4f599f6c7530a53
parent34ff953e37b9a96be57d73bb3c73d8c22c2ac98e (diff)
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
-rw-r--r--insns.def2
-rw-r--r--vm_eval.c6
-rw-r--r--vm_insnhelper.c14
3 files changed, 11 insertions, 11 deletions
diff --git a/insns.def b/insns.def
index 01bac33336..9350c2385c 100644
--- a/insns.def
+++ b/insns.def
@@ -837,7 +837,7 @@ defineclass
/* enter scope */
vm_push_frame(th->ec, class_iseq, VM_FRAME_MAGIC_CLASS | VM_ENV_FLAG_LOCAL, klass,
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->local_table_size,
class_iseq->body->stack_max);
diff --git a/vm_eval.c b/vm_eval.c
index bc8ca02790..3cdf4154ac 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -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);
}
- 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);
}
@@ -1601,7 +1601,7 @@ rb_yield_refine_block(VALUE refinement, VALUE refinements)
struct rb_captured_block new_captured = *captured;
VALUE new_block_handler = VM_BH_FROM_ISEQ_BLOCK(&new_captured);
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);
VM_FORCE_WRITE_SPECIAL_CONST(&VM_CF_LEP(th->ec->cfp)[VM_ENV_DATA_INDEX_SPECVAL], new_block_handler);
new_captured.self = refinement;
@@ -1613,7 +1613,7 @@ rb_yield_refine_block(VALUE refinement, VALUE refinements)
static VALUE
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);
return eval_string_with_cref(self, src, Qnil, cref, file, line);
}
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index de5e4f48b1..6d1b13b807 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -387,7 +387,7 @@ vm_svar_valid_p(VALUE svar)
#endif
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;
@@ -404,7 +404,7 @@ lep_svar(rb_execution_context_t *ec, const VALUE *lep)
}
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));
@@ -417,7 +417,7 @@ lep_svar_write(rb_execution_context_t *ec, const VALUE *lep, const struct vm_sva
}
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);
@@ -448,7 +448,7 @@ svar_new(VALUE obj)
}
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);
@@ -475,7 +475,7 @@ lep_svar_set(rb_execution_context_t *ec, const VALUE *lep, rb_num_t key, VALUE v
}
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;
@@ -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 *
-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;
@@ -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);
}
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) {
prev_cref = vm_env_cref(cfp->ep);