mirror of
https://github.com/ruby/ruby.git
synced 2025-09-16 09:04:05 +02:00
merge revision(s) r45758,r45759: [Backport #9759]
* vm.c (invoke_block_from_c): add VM_FRAME_FLAG_BMETHOD to record it is bmethod frame. * vm.c (vm_exec): invoke RUBY_EVENT_RETURN event if rollbacked frame is VM_FRAME_FLAG_BMETHOD. [Bug #9759] * test/ruby/test_settracefunc.rb: add a test for TracePoint/set_trace_func. * vm_core.h: rename rb_thread_t::passed_me to rb_thread_t::passed_bmethod_me to clarify the usage. * vm_insnhelper.c (vm_call_bmethod_body): use renamed member. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@45928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3cbfd63479
commit
86f8f5d94e
6 changed files with 83 additions and 14 deletions
33
vm.c
33
vm.c
|
@ -717,13 +717,24 @@ invoke_block_from_c(rb_thread_t *th, const rb_block_t *block,
|
|||
opt_pc = vm_yield_setup_args(th, iseq, argc, cfp->sp, blockptr,
|
||||
type == VM_FRAME_MAGIC_LAMBDA);
|
||||
|
||||
vm_push_frame(th, iseq, type | VM_FRAME_FLAG_FINISH,
|
||||
self, defined_class,
|
||||
VM_ENVVAL_PREV_EP_PTR(block->ep),
|
||||
iseq->iseq_encoded + opt_pc,
|
||||
cfp->sp + arg_size, iseq->local_size - arg_size,
|
||||
th->passed_me, iseq->stack_max);
|
||||
th->passed_me = 0;
|
||||
if (th->passed_bmethod_me != 0) {
|
||||
/* bmethod */
|
||||
vm_push_frame(th, iseq, type | VM_FRAME_FLAG_FINISH | VM_FRAME_FLAG_BMETHOD,
|
||||
self, defined_class,
|
||||
VM_ENVVAL_PREV_EP_PTR(block->ep),
|
||||
iseq->iseq_encoded + opt_pc,
|
||||
cfp->sp + arg_size, iseq->local_size - arg_size,
|
||||
th->passed_bmethod_me, iseq->stack_max);
|
||||
th->passed_bmethod_me = 0;
|
||||
}
|
||||
else {
|
||||
vm_push_frame(th, iseq, type | VM_FRAME_FLAG_FINISH,
|
||||
self, defined_class,
|
||||
VM_ENVVAL_PREV_EP_PTR(block->ep),
|
||||
iseq->iseq_encoded + opt_pc,
|
||||
cfp->sp + arg_size, iseq->local_size - arg_size,
|
||||
0, iseq->stack_max);
|
||||
}
|
||||
|
||||
if (cref) {
|
||||
th->cfp->ep[-1] = (VALUE)cref;
|
||||
|
@ -1512,7 +1523,13 @@ vm_exec(rb_thread_t *th)
|
|||
break;
|
||||
case VM_FRAME_MAGIC_BLOCK:
|
||||
case VM_FRAME_MAGIC_LAMBDA:
|
||||
EXEC_EVENT_HOOK_AND_POP_FRAME(th, RUBY_EVENT_B_RETURN, th->cfp->self, 0, 0, Qnil);
|
||||
if (VM_FRAME_TYPE_BMETHOD_P(th->cfp)) {
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_B_RETURN, th->cfp->self, 0, 0, Qnil);
|
||||
EXEC_EVENT_HOOK_AND_POP_FRAME(th, RUBY_EVENT_RETURN, th->cfp->self, th->cfp->me->called_id, th->cfp->me->klass, Qnil);
|
||||
}
|
||||
else {
|
||||
EXEC_EVENT_HOOK_AND_POP_FRAME(th, RUBY_EVENT_B_RETURN, th->cfp->self, 0, 0, Qnil);
|
||||
}
|
||||
break;
|
||||
case VM_FRAME_MAGIC_CLASS:
|
||||
EXEC_EVENT_HOOK_AND_POP_FRAME(th, RUBY_EVENT_END, th->cfp->self, 0, 0, Qnil);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue