mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
merge revision(s) 46465,46469,46484: [Backport #9961]
* vm.c (rb_vm_rewind_cfp): add new function to rewind specified cfp with invoking RUBY_EVENT_C_RETURN. [Bug #9961] * vm_core.h: ditto. * eval.c (rb_protect): use it. * eval.c (rb_rescue2): ditto. * vm_eval.c (rb_iterate): ditto. * test/ruby/test_settracefunc.rb: add a test. * vm_core.h (rb_name_err_mesg_new): * vm_eval.c (rb_catch_protect): fix same problem of [Bug #9961]. * vm_eval.c (rb_iterate): ditto. * vm_core.h (rb_vm_rewind_cfp): add the prototype declaration. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@47342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3ed06c80eb
commit
b10c3b6d51
7 changed files with 100 additions and 17 deletions
18
vm_eval.c
18
vm_eval.c
|
@ -1068,18 +1068,7 @@ rb_iterate(VALUE (* it_proc) (VALUE), VALUE data1,
|
|||
th->errinfo = Qnil;
|
||||
retval = GET_THROWOBJ_VAL(err);
|
||||
|
||||
/* check skipped frame */
|
||||
while (th->cfp != cfp) {
|
||||
#if VMDEBUG
|
||||
printf("skipped frame: %s\n", vm_frametype_name(th->cfp));
|
||||
#endif
|
||||
if (VM_FRAME_TYPE(th->cfp) != VM_FRAME_MAGIC_CFUNC) {
|
||||
vm_pop_frame(th);
|
||||
}
|
||||
else { /* unlikely path */
|
||||
rb_vm_pop_cfunc_frame();
|
||||
}
|
||||
}
|
||||
rb_vm_rewind_cfp(th, cfp);
|
||||
}
|
||||
else{
|
||||
/* SDR(); printf("%p, %p\n", cdfp, escape_dfp); */
|
||||
|
@ -1090,10 +1079,11 @@ rb_iterate(VALUE (* it_proc) (VALUE), VALUE data1,
|
|||
VALUE *cep = cfp->ep;
|
||||
|
||||
if (cep == escape_ep) {
|
||||
rb_vm_rewind_cfp(th, cfp);
|
||||
|
||||
state = 0;
|
||||
th->state = 0;
|
||||
th->errinfo = Qnil;
|
||||
th->cfp = cfp;
|
||||
goto iter_retry;
|
||||
}
|
||||
}
|
||||
|
@ -1835,7 +1825,7 @@ rb_catch_obj(VALUE tag, VALUE (*func)(), VALUE data)
|
|||
val = (*func)(tag, data, 1, &tag, Qnil);
|
||||
}
|
||||
else if (state == TAG_THROW && RNODE(th->errinfo)->u1.value == tag) {
|
||||
th->cfp = saved_cfp;
|
||||
rb_vm_rewind_cfp(th, saved_cfp);
|
||||
val = th->tag->retval;
|
||||
th->errinfo = Qnil;
|
||||
state = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue