summaryrefslogtreecommitdiff
path: root/tool/ruby_vm
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-29 06:56:56 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-29 06:56:56 +0000
commit7d4ad74f22fa259ee81064970fa12d9942472c13 (patch)
tree2eb4d97272327fcf9a288f1c1613446279d503a6 /tool/ruby_vm
parent592dcccdf9144a70d1dc9452034c5a583ea8be4a (diff)
also use sp_inc in vm core
Now that sp_inc attributes are officially provided as inline functions. Why not use them directly from the vm core, not just by the compiler. By doing so, it is now possible for us to optimize stack manipulations. We can now know exactly how many words of stack space an instruction consumes before it actually does. This changeset deletes some lines from insns.def because they are no longer needed. As a result it reduces the size of vm_exec_core function from 32,400 bytes to 32,352 bytes on my machine. It seems it does not affect performance: ----------------------------------------------------------- benchmark results: minimum results in each 3 measurements. Execution time (sec) name before after loop_for 1.093 1.061 loop_generator 1.156 1.152 loop_times 0.982 0.974 loop_whileloop 0.549 0.587 loop_whileloop2 0.115 0.121 Speedup ratio: compare with the result of `before' (greater is better) name after loop_for 1.030 loop_generator 1.003 loop_times 1.008 loop_whileloop 0.935 loop_whileloop2 0.949 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/ruby_vm')
-rw-r--r--tool/ruby_vm/views/_insn_entry.erb14
1 files changed, 7 insertions, 7 deletions
diff --git a/tool/ruby_vm/views/_insn_entry.erb b/tool/ruby_vm/views/_insn_entry.erb
index 708f637f83..2118dece86 100644
--- a/tool/ruby_vm/views/_insn_entry.erb
+++ b/tool/ruby_vm/views/_insn_entry.erb
@@ -21,7 +21,6 @@ INSN_ENTRY(<%= insn.name %>)
% insn.preamble.each do |konst|
<%= render_c_expr konst -%>
% end
-%
% insn.opes.each_with_index do |ope, i|
<%= ope[:name] %> = (<%= ope[:type] %>)GET_OPERAND(<%= i + 1 %>);
% end
@@ -32,8 +31,6 @@ INSN_ENTRY(<%= insn.name %>)
DEBUG_ENTER_INSN(INSN_ATTR(name));
% if insn.handles_frame?
ADD_PC(INSN_ATTR(width));
-% end
-% unless insn.pops.empty?
POPN(INSN_ATTR(popn));
% end
COLLECT_USAGE_INSN(INSN_ATTR(bin));
@@ -41,13 +38,16 @@ INSN_ENTRY(<%= insn.name %>)
COLLECT_USAGE_OPERAND(INSN_ATTR(bin), <%= i %>, <%= ope[:name] %>);
% end
<%= render_c_expr insn.expr -%>
-% unless insn.rets.empty?
CHECK_VM_STACK_OVERFLOW_FOR_INSN(VM_REG_CFP, INSN_ATTR(retn));
-% insn.rets.each_with_index do |ret, i|
+% if insn.handles_frame?
+% insn.rets.reverse_each do |ret|
PUSH(<%= insn.cast_to_VALUE ret %>);
% end
-% end
-% unless insn.handles_frame?
+% 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