-
Notifications
You must be signed in to change notification settings - Fork 729
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
Disable ClassLookahead by default #16453
Merged
vijaysun-omr
merged 1 commit into
eclipse-openj9:master
from
klangman:prevent-invalid-compiletime-field-access
Dec 12, 2022
Merged
Disable ClassLookahead by default #16453
vijaysun-omr
merged 1 commit into
eclipse-openj9:master
from
klangman:prevent-invalid-compiletime-field-access
Dec 12, 2022
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
Jenkins test sanity all jdk8,jdk11,jdk19 |
klangman
changed the title
WIP: Disable ClassLookahead by default
Disable ClassLookahead by default
Dec 9, 2022
Jenkins test sanity aix jdk8,jdk11 |
Jenkins test sanity.functional aix jdk8 |
Disable CLassLookahead because it is possible for static final field value to be changes via reflection or the unsafe API. 1. Disable ClassLookahead. Similar to GVP, ClassLookahead is using static analysis of static final field initialization code to provide field information that is later used to make assumptions about the field contents which might not be true if reflection or the unsafe API is used to change static final field values. An environment variable is introduced to allow ClassLookahead to be re-enable. 2. Apply a fix to ClassLookahead so that it does not not generate field information for static final fields that can be initialized with different values on different code paths. This fix is being applied in case the ClassLookahead code is resurrected in the future since `eclipse-openj9#1` above has disabled it globally. 3.Remove the code in IlGen what would replace array length checks with hard coded obj array length values. This code would look for static final fields that contain ClassLookahead fieldInfo and use the existence of that information to permit the inspection of a heap object and replace array length checks with a constant based on the current heap object's array length. This fix is also applied as a safety measure because the disabling of ClassLookahead (`eclipse-openj9#2` above) would effectively disable this code path. In general the only safe way to inspect at compile time heap objects pointed to by static final fields is to us the "Static Final Field Folding" optimization which uses OSR to invalidate any code which made an assumptions based on the contents of a static final field when that fields contents may have been modified by reflection. Signed-off-by: Kevin Langman <langman@ca.ibm.com>
klangman
force-pushed
the
prevent-invalid-compiletime-field-access
branch
from
December 12, 2022 19:01
2424b88
to
2cf11bc
Compare
The "GVP" changes referenced in the comments is here: eclipse-omr/omr#6843 |
vijaysun-omr
approved these changes
Dec 12, 2022
vijaysun-omr
approved these changes
Dec 12, 2022
All checks had passed in sanity functional testing earlier across releases. Last change was to commit message only. Merging. |
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.
Disable CLassLookahead because it is possible for static final field value to be changes via reflection or the unsafe API.
Disable ClassLookahead. Similar to GVP, ClassLookahead is using static analysis of static final field initialization code to provide field information that is later used to make assumptions about the field contents which might not be true if reflection or the unsafe API is used to change static final field values. An environment variable is introduced to allow ClassLookahead to be re-enable.
Apply a fix to ClassLookahead so that it does not not generate field information for static final fields that can be initialized with different values on different code paths. This fix is being applied in case the ClassLookahead code is resurrected in the future since
#1
above has disabled it globally.Remove the code in IlGen what would replace array length checks with hard coded obj array length values. This code would look for static final fields that contain ClassLookahead fieldInfo and use the existence of that information to permit the inspection of a heap object and replace array length checks with a constant based on the current heap object's array length. This fix is also applied as a safety measure because the disabling of ClassLookahead (
#1
above) would effectively disable this code path.In general the only safe way to inspect at compile time heap objects pointed to by static final fields is to us the "Static Final Field Folding" optimization which uses OSR to invalidate any code which made an assumptions based on the contents of a static final field when that fields contents may have been modified by reflection.
Signed-off-by: Kevin Langman langman@ca.ibm.com