Skip to content

Commit

Permalink
Set hashes to 0 if entry gets deleted
Browse files Browse the repository at this point in the history
from functional perspective this is not necessary as it
would never reach the point to compare the hashes.
However, when debugging, it helps to also see the deleted hashes.
  • Loading branch information
ChrisBr committed Sep 1, 2018
1 parent 899afc7 commit bd2e0c0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/RubyHash.java
Expand Up @@ -733,6 +733,7 @@ private final IRubyObject internalDeleteOpenAddressing(final int hash, final Ent
otherValue = entries[(index * NUMBER_OF_ENTRIES) + 1];
if (matchType.matches(key, value, otherKey, otherValue)) {
bins[bin] = DELETED_BIN;
hashes[index] = 0;
entries[index * NUMBER_OF_ENTRIES] = null;
entries[(index * NUMBER_OF_ENTRIES) + 1] = null;
size--;
Expand All @@ -759,6 +760,7 @@ private final IRubyObject internalDeleteLinearSearch(final int hash, final Entry
continue;

if (matchType.matches(key, value, otherKey, otherValue)) {
hashes[index] = 0;
entries[index * NUMBER_OF_ENTRIES] = null;
entries[(index * NUMBER_OF_ENTRIES) + 1] = null;
size--;
Expand Down

0 comments on commit bd2e0c0

Please sign in to comment.