-
Notifications
You must be signed in to change notification settings - Fork 738
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Read Barrier for CompareAndSwapObject
Compare-And-Swap on object reference (like one used in sun/misc/Unsafe but also any other used internally by JVM), while primarily is a store operation, it is also an implicit read (it reads the existing value to be compared with a provided compare value, before the store itself), hence needs a read barrier. This change introduces the pre-read barrier in all VM/GC CompareAndSwapObject helpers, that is used in Evacuating read barrier triggered by the read value, used in Concurrent Scavenger. An interesting dilemma is which out of two pre operations (read and store) is to be executed first. Currently in OpenJ9, we do not have any collector that have both of them active at the same time, so the order ATM is not important. However, in theory (and it actually may happen later in OpenJ9), they could both be active. An example, for Gencon GC policy, is the same read barrier on reference value (Concurrent Scavenger) and Snap-Shot-At-The-Beginning store barrier (for concurrent global marking). Since read barrier can modify the value, and SATB cares about the value being overwritten, read barrier should go first to bring it up to date, before SATB evaluates it. On the other side, from SATB perspective, we do not care about the very original value of the field (even before read barrier modifies it), since it is an object being evacuated/collected and is not part of the Snapshot (it is the copy of that object that we want to be preserved as part of the Snapshot). Signed-off-by: Aleksandar Micic <amicic@ca.ibm.com>
- Loading branch information
Showing
2 changed files
with
34 additions
and
29 deletions.
There are no files selected for viewing
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
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