-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
8352642: Set zipinfo-time=false when constructing zipfs FileSystem in com.sun.tools.javac.file.JavacFileManager$ArchiveContainer for better performance #24176
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back jzaugg! A progress list of the required criteria for merging this PR into |
@retronym This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 19 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@liach, @LanceAndersen, @jaikiran) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
@@ -562,7 +562,10 @@ private final class ArchiveContainer implements Container { | |||
public ArchiveContainer(Path archivePath) throws IOException, ProviderNotFoundException { | |||
this.archivePath = archivePath; | |||
if (multiReleaseValue != null && archivePath.toString().endsWith(".jar")) { |
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.
The else branch, which uses FileSystems.newFileSystem(archivePath, (ClassLoader)null)
rather than jarFsProvider.newFileSystem
, is unchanged in the PR.
AFAICT that would only be taken when a client using JavacFileManager
directly, omitting the fm.handleOption(Option.MULTIRELEASE, .. )
call, or in a custom scenario with non-JAR archivess.
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 wonder if there's some suspicion of a particular problem in the other branch, or other reason to not add the flag there as well. I would expect the default should be to add it to both branches, unless there's a fairly strong reason not to.
There are some more new jar FileSystems created in Locations
, but those only typically read one file, so probably not that big deal w.r.t. this flag.
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.
There are some more new jar FileSystems created in Locations, but those only typically read one file, so probably not that big deal w.r.t. this flag.
Agreed. I initially changed those as well but when I realized they only read a single file I reverted.
I wonder if there's some suspicion of a particular problem in the other branch,
The then
branch, which I've modified, was introduced in e652402 (JDK-8149757: Implement Multi-Release JAR aware JavacFileManager for javac). It became necessary to ensure exact usage of ZipFileSystemProvider
to be able to pass in the env
map with the multiRelease
config.
I reviewed the discussion of that change. There was a mention of the introduction of this branch, but it didn't go as far to suggest removal of the FileSystems.newFileSystem
call, it only justified the addition of the jarFsProvider.newFileSystem
call.
https://mail.openjdk.org/pipermail/compiler-dev/2016-April/thread.html
> -why is JavacFileManager.getJarFSProvider() needed? Shouldn't
> FileSystems.newFileSystem(realPath, env);
> be enough? (Calling an SPI directly from an API client seems
> suspicious to me.)
If I recall correctly, the NIO2 API design forced this one. The method
you are referring to does not exist. There is only one that takes a URI,
and that has very different semantics. So we had to go with the method
on the provider, hence the use of getJarFSProvider.
The tests introduced in e652402 don't appear to exercise the else branch.
It appears there are two ways to get there:
- Direct, programatic use of the a file manager in which the initialization sequence does not populate
multiReleaseValue
- Use of javac with a
.zip
as a classpath entry (I had to check, but this does work.) Side question -- what is the expected behaviour with a classpath entry with a non-lowercase extension,.JAR
? It is allowed byjavac
but would not respect themulti-release
setting.
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 that's all true, but I am not sure if it quite explains why not do the same for the same for the else section. There is FileSystems.newFileSystem(Path path, Map<String,?> env, ClassLoader loader)
since JDK 13, so there shouldn't be a big problem to call that one instead of FileSystems.newFileSystem(Path path, ClassLoader loader)
(the latter delegates to the former, so there shouldn't be any real change in semantics).
I guess one concern could be that, in theory, this method works for other FS providers/types as well. But, presumably, those would ignore env keys they don't know, and would ignore it.
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.
Looks good. Indeed JavacTask sets Option.MULTIRELEASE explicitly. Might need another zip area contributor to comment on such usages, as there is no usage of this property in the jdk codebase besides one specific test.
/label core-libs |
@liach |
I think this is okay. I was chatting with Jai and Lance about the undocumented property and I think we've agreed there is merit to the semantics (or close to it) for what is there now, but give it a more suitable name. It could then be documented in the jdk.zipfs's module description. |
I'm assuming this would come in a followup change for the ZipFS maintainers, rather this in this PR. |
Yes, that's correct. |
Can any zip area developer leave an approval? |
I'm running some tests with this change. I'll approve it once that completes. |
Good catch, thanks! Ordinarily, I would say a test is required, but I can't think up a viable test to verify the effect of this change in a test, so we probably need to do it without a test. |
The tier 1-3 tests submitted by jaikiran all pass. This should be good to go. |
I tested this change externally with JFRUnit. If preferred, I could create a |
Hello Jason, I was crafting some JAR files to compose a large classpath and running some compilation tests on a Windows system to see if there's a observable difference with this change. But I see that you have done the necessary testing externally with much more precise checks and those do show the expected improvements with reduced native calls to read. I won't pursue my Windows testing, since what you have is good both from the code change as well as testing point of view.
I don't think that can be guaranteed/asserted and could lead to an intermittent failing or brittle test. |
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.
Looks good to me. Before integrating, you might want to wait for Jan to have a chance to review and respond to the discussion you have been having about the "else" block and the possibility of introducing a test.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24176/head:pull/24176
$ git checkout pull/24176
Update a local copy of the PR:
$ git checkout pull/24176
$ git pull https://git.openjdk.org/jdk.git pull/24176/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24176
View PR using the GUI difftool:
$ git pr show -t 24176
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24176.diff
Using Webrev
Link to Webrev Comment