зеркало из https://github.com/github/ruby.git
* insnhelper.ci (vm_call_bmethod): fix to propagate information
that this proc is "from Method". [ruby-dev:31490] * proc.c (method_proc, rb_mod_define_method): ditto. * vm.c (vm_invoke_proc_core): removed. * vm_core.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
a854a4358f
Коммит
cd30220aff
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
Sun Aug 19 12:58:39 2007 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* insnhelper.ci (vm_call_bmethod): fix to propagate information
|
||||
that this proc is "from Method". [ruby-dev:31490]
|
||||
|
||||
* proc.c (method_proc, rb_mod_define_method): ditto.
|
||||
|
||||
* vm.c (vm_invoke_proc_core): removed.
|
||||
|
||||
* vm_core.h: ditto.
|
||||
|
||||
Sun Aug 19 12:36:11 2007 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* test/ruby/sentence.rb: new method Sentence().
|
||||
|
|
|
@ -387,7 +387,7 @@ vm_call_bmethod(rb_thread_t *th, ID id, VALUE procval, VALUE recv,
|
|||
(cfp-2)->method_klass = klass;
|
||||
|
||||
GetProcPtr(procval, proc);
|
||||
val = vm_invoke_proc_core(th, proc, recv, argc, argv, 0);
|
||||
val = vm_invoke_proc(th, proc, recv, argc, argv);
|
||||
return val;
|
||||
}
|
||||
|
||||
|
|
10
proc.c
10
proc.c
|
@ -957,6 +957,7 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod)
|
|||
proc->block.iseq->defined_method_id = id;
|
||||
proc->block.iseq->klass = mod;
|
||||
proc->is_lambda = Qtrue;
|
||||
proc->is_from_method = Qtrue;
|
||||
}
|
||||
node = NEW_BMETHOD(body);
|
||||
}
|
||||
|
@ -1351,7 +1352,8 @@ rb_proc_new(
|
|||
static VALUE
|
||||
method_proc(VALUE method)
|
||||
{
|
||||
VALUE proc;
|
||||
VALUE procval;
|
||||
rb_proc_t *proc;
|
||||
/*
|
||||
* class Method
|
||||
* def to_proc
|
||||
|
@ -1361,8 +1363,10 @@ method_proc(VALUE method)
|
|||
* end
|
||||
* end
|
||||
*/
|
||||
proc = rb_iterate((VALUE (*)(VALUE))mlambda, 0, bmcall, method);
|
||||
return proc;
|
||||
procval = rb_iterate((VALUE (*)(VALUE))mlambda, 0, bmcall, method);
|
||||
GetProcPtr(procval, proc);
|
||||
proc->is_from_method = 1;
|
||||
return procval;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
13
vm.c
13
vm.c
|
@ -606,8 +606,8 @@ vm_yield(rb_thread_t *th, int argc, VALUE *argv)
|
|||
}
|
||||
|
||||
VALUE
|
||||
vm_invoke_proc_core(rb_thread_t *th, rb_proc_t *proc,
|
||||
VALUE self, int argc, VALUE *argv, int restore_safe)
|
||||
vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc,
|
||||
VALUE self, int argc, VALUE *argv)
|
||||
{
|
||||
VALUE val = Qundef;
|
||||
int state;
|
||||
|
@ -623,7 +623,7 @@ vm_invoke_proc_core(rb_thread_t *th, rb_proc_t *proc,
|
|||
}
|
||||
TH_POP_TAG();
|
||||
|
||||
if (restore_safe) {
|
||||
if (!proc->is_from_method) {
|
||||
th->safe_level = stored_safe;
|
||||
}
|
||||
|
||||
|
@ -650,13 +650,6 @@ vm_invoke_proc_core(rb_thread_t *th, rb_proc_t *proc,
|
|||
return val;
|
||||
}
|
||||
|
||||
VALUE
|
||||
vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc,
|
||||
VALUE self, int argc, VALUE *argv)
|
||||
{
|
||||
return vm_invoke_proc_core(th, proc, self, argc, argv, 1);
|
||||
}
|
||||
|
||||
/* special variable */
|
||||
|
||||
VALUE
|
||||
|
|
|
@ -504,6 +504,7 @@ typedef struct {
|
|||
VALUE envval; /* for GC mark */
|
||||
VALUE blockprocval;
|
||||
int safe_level;
|
||||
int is_from_method;
|
||||
int is_lambda;
|
||||
|
||||
NODE *special_cref_stack;
|
||||
|
@ -616,7 +617,6 @@ int rb_thread_method_id_and_klass(rb_thread_t *th, ID *idp, VALUE *klassp);
|
|||
|
||||
VALUE vm_eval_body(rb_thread_t *th);
|
||||
VALUE vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self, int argc, VALUE *argv);
|
||||
VALUE vm_invoke_proc_core(rb_thread_t *th, rb_proc_t *proc, VALUE self, int argc, VALUE *argv, int restore_flag);
|
||||
VALUE vm_make_proc(rb_thread_t *th, rb_control_frame_t *cfp, rb_block_t *block);
|
||||
VALUE vm_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp);
|
||||
VALUE vm_backtrace(rb_thread_t *, int);
|
||||
|
|
Загрузка…
Ссылка в новой задаче