< prev index next >
src/share/vm/gc/g1/ptrQueue.hpp
Print this page
rev 10335 : imported patch bufnode_params
@@ -31,10 +31,11 @@
// There are various techniques that require threads to be able to log
// addresses. For example, a generational write barrier might log
// the addresses of modified old-generation objects. This type supports
// this operation.
+class BufferNode;
class PtrQueueSet;
class PtrQueue VALUE_OBJ_CLASS_SPEC {
friend class VMStructs;
// Noncopyable - not defined.
@@ -102,11 +103,11 @@
// entries were cleared from it so that it can be re-used. It should
// not return false if the buffer is still full (otherwise we can
// get into an infinite loop).
virtual bool should_enqueue_buffer() { return true; }
void handle_zero_index();
- void locking_enqueue_completed_buffer(void** buf);
+ void locking_enqueue_completed_buffer(BufferNode* node);
void enqueue_known_active(void* ptr);
size_t size() {
assert(_sz >= _index, "Invariant.");
@@ -134,10 +135,14 @@
static size_t byte_index_to_index(size_t ind) {
assert((ind % sizeof(void*)) == 0, "Invariant.");
return ind / sizeof(void*);
}
+ static size_t index_to_byte_index(size_t ind) {
+ return ind * sizeof(void*);
+ }
+
// To support compiler.
protected:
template<typename Derived>
static ByteSize byte_offset_of_index() {
@@ -184,14 +189,17 @@
static BufferNode* allocate(size_t byte_size);
// Free a BufferNode.
static void deallocate(BufferNode* node);
- // Return the BufferNode containing the buffer.
- static BufferNode* make_node_from_buffer(void** buffer) {
- return reinterpret_cast<BufferNode*>(
+ // Return the BufferNode containing the buffer, after setting its index.
+ static BufferNode* make_node_from_buffer(void** buffer, size_t index) {
+ BufferNode* node =
+ reinterpret_cast<BufferNode*>(
reinterpret_cast<char*>(buffer) - buffer_offset());
+ node->set_index(index);
+ return node;
}
// Return the buffer for node.
static void** make_buffer_from_node(BufferNode *node) {
// &_buffer[0] might lead to index out of bounds warnings.
@@ -241,11 +249,11 @@
protected:
// A mutator thread does the the work of processing a buffer.
// Returns "true" iff the work is complete (and the buffer may be
// deallocated).
- virtual bool mut_process_buffer(void** buf) {
+ virtual bool mut_process_buffer(BufferNode* node) {
ShouldNotReachHere();
return false;
}
// Create an empty ptr queue set.
@@ -265,17 +273,17 @@
// Return an empty array of size _sz (required to be non-zero).
void** allocate_buffer();
// Return an empty buffer to the free list. The "buf" argument is
// required to be a pointer to the head of an array of length "_sz".
- void deallocate_buffer(void** buf);
+ void deallocate_buffer(BufferNode* node);
// Declares that "buf" is a complete buffer.
- void enqueue_complete_buffer(void** buf, size_t index = 0);
+ void enqueue_complete_buffer(BufferNode* node);
// To be invoked by the mutator.
- bool process_or_enqueue_complete_buffer(void** buf);
+ bool process_or_enqueue_complete_buffer(BufferNode* node);
bool completed_buffers_exist_dirty() {
return _n_completed_buffers > 0;
}
< prev index next >