-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Loading symbols from TASTy files directly #17594
Loading symbols from TASTy files directly #17594
Conversation
compiler/src/dotty/tools/dotc/classpath/DirectoryClassPath.scala
Outdated
Show resolved
Hide resolved
95cb5c4
to
26e8f85
Compare
e545d54
to
5213b9e
Compare
This is also going to be very useful for TASTy-only class paths, such as the coming changes to include build-pipelining |
@bishabosha Can I assign this PR to you? |
@@ -1,2 +1,2 @@ | |||
List(/tastyPaths/I8163.class) | |||
List(/tastyPaths/I8163.tasty) |
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.
does this count as an API change?
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.
Good catch. This falls into undefined behavior in the documentation. Therefore we can change it.
This comes from a call to quotes.reflect.SourceFile.current
. In the inspector, we explicitly state that this method will not work
5213b9e
to
f9e8b36
Compare
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.
I did a benchmark on my machine of memory usage by compiling org-lichess/lila (140k scala LOC) and did not observe any significant change between either including the check or not, and the old way of loading tasty
test performance please |
I restarted the tests to make sure we do not have any conflicts before we merge this. |
there's just a lot more IO being done here now, i wonder if we can work more on assumption or caching rather than constantly asking the file system for proof of things |
I can't really reproduce any large spikes caused by these changes |
Are we sure that the CPU clock speed is still limited? In the past we had some issues with that when the machine rebooted. |
Why should this be 3.4? It doesnt have any effect on the compatibility - also it will be needed to bring pipelining to 3.3 |
It does not introduce any binary compatibility, but some external tools might start behaving differently. For example, if a build tool does not properly invalidate/remove the old |
@Kordyjan this would be eventually necessary if we ever want to have build pipelining support for scala 3.3, it seems from @nicolasstucki comment we should only wait to see if it's a problem or not. The proposed flowchart in #18636 would not reject this PR (or we need clarity on what breaking forward compatibility means) |
Alternatively, I am proposing a new file extension for "signature" tasty files used in pipelining or other purposes, which would depend on some of the changes here, so that would be more simple to nominate for backport (older scala version would simply ignore the file, and pipelining flags would be ignored) |
I have noticed a 3% slowdown compiling lichess-org/lila with 3.3.1 vs current main build, didn't verify if this is a cause -
|
Before this PR we used to parse the classfiles first and when we found a classfile that has a
TASTY
attribute we switched and loaded the tasty. Now we find the.tasty
files directly and load the symbols directly from them. We still load the class files to check that the UUID in that classfile matches the UUID in the TASTy file.When looking for classes in the classpath, we prioritize the TASTy files over classfiles. This implies that the symbol loader will receive the
.tasty
files for Scala 3 code and.class
for Scala 2 and Java code.A variant of the
ClassfileParser
calledClassfileTastyUUIDParser
was added to have a way to check the UUID in theTASTY
attribute of the classfile. TheClassfileParser
could not be used directly because it eagerly tries to initialize parts of the symbols that are already loaded from the TASTy file, causing some conflicts.Open question: should we only check the TASTy UUID under some flag to avoid loading both the
.tasty
and the.class
files? The second commit introduces this check.