summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-17 15:09:41 (GMT)
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-17 15:09:41 (GMT)
commit6a4bb345dfeff84bcf2541c50a2249fe31f02846 (patch)
treee7ce21fa9a1858360094f55bff84f95a77da0947 /vm_insnhelper.c
parente749134f0a38fca202aacc0ff65db882646749c2 (diff)
mjit_compile.c: resurrect local variable stack
This optimization was reverted on r63863, but this commit resurrects the optimization to skip some sp motions on JIT execution. tool/ruby_vm/views/_mjit_compile_insn_body.erb: ditto tool/ruby_vm/views/_mjit_compile_insn.erb: ditto insns.def: resurrect handles_frame as handles_stack, which was deleted on r63763. tool/ruby_vm/models/bare_instructions.rb: ditto vm_insnhelper.c: prevent moving sp outside insns.def to allow modifying it by JIT. * Optcarrot benchmark $ benchmark-driver benchmark.yml --rbenv 'before --jit;after --jit' --repeat-count 12 -v before --jit: ruby 2.6.0dev (2018-07-17 trunk 63987) +JIT [x86_64-linux] after --jit: ruby 2.6.0dev (2018-07-17 local-stack 63987) +JIT [x86_64-linux] last_commit=mjit_compile.c: resurrect local variable stack Calculating ------------------------------------- before --jit after --jit Optcarrot Lan_Master.nes 70.518 72.144 fps Comparison: Optcarrot Lan_Master.nes after --jit: 72.1 fps before --jit: 70.5 fps - 1.02x slower git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 07c22b0..1d401d4 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1236,12 +1236,12 @@ vm_throw(const rb_execution_context_t *ec, rb_control_frame_t *reg_cfp,
}
}
-static inline void
-vm_expandarray(rb_control_frame_t *cfp, VALUE ary, rb_num_t num, int flag)
+static inline rb_num_t
+vm_expandarray(VALUE *sp, VALUE ary, rb_num_t num, int flag)
{
int is_splat = flag & 0x01;
rb_num_t space_size = num + is_splat;
- VALUE *base = cfp->sp;
+ VALUE *base = sp;
const VALUE *ptr;
rb_num_t len;
const VALUE obj = ary;
@@ -1256,8 +1256,6 @@ vm_expandarray(rb_control_frame_t *cfp, VALUE ary, rb_num_t num, int flag)
len = (rb_num_t)RARRAY_LEN(ary);
}
- cfp->sp += space_size;
-
if (flag & 0x02) {
/* post: ..., nil ,ary[-1], ..., ary[0..-num] # top */
rb_num_t i = 0, j;
@@ -1299,6 +1297,7 @@ vm_expandarray(rb_control_frame_t *cfp, VALUE ary, rb_num_t num, int flag)
}
}
RB_GC_GUARD(ary);
+ return space_size;
}
static VALUE vm_call_general(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc);