Closed Bug 1500926 Opened 2 years ago Closed 2 years ago

Use a static perfect hash for WebIDLGlobalNameHash

Categories

(Core :: DOM: Bindings (WebIDL), enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla65
Tracking Status
firefox65 --- fixed

People

(Reporter: nika, Assigned: nika)

References

Details

Attachments

(3 files)

Currently we build an in-memory hash table containing this information, while we can instead use perfecthash.py to generate a static data structure.

My initial patches do not separate the table information requiring relocation data from those which do not, but that was done for simplicity of implementation. It may not be worthwhile to perform that refactoring, due to the relatively small size of the table (~800 entries).
Depends on: 1500927
This strategy allows us to dodge dynamic allocations in WebIDLGlobalNameHash.
This removes the Init() and Shutdown() methods, as well as Register. The
RegisterBindings.cpp file now only contains static data and one method
declaration for the WebIDLGlobalNameHash class.

This should also be faster by making the hashtable lookup infallible.

Depends on D9405
When running tests, we can build a WebIDL environment with no interfaces
exposed on the primary global. Unfortunately, due to the perfecthash.py logic
not handling empty tables, this causes an assertion to be raised. 

We can work around this by generating some dummy code for that situation, as we
will never try to build it.

Depends on D9406
Pushed by nika@thelayzells.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/80b71708f7ca
Part 1: Use a statically generated perfect hash in WebIDLGlobalNameHash, r=bzbarsky
https://hg.mozilla.org/integration/mozilla-inbound/rev/3d9631fca868
Part 2: Support a test-only edgecase in Codegen.py, r=bzbarsky
https://hg.mozilla.org/integration/mozilla-inbound/rev/8b0b407e053f
Part 3: Remove unused WebIDL Codegen items, r=bzbarsky
https://hg.mozilla.org/mozilla-central/rev/80b71708f7ca
https://hg.mozilla.org/mozilla-central/rev/3d9631fca868
https://hg.mozilla.org/mozilla-central/rev/8b0b407e053f
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
You need to log in before you can comment on or make changes to this bug.