src/hotspot/share/gc/g1/g1HotCardCache.cpp
changeset 59252 623722a6aeb9
parent 59249 29b0d0b61615
child 59319 9ee940f1de90
equal deleted inserted replaced
59251:4cbfa5077d68 59252:623722a6aeb9
    76   // against the unlikely event of a race resulting in another card pointer to
    76   // against the unlikely event of a race resulting in another card pointer to
    77   // have already been written to the cache. In this case we will return
    77   // have already been written to the cache. In this case we will return
    78   // card_ptr in favor of the other option, which would be starting over. This
    78   // card_ptr in favor of the other option, which would be starting over. This
    79   // should be OK since card_ptr will likely be the older card already when/if
    79   // should be OK since card_ptr will likely be the older card already when/if
    80   // this ever happens.
    80   // this ever happens.
    81   CardValue* previous_ptr = Atomic::cmpxchg(card_ptr,
    81   CardValue* previous_ptr = Atomic::cmpxchg(&_hot_cache[masked_index],
    82                                             &_hot_cache[masked_index],
    82                                             current_ptr,
    83                                             current_ptr);
    83                                             card_ptr);
    84   return (previous_ptr == current_ptr) ? previous_ptr : card_ptr;
    84   return (previous_ptr == current_ptr) ? previous_ptr : card_ptr;
    85 }
    85 }
    86 
    86 
    87 void G1HotCardCache::drain(G1CardTableEntryClosure* cl, uint worker_id) {
    87 void G1HotCardCache::drain(G1CardTableEntryClosure* cl, uint worker_id) {
    88   assert(default_use_cache(), "Drain only necessary if we use the hot card cache.");
    88   assert(default_use_cache(), "Drain only necessary if we use the hot card cache.");