-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Finish Position-Related Renamings #5697
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
Conversation
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.
Hello, and thank you for opening this PR! 🎉
All contributors have signed the CLA, thank you! ❤️
Commit Messages
We want to keep history, but for that to actually be useful we have
some rules on how to format our commit messages (relevant xkcd).
Please stick to these guidelines for commit messages:
- Separate subject from body with a blank line
- When fixing an issue, start your commit message with
Fix #<ISSUE-NBR>:
- Limit the subject line to 72 characters
- Capitalize the subject line
- Do not end the subject line with a period
- Use the imperative mood in the subject line ("Add" instead of "Added")
- Wrap the body at 80 characters
- Use the body to explain what and why vs. how
adapted from https://chris.beams.io/posts/git-commit
Have an awesome day! ☀️
test performance please |
performance test scheduled: 1 job(s) in queue, 0 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/5697/ to see the changes. Benchmarks is based on merging with master (00bfbbd) |
We still have a slight performance degradation, but the fact is that we do solve a more complex problem now. I propose to ignore this for now, and do a more sweeping simplification of positions based on implicit parameters in another PR. That will hopefully improve performance. |
... preparing to add a nextTreeId as well.
This removes some technical debt: nextId was a global counter, so unreliable under parallelism. That was OK so far since it was only intended for debugging. But now we want to give more significance to tree ids, since they will be used to determine the source file of a tree. Hence, we need to put this aspect in order by making nextTreeId a context field. This entailed a lot of changes, so no wonder it was not done before.
It's very important that tree nodes don't capture contexts. The @transientParam annotation makes sure they don't.
Tree ids are now allocated in chunks. All ids in the same chunk were produced by contexts with the same source file.
Inlined sources might not come from a compilation units that's currently compiled.
Copies should have the same source attribute as originals.
Serialize source file changes in positions section
Tree ids survive compilation runs, need to be allocated globally.
Pickle SOURCE position for roots, so that unpickler get the'right source when constructing trees.
Generate a position entry if sourcefiles change.
Used to depend on file's path, but that does not work for VirtualFiles that might be different even though they have the same path.
Use interned strings for the comparison of their paths.
Reduce concurrent hashmap lookups in TreeIds by caching the last result in SourceInfo. This reduces lookups for typer/*.scala from 500K+ to 7.6K.
Deemphasize AbstractFile, drop TreeIds.
When set, prints full source positions, not just file + line.
The decision when to pickle a position is a time sink. Try to optimize this by not going through Positioned#{initialSpan,elemSource} functionality.
Single traversal to set id and span.
It's called more often now that we generation source positions. Time for some caching.
No need to do the wrapping
92419dd
to
c6a54fa
Compare
I think we should put this on hold until #5644 is merged. The reason is merge conflicts with other inflight PR's. Such conflicts will almost certainly be build errors for #5644, since types have different names. But if we apply #5697 on top, we get the same type name |
This should be revived starting from #5713, once that one is in. |
This is a follow-up to #5644, with more renamings from SourcePosition and its derivatives to Position. Hence,
Position
is now what it is inscalac
: an aggregate of a source file and an offset interval (called a span here).Compared to #5644, this PR changes fewer lines overall since some usages of
pos
,Position
are kept, but now have a new meaning that the source is included.So it might be easier to review only this PR instead of reviewing #5644 separately.