summaryrefslogtreecommitdiff
path: root/insns.def
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-29 06:56:56 (GMT)
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-29 06:56:56 (GMT)
commit7d4ad74f22fa259ee81064970fa12d9942472c13 (patch)
tree2eb4d97272327fcf9a288f1c1613446279d503a6 /insns.def
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 'insns.def')
-rw-r--r--insns.def11
1 files changed, 3 insertions, 8 deletions
diff --git a/insns.def b/insns.def
index cd57fbd..69f1795 100644
--- a/insns.def
+++ b/insns.def
@@ -366,7 +366,6 @@ concatstrings
// attr rb_snum_t sp_inc = 1 - num;
{
val = rb_str_concat_literals(num, STACK_ADDR_FROM_TOP(num));
- POPN(num);
}
/* push the result of to_s. */
@@ -403,7 +402,6 @@ toregexp
VALUE rb_reg_new_ary(VALUE ary, int options);
VALUE rb_ary_tmp_new_from_values(VALUE, long, const VALUE *);
const VALUE ary = rb_ary_tmp_new_from_values(0, cnt, STACK_ADDR_FROM_TOP(cnt));
- POPN(cnt);
val = rb_reg_new_ary(ary, (int)opt);
rb_ary_clear(ary);
}
@@ -427,7 +425,6 @@ newarray
// attr rb_snum_t sp_inc = 1 - num;
{
val = rb_ary_new4(num, STACK_ADDR_FROM_TOP(num));
- POPN(num);
}
/* dup array */
@@ -494,7 +491,6 @@ newhash
if (num) {
rb_hash_bulk_insert(num, STACK_ADDR_FROM_TOP(num), val);
}
- POPN(num);
}
/* put new Range object.(Range.new(low, high, flag)) */
@@ -545,6 +541,7 @@ dupn
INC_SP(n); /* alloca */
MEMCPY(dst, src, VALUE, n);
+ DEC_SP(n);
}
/* swap top 2 vals */
@@ -606,7 +603,7 @@ setn
(VALUE val)
// attr rb_snum_t sp_inc = 0;
{
- TOPN(n-1) = val;
+ TOPN(n) = val;
}
/* empty current stack */
@@ -617,7 +614,7 @@ adjuststack
(...)
// attr rb_snum_t sp_inc = -(rb_snum_t)n;
{
- DEC_SP(n);
+ /* none */
}
/**********************************************************/
@@ -757,7 +754,6 @@ opt_newarray_max
// attr rb_snum_t sp_inc = 1 - num;
{
val = vm_opt_newarray_max(num, STACK_ADDR_FROM_TOP(num));
- POPN(num);
}
DEFINE_INSN
@@ -768,7 +764,6 @@ opt_newarray_min
// attr rb_snum_t sp_inc = 1 - num;
{
val = vm_opt_newarray_min(num, STACK_ADDR_FROM_TOP(num));
- POPN(num);
}
/* Invoke method without block */