-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parser+source: improvements and cleanups #934
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
feds01
force-pushed
the
parser-cleanups
branch
from
August 31, 2023 13:22
20a8df8
to
bd4f661
Compare
Swapping to `ThinVec` reduces the size of diagnostic stores in order to avoid bloating things like the `SemanticAnalyser`, `AstGen`, `Lexer`. This reduces store size from `48bytes` to `16bytes` per diagnostic store. Additionally, remove manual implementations of diagnostic access for `Lexer` and `SemanticAnalyser`.
feds01
force-pushed
the
parser-cleanups
branch
from
August 31, 2023 14:02
78f173c
to
e855b02
Compare
kontheocharis
previously approved these changes
Aug 31, 2023
feds01
commented
Aug 31, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be removed
feds01
force-pushed
the
parser-cleanups
branch
from
August 31, 2023 16:33
d916b1b
to
f6a3eeb
Compare
kontheocharis
approved these changes
Aug 31, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
This PR is an aggregation of various improvements and cleanups to the parser and constants API in the compiler.
Improvements to constant storage:
CONSTANT_MAP
and just place them onto eachInterned<ConstKind>
- this improves code readability in quite a few places.HashMap
for storing floats/ints as they don't need to be looked up in that manner.fxhash
to look up identifiers and strings instead of the default dashmap hasher.Improvements to the parser:
ExpectedItem
type to represent what the parser might be expecting when parsing items, which gives it more flexibility to specify expected items other than tokens. Additionally, it saves on quite a bit of memory around the place: the size ofParseResult<T>
went down from a minimum bound of 70 bytes to 40 bytes.gprerf
).is_compound_expr
flag onAstGen
.ThinVec
for diagnostics across compiler, which should reduce several items that used to storeVec
s inline (which seemed wasteful). It also optimises for the common case of no diagnostics which effectively means that it will be astd::ptr::nullptr()
and only takes up 8bytes instead of 24bytes as aVec
would.AstGen
s which again reduces the size of anAstGen
from 112 bytes to 64 bytes.ParseWarning::RedundantParenthesees
to be more accurate.Todo
TyParams
andParams
to represent parameters in various places #931 needs to be merged before review.