-
Notifications
You must be signed in to change notification settings - Fork 223
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
Add ability to only analyze a subset of standard lib from running JVM #1286
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
liblit
approved these changes
Jul 5, 2023
String javaVersion = System.getProperty("java.specification.version"); | ||
if (!javaVersion.equals("1.8")) { | ||
// java11 support for jmod files | ||
public static String[] getJDKModules(boolean justBase) { |
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'm all about that bass, 'bout that bass, no treble
I'm all about that bass, 'bout that bass, no treble
I'm all about that bass, 'bout that bass (bass, bass, bass, bass)
🎶
Nice work, @msridhar! |
Thanks @liblit! At least for some clients this should give a nice perf win |
msridhar
added a commit
to uber/NullAway
that referenced
this pull request
Aug 11, 2023
We use a [new WALA feature](wala/WALA#1286) to only include the `java.base` module in the `AnalysisScope` used for JarInfer. JarInfer does not require all JDK standard library modules to be part of the analysis scope, just enough to make a valid class hierarchy, and `java.base` suffices. This should speed up runs of JarInfer, and in particular it speeds up our JarInfer regression tests.
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.
Before, when performing Java bytecode analysis using the standard library from the running JVM, we would always include all the standard library jar / jmod files. Now that WALA only runs on JDK 11+, which has a modularized standard library, it makes sense to support strategies where only a subset of the modules are analyzed.
This PR adds support for such alternate strategies as follows. First, we add a
base
option for thestdlib
line in scope files, such that when used, only thejava.base
module is added to theAnalysisScope
. Additional JDK modules can be added via the scope file via a newjdkModule
line and the module name. We also add corresponding APIs,AnalysisScopeReader.makeBasePrimordialScope
andAnalysisScope.addJDKModuleToScope
. By default, WALA client behavior remains the same; clients must make use of these new features / APIs to opt into new behavior.The
core
module regression tests have been rewritten to minimize the number of modules included for the analyses; most tests can pass when just includingjava.base
. Surprisingly, the tests still take significantly longer to run on JDK 17 than on JDK 11; we should investigate why in the future.Some code only relevant when running on pre-JDK-11 JVMs has also been cleaned up / removed.