[GR-51974] Track never-null instance fields in the static analysis. #9121
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.
Allow the static analysis to discover never-null instance fields by
InlineBeforeAnalysisPolicyUtils).Classes that can be allocated without running a constructor, via
Unsafeor JNI, are excluded from the optimization (seePointsToAnalysisType.registerAsUnsafeAllocated).When the analysis tracks primitive values, then also never-zero primitive instance fields will be optimized. But I expect that to be a rare case with limited impact.
This PR relies on #8869 which tightened the rules to require explicit reflection configuration for unsafe allocated objects. But in order to not break compatibility, this is only done when
ThrowMissingRegistrationErrorsis used (which is not enabled for our benchmarks yet), or when the new option-H:-AllowUnsafeAllocationOfAllInstantiatedTypesis used (which will be sufficient for our benchmarking for papers).