aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_bp.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2010-05-31 20:03:56 +0200
committerRaimo Niskanen <[email protected]>2010-06-03 14:54:22 +0200
commit9a4c67fa6c6093b11e387247e1ca756edefbdbfe (patch)
tree3f604ae97854ce8a20dc8131b2db32c6f9fcd118 /erts/emulator/beam/beam_bp.c
parent97ea51cb947e5c394155f138d1b60622a794436b (diff)
downloadotp-9a4c67fa6c6093b11e387247e1ca756edefbdbfe.tar.gz
otp-9a4c67fa6c6093b11e387247e1ca756edefbdbfe.tar.bz2
otp-9a4c67fa6c6093b11e387247e1ca756edefbdbfe.zip
Fix bp_hash_put to do hash value after rehash
If a rehash was done the old hash value was used. This was incorrect.
Diffstat (limited to 'erts/emulator/beam/beam_bp.c')
-rw-r--r--erts/emulator/beam/beam_bp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/erts/emulator/beam/beam_bp.c b/erts/emulator/beam/beam_bp.c
index 5ccac9b593..682f31b83f 100644
--- a/erts/emulator/beam/beam_bp.c
+++ b/erts/emulator/beam/beam_bp.c
@@ -570,7 +570,7 @@ static ERTS_INLINE bp_data_time_item_t * bp_hash_get(bp_time_hash_t *hash, bp_da
}
static ERTS_INLINE bp_data_time_item_t * bp_hash_put(bp_time_hash_t *hash, bp_data_time_item_t* sitem) {
- Uint hval = (sitem->pid >> 4) % hash->n;
+ Uint hval;
float r = 0.0;
bp_data_time_item_t *item;
@@ -582,6 +582,8 @@ static ERTS_INLINE bp_data_time_item_t * bp_hash_put(bp_time_hash_t *hash, bp_da
if (r > 0.7f) {
bp_hash_rehash(hash, hash->n * 2);
}
+ /* Do hval after rehash */
+ hval = (sitem->pid >> 4) % hash->n;
/* find free slot */
item = hash->item;