1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

mjit_compile.c: skip generating unnecessary goto

after return or longjmp. This is mainly for skipping the check of stack
size in such cases, which shouldn't be checked because it does never
happen.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
k0kubun 2018-05-03 07:09:51 +00:00
parent cdef13d703
commit d9d84688d6

View file

@ -122,18 +122,18 @@ compile_insn(FILE *f, const struct rb_iseq_constant_body *body, const int insn,
#include "mjit_compile.inc"
/*****************/
if (next_pos < body->iseq_size && ALREADY_COMPILED_P(status, next_pos)) {
/* If next_pos is already compiled and this branch is not finished yet,
next instruction won't be compiled in C code next and will need `goto`. */
if (!b->finish_p && next_pos < body->iseq_size && ALREADY_COMPILED_P(status, next_pos)) {
fprintf(f, "goto label_%d;\n", next_pos);
/* Verify stack size assumption is the same among multiple branches */
if ((unsigned int)status->stack_size_for_pos[next_pos] != b->stack_size) {
if (mjit_opts.warnings || mjit_opts.verbose)
fprintf(stderr, "MJIT warning: JIT stack assumption is not the same between branches (%d != %u)\n",
status->stack_size_for_pos[next_pos], b->stack_size);
status->success = FALSE;
return next_pos;
}
/* If next_pos is already compiled, next instruction won't be compiled in C code and needs `goto`. */
fprintf(f, "goto label_%d;\n", next_pos);
}
return next_pos;