Cache access to reg_cfp->self on JIT
``` $ benchmark-driver -v --rbenv 'before --jit;after --jit' --repeat-count=12 --alternate --output=all benchmark.yml before --jit: ruby 3.0.0dev (2020-11-27T06:41:15Z master 8ce1711c25) +JIT [x86_64-linux] after --jit: ruby 3.0.0dev (2020-11-27T08:36:02Z master 2c592126b9) +JIT [x86_64-linux] last_commit=Cache access to reg_cfp->self on JIT Calculating ------------------------------------- before --jit after --jit Optcarrot Lan_Master.nes 82.40522392468650 82.66023870551237 fps 82.67998539899482 83.08660305312587 85.51280693947453 87.09311989553235 86.32925337181406 87.16115255191410 87.35617494926235 87.30699391518075 87.91865339426212 88.47590342996875 88.11573661006648 88.64778616696353 88.16060826662158 88.67015079203991 88.21639244865058 89.19630739497482 88.47241577897603 89.23443637947730 89.37087287229809 89.57052723997015 89.46969964699964 89.97803363889025 ```
This commit is contained in:
parent
5496415d31
commit
d409837729
@ -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 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",
|
fprintf(f, " static const VALUE *const original_body_iseq = (VALUE *)0x%"PRIxVALUE";\n",
|
||||||
(VALUE)body->iseq_encoded);
|
(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
|
// Generate merged ivar guards first if needed
|
||||||
if (!status->compile_info->disable_ivar_cache && status->merge_ivar_guards_p) {
|
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_insns(f, body, 0, 0, status);
|
||||||
compile_cancel_handler(f, body, status);
|
compile_cancel_handler(f, body, status);
|
||||||
|
fprintf(f, "#undef GET_SELF");
|
||||||
return status->success;
|
return status->success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
% # GET_CFP(): refers to `reg_cfp`
|
% # GET_CFP(): refers to `reg_cfp`
|
||||||
% # GET_EP(): refers to `reg_cfp->ep`
|
% # GET_EP(): refers to `reg_cfp->ep`
|
||||||
% # GET_SP(): refers to `reg_cfp->sp`, or `(stack + stack_size)` if local_stack_p
|
% # 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)`
|
% # GET_LEP(): refers to `VM_EP_LEP(reg_cfp->ep)`
|
||||||
% # EXEC_EC_CFP(): refers to `val = vm_exec(ec, TRUE)` with frame setup
|
% # EXEC_EC_CFP(): refers to `val = vm_exec(ec, TRUE)` with frame setup
|
||||||
% # CALL_METHOD(): using `GET_CFP()` and `EXEC_EC_CFP()`
|
% # CALL_METHOD(): using `GET_CFP()` and `EXEC_EC_CFP()`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user