--- old/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp 2019-08-26 18:55:19.120109896 -0400 +++ new/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp 2019-08-26 18:55:18.920099121 -0400 @@ -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 @@ // 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); --- old/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp 2019-08-26 18:55:20.092162260 -0400 +++ new/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp 2019-08-26 18:55:19.880150839 -0400 @@ -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 @@ } } -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 @@ 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::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); --- old/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.hpp 2019-08-26 18:55:21.040213332 -0400 +++ new/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.hpp 2019-08-26 18:55:20.832202126 -0400 @@ -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 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 LocalQSet : public PtrQueueSet { G1RedirtyCardsQueueSet* _shared_qset; - G1RedirtyCardsBufferList _buffers; + G1BufferNodeList _buffers; public: LocalQSet(G1RedirtyCardsQueueSet* shared_qset); @@ -64,7 +56,7 @@ // 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 @@ // 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 --- /dev/null 2019-08-13 13:41:29.860155506 -0400 +++ new/src/hotspot/share/gc/g1/g1BufferNodeList.cpp 2019-08-26 18:55:21.756251905 -0400 @@ -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"); +} --- /dev/null 2019-08-13 13:41:29.860155506 -0400 +++ new/src/hotspot/share/gc/g1/g1BufferNodeList.hpp 2019-08-26 18:55:22.576296081 -0400 @@ -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 +