-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[GR-45250][GR-45734] Reachability proofs for reflective operations #11079
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
Open
graalvmbot
wants to merge
9
commits into
master
Choose a base branch
from
alekstef/GR-45250-GR-45734-bytecode-level-reflection-analysis
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[GR-45250][GR-45734] Reachability proofs for reflective operations #11079
graalvmbot
wants to merge
9
commits into
master
from
alekstef/GR-45250-GR-45734-bytecode-level-reflection-analysis
Conversation
This file contains hidden or 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
51bf4e1
to
50a8e02
Compare
db34a29
to
5a4d449
Compare
4d9ed1b
to
385e93e
Compare
385e93e
to
b5cd103
Compare
…the start of parsing.
…requiring reachability registrations.
…with dynamic access.
b5cd103
to
bc5bec8
Compare
…they are no longer needed.
85054c9
to
3650c1d
Compare
17ffed5
to
a5128b5
Compare
a5128b5
to
d820f11
Compare
b22165b
to
e236ee3
Compare
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.
Additions from this PR
The current implementation of the analysis for constant reflection (and other dynamic access) invocations is optimization dependent, leading to the possibility of different image run-time behavior when compiled with different optimization options (specifically related to
InlineBeforeAnalysis
).This PR introduced a bytecode-level analysis for such invocations, thus avoiding any graph optimizations.
Two new hosted options are introduced:
-H:StrictDynamicAccessInference=Disable|Warn|Enforce
-H:DynamicAccessInferenceLog=<location>
Review guide
The PR is roughly split into the following components:
com.oracle.svm.hosted.dataflow
package. The main classes here are:com.oracle.svm.hosted.dataflow.ForwardDataFlowAnalyzer
- a generic data flow analyzer;com.oracle.svm.hosted.dataflow.AbstractInterpreter
- an abstract bytecode interpreter built on top ofForwardDataFlowAnalyzer
by propagating abstract bytecode execution frames through the data-flow.AbstractInterpreter
. It is implemented in thecom.oracle.svm.hosted.dynamicaccessinference
package.The entry point of the analysis is in the
com.oracle.svm.hosted.dynamicaccessinference.StrictDynamicAccessInferenceFeature
class. The main steps are:com.oracle.svm.hosted.dynamicaccessinference.ConstantExpressionRegistry
and register it as an image singleton. The registry maps method and BCI pairs into the abstract state before the execution of the corresponding instruction. That abstract state holds the information on constant expressions.com.oracle.svm.hosted.dynamicaccessinference.StrictDynamicAccessInferenceSupport
singleton which analyzes every method sent toAnalysisBytecodeParser
andClassInitializerBytecodeParser
using acom.oracle.svm.hosted.dynamicaccessinference.ConstantExpressionAnalyzer
. The results are stored in the constant expression registry.Class.forName(String)
. The full list of targeted methods can be found in the feature class.Additionally, all logging of inferred calls is handled by the
com.oracle.svm.hosted.dynamicaccessinference.DynamicAccessInferenceLoggingFeature
feature.One important implementation detail to note is that
ConstantExpressionAnalyzer
unwraps analysis methods in order to avoid lookups through the analysis universe, and thus potential unsupported feature exceptions.The decision if this functionality is added to
--future-defaults
can be made after the review and integration tests are complete.