Hash size is fixed at hash initialization #define OBJHASHSIZE 42073. Leads to performance issues in larger chips. Proposal: allow hash resizing.
HashIntPtrInstall and HashIntPtrLookup use (*matchintfunc)(name, np->name, value, (int)(*((int *)np->ptr))) where value is a file number. (int)(*((int *)np->ptr))) is the first 32 bits of whatever is at the address stored in np->ptr, correct? I don't see how that would match a file number (unless they're both zero). Proposal: Change to HashInt2PtrInstall and HashInt2PtrLookup.
HashInt2PtrInstall and HashInt2PtrLookup use genhash to generate the key, which is not case insensitive. Although the hash does contain the integer c, it is possible that creating the key via modulo would give the same key for the same name and 2 different int values. The hash origin comparison does not include a check for the integer, so the wrong value may be returned. Proposal: Save int in the hash list for comparison. Create case insensitive comparison, if needed.
Hash key creation uses modulo division, which can be slow. Proposal: limit hash sizes to 2^n - the hash key is (hash & (2^n-1))
#define OBJHASHSIZE 42073
. Leads to performance issues in larger chips. Proposal: allow hash resizing.HashIntPtrInstall
andHashIntPtrLookup
use(*matchintfunc)(name, np->name, value, (int)(*((int *)np->ptr)))
wherevalue
is a file number.(int)(*((int *)np->ptr)))
is the first 32 bits of whatever is at the address stored innp->ptr
, correct? I don't see how that would match a file number (unless they're both zero). Proposal: Change toHashInt2PtrInstall
andHashInt2PtrLookup
.HashInt2PtrInstall
andHashInt2PtrLookup
usegenhash
to generate the key, which is not case insensitive. Although the hash does contain the integerc
, it is possible that creating the key via modulo would give the same key for the same name and 2 different int values. The hash origin comparison does not include a check for the integer, so the wrong value may be returned. Proposal: Save int in the hash list for comparison. Create case insensitive comparison, if needed.(hash & (2^n-1))