-
Notifications
You must be signed in to change notification settings - Fork 738
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
Prevent allocation of replaced classes #3143
Conversation
Objects on the heap must always point to the most current version of the J9Class. Prevent allocation of replaced classes by causing fast path allocations to fail for replaced classes. The final (slow path) allocator will use the most current version of the requested class to fix any callers who unwittingly passes a replaced class. [ci skip] Signed-off-by: Graham Chapman <graham_chapman@ca.ibm.com>
jenkins test all zlinux jdk8 |
@@ -77,7 +77,7 @@ class MM_JavaObjectAllocationModel : public MM_AllocateInitialization | |||
if (NULL != objectPtr) { | |||
/* Initialize class pointer in object header -- preserve flags set by base class */ | |||
MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(env); | |||
extensions->objectModel.setObjectClass(objectPtr, _class); | |||
extensions->objectModel.setObjectClass(objectPtr, getClass()); |
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.
Should the protected _class
field become private to prevent subclass's from reaching for it directly? And likely commented to indicate the 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.
Making the field private means modifying a lot of code. Any users of the field before a GC has occurred really don't need to get the current class (the OM is used in the faster path NoGC code as well).
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.
Tempted to add a new accessor getCurrentClass() for people who are aware that the class may change during a GC, and leave getClass() as it is (there are actually no callers - all access is by direct field fetch).
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.
@dmitripivkine I'm OK with taking this change as is. Do you want a followup issue to make the _class
field private?
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.
yes, we will take care about this
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 will not make the accessor change now - you can decide if you want it when changing the field visibility.
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.
LGTM
Once the testing passes, whoever sees it first can merge |
Jenkins is struggling to complete builds. Merging now as the Sanity passed. |
Objects on the heap must always point to the most current version of the
J9Class. Prevent allocation of replaced classes by causing fast path
allocations to fail for replaced classes. The final (slow path)
allocator will use the most current version of the requested class to
fix any callers who unwittingly passes a replaced class.
[ci skip]
Signed-off-by: Graham Chapman graham_chapman@ca.ibm.com