Closed Bug 929620 Opened 11 years ago Closed 11 years ago

Don't use 8-bit fixed point arithmetic in HashTable

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 934718

People

(Reporter: n.nethercote, Assigned: n.nethercote)

Details

Bug 927705 made a change to pldhash that is worth propagating to HashTable. HashTable.h currently has a 16M capacity limit. This is currently a hard limit due to the use of 8-bit fixed point arithmetic (which fails above 16M) to compute min/max loads. The 8-bitness is unnecessary complexity and should be removed. We could consider increasing the max capacity limit as well (pldhash now has 64M). If we do, the following static assertion JS_STATIC_ASSERT((sMaxCapacity * sizeof(Entry)) <= UINT32_MAX); might need to be reconsidered; if it's too onerous, we could change to a dynamic overflow check, which is what pldhash uses.
Note to self: HashTable has two unit tests in js/src/jsapi-tests/: testHashTable.cpp and testHashTableInit.cpp, and I don't understand why the testHashInitTooHuge() in the latter fails -- it seems like a bigger init number should be allowed. Maybe it's a limit of the 8-bit fixed point arithmetic.
Another idea worth stealing from pldhash is bug 933074 -- allowing reasonable overloading (past 75% full) if the table cannot be grown.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.