Fix #1664 for Hash#compare_by_identity and Hash#store

https://github.com/jruby/jruby/issues/1664

Test in RubySpec:
https://github.com/rubyspec/rubyspec/pull/274

Sorry that I didn't check if this works. Let's see travis :P