-
Notifications
You must be signed in to change notification settings - Fork 778
Strict static field support fixes #23061
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
base: master
Are you sure you want to change the base?
Conversation
ad18c5a to
a9f63c3
Compare
| buildGenericSpecialStackFrame(REGISTER_ARGS, 0); | ||
| updateVMStruct(REGISTER_ARGS); | ||
| void *resolveResult = resolveStaticFieldRef(_currentThread, NULL, ramConstantPool, index, J9_RESOLVE_FLAG_RUNTIME_RESOLVE | J9_RESOLVE_FLAG_CHECK_CLINIT, NULL); | ||
| void *resolveResult = resolveStaticFieldRef(_currentThread, NULL, ramConstantPool, index, J9_RESOLVE_FLAG_RUNTIME_RESOLVE | J9_RESOLVE_FLAG_CHECK_CLINIT, NULL |
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.
When resolveResult is -1 (the <clinit> case where the class is in larval state ), ramStaticFieldRef is set to _currentThread->floatTemp1, the modification to classAndFlags at line 7706 won't be saved to the class/class constant pool.
I think putstatic has the same issue.
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.
putstatic on a strict field will not go through the clinit case, the check at line 918 should always be true. For getstatic when resolveResult is -1 the code will attempt to resolve the field again.
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.
putstatic on a strict field will not go through the clinit case
Is it correct to change the behaviour of <clinit> for putstatic ?
For getstatic when resolveResult is -1 the code will attempt to resolve the field again.
The code in getstatic is:
if ((void*)-1 != resolveResult) {
goto retry;
}
So when resolveResult is not -1, it will attempt to resolve again.
It can be resolved by another call of getstatic or putstatic though. But J9StaticFieldRefStrictInitRead is not recorded for this call.
|
|
||
| #if defined(J9VM_OPT_VALHALLA_STRICT_FIELDS) | ||
| if (J9ClassInitNotInitialized == (ramConstantPool->ramClass->initializeStatus & J9ClassInitStatusMask)) { | ||
| if (J9_STATIC_FIELD_STRICT_INIT_IS_UNSET(classAndFlags)) { |
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.
In the the <clinit> case, the classAndFlags here and in the else if below is also from ramStaticFieldRef (which is _currentThread->floatTemp1), not from the class/class constant pool.
- support fields set through the ConstantValue attribute - exclude 8th bit representing null restricted static field from type calculations - verbose messages for IllegalStateException - save unset strict field flags for final fields Signed-off-by: Theresa Mammarella <Theresa.T.Mammarella@ibm.com>
a9f63c3 to
d48ea80
Compare
This fixes more tests in
test/hotspot/jtreg/runtime/valhalla/inlinetypes/verifier/StrictStaticFieldsTest.java. The final tests require the implementation of notifyStrictStaticAccess.Related: #21884