From 0e1a5ece622a3a7967914e43cb4ad6b68000136d Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 10 Feb 2018 01:28:51 +0000 Subject: mjit_compile.c: original_body_iseq * mjit_compile.c (mjit_compile): name the original iseq pointer to eliminate magic numbers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- mjit_compile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mjit_compile.c') diff --git a/mjit_compile.c b/mjit_compile.c index 69fc8947d8..4e4ca39e7f 100644 --- a/mjit_compile.c +++ b/mjit_compile.c @@ -142,6 +142,8 @@ mjit_compile(FILE *f, const struct rb_iseq_constant_body *body, const char *func #endif fprintf(f, "VALUE\n%s(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp)\n{\n", funcname); fprintf(f, " VALUE *stack = reg_cfp->sp;\n"); + fprintf(f, " static const VALUE *const original_body_iseq = (VALUE *)%p;\n", + body->iseq_encoded); /* Simulate `opt_pc` in setup_parameters_complex */ if (body->param.flags.has_opt) { @@ -157,7 +159,7 @@ mjit_compile(FILE *f, const struct rb_iseq_constant_body *body, const char *func } /* ISeq might be used for catch table too. For that usage, this code cancels JIT execution. */ - fprintf(f, " if (reg_cfp->pc != 0x%"PRIxVALUE") {\n", (VALUE)body->iseq_encoded); + fprintf(f, " if (reg_cfp->pc != original_body_iseq) {\n"); fprintf(f, " return Qundef;\n"); fprintf(f, " }\n"); -- cgit v1.2.3