summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-31 13:24:42 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-31 13:24:42 +0000
commit91e4978bb0f1fac38226733324828599e7359484 (patch)
tree2d95a5812a80936fc0b6a3dead8796ea47e2cab1 /vm.c
parent935319fbb8271622370792c013a8b933263e0b5e (diff)
merge revision(s) 60024: [Backport #13945]
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/branches/ruby_2_3@62136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/vm.c b/vm.c
index 1c00fe7499..89cd1c2f12 100644
--- a/vm.c
+++ b/vm.c
@@ -1310,33 +1310,31 @@ rb_vm_localjump_error(const char *mesg, VALUE value, int reason)
VALUE
rb_vm_make_jump_tag_but_local_jump(int state, VALUE val)
{
- VALUE result = Qnil;
+ const char *mesg;
- if (val == Qundef) {
- val = GET_THREAD()->tag->retval;
- }
switch (state) {
- case 0:
- break;
case TAG_RETURN:
- result = make_localjump_error("unexpected return", val, state);
+ mesg = "unexpected return";
break;
case TAG_BREAK:
- result = make_localjump_error("unexpected break", val, state);
+ mesg = "unexpected break";
break;
case TAG_NEXT:
- result = make_localjump_error("unexpected next", val, state);
+ mesg = "unexpected next";
break;
case TAG_REDO:
- result = make_localjump_error("unexpected redo", Qnil, state);
+ mesg = "unexpected redo";
break;
case TAG_RETRY:
- result = make_localjump_error("retry outside of rescue clause", Qnil, state);
+ mesg = "retry outside of rescue clause";
break;
default:
- break;
+ return Qnil;
}
- return result;
+ if (val == Qundef) {
+ val = GET_THREAD()->tag->retval;
+ }
+ return make_localjump_error(mesg, val, state);
}
void