mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-31 21:48:23 +00:00
8280437: Move G1BufferNodeList to gc/shared
Reviewed-by: sjohanss, iwalulya, mli
This commit is contained in:
parent
4b329addf1
commit
1c7769d35b
@ -24,7 +24,6 @@
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "gc/g1/g1BarrierSet.inline.hpp"
|
||||
#include "gc/g1/g1BufferNodeList.hpp"
|
||||
#include "gc/g1/g1CardTableEntryClosure.hpp"
|
||||
#include "gc/g1/g1CollectedHeap.inline.hpp"
|
||||
#include "gc/g1/g1ConcurrentRefineStats.hpp"
|
||||
@ -35,6 +34,7 @@
|
||||
#include "gc/g1/g1RemSet.hpp"
|
||||
#include "gc/g1/g1ThreadLocalData.hpp"
|
||||
#include "gc/g1/heapRegionRemSet.inline.hpp"
|
||||
#include "gc/shared/bufferNodeList.hpp"
|
||||
#include "gc/shared/suspendibleThreadSet.hpp"
|
||||
#include "memory/iterator.hpp"
|
||||
#include "runtime/atomic.hpp"
|
||||
@ -313,7 +313,7 @@ void G1DirtyCardQueueSet::enqueue_all_paused_buffers() {
|
||||
}
|
||||
|
||||
void G1DirtyCardQueueSet::abandon_completed_buffers() {
|
||||
G1BufferNodeList list = take_all_completed_buffers();
|
||||
BufferNodeList list = take_all_completed_buffers();
|
||||
BufferNode* buffers_to_delete = list._head;
|
||||
while (buffers_to_delete != NULL) {
|
||||
BufferNode* bn = buffers_to_delete;
|
||||
@ -334,20 +334,20 @@ void G1DirtyCardQueueSet::notify_if_necessary() {
|
||||
// result. The queue sets must share the same allocator.
|
||||
void G1DirtyCardQueueSet::merge_bufferlists(G1RedirtyCardsQueueSet* src) {
|
||||
assert(allocator() == src->allocator(), "precondition");
|
||||
const G1BufferNodeList from = src->take_all_completed_buffers();
|
||||
const BufferNodeList from = src->take_all_completed_buffers();
|
||||
if (from._head != NULL) {
|
||||
Atomic::add(&_num_cards, from._entry_count);
|
||||
_completed.append(*from._head, *from._tail);
|
||||
}
|
||||
}
|
||||
|
||||
G1BufferNodeList G1DirtyCardQueueSet::take_all_completed_buffers() {
|
||||
BufferNodeList G1DirtyCardQueueSet::take_all_completed_buffers() {
|
||||
enqueue_all_paused_buffers();
|
||||
verify_num_cards();
|
||||
Pair<BufferNode*, BufferNode*> pair = _completed.take_all();
|
||||
size_t num_cards = Atomic::load(&_num_cards);
|
||||
Atomic::store(&_num_cards, size_t(0));
|
||||
return G1BufferNodeList(pair.first, pair.second, num_cards);
|
||||
return BufferNodeList(pair.first, pair.second, num_cards);
|
||||
}
|
||||
|
||||
class G1RefineBufferedCards : public StackObj {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2022, 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
|
||||
@ -25,10 +25,10 @@
|
||||
#ifndef SHARE_GC_G1_G1DIRTYCARDQUEUE_HPP
|
||||
#define SHARE_GC_G1_G1DIRTYCARDQUEUE_HPP
|
||||
|
||||
#include "gc/g1/g1BufferNodeList.hpp"
|
||||
#include "gc/g1/g1FreeIdSet.hpp"
|
||||
#include "gc/g1/g1CardTable.hpp"
|
||||
#include "gc/g1/g1ConcurrentRefineStats.hpp"
|
||||
#include "gc/shared/bufferNodeList.hpp"
|
||||
#include "gc/shared/ptrQueue.hpp"
|
||||
#include "memory/allocation.hpp"
|
||||
#include "memory/padded.hpp"
|
||||
@ -69,7 +69,7 @@ public:
|
||||
|
||||
class G1DirtyCardQueueSet: public PtrQueueSet {
|
||||
// Head and tail of a list of BufferNodes, linked through their next()
|
||||
// fields. Similar to G1BufferNodeList, but without the _entry_count.
|
||||
// fields. Similar to BufferNodeList, but without the _entry_count.
|
||||
struct HeadTail {
|
||||
BufferNode* _head;
|
||||
BufferNode* _tail;
|
||||
@ -275,7 +275,7 @@ public:
|
||||
|
||||
void merge_bufferlists(G1RedirtyCardsQueueSet* src);
|
||||
|
||||
G1BufferNodeList take_all_completed_buffers();
|
||||
BufferNodeList take_all_completed_buffers();
|
||||
|
||||
void flush_queue(G1DirtyCardQueue& queue);
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2022, 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
|
||||
@ -67,7 +67,7 @@ void G1RedirtyCardsLocalQueueSet::enqueue(void* value) {
|
||||
void G1RedirtyCardsLocalQueueSet::flush() {
|
||||
flush_queue(_queue);
|
||||
_shared_qset->add_bufferlist(_buffers);
|
||||
_buffers = G1BufferNodeList();
|
||||
_buffers = BufferNodeList();
|
||||
}
|
||||
|
||||
// G1RedirtyCardsLocalQueueSet::Queue
|
||||
@ -109,9 +109,9 @@ BufferNode* G1RedirtyCardsQueueSet::all_completed_buffers() const {
|
||||
return _list.top();
|
||||
}
|
||||
|
||||
G1BufferNodeList G1RedirtyCardsQueueSet::take_all_completed_buffers() {
|
||||
BufferNodeList G1RedirtyCardsQueueSet::take_all_completed_buffers() {
|
||||
DEBUG_ONLY(_collecting = false;)
|
||||
G1BufferNodeList result(_list.pop_all(), _tail, _entry_count);
|
||||
BufferNodeList result(_list.pop_all(), _tail, _entry_count);
|
||||
_tail = NULL;
|
||||
_entry_count = 0;
|
||||
DEBUG_ONLY(_collecting = true;)
|
||||
@ -135,7 +135,7 @@ void G1RedirtyCardsQueueSet::enqueue_completed_buffer(BufferNode* node) {
|
||||
update_tail(node);
|
||||
}
|
||||
|
||||
void G1RedirtyCardsQueueSet::add_bufferlist(const G1BufferNodeList& buffers) {
|
||||
void G1RedirtyCardsQueueSet::add_bufferlist(const BufferNodeList& buffers) {
|
||||
assert(_collecting, "precondition");
|
||||
if (buffers._head != NULL) {
|
||||
assert(buffers._tail != NULL, "invariant");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2022, 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
|
||||
@ -25,7 +25,7 @@
|
||||
#ifndef SHARE_GC_G1_G1REDIRTYCARDSQUEUE_HPP
|
||||
#define SHARE_GC_G1_G1REDIRTYCARDSQUEUE_HPP
|
||||
|
||||
#include "gc/g1/g1BufferNodeList.hpp"
|
||||
#include "gc/shared/bufferNodeList.hpp"
|
||||
#include "gc/shared/ptrQueue.hpp"
|
||||
#include "memory/padded.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
@ -42,7 +42,7 @@ class G1RedirtyCardsLocalQueueSet : private PtrQueueSet {
|
||||
};
|
||||
|
||||
G1RedirtyCardsQueueSet* _shared_qset;
|
||||
G1BufferNodeList _buffers;
|
||||
BufferNodeList _buffers;
|
||||
Queue _queue;
|
||||
|
||||
// Add the buffer to the local list.
|
||||
@ -84,12 +84,12 @@ public:
|
||||
// Collect buffers. These functions are thread-safe.
|
||||
// precondition: Must not be concurrent with buffer processing.
|
||||
virtual void enqueue_completed_buffer(BufferNode* node);
|
||||
void add_bufferlist(const G1BufferNodeList& buffers);
|
||||
void add_bufferlist(const BufferNodeList& buffers);
|
||||
|
||||
// Processing phase operations.
|
||||
// precondition: Must not be concurrent with buffer collection.
|
||||
BufferNode* all_completed_buffers() const;
|
||||
G1BufferNodeList take_all_completed_buffers();
|
||||
BufferNodeList take_all_completed_buffers();
|
||||
};
|
||||
|
||||
#endif // SHARE_GC_G1_G1REDIRTYCARDSQUEUE_HPP
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2022, 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
|
||||
@ -45,6 +45,7 @@
|
||||
#include "gc/g1/heapRegion.inline.hpp"
|
||||
#include "gc/g1/heapRegionManager.inline.hpp"
|
||||
#include "gc/g1/heapRegionRemSet.inline.hpp"
|
||||
#include "gc/shared/bufferNodeList.hpp"
|
||||
#include "gc/shared/gcTraceTime.inline.hpp"
|
||||
#include "gc/shared/ptrQueue.hpp"
|
||||
#include "gc/shared/suspendibleThreadSet.hpp"
|
||||
@ -1429,7 +1430,7 @@ public:
|
||||
{
|
||||
if (initial_evacuation) {
|
||||
G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
|
||||
G1BufferNodeList buffers = dcqs.take_all_completed_buffers();
|
||||
BufferNodeList buffers = dcqs.take_all_completed_buffers();
|
||||
if (buffers._entry_count != 0) {
|
||||
_dirty_card_buffers.prepend(*buffers._head, *buffers._tail);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2022, 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
|
||||
@ -23,15 +23,15 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "gc/g1/g1BufferNodeList.hpp"
|
||||
#include "gc/shared/bufferNodeList.hpp"
|
||||
#include "utilities/debug.hpp"
|
||||
|
||||
G1BufferNodeList::G1BufferNodeList() :
|
||||
BufferNodeList::BufferNodeList() :
|
||||
_head(NULL), _tail(NULL), _entry_count(0) {}
|
||||
|
||||
G1BufferNodeList::G1BufferNodeList(BufferNode* head,
|
||||
BufferNode* tail,
|
||||
size_t entry_count) :
|
||||
BufferNodeList::BufferNodeList(BufferNode* head,
|
||||
BufferNode* tail,
|
||||
size_t entry_count) :
|
||||
_head(head), _tail(tail), _entry_count(entry_count)
|
||||
{
|
||||
assert((_head == NULL) == (_tail == NULL), "invariant");
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2022, 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
|
||||
@ -22,21 +22,20 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SHARE_GC_G1_G1BUFFERNODELIST_HPP
|
||||
#define SHARE_GC_G1_G1BUFFERNODELIST_HPP
|
||||
#ifndef SHARE_GC_SHARED_BUFFERNODELIST_HPP
|
||||
#define SHARE_GC_SHARED_BUFFERNODELIST_HPP
|
||||
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
|
||||
class BufferNode;
|
||||
|
||||
struct G1BufferNodeList {
|
||||
struct BufferNodeList {
|
||||
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);
|
||||
BufferNodeList();
|
||||
BufferNodeList(BufferNode* head, BufferNode* tail, size_t entry_count);
|
||||
};
|
||||
|
||||
#endif // SHARE_GC_G1_G1BUFFERNODELIST_HPP
|
||||
|
||||
#endif // SHARE_GC_SHARED_BUFFERNODELIST_HPP
|
||||
Loading…
x
Reference in New Issue
Block a user