[buddy] Reduce the size of bddNode to improve cache efficiency.

The unicity table was mixed with the bddNode table for now
apparent reason.  After the hash of some node is computed,
bddnodes[hash] did only contain some random node (not the one
looked for) whose .hash member would point to the actual node with
this hash.  So that's a two step lookup.  With this patch, we sill
have a two step lookup, but the .hash member have been moved to a
separate array.  A consequence is that bddNode is now 16-byte long
(instead of 20) so it will never span across two cache lines.

* src/kernel.h (bddNode): Remove the hash member, and move it...
(bddhash): ... as this new separate table.
* src/kernel.c, src/reorder.c: Adjust all code.
This commit is contained in:
Alexandre Duret-Lutz 2012-06-08 11:28:48 +02:00
parent 96c436e0e2
commit e7a46e10e2
4 changed files with 75 additions and 43 deletions

View file

@ -96,7 +96,6 @@ typedef struct s_BddNode /* Node table entry */
unsigned int level : 22;
int low;
int high;
int hash;
int next;
} BddNode;
@ -113,6 +112,7 @@ extern int bddnodesize; /* Number of allocated nodes */
extern int bddmaxnodesize; /* Maximum allowed number of nodes */
extern int bddmaxnodeincrease; /* Max. # of nodes used to inc. table */
extern BddNode* bddnodes; /* All of the bdd nodes */
extern int* bddhash; /* Unicity hash table */
extern int bddvarnum; /* Number of defined BDD variables */
extern int* bddrefstack; /* Internal node reference stack */
extern int* bddrefstacktop; /* Internal node reference stack top */