src/hotspot/share/gc/z/zLiveMap.cpp
changeset 59247 56bf71d64d51
parent 59039 c60978f87d45
child 59252 623722a6aeb9
equal deleted inserted replaced
59246:fcad92f425c5 59247:56bf71d64d51
    52   const uint32_t seqnum_initializing = (uint32_t)-1;
    52   const uint32_t seqnum_initializing = (uint32_t)-1;
    53   bool contention = false;
    53   bool contention = false;
    54 
    54 
    55   // Multiple threads can enter here, make sure only one of them
    55   // Multiple threads can enter here, make sure only one of them
    56   // resets the marking information while the others busy wait.
    56   // resets the marking information while the others busy wait.
    57   for (uint32_t seqnum = OrderAccess::load_acquire(&_seqnum);
    57   for (uint32_t seqnum = Atomic::load_acquire(&_seqnum);
    58        seqnum != ZGlobalSeqNum;
    58        seqnum != ZGlobalSeqNum;
    59        seqnum = OrderAccess::load_acquire(&_seqnum)) {
    59        seqnum = Atomic::load_acquire(&_seqnum)) {
    60     if ((seqnum != seqnum_initializing) &&
    60     if ((seqnum != seqnum_initializing) &&
    61         (Atomic::cmpxchg(seqnum_initializing, &_seqnum, seqnum) == seqnum)) {
    61         (Atomic::cmpxchg(seqnum_initializing, &_seqnum, seqnum) == seqnum)) {
    62       // Reset marking information
    62       // Reset marking information
    63       _live_bytes = 0;
    63       _live_bytes = 0;
    64       _live_objects = 0;
    64       _live_objects = 0;
    71 
    71 
    72       // Make sure the newly reset marking information is ordered
    72       // Make sure the newly reset marking information is ordered
    73       // before the update of the page seqnum, such that when the
    73       // before the update of the page seqnum, such that when the
    74       // up-to-date seqnum is load acquired, the bit maps will not
    74       // up-to-date seqnum is load acquired, the bit maps will not
    75       // contain stale information.
    75       // contain stale information.
    76       OrderAccess::release_store(&_seqnum, ZGlobalSeqNum);
    76       Atomic::release_store(&_seqnum, ZGlobalSeqNum);
    77       break;
    77       break;
    78     }
    78     }
    79 
    79 
    80     // Mark reset contention
    80     // Mark reset contention
    81     if (!contention) {
    81     if (!contention) {