Closed Bug 1633841 Opened 5 years ago Closed 5 years ago

Make TokenStreamAnyChars a base class of TokenStreamCharsShared

Categories

(Core :: JavaScript Engine, task)

task

Tracking

()

RESOLVED INVALID

People

(Reporter: djvj, Assigned: djvj)

References

Details

Attachments

(1 file)

Explanation of problem:

The TokenStream infrastructure eventually descends into a multiple-inheritance branch that looks like this:

TokenStreamShared <-- TokenStreamAnyChars <------------------
                                                                                                            ...... <-- TokenStream

TokenStreamCharsShared <-- TokenStreamCharsBase<Unit> <---

My ongoing work with converting the parser to using internal atoms ran into a hitch. Currently I'm keeping the parser table in TokenStreamCharsShared. The ParserAtoms reference is indexed based (i.e. an opaque integer), and thus inspecting a parser atom requires access to the table.

However, there are references to atoms within TokenStreamAnyChars which are used in a way that requires access to atom internals, which needs access to the parser-atoms table.. which is stored in the other branch of the multiple-inheritance tree for TokenStream.

The goal here, then.. is to re-inherit TokenStreamAnyChars under TokenStreamCharsShared, and eliminate the multiple-inheritance issue, allowing a single reference to the parser atoms table to be stored within TokenStreamAnyChars:

TokenStreamShared <-- TokenStreamAnyChars <-- TokenStreamCharsShared <- ....
Attached patch patchSplinter Review

This patch compiles, but will not work due to other problems I discovered during the writing of the patch.

Turns out the Parser infrastructure splits the implementation of the TokenStream into two different pieces - which are reflected by the two inheritance lineages which happen to be shared by one particular derived TokenStream class, but is not used that way generally.

GeneralParser embeds the TokenStreamChars* lineage.
ParserBase embeds the TokenStreamAnyChars lineage.

The former holds all the actual character stream information. The latter holds some character agnostic token data (e.g. lookaheads, etc.)

The former is given access to the latter using AnyCharsAccess, which is a template-type for a parameter held by the TokenStreamChars* lineage, which does the actual token parsing.

Unifying these replicates the AnyChars state into the TokenStreamChars* lineage, but we can't really modify the GeneralParser/ParserBase splitting off AnyChars by itself, so the duplication cannot be eliminated without rewriting the entire parser infrastructure.

This entire bug is invalid.

Assignee: nobody → kvijayan
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: