Remove well-known and static string atom instance
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox87 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
(Blocks 1 open bug)
Details
Attachments
(21 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
If all operations on well-known/static ParserAtomEntry
pointer outside of ParserAtomsTable
can be moved inside ParserAtomTable (bug 1689892), we can remove well-known/static ParserAtomEntry
instances and instead use only TaggedParserAtomIndex
as reference to them.
so that:
- reduce rodata size
- reduce startup cost for initializing the well-known table
- enable adding more well-known/static
- bug 1689434 (length-3 or more static strings)
- make all atoms in self-hosted.js well-known
Assignee | ||
Comment 1•3 years ago
|
||
for static strings, the content can be encoded directly in the TaggedParserAtomIndex
, so we don't need extra space.
for well-known, we'll need string constant in addition to atom index, to retrieve the content,
but that can be shared between VM well-known atoms or other static string constant.
Assignee | ||
Comment 2•3 years ago
|
||
Thinking a bit more about the merit:
ParserAtomEntry
consists of:
HashNumber hash_
uint32_t length_
uint32_t flags_
- trailing chars
even if we remove the entry instance, we need hash and the equivalent of trailing chars.
So, 8 bytes (length and flags) can be definitely reduced for each atom.
then, for well-known atoms, we already have const char js_FOO_str[];
, so that can be shared.
https://searchfox.org/mozilla-central/rev/927e525f481a93a8f63d27a78ae6201e42b1b1fb/js/src/vm/JSAtom.cpp#220-222
Assignee | ||
Comment 3•3 years ago
|
||
bug 1689434 experiment proved that we can have TaggedParserAtomIndex
without ParserAtomEntry
instance.
the problem there were:
- cannot statically calculate/allocate hash
- atomization in toExistingJSAtom call
for well-known and length-1/2 case, we already calculate/allocate hash, and toExistingJSatom
doesn't touch ParserAtomEntry
instance but just returns from VM side's table,
so this should work.
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 4•3 years ago
|
||
https://treeherder.mozilla.org/jobs?repo=try&revision=8934f21512c29261e32a08e0490a4049f89ad881
the patch doesn't yet dedup well-known atoms' string in frontend and js_FOO_str
.
I hoped compiler can do that automatically, but maybe I should explicitly point the same string.
Assignee | ||
Comment 5•3 years ago
|
||
maybe we can move the WellKnownStringInfo
in the patch out of frontend, and use that also from JSAtom.cpp
WellKnownStringInfo
also contains hash, so JSRuntime::initializeAtoms
can use that info to skip hash calculation on runtime
Assignee | ||
Comment 6•3 years ago
|
||
Here's the plan:
- Rewrite length-1/2 cases not to retrieve
ParserAtom
, but construct necessary info (content, length) in place - Add
WellKnownAtomInfo
that holds (content, length, hash) for each well-known atoms - Use
WellKnownAtomInfo
array to populateWellKnownParserAtoms::wellKnownMap_
- Rewrite well-known atom case not to retrieve
ParserAtom
, but useWellKnownAtomInfo
- Remove
WellKnownParserAtoms_ROM
andWellKnownParserAtoms
's pointer fields - Dedup
js_*_str
andWellKnownAtomInfo
content - Rewrite
JSAtom
common names initialization to useWellKnownAtomInfo
array, with pre-calculated hash
Assignee | ||
Comment 7•3 years ago
|
||
Assignee | ||
Comment 8•3 years ago
|
||
Assignee | ||
Comment 9•3 years ago
|
||
Depends on D104593
Assignee | ||
Comment 10•3 years ago
|
||
Depends on D104594
Assignee | ||
Comment 11•3 years ago
|
||
Depends on D104595
Assignee | ||
Comment 12•3 years ago
|
||
Depends on D104596
Assignee | ||
Comment 13•3 years ago
|
||
Depends on D104597
Assignee | ||
Comment 14•3 years ago
|
||
Depends on D104598
Assignee | ||
Comment 15•3 years ago
|
||
Depends on D104599
Assignee | ||
Comment 16•3 years ago
|
||
Depends on D104600
Assignee | ||
Comment 17•3 years ago
|
||
Depends on D104601
Assignee | ||
Comment 18•3 years ago
|
||
Depends on D104602
Assignee | ||
Comment 19•3 years ago
|
||
Depends on D104603
Assignee | ||
Comment 20•3 years ago
|
||
Depends on D104604
Assignee | ||
Comment 21•3 years ago
|
||
Depends on D104605
Assignee | ||
Comment 22•3 years ago
|
||
Depends on D104606
Assignee | ||
Comment 23•3 years ago
|
||
WellKnownAtomInfo can be used also from JSAtom initialization later, so the
definition is placed in vm/WellKnownAtom.h, and also WellKnownAtomId is moved
there.
Depends on D104607
Assignee | ||
Comment 24•3 years ago
|
||
Depends on D104608
Assignee | ||
Comment 25•3 years ago
|
||
Depends on D104609
Assignee | ||
Comment 26•3 years ago
|
||
Depends on D104610
Assignee | ||
Comment 27•3 years ago
|
||
Depends on D104611
Assignee | ||
Comment 28•3 years ago
|
||
Depends on D104612
Assignee | ||
Comment 29•3 years ago
|
||
The result of size reduction
file | before | after | diff |
---|---|---|---|
js shell | 40,429,520 | 40,365,856 | -63,664 |
x86_64 dmg | 77,814,414 | 77,743,517 | -70,897 |
XUL | 161,242,216 | 161,193,856 | -48,360 |
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Comment 30•3 years ago
|
||
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/218bb88bba9d Part 1: Use range-specific methods. r=nbp https://hg.mozilla.org/integration/autoland/rev/1c3cdfd28aff Part 2: Do not reteieve atom entry for length-1/2 in ParserAtomsTable::length. r=nbp https://hg.mozilla.org/integration/autoland/rev/0449ae9ec529 Part 3: Add ParserAtomsTable::{getLength1Content,getLength2Content} methods and use in ParserAtomsTable::{dump,dumpCharsNoQuote}. r=nbp https://hg.mozilla.org/integration/autoland/rev/a8abd8e27509 Part 4: Add length-1/2-specific path for ParserAtomsTable::isIdentifier. r=nbp https://hg.mozilla.org/integration/autoland/rev/8118bd961f9c Part 5: Add length-1/2-specific path for ParserAtomsTable::isExtendedUnclonedSelfHostedFunctionName. r=nbp https://hg.mozilla.org/integration/autoland/rev/6e986649b078 Part 6: Add length-1/2-specific path for ParserAtomsTable::isIndex. r=nbp https://hg.mozilla.org/integration/autoland/rev/8bf00cffdeba Part 7: Add length-1/2-specific path for ParserAtomsTable::toNumber. r=nbp https://hg.mozilla.org/integration/autoland/rev/218133df75d4 Part 8: Add length-1/2-specific path for ParserAtomsTable::toNewUTF8CharsZ. r=nbp https://hg.mozilla.org/integration/autoland/rev/e3c635019f2a Part 9: Add length-1/2-specific path for ParserAtomsTable::toPrintableString. r=nbp https://hg.mozilla.org/integration/autoland/rev/d85cd571f708 Part 10: Add length-1/2-specific path for ParserAtomsTable::toQuotedString. r=nbp https://hg.mozilla.org/integration/autoland/rev/c73eb9133e56 Part 11: Add length-1/2-specific path for ParserAtomsTable::appendTo. r=nbp https://hg.mozilla.org/integration/autoland/rev/833782d13263 Part 12: Add length-1/2-specific path for ParserAtomsTable::isModuleExportName. r=nbp https://hg.mozilla.org/integration/autoland/rev/74cbe3f3c730 Part 13: Remove TaggedParserAtomIndex variant of getParserAtom. r=nbp https://hg.mozilla.org/integration/autoland/rev/b2ba7e3b9245 Part 14: Move dumpCharsNoQuote for length-1/2 into separate static function, to use from stencil dump. r=nbp https://hg.mozilla.org/integration/autoland/rev/52dd05ae7c18 Part 15: Remove ParserAtomsTable::{getLength1Static,getLength2Static}. r=nbp https://hg.mozilla.org/integration/autoland/rev/d80f85078a7f Part 16: Add WellKnownAtomInfo and use it in WellKnownParserAtoms::wellKnownMap_ and ParserAtomsTable::{dump,dumpCharsNoQuote}. r=nbp https://hg.mozilla.org/integration/autoland/rev/a97f35aa5813 Part 17: Use GetWellKnownAtomInfo in ParserAtomsTable methods. r=nbp https://hg.mozilla.org/integration/autoland/rev/6550f2638e10 Part 18: Remove WellKnownParserAtoms_ROM. r=nbp https://hg.mozilla.org/integration/autoland/rev/11be0b92d7fa Part 19: Move js_*_str to WellKnownAtom.h. r=nbp https://hg.mozilla.org/integration/autoland/rev/8b5f8b69af1f Part 20: Use pre-calculated hash in JSAtom common name initialization. r=nbp https://hg.mozilla.org/integration/autoland/rev/b23da4ca0327 Part 21: Pre-calculate hash for symbol-related common names. r=nbp
Comment 31•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/218bb88bba9d
https://hg.mozilla.org/mozilla-central/rev/1c3cdfd28aff
https://hg.mozilla.org/mozilla-central/rev/0449ae9ec529
https://hg.mozilla.org/mozilla-central/rev/a8abd8e27509
https://hg.mozilla.org/mozilla-central/rev/8118bd961f9c
https://hg.mozilla.org/mozilla-central/rev/6e986649b078
https://hg.mozilla.org/mozilla-central/rev/8bf00cffdeba
https://hg.mozilla.org/mozilla-central/rev/218133df75d4
https://hg.mozilla.org/mozilla-central/rev/e3c635019f2a
https://hg.mozilla.org/mozilla-central/rev/d85cd571f708
https://hg.mozilla.org/mozilla-central/rev/c73eb9133e56
https://hg.mozilla.org/mozilla-central/rev/833782d13263
https://hg.mozilla.org/mozilla-central/rev/74cbe3f3c730
https://hg.mozilla.org/mozilla-central/rev/b2ba7e3b9245
https://hg.mozilla.org/mozilla-central/rev/52dd05ae7c18
https://hg.mozilla.org/mozilla-central/rev/d80f85078a7f
https://hg.mozilla.org/mozilla-central/rev/a97f35aa5813
https://hg.mozilla.org/mozilla-central/rev/6550f2638e10
https://hg.mozilla.org/mozilla-central/rev/11be0b92d7fa
https://hg.mozilla.org/mozilla-central/rev/8b5f8b69af1f
https://hg.mozilla.org/mozilla-central/rev/b23da4ca0327
Description
•