зеркало из https://github.com/github/ruby.git
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
e07dad00ee
Коммит
994460c4db
12
ChangeLog
12
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>
|
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
|
* vm_core.h, vm.c: remvoe rb_env_t::prev_envval because we can know it
|
||||||
|
|
8
proc.c
8
proc.c
|
@ -46,10 +46,9 @@ static void
|
||||||
proc_mark(void *ptr)
|
proc_mark(void *ptr)
|
||||||
{
|
{
|
||||||
rb_proc_t *proc = 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.proc);
|
||||||
RUBY_MARK_UNLESS_NULL(proc->block.self);
|
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)) {
|
if (proc->block.iseq && RUBY_VM_IFUNC_P(proc->block.iseq)) {
|
||||||
RUBY_MARK_UNLESS_NULL((VALUE)(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_proc_t *po;
|
||||||
rb_env_t *env;
|
rb_env_t *env;
|
||||||
GetProcPtr(proc, po);
|
GetProcPtr(proc, po);
|
||||||
GetEnvPtr(po->envval, env);
|
GetEnvPtr(rb_vm_proc_envval(po), env);
|
||||||
env->env[0] = Qnil;
|
env->env[0] = Qnil;
|
||||||
return proc;
|
return proc;
|
||||||
}
|
}
|
||||||
|
@ -1021,7 +1020,6 @@ rb_hash_proc(st_index_t hash, VALUE prc)
|
||||||
rb_proc_t *proc;
|
rb_proc_t *proc;
|
||||||
GetProcPtr(prc, proc);
|
GetProcPtr(prc, proc);
|
||||||
hash = rb_hash_uint(hash, (st_index_t)proc->block.iseq);
|
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);
|
return rb_hash_uint(hash, (st_index_t)proc->block.ep >> 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2533,7 +2531,7 @@ proc_binding(VALUE self)
|
||||||
rb_binding_t *bind;
|
rb_binding_t *bind;
|
||||||
|
|
||||||
GetProcPtr(self, proc);
|
GetProcPtr(self, proc);
|
||||||
envval = proc->envval;
|
envval = rb_vm_proc_envval(proc);
|
||||||
iseq = proc->block.iseq;
|
iseq = proc->block.iseq;
|
||||||
if (RUBY_VM_IFUNC_P(iseq)) {
|
if (RUBY_VM_IFUNC_P(iseq)) {
|
||||||
if (IS_METHOD_PROC_ISEQ(iseq)) {
|
if (IS_METHOD_PROC_ISEQ(iseq)) {
|
||||||
|
|
9
vm.c
9
vm.c
|
@ -679,7 +679,6 @@ rb_proc_create(VALUE klass, const rb_block_t *block,
|
||||||
proc->safe_level = safe_level;
|
proc->safe_level = safe_level;
|
||||||
proc->is_from_method = is_from_method;
|
proc->is_from_method = is_from_method;
|
||||||
proc->is_lambda = is_lambda;
|
proc->is_lambda = is_lambda;
|
||||||
proc->envval = envval;
|
|
||||||
|
|
||||||
return procval;
|
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;
|
return procval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VALUE
|
||||||
|
rb_vm_proc_envval(const rb_proc_t *proc)
|
||||||
|
{
|
||||||
|
VALUE envval = VM_ENV_EP_ENVVAL(proc->block.ep);
|
||||||
|
return envval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Binding */
|
/* Binding */
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
|
|
|
@ -784,8 +784,6 @@ RUBY_SYMBOL_EXPORT_END
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
rb_block_t block;
|
rb_block_t block;
|
||||||
|
|
||||||
VALUE envval; /* for GC mark */
|
|
||||||
int8_t safe_level; /* 0..1 */
|
int8_t safe_level; /* 0..1 */
|
||||||
int8_t is_from_method; /* bool */
|
int8_t is_from_method; /* bool */
|
||||||
int8_t is_lambda; /* 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_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_local_variables(const rb_env_t *env);
|
||||||
VALUE rb_vm_env_prev_envval(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);
|
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_inc_const_missing_count(void);
|
||||||
void rb_vm_gvl_destroy(rb_vm_t *vm);
|
void rb_vm_gvl_destroy(rb_vm_t *vm);
|
||||||
|
|
|
@ -214,7 +214,7 @@ rb_vmdebug_proc_dump_raw(rb_proc_t *proc)
|
||||||
|
|
||||||
fprintf(stderr, "-- proc -------------------\n");
|
fprintf(stderr, "-- proc -------------------\n");
|
||||||
fprintf(stderr, "self: %s\n", selfstr);
|
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);
|
rb_vmdebug_env_dump_raw(env, proc->block.ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче