< prev index next >
src/hotspot/share/gc/shared/satbMarkQueue.hpp
Print this page
rev 55389 : [mq]: satb_lock_free
*** 25,34 ****
--- 25,35 ----
#ifndef SHARE_GC_SHARED_SATBMARKQUEUE_HPP
#define SHARE_GC_SHARED_SATBMARKQUEUE_HPP
#include "gc/shared/ptrQueue.hpp"
#include "memory/allocation.hpp"
+ #include "memory/padded.hpp"
class Thread;
class Monitor;
class SATBMarkQueueSet;
*** 91,118 ****
using PtrQueue::byte_width_of_active;
};
class SATBMarkQueueSet: public PtrQueueSet {
size_t _buffer_enqueue_threshold;
#ifdef ASSERT
void dump_active_states(bool expected_active);
void verify_active_states(bool expected_active);
#endif // ASSERT
protected:
SATBMarkQueueSet();
! ~SATBMarkQueueSet() {}
template<typename Filter>
void apply_filter(Filter filter, SATBMarkQueue* queue) {
queue->apply_filter(filter);
}
! void initialize(Monitor* cbl_mon,
! BufferNode::Allocator* allocator,
size_t process_completed_buffers_threshold,
uint buffer_enqueue_threshold_percentage);
public:
virtual SATBMarkQueue& satb_queue_for_thread(Thread* const t) const = 0;
--- 92,128 ----
using PtrQueue::byte_width_of_active;
};
class SATBMarkQueueSet: public PtrQueueSet {
+
+ DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, 0);
+ PaddedEnd<BufferNode::Stack> _list;
+ volatile size_t _count_and_process_flag;
+ // These are rarely (if ever) changed, so same cache line as count.
+ size_t _process_completed_buffers_threshold;
size_t _buffer_enqueue_threshold;
+ DEFINE_PAD_MINUS_SIZE(2, DEFAULT_CACHE_LINE_SIZE, 3 * sizeof(size_t));
+
+ BufferNode* get_completed_buffer();
+ void abandon_completed_buffers();
#ifdef ASSERT
void dump_active_states(bool expected_active);
void verify_active_states(bool expected_active);
#endif // ASSERT
protected:
SATBMarkQueueSet();
! ~SATBMarkQueueSet();
template<typename Filter>
void apply_filter(Filter filter, SATBMarkQueue* queue) {
queue->apply_filter(filter);
}
! void initialize(BufferNode::Allocator* allocator,
size_t process_completed_buffers_threshold,
uint buffer_enqueue_threshold_percentage);
public:
virtual SATBMarkQueue& satb_queue_for_thread(Thread* const t) const = 0;
*** 130,139 ****
--- 140,162 ----
// return true. Otherwise return false. Processing a buffer
// consists of applying the closure to the active range of the
// buffer; the leading entries may be excluded due to filtering.
bool apply_closure_to_completed_buffer(SATBBufferClosure* cl);
+ virtual void enqueue_completed_buffer(BufferNode* node);
+
+ // The number of buffers in the list. Racy and not updated atomically
+ // with the set of completed buffers.
+ size_t completed_buffers_num() const {
+ return _count_and_process_flag >> 1;
+ }
+
+ // Return true if completed buffers should be processed.
+ bool process_completed_buffers() const {
+ return (_count_and_process_flag & 1) != 0;
+ }
+
#ifndef PRODUCT
// Helpful for debugging
void print_all(const char* msg);
#endif // PRODUCT
< prev index next >