diff options
-rw-r--r-- | mjit_compile.c | 2 | ||||
-rw-r--r-- | tool/ruby_vm/views/_mjit_compile_insn.erb | 2 | ||||
-rw-r--r-- | tool/ruby_vm/views/_mjit_compile_insn_body.erb | 2 | ||||
-rw-r--r-- | tool/ruby_vm/views/_mjit_compile_ivar.erb | 2 | ||||
-rw-r--r-- | tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb | 6 | ||||
-rw-r--r-- | tool/ruby_vm/views/_mjit_compile_send.erb | 4 | ||||
-rw-r--r-- | vm_core.h | 2 | ||||
-rw-r--r-- | vm_insnhelper.c | 8 |
8 files changed, 16 insertions, 12 deletions
diff --git a/mjit_compile.c b/mjit_compile.c index b57a988926..c502a44637 100644 --- a/mjit_compile.c +++ b/mjit_compile.c @@ -191,7 +191,7 @@ compile_cancel_handler(FILE *f, const struct rb_iseq_constant_body *body, struct fprintf(f, "\ncancel:\n"); if (status->local_stack_p) { for (i = 0; i < body->stack_max; i++) { - fprintf(f, " *((VALUE *)reg_cfp->bp + %d) = stack[%d];\n", i + 1, i); + fprintf(f, " *((VALUE *)reg_cfp->bp_ + %d) = stack[%d];\n", i, i); } } fprintf(f, " return Qundef;\n"); diff --git a/tool/ruby_vm/views/_mjit_compile_insn.erb b/tool/ruby_vm/views/_mjit_compile_insn.erb index dc6f45f433..ca053f67e2 100644 --- a/tool/ruby_vm/views/_mjit_compile_insn.erb +++ b/tool/ruby_vm/views/_mjit_compile_insn.erb @@ -62,7 +62,7 @@ % # JIT: We should evaluate ISeq modified for TracePoint if it's enabled. Note: This is slow. % unless insn.always_leaf? fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n"); - fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)<%= insn.call_attribute('sp_inc') %> + 1); + fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp_ + %d;\n", b->stack_size + (int)<%= insn.call_attribute('sp_inc') %>); if (!pc_moved_p) { fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); } diff --git a/tool/ruby_vm/views/_mjit_compile_insn_body.erb b/tool/ruby_vm/views/_mjit_compile_insn_body.erb index aec748385a..68c85a59d3 100644 --- a/tool/ruby_vm/views/_mjit_compile_insn_body.erb +++ b/tool/ruby_vm/views/_mjit_compile_insn_body.erb @@ -76,7 +76,7 @@ % when /\A\s+CALL_SIMPLE_METHOD\(\);\s+\z/ % # For `opt_xxx`'s fallbacks. if (status->local_stack_p) { - fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1); + fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp_ + %d;\n", b->stack_size); } fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos); fprintf(f, " goto cancel;\n"); diff --git a/tool/ruby_vm/views/_mjit_compile_ivar.erb b/tool/ruby_vm/views/_mjit_compile_ivar.erb index d8d77f3d36..16443f9c9d 100644 --- a/tool/ruby_vm/views/_mjit_compile_ivar.erb +++ b/tool/ruby_vm/views/_mjit_compile_ivar.erb @@ -41,7 +41,7 @@ % end fprintf(f, " else {\n"); fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos); - fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1); + fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp_ + %d;\n", b->stack_size); fprintf(f, " goto cancel;\n"); fprintf(f, " }\n"); diff --git a/tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb b/tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb index eff728f551..0227fc1f3e 100644 --- a/tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb +++ b/tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb @@ -20,7 +20,7 @@ { rb_snum_t i, push_size; push_size = -<%= insn.call_attribute('sp_inc') %> + <%= insn.rets.size %> - <%= insn.pops.size %>; - fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %ld + 1;\n", push_size); /* POPN(INSN_ATTR(popn)); */ + fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp_ + %ld;\n", push_size); /* POPN(INSN_ATTR(popn)); */ for (i = 0; i < push_size; i++) { fprintf(f, " *(reg_cfp->sp + %ld) = stack[%ld];\n", i - push_size, (rb_snum_t)b->stack_size - push_size + i); } @@ -29,8 +29,8 @@ } else { % if insn.handles_sp? - fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1 - <%= insn.pops.size %>); /* POPN(INSN_ATTR(popn)); */ + fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp_ + %d;\n", b->stack_size - <%= insn.pops.size %>); /* POPN(INSN_ATTR(popn)); */ % else - fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1); + fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp_ + %d;\n", b->stack_size); % end } diff --git a/tool/ruby_vm/views/_mjit_compile_send.erb b/tool/ruby_vm/views/_mjit_compile_send.erb index 0c59e040ce..e699c96af8 100644 --- a/tool/ruby_vm/views/_mjit_compile_send.erb +++ b/tool/ruby_vm/views/_mjit_compile_send.erb @@ -37,7 +37,7 @@ fprintf(f, " if (UNLIKELY(GET_GLOBAL_METHOD_STATE() != %"PRI_SERIALT_PREFIX"u ||\n", cc_copy->method_state); fprintf(f, " RCLASS_SERIAL(CLASS_OF(stack[%d])) != %"PRI_SERIALT_PREFIX"u)) {\n", b->stack_size - 1 - argc, cc_copy->class_serial); fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos); - fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1); + fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp_ + %d;\n", b->stack_size); fprintf(f, " goto cancel;\n"); fprintf(f, " }\n"); @@ -77,7 +77,7 @@ % # JIT: We should evaluate ISeq modified for TracePoint if it's enabled. Note: This is slow. fprintf(f, " if (UNLIKELY(ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS)) {\n"); - fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + (int)<%= insn.call_attribute('sp_inc') %> + 1); + fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp_ + %d;\n", b->stack_size + (int)<%= insn.call_attribute('sp_inc') %>); if (!pc_moved_p) { fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); } @@ -763,7 +763,7 @@ typedef struct rb_control_frame_struct { VALUE self; /* cfp[3] / block[0] */ const VALUE *ep; /* cfp[4] / block[1] */ const void *block_code; /* cfp[5] / block[2] */ /* iseq or ifunc */ - const VALUE *bp; /* cfp[6] */ + VALUE *bp_; /* cfp[6] */ #if VM_DEBUG_BP_CHECK VALUE *bp_check; /* cfp[7] */ diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 0e845dea60..af1ede2e6b 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -299,8 +299,8 @@ vm_push_frame(rb_execution_context_t *ec, *sp = type; /* ep[-0] / ENV_FLAGS */ /* Store initial value of ep as bp to skip calculation cost of bp on JIT cancellation. */ - cfp->ep = cfp->bp = sp; - cfp->sp = sp + 1; + cfp->ep = sp; + cfp->bp_ = cfp->sp = sp + 1; #if VM_DEBUG_BP_CHECK cfp->bp_check = sp + 1; @@ -1640,6 +1640,7 @@ double_cmp_ge(double a, double b) static VALUE * vm_base_ptr(const rb_control_frame_t *cfp) { +#if 0 const rb_control_frame_t *prev_cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp); if (cfp->iseq && VM_FRAME_RUBYFRAME_P(cfp)) { @@ -1661,6 +1662,9 @@ vm_base_ptr(const rb_control_frame_t *cfp) else { return NULL; } +#else + return cfp->bp_; +#endif } /* method call processes with call_info */ |