8230192: Rename G1RedirtyCardsBufferList to G1BufferNodeList

Rename class and move to new files.

Reviewed-by: sjohanss, lkorinth
This commit is contained in:
Kim Barrett 2019-08-27 11:05:17 -04:00
parent b76a9b8f11
commit b0632088a8
5 changed files with 93 additions and 33 deletions

View File

@ -0,0 +1,39 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "gc/g1/g1BufferNodeList.hpp"
#include "utilities/debug.hpp"
G1BufferNodeList::G1BufferNodeList() :
_head(NULL), _tail(NULL), _entry_count(0) {}
G1BufferNodeList::G1BufferNodeList(BufferNode* head,
BufferNode* tail,
size_t entry_count) :
_head(head), _tail(tail), _entry_count(entry_count)
{
assert((_head == NULL) == (_tail == NULL), "invariant");
assert((_head == NULL) == (_entry_count == 0), "invariant");
}

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_GC_G1_G1BUFFERNODELIST_HPP
#define SHARE_GC_G1_G1BUFFERNODELIST_HPP
#include "utilities/globalDefinitions.hpp"
class BufferNode;
struct G1BufferNodeList {
BufferNode* _head; // First node in list or NULL if empty.
BufferNode* _tail; // Last node in list or NULL if empty.
size_t _entry_count; // Sum of entries in nodes in list.
G1BufferNodeList();
G1BufferNodeList(BufferNode* head, BufferNode* tail, size_t entry_count);
};
#endif // SHARE_GC_G1_G1BUFFERNODELIST_HPP

View File

@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
#include "gc/g1/g1BufferNodeList.hpp"
#include "gc/g1/g1CardTableEntryClosure.hpp"
#include "gc/g1/g1CollectedHeap.inline.hpp"
#include "gc/g1/g1DirtyCardQueue.hpp"
@ -215,7 +216,7 @@ void G1DirtyCardQueueSet::notify_if_necessary() {
// must share the monitor.
void G1DirtyCardQueueSet::merge_bufferlists(G1RedirtyCardsQueueSet* src) {
assert(allocator() == src->allocator(), "precondition");
const G1RedirtyCardsBufferList from = src->take_all_completed_buffers();
const G1BufferNodeList from = src->take_all_completed_buffers();
if (from._head == NULL) return;
MutexLocker x(_cbl_mon, Mutex::_no_safepoint_check_flag);

View File

@ -28,20 +28,6 @@
#include "utilities/debug.hpp"
#include "utilities/macros.hpp"
// G1RedirtyCardsBufferList
G1RedirtyCardsBufferList::G1RedirtyCardsBufferList() :
_head(NULL), _tail(NULL), _entry_count(0) {}
G1RedirtyCardsBufferList::G1RedirtyCardsBufferList(BufferNode* head,
BufferNode* tail,
size_t entry_count) :
_head(head), _tail(tail), _entry_count(entry_count)
{
assert((_head == NULL) == (_tail == NULL), "invariant");
assert((_head == NULL) == (_entry_count == 0), "invariant");
}
// G1RedirtyCardsQueueBase::LocalQSet
G1RedirtyCardsQueueBase::LocalQSet::LocalQSet(G1RedirtyCardsQueueSet* shared_qset) :
@ -67,9 +53,9 @@ void G1RedirtyCardsQueueBase::LocalQSet::enqueue_completed_buffer(BufferNode* no
}
}
G1RedirtyCardsBufferList G1RedirtyCardsQueueBase::LocalQSet::take_all_completed_buffers() {
G1RedirtyCardsBufferList result = _buffers;
_buffers = G1RedirtyCardsBufferList();
G1BufferNodeList G1RedirtyCardsQueueBase::LocalQSet::take_all_completed_buffers() {
G1BufferNodeList result = _buffers;
_buffers = G1BufferNodeList();
return result;
}
@ -126,9 +112,9 @@ BufferNode* G1RedirtyCardsQueueSet::all_completed_buffers() const {
return _list.top();
}
G1RedirtyCardsBufferList G1RedirtyCardsQueueSet::take_all_completed_buffers() {
G1BufferNodeList G1RedirtyCardsQueueSet::take_all_completed_buffers() {
DEBUG_ONLY(_collecting = false;)
G1RedirtyCardsBufferList result(_list.pop_all(), _tail, _entry_count);
G1BufferNodeList result(_list.pop_all(), _tail, _entry_count);
_tail = NULL;
_entry_count = 0;
DEBUG_ONLY(_collecting = true;)
@ -154,7 +140,7 @@ void G1RedirtyCardsQueueSet::enqueue_completed_buffer(BufferNode* node) {
void G1RedirtyCardsQueueSet::merge_bufferlist(LocalQSet* src) {
assert(_collecting, "precondition");
const G1RedirtyCardsBufferList from = src->take_all_completed_buffers();
const G1BufferNodeList from = src->take_all_completed_buffers();
if (from._head != NULL) {
assert(from._tail != NULL, "invariant");
Atomic::add(from._entry_count, &_entry_count);

View File

@ -25,6 +25,7 @@
#ifndef SHARE_GC_G1_G1REDIRTYCARDSQUEUE_HPP
#define SHARE_GC_G1_G1REDIRTYCARDSQUEUE_HPP
#include "gc/g1/g1BufferNodeList.hpp"
#include "gc/shared/ptrQueue.hpp"
#include "memory/allocation.hpp"
#include "memory/padded.hpp"
@ -33,15 +34,6 @@ class G1CardTableEntryClosure;
class G1RedirtyCardsQueue;
class G1RedirtyCardsQueueSet;
struct G1RedirtyCardsBufferList {
BufferNode* _head;
BufferNode* _tail;
size_t _entry_count;
G1RedirtyCardsBufferList();
G1RedirtyCardsBufferList(BufferNode* head, BufferNode* tail, size_t entry_count);
};
// Provide G1RedirtyCardsQueue with a thread-local qset. It provides an
// uncontended staging area for completed buffers, to be flushed to the
// shared qset en masse. Using the "base from member" idiom so the local
@ -52,7 +44,7 @@ class G1RedirtyCardsQueueBase {
class LocalQSet : public PtrQueueSet {
G1RedirtyCardsQueueSet* _shared_qset;
G1RedirtyCardsBufferList _buffers;
G1BufferNodeList _buffers;
public:
LocalQSet(G1RedirtyCardsQueueSet* shared_qset);
@ -64,7 +56,7 @@ class G1RedirtyCardsQueueBase {
// Transfer all completed buffers to the shared qset.
void flush();
G1RedirtyCardsBufferList take_all_completed_buffers();
G1BufferNodeList take_all_completed_buffers();
};
G1RedirtyCardsQueueBase(G1RedirtyCardsQueueSet* shared_qset) :
@ -123,7 +115,7 @@ public:
// Processing phase operations.
// precondition: Must not be concurrent with buffer collection.
BufferNode* all_completed_buffers() const;
G1RedirtyCardsBufferList take_all_completed_buffers();
G1BufferNodeList take_all_completed_buffers();
};
#endif // SHARE_GC_G1_G1REDIRTYCARDSQUEUE_HPP