The fix for 8033601 changed the code for chunked arrays to use the from obj length as index rather than the to object.
This was nice since it made G1 look more like the other collectors.
However, another difference in G1 is that it writes the forward pointer before it writes the to-object. That means that there are times when an object is forwarded, but there is no to-object image that can be trusted.
One such place is
void G1ParCopyClosure<barrier, do_mark_object>
::do_oop_work(T* p)
We can find that the object is forwarded, but it may not have been marked yet. So, we end up calling mark_forwarded_object() which needs the size to call _cm->grayRoot(to_obj, (size_t) from_obj->size(), _worker_id);
mark_forwarded_object() has a comment that tries to describe this situation:
// The object might be in the process of being copied by another
// worker so we cannot trust that its to-space image is
// well-formed. So we have to read its size from its from-space
// image which we know should not be changing.
_cm->grayRoot(to_obj, (size_t) from_obj->size(), _worker_id);
So, just as the comment say, we can not trust the to-space image. However, after the change for 8033601 we can not trust the from-space image either.
This seems like a show-stopper for the suggested change for 8033601 so we need to back it out.
This was nice since it made G1 look more like the other collectors.
However, another difference in G1 is that it writes the forward pointer before it writes the to-object. That means that there are times when an object is forwarded, but there is no to-object image that can be trusted.
One such place is
void G1ParCopyClosure<barrier, do_mark_object>
::do_oop_work(T* p)
We can find that the object is forwarded, but it may not have been marked yet. So, we end up calling mark_forwarded_object() which needs the size to call _cm->grayRoot(to_obj, (size_t) from_obj->size(), _worker_id);
mark_forwarded_object() has a comment that tries to describe this situation:
// The object might be in the process of being copied by another
// worker so we cannot trust that its to-space image is
// well-formed. So we have to read its size from its from-space
// image which we know should not be changing.
_cm->grayRoot(to_obj, (size_t) from_obj->size(), _worker_id);
So, just as the comment say, we can not trust the to-space image. However, after the change for 8033601 we can not trust the from-space image either.
This seems like a show-stopper for the suggested change for 8033601 so we need to back it out.
- relates to
-
JDK-8033601 G1: Make array chunking use the same length field as the other young GCs
-
- Resolved
-