diff options
author | Peter Zhu <[email protected]> | 2024-11-05 10:45:39 -0500 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2024-11-06 10:34:20 -0500 |
commit | 56ecc243e230e8e99761ec0ffc5116601f094bb0 (patch) | |
tree | e4a298e8f8a7ae865c86082095f7264001f9d9cc /test/ruby/test_io_buffer.rb | |
parent | 96e695ad00b78cf7090eebdb4cfa9dd3350bd299 (diff) |
[Bug #20868] Fix Method#hash to not change after compaction
The hash value of a Method must remain constant after a compaction, otherwise
it may not work as the key in a hash table.
For example:
def a; end
# Need this method here because otherwise the iseq may be on the C stack
# which would get pinned and not move during compaction
def get_hash
method(:a).hash
end
puts get_hash # => 2993401401091578131
GC.verify_compaction_references(expand_heap: true, toward: :empty)
puts get_hash # => -2162775864511574135
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12004
Diffstat (limited to 'test/ruby/test_io_buffer.rb')
0 files changed, 0 insertions, 0 deletions