diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-27 09:28:09 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-27 09:28:09 +0000 |
commit | 6b534134a78e3e43c344682c3585e1abab015216 (patch) | |
tree | d11c5c2df90dd40086ab6e189e856219b1be098a /tool/ruby_vm/views | |
parent | 8222d794f3ecf6cd93d537ee2f214b86975d1efc (diff) |
give up insn attr handles_frame
I introduced this mechanism in r62051 to speed things up. Later it
was reported that the change causes problems. I searched for
workarounds but nothing seemed appropriate. I hereby officially
give it up. The idea to move ADD_PC around was a mistake.
Fixes [Bug #14809] and [Bug #14834].
Signed-off-by: Urabe, Shyouhei <[email protected]>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/ruby_vm/views')
-rw-r--r-- | tool/ruby_vm/views/_insn_entry.erb | 13 | ||||
-rw-r--r-- | tool/ruby_vm/views/_mjit_compile_insn_body.erb | 25 | ||||
-rw-r--r-- | tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb | 14 |
3 files changed, 1 insertions, 51 deletions
diff --git a/tool/ruby_vm/views/_insn_entry.erb b/tool/ruby_vm/views/_insn_entry.erb index 2118dece86..836ca32b6b 100644 --- a/tool/ruby_vm/views/_insn_entry.erb +++ b/tool/ruby_vm/views/_insn_entry.erb @@ -29,28 +29,17 @@ INSN_ENTRY(<%= insn.name %>) <%= pop[:name] %> = <%= insn.cast_from_VALUE pop, "TOPN(#{i})"%>; % end DEBUG_ENTER_INSN(INSN_ATTR(name)); -% if insn.handles_frame? ADD_PC(INSN_ATTR(width)); POPN(INSN_ATTR(popn)); -% end COLLECT_USAGE_INSN(INSN_ATTR(bin)); % insn.opes.each_with_index do |ope, i| COLLECT_USAGE_OPERAND(INSN_ATTR(bin), <%= i %>, <%= ope[:name] %>); % end <%= render_c_expr insn.expr -%> CHECK_VM_STACK_OVERFLOW_FOR_INSN(VM_REG_CFP, INSN_ATTR(retn)); -% if insn.handles_frame? -% insn.rets.reverse_each do |ret| +% insn.rets.each do |ret| PUSH(<%= insn.cast_to_VALUE ret %>); % end -% else - ADJ_SP(INSN_ATTR(sp_inc)); -% insn.rets.reverse_each.with_index do |ret, i| - TOPN(<%= i %>) = <%= insn.cast_to_VALUE ret %>; -% end - ADD_PC(INSN_ATTR(width)); - PREFETCH(GET_PC()); -% end END_INSN(<%= insn.name %>); # undef INSN_ATTR # undef NAME_OF_CURRENT_INSN diff --git a/tool/ruby_vm/views/_mjit_compile_insn_body.erb b/tool/ruby_vm/views/_mjit_compile_insn_body.erb index 9880689a84..5851313bf7 100644 --- a/tool/ruby_vm/views/_mjit_compile_insn_body.erb +++ b/tool/ruby_vm/views/_mjit_compile_insn_body.erb @@ -77,31 +77,6 @@ } fprintf(f, " goto cancel;\n"); % else -% if insn.handles_frame? -% # If insn.handles_frame? is true, cfp->sp might be changed inside insns (like vm_caller_setup_arg_block) -% # and thus we need to use cfp->sp, even when local_stack_p is TRUE. When insn.handles_frame? is true, -% # cfp->sp should be available too because _mjit_compile_pc_and_sp.erb sets it. fprintf(f, <%= to_cstr.call(line) %>); -% else -% # If local_stack_p is TRUE and insn.handles_frame? is false, stack values are only available in local variables -% # for stack. So we need to replace those macros if local_stack_p is TRUE here. -% case line -% when /\bGET_SP\(\)/ -% # reg_cfp->sp - fprintf(f, <%= to_cstr.call(line.sub(/\bGET_SP\(\)/, '%s')) %>, (status->local_stack_p ? "(stack + stack_size)" : "GET_SP()")); -% when /\bSTACK_ADDR_FROM_TOP\((?<num>[^)]+)\)/ -% # #define STACK_ADDR_FROM_TOP(n) (GET_SP()-(n)) -% num = Regexp.last_match[:num] - fprintf(f, <%= to_cstr.call(line.sub(/\bSTACK_ADDR_FROM_TOP\(([^)]+)\)/, '%s')) %>, - (status->local_stack_p ? "stack + (stack_size - (<%= num %>))" : "STACK_ADDR_FROM_TOP(<%= num %>)")); -% when /\bTOPN\((?<num>[^)]+)\)/ -% # #define TOPN(n) (*(GET_SP()-(n)-1)) -% num = Regexp.last_match[:num] - fprintf(f, <%= to_cstr.call(line.sub(/\bTOPN\(([^)]+)\)/, '%s')) %>, - (status->local_stack_p ? "*(stack + (stack_size - (<%= num %>) - 1))" : "TOPN(<%= num %>)")); -% else - fprintf(f, <%= to_cstr.call(line) %>); -% end -% end % end % end 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 26037e1191..1230ca508e 100644 --- a/tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb +++ b/tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb @@ -8,33 +8,19 @@ % # JIT: Move pc so that catch table lookup condition is met. If the ISeq might not catch an exception, % # the pc motion is optimized away and thus pc should be set properly before `goto cancel`. if (body->catch_except_p) { -% if insn.handles_frame? fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */ -% else - fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos); -% end } % % # JIT: move sp to use or preserve stack variables if (status->local_stack_p) { -% # sp motion is optimized away for `handles_frame? #=> false` case. -% # Thus sp should be set properly before `goto cancel`. -% if insn.handles_frame? % # JIT-only behavior (pushing JIT's local variables to VM's stack): - { 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)); */ for (i = 0; i < push_size; i++) { /* TODO: use memcpy? */ fprintf(f, " *(reg_cfp->sp + %ld) = stack[%ld];\n", i - push_size, (rb_snum_t)b->stack_size - push_size + i); } - } -% end } else { -% if insn.handles_frame? fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1 - <%= insn.pops.size %>); /* POPN(INSN_ATTR(popn)); */ -% else - fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1); -% end } |