aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-05-26 12:13:50 +0200
committerSverker Eriksson <[email protected]>2016-05-26 12:13:50 +0200
commita3fcb808a48a8bbcc785edd06d68b7a1fe079c8d (patch)
treeaf2b66530b465dfa75b32fd1c558838697210e91 /erts
parent50447f0bfa84046961cdc7693f7c374f5b81d461 (diff)
downloadotp-a3fcb808a48a8bbcc785edd06d68b7a1fe079c8d.tar.gz
otp-a3fcb808a48a8bbcc785edd06d68b7a1fe079c8d.tar.bz2
otp-a3fcb808a48a8bbcc785edd06d68b7a1fe079c8d.zip
erts: Improve bucket search for hipe_mfa_info
by actually using the cached hash value.
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/hipe/hipe_bif0.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/erts/emulator/hipe/hipe_bif0.c b/erts/emulator/hipe/hipe_bif0.c
index 307d2424ce..918cdd61e6 100644
--- a/erts/emulator/hipe/hipe_bif0.c
+++ b/erts/emulator/hipe/hipe_bif0.c
@@ -1140,10 +1140,13 @@ static inline struct hipe_mfa_info *hipe_mfa_info_table_get_locked(Eterm m, Eter
h = HIPE_MFA_HASH(m, f, arity);
i = h & hipe_mfa_info_table.mask;
p = hipe_mfa_info_table.bucket[i];
- for (; p; p = p->bucket.next)
- /* XXX: do we want to compare p->bucket.hvalue as well? */
- if (p->m == m && p->f == f && p->a == arity)
- return p;
+ for (; p; p = p->bucket.next) {
+ if (p->bucket.hvalue == h) {
+ if (p->m == m && p->f == f && p->a == arity)
+ return p;
+ }
+ else ASSERT(!(p->m == m && p->f == f && p->a == arity));
+ }
return NULL;
}
@@ -1167,10 +1170,13 @@ static struct hipe_mfa_info *hipe_mfa_info_table_put_rwlocked(Eterm m, Eterm f,
h = HIPE_MFA_HASH(m, f, arity);
i = h & hipe_mfa_info_table.mask;
p = hipe_mfa_info_table.bucket[i];
- for (; p; p = p->bucket.next)
- /* XXX: do we want to compare p->bucket.hvalue as well? */
- if (p->m == m && p->f == f && p->a == arity)
- return p;
+ for (; p; p = p->bucket.next) {
+ if (p->bucket.hvalue == h) {
+ if (p->m == m && p->f == f && p->a == arity)
+ return p;
+ }
+ else ASSERT(!(p->m == m && p->f == f && p->a == arity));
+ }
p = hipe_mfa_info_table_alloc(m, f, arity);
p->bucket.hvalue = h;
p->bucket.next = hipe_mfa_info_table.bucket[i];