-
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
Default to emitting .tasty files (not .hasTasty) #4467
Conversation
@@ -404,8 +404,11 @@ trait ParallelTesting extends RunnerOrchestration { self => | |||
tastyOutput.mkdir() | |||
val flags = flags0 and ("-d", tastyOutput.getAbsolutePath) and "-from-tasty" | |||
|
|||
def hasTastyFileToClassName(f: JFile): String = | |||
targetDir.toPath.relativize(f.toPath).toString.dropRight(".hasTasty".length).replace('/', '.') | |||
def hasTastyFileToClassName(f: JFile): String = { |
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.
name is now misleading
def hasTastyFileToClassName(f: JFile): String = { | ||
val pathStr = targetDir.toPath.relativize(f.toPath).toString.replace('/', '.') | ||
if (pathStr.endsWith(".hasTasty")) pathStr.dropRight(".hasTasty".length) | ||
else pathStr.dropRight(".tasty".length) |
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.
.stripSuffix(".hasTasty").stripSuffix(".hasTasty")
?
94c8c88
to
5de4a9d
Compare
@@ -700,7 +700,7 @@ object PatternMatcher { | |||
} | |||
val newArgs = | |||
for { | |||
(rhs, actual) <- seenVars.toList | |||
(rhs, actual) <- seenVars.toList.sortBy(_._2.name.toString) |
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.
We have an ordering on Name
(i.e. Names.NameOrdering
), you shouldn't need to do toString
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 is just to test if this is the source of the idempotency failure.
8de6223
to
ab6d5fa
Compare
3a3cc05
to
930cff2
Compare
f7fb52d
to
308b1fb
Compare
performance test scheduled: 30 job(s) in queue, 1 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/4467/ to see the changes. Benchmarks is based on merging with master (bdf3ef4) |
c94b032
to
c5d2c6b
Compare
Rebased |
@allanrenucci could you review the last commit |
val path = classfile.path.stripSuffix(".class") + ".tasty" | ||
val stream = cl.getResourceAsStream(path) | ||
if (stream != null) { | ||
val tasty = new Array[Byte](stream.available()) |
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.
From the Javadoc
Note that while some implementations of InputStream will return the total number of bytes in the stream, many will not. It is never correct to use the return value of this method to allocate a buffer intended to hold all data in this stream.
val jarFile = JarArchive.open(io.File(jar.jpath)) | ||
try readTastyForClass(jarFile.jpath.resolve(classfile.path)) | ||
finally jarFile.close() | ||
val cl = new URLClassLoader(Array(jar.jpath.toUri.toURL)) |
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.
Are you sure we won't have to deal with the same issues using a URLClassLoader
?
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 would say no because the classloader never instanciates an class with a reference to it. Hence the classloader should be GCed at some point. I will experiment a bit with the profiler to see if I can observe any leaks.
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.
Not only leaks. Can the jar be read using an URLClassLoader
while at the same time it is read using nio.file.FileSystems
. What if someone close the FileSystems
while you're reading the jar with URLClassLoader
?
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 tried it and it does not affect the class loader. I closed the file system in the middle of reading from the stream and some other places.
dd7a295
to
4f05fbd
Compare
if (stream != null) { | ||
val tasty = Array.newBuilder[Byte] | ||
tasty.sizeHint(stream.available()) | ||
while (stream.available() > 0) // TODO improve performance |
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 think the proper way to read from an InputStream
, is to read()
until -1
is returned
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.
Changed it
Solution based on http://www.gregbugaj.com/?p=283&cpage=1
6641938
to
de291c1
Compare
Rebased |
Ready to merge? |
It is ready to merge. But after it is merged everyone needs to clean their |
I ran the |
|
578b580
to
de291c1
Compare
TODO