vm.c: fetch retval iff necessary
* vm.c (rb_vm_make_jump_tag_but_local_jump): get rid of fetching retval when it is not used. it is necessary for local jump state only. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4ea46ca0f5
commit
d352d0a0a7
2
load.c
2
load.c
@ -627,6 +627,8 @@ rb_load_internal0(rb_thread_t *th, VALUE fname, int wrap)
|
|||||||
th->top_wrapper = wrapper;
|
th->top_wrapper = wrapper;
|
||||||
|
|
||||||
if (state) {
|
if (state) {
|
||||||
|
/* usually state == TAG_RAISE only, except for
|
||||||
|
* rb_iseq_load_iseq case */
|
||||||
VALUE exc = rb_vm_make_jump_tag_but_local_jump(state, Qundef);
|
VALUE exc = rb_vm_make_jump_tag_but_local_jump(state, Qundef);
|
||||||
if (NIL_P(exc)) return state;
|
if (NIL_P(exc)) return state;
|
||||||
th->ec.errinfo = exc;
|
th->ec.errinfo = exc;
|
||||||
|
46
vm.c
46
vm.c
@ -1421,33 +1421,33 @@ rb_vm_localjump_error(const char *mesg, VALUE value, int reason)
|
|||||||
VALUE
|
VALUE
|
||||||
rb_vm_make_jump_tag_but_local_jump(int state, VALUE val)
|
rb_vm_make_jump_tag_but_local_jump(int state, VALUE val)
|
||||||
{
|
{
|
||||||
VALUE result = Qnil;
|
const char *mesg;
|
||||||
|
|
||||||
|
switch (state) {
|
||||||
|
case TAG_RETURN:
|
||||||
|
mesg = "unexpected return";
|
||||||
|
break;
|
||||||
|
case TAG_BREAK:
|
||||||
|
mesg = "unexpected break";
|
||||||
|
break;
|
||||||
|
case TAG_NEXT:
|
||||||
|
mesg = "unexpected next";
|
||||||
|
break;
|
||||||
|
case TAG_REDO:
|
||||||
|
mesg = "unexpected redo";
|
||||||
|
val = Qnil;
|
||||||
|
break;
|
||||||
|
case TAG_RETRY:
|
||||||
|
mesg = "retry outside of rescue clause";
|
||||||
|
val = Qnil;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
val = GET_THREAD()->ec.tag->retval;
|
val = GET_THREAD()->ec.tag->retval;
|
||||||
}
|
}
|
||||||
switch (state) {
|
return make_localjump_error(mesg, val, state);
|
||||||
case 0:
|
|
||||||
break;
|
|
||||||
case TAG_RETURN:
|
|
||||||
result = make_localjump_error("unexpected return", val, state);
|
|
||||||
break;
|
|
||||||
case TAG_BREAK:
|
|
||||||
result = make_localjump_error("unexpected break", val, state);
|
|
||||||
break;
|
|
||||||
case TAG_NEXT:
|
|
||||||
result = make_localjump_error("unexpected next", val, state);
|
|
||||||
break;
|
|
||||||
case TAG_REDO:
|
|
||||||
result = make_localjump_error("unexpected redo", Qnil, state);
|
|
||||||
break;
|
|
||||||
case TAG_RETRY:
|
|
||||||
result = make_localjump_error("retry outside of rescue clause", Qnil, state);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user