From: Eric Wong Date: 2014-01-07T01:31:54+00:00 Subject: [ruby-core:59610] Re: [ruby-trunk - Feature #9362][Assigned] Minimize cache misshit to gain optimal speed Eric Wong wrote: > Eric Wong wrote: > > I am testing this, it looks like GC is confused by EMBED_FLAG being > > set and having ->ntbl: > > > > --- a/hash.c > > +++ b/hash.c > > @@ -866,7 +866,8 @@ rb_hash_rehash(VALUE hash) > > rb_hash_modify_check(hash); > > if (!RHASH(hash)->ntbl) > > return hash; > > - tmp = hash_alloc(0); > > + tmp = rb_hash_new(); > > Btw, I just noticed this reverts r43975. I must say I don't understand why > r43975 was made, actually. Bug #9187 is fixed by several commits, but I was > confused by the use of 0 as klass... > (commit 437b8bc53b25c3c2ac751db816dc1076d8c6957f) OK, so it seems my hash_alloc(0) -> rb_hash_new() change is not necessary (but explode() is). basic.klass == 0 apparently means it's an internal object, so it is probably meant to make tools like ObjectSpace more usable (please correct me on this if I'm wrong). I've updated my pull request (new branch) to only do explode() and added a comment. The following changes since commit fe8820a15f0c7a25a532968601c645d1de7a3f95: Merge branch 'pull-495-fixes' of git://80x24.org/ruby into cachelined (2014-01-05 19:23:15 +0900) are available in the git repository at: git://bogomips.org/ruby.git pull-495-rehash for you to fetch changes up to 25771cdbe64b54c2371e44d394642135aaabfe00: hash: fix GC crash during Hash#rehash (2014-01-07 01:28:14 +0000) ---------------------------------------------------------------- Eric Wong (1): hash: fix GC crash during Hash#rehash hash.c | 6 ++++++ 1 file changed, 6 insertions(+)