Duplicate :
|
|
Relates :
|
The current G1 object copy implementation reads age multiple times from the object being promoted/copied which is a fairly expensive operation as it is reading a volatile and requires using a mask to access the age bits. To avoid this the markOop will read before the check if the object has already been copied and then the age is read once and reused when updating the age of the object if the thread ends up copying it.