src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp
changeset 53850 f42c58bab973
parent 53405 8d03f69b8325
child 54006 a421bdf22394
equal deleted inserted replaced
53849:46ef4dea49e5 53850:f42c58bab973
    47 
    47 
    48 SATBMarkQueue& ShenandoahSATBMarkQueueSet::satb_queue_for_thread(JavaThread* const t) const {
    48 SATBMarkQueue& ShenandoahSATBMarkQueueSet::satb_queue_for_thread(JavaThread* const t) const {
    49   return ShenandoahThreadLocalData::satb_mark_queue(t);
    49   return ShenandoahThreadLocalData::satb_mark_queue(t);
    50 }
    50 }
    51 
    51 
    52 static inline bool discard_entry(const void* entry, ShenandoahHeap* heap) {
    52 template <bool RESOLVE>
    53   return !heap->requires_marking(entry);
       
    54 }
       
    55 
       
    56 class ShenandoahSATBMarkQueueFilterFn {
    53 class ShenandoahSATBMarkQueueFilterFn {
    57   ShenandoahHeap* _heap;
    54   ShenandoahHeap* const _heap;
    58 
    55 
    59 public:
    56 public:
    60   ShenandoahSATBMarkQueueFilterFn(ShenandoahHeap* heap) : _heap(heap) {}
    57   ShenandoahSATBMarkQueueFilterFn(ShenandoahHeap* heap) : _heap(heap) {}
    61 
    58 
    62   // Return true if entry should be filtered out (removed), false if
    59   // Return true if entry should be filtered out (removed), false if
    63   // it should be retained.
    60   // it should be retained.
    64   bool operator()(const void* entry) const {
    61   bool operator()(const void* entry) const {
    65     return discard_entry(entry, _heap);
    62     return !_heap->requires_marking<RESOLVE>(entry);
    66   }
    63   }
    67 };
    64 };
    68 
    65 
    69 void ShenandoahSATBMarkQueueSet::filter(SATBMarkQueue* queue) {
    66 void ShenandoahSATBMarkQueueSet::filter(SATBMarkQueue* queue) {
    70   assert(_heap != NULL, "SATB queue set not initialized");
    67   assert(_heap != NULL, "SATB queue set not initialized");
    71   apply_filter(ShenandoahSATBMarkQueueFilterFn(_heap), queue);
    68   if (_heap->has_forwarded_objects()) {
       
    69     apply_filter(ShenandoahSATBMarkQueueFilterFn<true>(_heap), queue);
       
    70   } else {
       
    71     apply_filter(ShenandoahSATBMarkQueueFilterFn<false>(_heap), queue);
       
    72   }
    72 }
    73 }
    73 
    74 
    74 bool ShenandoahSATBMarkQueue::should_enqueue_buffer() {
    75 bool ShenandoahSATBMarkQueue::should_enqueue_buffer() {
    75   bool should_enqueue = SATBMarkQueue::should_enqueue_buffer();
    76   bool should_enqueue = SATBMarkQueue::should_enqueue_buffer();
    76   size_t cap = capacity();
    77   size_t cap = capacity();