summaryrefslogtreecommitdiff
path: root/insns.def
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-20 10:32:08 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-20 10:32:08 +0000
commit5069122ab67466fe569a0bfe31c551ba9185c74a (patch)
treef569b74f83a4e44e1a831b5123a700a2d31db9c1 /insns.def
parent6a08beef517fa766b276975cdb2619939c6f7779 (diff)
refactor torexp to use routine in array.c
Found a part where copy&paste can be eliminated. Reduces vm_exec_core from 26,228 bytes to 26,176 bytes in size on my machine. I believe it does not affect any runtime performance. ---- * array.c (rb_ary_tmp_new_from_values): extend existing rb_ary_new_from_values function so that it can take additional value for klass. * array.c (rb_ary_new_from_values): use the new function. * insns.def (toregexp): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'insns.def')
-rw-r--r--insns.def7
1 files changed, 2 insertions, 5 deletions
diff --git a/insns.def b/insns.def
index 45dab0a927..a056b221d5 100644
--- a/insns.def
+++ b/insns.def
@@ -388,11 +388,8 @@ toregexp
(VALUE val) // inc += 1 - cnt;
{
VALUE rb_reg_new_ary(VALUE ary, int options);
- rb_num_t i;
- const VALUE ary = rb_ary_tmp_new(cnt);
- for (i = 0; i < cnt; i++) {
- rb_ary_store(ary, cnt-i-1, TOPN(i));
- }
+ 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);