summaryrefslogtreecommitdiff
path: root/mjit_compile.c
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-03 07:09:51 (GMT)
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-03 07:09:51 (GMT)
commitd9d84688d68cad09c654a42c570fcb9781ccc160 (patch)
tree8ca910804a9119ac7bdf8d1f10f8f6a51ac9cfc5 /mjit_compile.c
parentcdef13d7034d365cb7a9bc6aa981bf0a0aa854d0 (diff)
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
Diffstat (limited to 'mjit_compile.c')
-rw-r--r--mjit_compile.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/mjit_compile.c b/mjit_compile.c
index bc507a3..4f87550 100644
--- a/mjit_compile.c
+++ b/mjit_compile.c
@@ -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;