vm.c: vm_invoke_bmethod
* vm.c (vm_invoke_bmethod): bmethod does not need EXEC_TAG as it does not set safe level. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a65ee87bf2
commit
ca61b4c4e0
29
vm.c
29
vm.c
@ -115,6 +115,9 @@ static void vm_collect_usage_insn(int insn);
|
|||||||
static void vm_collect_usage_register(int reg, int isset);
|
static void vm_collect_usage_register(int reg, int isset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
vm_invoke_bmethod(rb_thread_t *th, rb_proc_t *proc, VALUE self, VALUE defined_class,
|
||||||
|
int argc, const VALUE *argv, const rb_block_t *blockptr);
|
||||||
static VALUE
|
static VALUE
|
||||||
vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self, VALUE defined_class,
|
vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self, VALUE defined_class,
|
||||||
int argc, const VALUE *argv, const rb_block_t *blockptr);
|
int argc, const VALUE *argv, const rb_block_t *blockptr);
|
||||||
@ -896,17 +899,13 @@ vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self, VALUE defined_class
|
|||||||
|
|
||||||
TH_PUSH_TAG(th);
|
TH_PUSH_TAG(th);
|
||||||
if ((state = EXEC_TAG()) == 0) {
|
if ((state = EXEC_TAG()) == 0) {
|
||||||
if (!proc->is_from_method) {
|
th->safe_level = proc->safe_level;
|
||||||
th->safe_level = proc->safe_level;
|
|
||||||
}
|
|
||||||
val = invoke_block_from_c(th, &proc->block, self, argc, argv, blockptr, 0,
|
val = invoke_block_from_c(th, &proc->block, self, argc, argv, blockptr, 0,
|
||||||
defined_class, 0);
|
defined_class, 0);
|
||||||
}
|
}
|
||||||
TH_POP_TAG();
|
TH_POP_TAG();
|
||||||
|
|
||||||
if (!proc->is_from_method) {
|
th->safe_level = stored_safe;
|
||||||
th->safe_level = stored_safe;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state) {
|
if (state) {
|
||||||
JUMP_TAG(state);
|
JUMP_TAG(state);
|
||||||
@ -914,12 +913,26 @@ vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self, VALUE defined_class
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
vm_invoke_bmethod(rb_thread_t *th, rb_proc_t *proc, VALUE self, VALUE defined_class,
|
||||||
|
int argc, const VALUE *argv, const rb_block_t *blockptr)
|
||||||
|
{
|
||||||
|
return invoke_block_from_c(th, &proc->block, self, argc, argv, blockptr, 0,
|
||||||
|
defined_class, 0);
|
||||||
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc,
|
rb_vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc,
|
||||||
int argc, const VALUE *argv, const rb_block_t *blockptr)
|
int argc, const VALUE *argv, const rb_block_t *blockptr)
|
||||||
{
|
{
|
||||||
return vm_invoke_proc(th, proc, proc->block.self, proc->block.klass,
|
VALUE self = proc->block.self;
|
||||||
argc, argv, blockptr);
|
VALUE defined_class = proc->block.klass;
|
||||||
|
if (proc->is_from_method) {
|
||||||
|
return vm_invoke_bmethod(th, proc, self, defined_class, argc, argv, blockptr);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return vm_invoke_proc(th, proc, self, defined_class, argc, argv, blockptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* special variable */
|
/* special variable */
|
||||||
|
@ -1539,7 +1539,7 @@ vm_call_bmethod_body(rb_thread_t *th, rb_call_info_t *ci, const VALUE *argv)
|
|||||||
/* control block frame */
|
/* control block frame */
|
||||||
th->passed_bmethod_me = ci->me;
|
th->passed_bmethod_me = ci->me;
|
||||||
GetProcPtr(ci->me->def->body.proc, proc);
|
GetProcPtr(ci->me->def->body.proc, proc);
|
||||||
val = vm_invoke_proc(th, proc, ci->recv, ci->defined_class, ci->argc, argv, ci->blockptr);
|
val = vm_invoke_bmethod(th, proc, ci->recv, ci->defined_class, ci->argc, argv, ci->blockptr);
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user