From 9a4c67fa6c6093b11e387247e1ca756edefbdbfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Mon, 31 May 2010 20:03:56 +0200 Subject: Fix bp_hash_put to do hash value after rehash If a rehash was done the old hash value was used. This was incorrect. --- erts/emulator/beam/beam_bp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'erts/emulator') 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; -- cgit v1.2.3