Closed Bug 1675241 Opened 3 months ago Closed 2 months ago

Use ParserAtom index in stencil

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
84 Branch
Tracking Status
firefox84 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(12 files, 13 obsolete files)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review

Currently ParserAtoms are referred by pointer inside stencil structure.
If we can replace it with ParserAtom index inside vector (added by bug 1674351),
The struct size and variant size gets reduced, and also we can directly encode the index into XDR buffer.

Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED

TODO:

  1. Use separate storage for "all frontend atoms" and "atoms used by stencil"
  2. Add 28-bit limitation to the number of parser atom
  3. Add TaggedAtomIndex that represents all ParserAtom kind in 32-bit
  4. Encode/decode "atoms used by stencil" at the beginning, instead of switching between buffer while encoding fields
  5. Use TaggedAtomIndex in stencil fields

Now ParserAtomsTable in CompilationState uses different storage than
CompilationStencil.parserAtomData, and when storing a parser atom into
any of stencil field, the atom is copied to CompilationStencil.parserAtomData.

As a result, all atoms inside CompilationStencil.parserAtomData are used by
stencil and allocation/instantiation gets simpler.

This replaces markUsedByStencil with storeIntoStencil, and slightly moves the
callsite, to get access to CompilationInfo.

Later patch will modify storeIntoStencil to return an index, and all
ParserAtom* field will be replaced by the index.

Also add 28-bit limitation to the number of parser atoms.

Later patch will add null tag, and also move well-known/static1/static2 into
sub tag.

Depends on D96240

Depends on D96241

To use index in nullable atom field, add null tag.

Depends on D96244

Added infrastructure for handling TaggedAtomIndex in stencil instantiation and
encode/decode, and replaced ScriptStencil.functionAtom with TaggedAtomIndex
as an example consumer.

Depends on D96245

Depends on D96250

Attachment #9186337 - Attachment description: Bug 1675241 - Part 1: Use separate storage for all parser atoms and stencil-related parser atoms. r?tcampbell! → Bug 1675241 - Part 1: Build CompilationStencil.parserAtomData when storing into stencil fields. r?tcampbell!

Now ParserAtomsTable doesn't build CompilationStencil.parserAtomData.
CompilationStencil.parserAtomData is built when storing a parser atom into
any of stencil field.

As a result, all atoms inside CompilationStencil.parserAtomData are used by
stencil and allocation/instantiation gets simpler.

This replaces markUsedByStencil with storeIntoStencil, and slightly moves the
callsite, to get access to CompilationInfo.

Later patch will modify storeIntoStencil to return an index, and all
ParserAtom* field will be replaced by the index.

Attachment #9186337 - Attachment is obsolete: true
Attachment #9186339 - Attachment is obsolete: true
Attachment #9186340 - Attachment is obsolete: true
Attachment #9186341 - Attachment is obsolete: true
Attachment #9186342 - Attachment is obsolete: true
Attachment #9186343 - Attachment is obsolete: true
Attachment #9186344 - Attachment is obsolete: true
Attachment #9186345 - Attachment is obsolete: true
Attachment #9186346 - Attachment is obsolete: true
Attachment #9186347 - Attachment is obsolete: true
Attachment #9186348 - Attachment is obsolete: true
Attachment #9186349 - Attachment is obsolete: true
Attachment #9186465 - Attachment is obsolete: true
Attachment #9187502 - Attachment description: Bug 1675241 - Part 9: Use TaggedParserAtomIndex in StencilModuleEntry. r?tcampbell! → Bug 1675241 - Part 10: Use TaggedParserAtomIndex in StencilModuleEntry. r?tcampbell!
Attachment #9187503 - Attachment description: Bug 1675241 - Part 10: Use TaggedParserAtomIndex in ScriptThingVariant. r?tcampbell! → Bug 1675241 - Part 11: Use TaggedParserAtomIndex in ScriptThingVariant. r?tcampbell!
Attachment #9187504 - Attachment description: Bug 1675241 - Part 11: Use TaggedParserAtomIndex in ObjLiteralStencil. r?tcampbell! → Bug 1675241 - Part 12: Use TaggedParserAtomIndex in ObjLiteralStencil. r?tcampbell!
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/0210295f9234
Part 1: Move getWellKnown/getStatic1/getStatic2 impl to WellKnownParserAtoms. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/5e683e6376b9
Part 2: Add getWellKnown/getStatic1/getStatic2 to ParserAtomsTable. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/b2dc7bdd01dc
Part 3: Add {ParserAtomsTable,ParserAtomVectorBuilder}::getParserAtom. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/f8de842b23db
Part 4: Use TaggedParserAtomIndex in ParserAtomEntry. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/5d6e0d22083f
Part 5: Use TaggedParserAtomIndex in XDR. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/50e9d084764c
Part 6: Add CompilationAtomCache.getExistingAtomAt with TaggedParserAtomIndex. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/3749d6d2325d
Part 7: Add CompilationStencil::getParserAtomAt. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/f505b8fb8f8b
Part 8: Use TaggedParserAtomIndex in ScriptStencil.functionAtom. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/73cc5fa0e0bd
Part 9: Use TaggedParserAtomIndex in RegExpStencil.atom_. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/cb0e58368cd4
Part 10: Use TaggedParserAtomIndex in StencilModuleEntry. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/8af30c6d9bb9
Part 11: Use TaggedParserAtomIndex in ScriptThingVariant. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/ca60758cd534
Part 12: Use TaggedParserAtomIndex in ObjLiteralStencil. r=tcampbell
Regressions: 1677371
You need to log in before you can comment on or make changes to this bug.