diff options
-rw-r--r-- | mjit_compile.c | 3 | ||||
-rw-r--r-- | tool/ruby_vm/views/mjit_compile.inc.erb | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/mjit_compile.c b/mjit_compile.c index c1d8f3468a..8591b5c5d6 100644 --- a/mjit_compile.c +++ b/mjit_compile.c @@ -348,6 +348,8 @@ mjit_compile_body(FILE *f, const rb_iseq_t *iseq, struct compile_status *status) fprintf(f, " static const rb_iseq_t *original_iseq = (const rb_iseq_t *)0x%"PRIxVALUE";\n", (VALUE)iseq); fprintf(f, " static const VALUE *const original_body_iseq = (VALUE *)0x%"PRIxVALUE";\n", (VALUE)body->iseq_encoded); + fprintf(f, " VALUE cfp_self = reg_cfp->self;\n"); // cache self across the method + fprintf(f, "#define GET_SELF() cfp_self\n"); // Generate merged ivar guards first if needed if (!status->compile_info->disable_ivar_cache && status->merge_ivar_guards_p) { @@ -379,6 +381,7 @@ mjit_compile_body(FILE *f, const rb_iseq_t *iseq, struct compile_status *status) compile_insns(f, body, 0, 0, status); compile_cancel_handler(f, body, status); + fprintf(f, "#undef GET_SELF"); return status->success; } diff --git a/tool/ruby_vm/views/mjit_compile.inc.erb b/tool/ruby_vm/views/mjit_compile.inc.erb index 6836d59a4f..32fd65ad6c 100644 --- a/tool/ruby_vm/views/mjit_compile.inc.erb +++ b/tool/ruby_vm/views/mjit_compile.inc.erb @@ -35,7 +35,7 @@ % # GET_CFP(): refers to `reg_cfp` % # GET_EP(): refers to `reg_cfp->ep` % # GET_SP(): refers to `reg_cfp->sp`, or `(stack + stack_size)` if local_stack_p -% # GET_SELF(): refers to `reg_cfp->self` +% # GET_SELF(): refers to `cfp_self` % # GET_LEP(): refers to `VM_EP_LEP(reg_cfp->ep)` % # EXEC_EC_CFP(): refers to `val = vm_exec(ec, TRUE)` with frame setup % # CALL_METHOD(): using `GET_CFP()` and `EXEC_EC_CFP()` |