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_4@61440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2017-12-24 03:01:35 +00:00
parent 1a3bca1dd6
commit 04aa6a8168
3 changed files with 26 additions and 24 deletions

2
load.c
View file

@ -626,6 +626,8 @@ rb_load_internal0(rb_thread_t *th, VALUE fname, int wrap)
th->top_wrapper = wrapper;
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);
if (NIL_P(exc)) return state;
th->errinfo = exc;

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.4.4"
#define RUBY_RELEASE_DATE "2017-12-24"
#define RUBY_PATCHLEVEL 222
#define RUBY_PATCHLEVEL 223
#define RUBY_RELEASE_YEAR 2017
#define RUBY_RELEASE_MONTH 12

46
vm.c
View file

@ -1398,33 +1398,33 @@ 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;
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) {
val = GET_THREAD()->tag->retval;
}
switch (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;
return make_localjump_error(mesg, val, state);
}
void