|
|
Message-Id: <1435448915-28419-7-git-send-email-amonakov@ispras.ru>
Date: Sun, 28 Jun 2015 02:48:35 +0300
From: Alexander Monakov <amonakov@...ras.ru>
To: musl@...ts.openwall.com
Subject: [PATCH v2 6/6] dynlink.c: store bloom filter size in struct dso
This slightly speeds up gnu_lookup_filtered by avoiding pointer chasing.
---
src/ldso/dynlink.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
index f181209..12e8c25 100644
--- a/src/ldso/dynlink.c
+++ b/src/ldso/dynlink.c
@@ -59,6 +59,7 @@ struct dso {
Sym *syms;
uint32_t *hashtab;
uint32_t *ghashtab;
+ uint32_t ghashmask;
struct udiv gudiv;
int16_t *versym;
char *strings;
@@ -259,7 +260,7 @@ static Sym *gnu_lookup_filtered(uint32_t h1, uint32_t *hashtab, struct dso *dso,
uint32_t fofs, size_t fmask)
{
const size_t *bloomwords = (const void *)(hashtab+4);
- size_t f = bloomwords[fofs & (hashtab[2]-1)];
+ size_t f = bloomwords[fofs & dso->ghashmask];
if (!(f & fmask)) return 0;
f >>= (h1 >> hashtab[3]) % (8 * sizeof f);
@@ -758,6 +759,7 @@ static void decode_dyn(struct dso *p)
p->rpath_orig = (void *)(p->strings + dyn[DT_RUNPATH]);
if (search_vec(p->dynv, dyn, DT_GNU_HASH)) {
p->ghashtab = (void *)(p->base + *dyn);
+ p->ghashmask = p->ghashtab[2]-1;
precompute_udiv(p->ghashtab[0], &p->gudiv);
}
if (search_vec(p->dynv, dyn, DT_VERSYM))
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.