Closed Bug 989013 Opened 10 years ago Closed 8 years ago

Provide a specialized hashtable that works with GC thing keys/values


(Core :: JavaScript: GC, defect)

Not set





(Reporter: jonco, Unassigned)


(Blocks 1 open bug)



(1 file)

Currently using hashtables is hard because you need to:
 1) Wrap GC thing keys in EncapsulatedPtr
 2) Wrap GC thing values in RelocatablePtr
 3) Add the correct write barriering to ensure the keys get moved

(and this is the simple case when they keys/values are not compound structures)

Needless to say, this is not trivial and it's easy to get wrong.

Instead we should provide a specialized hashtable class that does as much as possible of this for you.
Blocks: GC.stability
No longer blocks: 673454
Another usability option would be to make object hashes independent of the address so that users can avoid the rekeying barrier and just use RelocatablePtr everywhere. The attached POC does this and manages to pass 95% of jit-tests, although is obviously flawed in a number of respects.
On my machine we hit the object hasher 12,000 to 13,000 times, the vast majority for existing hashes. That's lots, but maybe not so many that performance will be a serious issue.
This was actually missing overloads for JSObject subclasses, so we were missing a ton of GlobalObject and SavedFrame hashes. Need to re-measure.
We're going with the stable hash code for object approach instead.
Closed: 8 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.