aboutsummaryrefslogtreecommitdiffstats
path: root/insns.def
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-24 01:40:51 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-24 01:40:51 +0000
commite8c55ea540f85fffdba99d003e9cc363c5888515 (patch)
tree2b635425fb05d3325a5c58ed0c0de6801f950ce3 /insns.def
parentcf5979fa7ceb4dce319a42541fc6cc322fd9a821 (diff)
downloadruby-e8c55ea540f85fffdba99d003e9cc363c5888515.tar.gz
revert newhash refactoring
We need to fix GC bug before merging this. Revert revisions 58452, 58435, 58434, 58428, 58427 in this order. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'insns.def')
-rw-r--r--insns.def13
1 files changed, 8 insertions, 5 deletions
diff --git a/insns.def b/insns.def
index 36ba48eaea..a056b221d5 100644
--- a/insns.def
+++ b/insns.def
@@ -492,13 +492,16 @@ newhash
(...)
(VALUE val) // inc += 1 - num;
{
+ rb_num_t i;
+
RUBY_DTRACE_CREATE_HOOK(HASH, num);
- if (num) {
- val = rb_hash_new_from_values(num, STACK_ADDR_FROM_TOP(num));
- }
- else {
- val = rb_hash_new();
+ val = rb_hash_new();
+
+ for (i = num; i > 0; i -= 2) {
+ const VALUE v = TOPN(i - 2);
+ const VALUE k = TOPN(i - 1);
+ rb_hash_aset(val, k, v);
}
POPN(num);
}