summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-25 06:58:50 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-25 06:58:50 +0000
commit8dd0fb9039bbe6152ea5542e6bc70de152871e23 (patch)
tree3a8c658692e6692095195b081687cf92055a74e9 /tool
parent9f05891c3daa79e26dd01f0575f1b595ddb7d302 (diff)
use cfp->bp more.
cfp->bp was (re-)introduced by Kokubun san, but VM doesn't use it because I (ko1) want to remove it in a future. But using it make leave instruction fast because of sp consisntency check. So now VM uses cfp->bp. To use cfp->bp, I checked the value and I found that it is not a "initial value of sp" but a "initial value of ep". Fix this problem and fix all bp references (this is why bp is renamed to bp_). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rw-r--r--tool/ruby_vm/views/_mjit_compile_insn.erb2
-rw-r--r--tool/ruby_vm/views/_mjit_compile_insn_body.erb2
-rw-r--r--tool/ruby_vm/views/_mjit_compile_ivar.erb2
-rw-r--r--tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb6
-rw-r--r--tool/ruby_vm/views/_mjit_compile_send.erb4
5 files changed, 8 insertions, 8 deletions
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);
}