src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp
author kbarrett
Fri, 19 Jul 2019 16:47:11 -0400
changeset 55752 8ae33203d600
child 57507 f6b30bd6804e
permissions -rw-r--r--
8162929: Enqueuing dirty cards into a single DCQS during GC does not scale Summary: Refactor into G1RedirtyCardsQueue[Set] and G1DirtyCardQueueSet Reviewed-by: tschatzl, sangheki
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
55752
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
     1
/*
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
     2
 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
     4
 *
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
     8
 *
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    13
 * accompanied this code).
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    14
 *
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    18
 *
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    21
 * questions.
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    22
 *
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    23
 */
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    24
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    25
#include "precompiled.hpp"
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    26
#include "gc/g1/g1RedirtyCardsQueue.hpp"
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    27
#include "runtime/atomic.hpp"
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    28
#include "utilities/debug.hpp"
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    29
#include "utilities/macros.hpp"
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    30
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    31
// G1RedirtyCardsBufferList
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    32
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    33
G1RedirtyCardsBufferList::G1RedirtyCardsBufferList() :
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    34
  _head(NULL), _tail(NULL), _count(0) {}
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    35
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    36
G1RedirtyCardsBufferList::G1RedirtyCardsBufferList(BufferNode* head,
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    37
                                                   BufferNode* tail,
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    38
                                                   size_t count) :
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    39
  _head(head), _tail(tail), _count(count)
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    40
{
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    41
  assert((_head == NULL) == (_tail == NULL), "invariant");
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    42
  assert((_head == NULL) == (_count == 0), "invariant");
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    43
}
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    44
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    45
// G1RedirtyCardsQueueBase::LocalQSet
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    46
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    47
G1RedirtyCardsQueueBase::LocalQSet::LocalQSet(G1RedirtyCardsQueueSet* shared_qset) :
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    48
  PtrQueueSet(),
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    49
  _shared_qset(shared_qset),
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    50
  _buffers()
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    51
{
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    52
  PtrQueueSet::initialize(_shared_qset->allocator());
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    53
}
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    54
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    55
G1RedirtyCardsQueueBase::LocalQSet::~LocalQSet() {
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    56
  assert(_buffers._head == NULL, "unflushed qset");
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    57
  assert(_buffers._tail == NULL, "invariant");
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    58
  assert(_buffers._count == 0, "invariant");
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    59
}
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    60
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    61
void G1RedirtyCardsQueueBase::LocalQSet::enqueue_completed_buffer(BufferNode* node) {
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    62
  ++_buffers._count;
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    63
  node->set_next(_buffers._head);
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    64
  _buffers._head = node;
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    65
  if (_buffers._tail == NULL) {
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    66
    _buffers._tail = node;
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    67
  }
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    68
}
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    69
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    70
G1RedirtyCardsBufferList
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    71
G1RedirtyCardsQueueBase::LocalQSet::take_all_completed_buffers() {
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    72
  G1RedirtyCardsBufferList result = _buffers;
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    73
  _buffers = G1RedirtyCardsBufferList();
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    74
  return result;
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    75
}
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    76
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    77
void G1RedirtyCardsQueueBase::LocalQSet::flush() {
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    78
  _shared_qset->merge_bufferlist(this);
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    79
}
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    80
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    81
// G1RedirtyCardsQueue
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    82
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    83
G1RedirtyCardsQueue::G1RedirtyCardsQueue(G1RedirtyCardsQueueSet* qset) :
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    84
  G1RedirtyCardsQueueBase(qset), // Init _local_qset before passing to PtrQueue.
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    85
  PtrQueue(&_local_qset, true /* active (always) */)
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    86
{}
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    87
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    88
G1RedirtyCardsQueue::~G1RedirtyCardsQueue() {
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    89
  flush();
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    90
}
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    91
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    92
void G1RedirtyCardsQueue::handle_completed_buffer() {
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    93
  enqueue_completed_buffer();
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    94
}
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    95
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    96
void G1RedirtyCardsQueue::flush() {
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    97
  flush_impl();
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    98
  _local_qset.flush();
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
    99
}
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   100
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   101
// G1RedirtyCardsQueueSet
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   102
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   103
G1RedirtyCardsQueueSet::G1RedirtyCardsQueueSet() :
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   104
  PtrQueueSet(),
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   105
  _list(),
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   106
  _count(0),
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   107
  _tail(NULL)
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   108
  DEBUG_ONLY(COMMA _collecting(true))
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   109
{}
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   110
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   111
G1RedirtyCardsQueueSet::~G1RedirtyCardsQueueSet() {
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   112
  verify_empty();
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   113
}
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   114
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   115
#ifdef ASSERT
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   116
void G1RedirtyCardsQueueSet::verify_empty() const {
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   117
  assert(_list.empty(), "precondition");
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   118
  assert(_tail == NULL, "invariant");
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   119
  assert(_count == 0, "invariant");
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   120
}
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   121
#endif // ASSERT
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   122
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   123
BufferNode* G1RedirtyCardsQueueSet::all_completed_buffers() const {
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   124
  DEBUG_ONLY(_collecting = false;)
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   125
  return _list.top();
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   126
}
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   127
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   128
G1RedirtyCardsBufferList G1RedirtyCardsQueueSet::take_all_completed_buffers() {
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   129
  DEBUG_ONLY(_collecting = false;)
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   130
  G1RedirtyCardsBufferList result(_list.pop_all(), _tail, _count);
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   131
  _tail = NULL;
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   132
  _count = 0;
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   133
  DEBUG_ONLY(_collecting = true;)
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   134
  return result;
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   135
}
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   136
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   137
void G1RedirtyCardsQueueSet::update_tail(BufferNode* node) {
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   138
  // Node is the tail of a (possibly single element) list just prepended to
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   139
  // _list.  If, after that prepend, node's follower is NULL, then node is
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   140
  // also the tail of _list, so record it as such.
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   141
  if (node->next() == NULL) {
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   142
    assert(_tail == NULL, "invariant");
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   143
    _tail = node;
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   144
  }
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   145
}
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   146
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   147
void G1RedirtyCardsQueueSet::enqueue_completed_buffer(BufferNode* node) {
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   148
  assert(_collecting, "precondition");
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   149
  Atomic::inc(&_count);
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   150
  _list.push(*node);
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   151
  update_tail(node);
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   152
}
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   153
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   154
void G1RedirtyCardsQueueSet::merge_bufferlist(LocalQSet* src) {
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   155
  assert(_collecting, "precondition");
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   156
  const G1RedirtyCardsBufferList from = src->take_all_completed_buffers();
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   157
  if (from._head != NULL) {
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   158
    assert(from._tail != NULL, "invariant");
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   159
    Atomic::add(from._count, &_count);
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   160
    _list.prepend(*from._head, *from._tail);
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   161
    update_tail(from._tail);
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   162
  }
8ae33203d600 8162929: Enqueuing dirty cards into a single DCQS during GC does not scale
kbarrett
parents:
diff changeset
   163
}