summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--proc.c8
-rw-r--r--vm.c9
-rw-r--r--vm_core.h3
-rw-r--r--vm_dump.c2
5 files changed, 25 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index eb8d947..2345b99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Wed Jul 15 02:53:11 2015 Koichi Sasada <ko1@atdot.net>
+
+ * vm_core.h, vm.c: remove rb_proc_t::envval because we can know it via
+ rb_proc_t::block::ep.
+
+ rb_vm_proc_envval(const rb_proc_t *proc) returns an Env object which
+ the Proc object use.
+
+ * proc.c: catch up this fix.
+
+ * vm_dump.c (rb_vmdebug_proc_dump_raw): ditto.
+
Wed Jul 15 02:27:22 2015 Koichi Sasada <ko1@atdot.net>
* vm_core.h, vm.c: remvoe rb_env_t::prev_envval because we can know it
diff --git a/proc.c b/proc.c
index 1405c19..f1fd3ce 100644
--- a/proc.c
+++ b/proc.c
@@ -46,10 +46,9 @@ static void
proc_mark(void *ptr)
{
rb_proc_t *proc = ptr;
- RUBY_MARK_ENTER("proc");
- RUBY_MARK_UNLESS_NULL(proc->envval);
RUBY_MARK_UNLESS_NULL(proc->block.proc);
RUBY_MARK_UNLESS_NULL(proc->block.self);
+ RUBY_MARK_UNLESS_NULL(rb_vm_proc_envval(proc));
if (proc->block.iseq && RUBY_VM_IFUNC_P(proc->block.iseq)) {
RUBY_MARK_UNLESS_NULL((VALUE)(proc->block.iseq));
}
@@ -670,7 +669,7 @@ rb_block_clear_env_self(VALUE proc)
rb_proc_t *po;
rb_env_t *env;
GetProcPtr(proc, po);
- GetEnvPtr(po->envval, env);
+ GetEnvPtr(rb_vm_proc_envval(po), env);
env->env[0] = Qnil;
return proc;
}
@@ -1021,7 +1020,6 @@ rb_hash_proc(st_index_t hash, VALUE prc)
rb_proc_t *proc;
GetProcPtr(prc, proc);
hash = rb_hash_uint(hash, (st_index_t)proc->block.iseq);
- hash = rb_hash_uint(hash, (st_index_t)proc->envval);
return rb_hash_uint(hash, (st_index_t)proc->block.ep >> 16);
}
@@ -2533,7 +2531,7 @@ proc_binding(VALUE self)
rb_binding_t *bind;
GetProcPtr(self, proc);
- envval = proc->envval;
+ envval = rb_vm_proc_envval(proc);
iseq = proc->block.iseq;
if (RUBY_VM_IFUNC_P(iseq)) {
if (IS_METHOD_PROC_ISEQ(iseq)) {
diff --git a/vm.c b/vm.c
index db4d6d8..1940c5a 100644
--- a/vm.c
+++ b/vm.c
@@ -679,7 +679,6 @@ rb_proc_create(VALUE klass, const rb_block_t *block,
proc->safe_level = safe_level;
proc->is_from_method = is_from_method;
proc->is_lambda = is_lambda;
- proc->envval = envval;
return procval;
}
@@ -712,6 +711,14 @@ rb_vm_make_proc_lambda(rb_thread_t *th, const rb_block_t *block, VALUE klass, in
return procval;
}
+VALUE
+rb_vm_proc_envval(const rb_proc_t *proc)
+{
+ VALUE envval = VM_ENV_EP_ENVVAL(proc->block.ep);
+ return envval;
+}
+
+
/* Binding */
VALUE
diff --git a/vm_core.h b/vm_core.h
index ad5b317..20e4b5f 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -784,8 +784,6 @@ RUBY_SYMBOL_EXPORT_END
typedef struct {
rb_block_t block;
-
- VALUE envval; /* for GC mark */
int8_t safe_level; /* 0..1 */
int8_t is_from_method; /* bool */
int8_t is_lambda; /* bool */
@@ -959,6 +957,7 @@ VALUE rb_vm_make_proc(rb_thread_t *th, const rb_block_t *block, VALUE klass);
VALUE rb_vm_make_binding(rb_thread_t *th, const rb_control_frame_t *src_cfp);
VALUE rb_vm_env_local_variables(const rb_env_t *env);
VALUE rb_vm_env_prev_envval(const rb_env_t *env);
+VALUE rb_vm_proc_envval(const rb_proc_t *proc);
VALUE *rb_binding_add_dynavars(rb_binding_t *bind, int dyncount, const ID *dynvars);
void rb_vm_inc_const_missing_count(void);
void rb_vm_gvl_destroy(rb_vm_t *vm);
diff --git a/vm_dump.c b/vm_dump.c
index 714bee6..599229b 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -214,7 +214,7 @@ rb_vmdebug_proc_dump_raw(rb_proc_t *proc)
fprintf(stderr, "-- proc -------------------\n");
fprintf(stderr, "self: %s\n", selfstr);
- GetEnvPtr(proc->envval, env);
+ GetEnvPtr(rb_vm_proc_envval(proc), env);
rb_vmdebug_env_dump_raw(env, proc->block.ep);
}