author | kbarrett |
Sat, 18 Aug 2018 13:59:25 -0400 | |
changeset 51441 | 2e91d927e00c |
parent 51401 | src/hotspot/share/gc/g1/satbMarkQueue.hpp@58113ce90caf |
child 52582 | 6df094be7f58 |
permissions | -rw-r--r-- |
1374 | 1 |
/* |
51278
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. |
1374 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5082
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5082
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5082
diff
changeset
|
21 |
* questions. |
1374 | 22 |
* |
23 |
*/ |
|
24 |
||
51441
2e91d927e00c
8154343: Make SATB related code available to other GCs
kbarrett
parents:
51401
diff
changeset
|
25 |
#ifndef SHARE_GC_SHARED_SATBMARKQUEUE_HPP |
2e91d927e00c
8154343: Make SATB related code available to other GCs
kbarrett
parents:
51401
diff
changeset
|
26 |
#define SHARE_GC_SHARED_SATBMARKQUEUE_HPP |
7397 | 27 |
|
51441
2e91d927e00c
8154343: Make SATB related code available to other GCs
kbarrett
parents:
51401
diff
changeset
|
28 |
#include "gc/shared/ptrQueue.hpp" |
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
29 |
#include "memory/allocation.hpp" |
7397 | 30 |
|
1374 | 31 |
class JavaThread; |
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
7920
diff
changeset
|
32 |
class SATBMarkQueueSet; |
1374 | 33 |
|
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
34 |
// Base class for processing the contents of a SATB buffer. |
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
35 |
class SATBBufferClosure : public StackObj { |
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
36 |
protected: |
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
37 |
~SATBBufferClosure() { } |
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
38 |
|
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
39 |
public: |
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
40 |
// Process the SATB entries in the designated buffer range. |
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
41 |
virtual void do_buffer(void** buffer, size_t size) = 0; |
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
42 |
}; |
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
43 |
|
33792 | 44 |
// A PtrQueue whose elements are (possibly stale) pointers to object heads. |
45 |
class SATBMarkQueue: public PtrQueue { |
|
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
7920
diff
changeset
|
46 |
friend class SATBMarkQueueSet; |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
7920
diff
changeset
|
47 |
|
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
7920
diff
changeset
|
48 |
private: |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
7920
diff
changeset
|
49 |
// Filter out unwanted entries from the buffer. |
51278
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
50 |
inline void filter(); |
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
7920
diff
changeset
|
51 |
|
51278
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
52 |
// Removes entries from the buffer that are no longer needed. |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
53 |
template<typename Filter> |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
54 |
inline void apply_filter(Filter filter_out); |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
55 |
|
51393
cc8d309cd05a
8209345: Merge SATBMarkQueueFilter into SATBMarkQueueSet
kbarrett
parents:
51368
diff
changeset
|
56 |
public: |
cc8d309cd05a
8209345: Merge SATBMarkQueueFilter into SATBMarkQueueSet
kbarrett
parents:
51368
diff
changeset
|
57 |
SATBMarkQueue(SATBMarkQueueSet* qset, bool permanent = false); |
cc8d309cd05a
8209345: Merge SATBMarkQueueFilter into SATBMarkQueueSet
kbarrett
parents:
51368
diff
changeset
|
58 |
|
28507 | 59 |
// Process queue entries and free resources. |
60 |
void flush(); |
|
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
7920
diff
changeset
|
61 |
|
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
62 |
// Apply cl to the active part of the buffer. |
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
63 |
// Prerequisite: Must be at a safepoint. |
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
64 |
void apply_closure_and_empty(SATBBufferClosure* cl); |
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
65 |
|
7920 | 66 |
// Overrides PtrQueue::should_enqueue_buffer(). See the method's |
67 |
// definition for more information. |
|
68 |
virtual bool should_enqueue_buffer(); |
|
69 |
||
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
7920
diff
changeset
|
70 |
#ifndef PRODUCT |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
7920
diff
changeset
|
71 |
// Helpful for debugging |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
7920
diff
changeset
|
72 |
void print(const char* name); |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
7920
diff
changeset
|
73 |
#endif // PRODUCT |
34148
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33792
diff
changeset
|
74 |
|
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33792
diff
changeset
|
75 |
// Compiler support. |
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33792
diff
changeset
|
76 |
static ByteSize byte_offset_of_index() { |
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33792
diff
changeset
|
77 |
return PtrQueue::byte_offset_of_index<SATBMarkQueue>(); |
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33792
diff
changeset
|
78 |
} |
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33792
diff
changeset
|
79 |
using PtrQueue::byte_width_of_index; |
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33792
diff
changeset
|
80 |
|
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33792
diff
changeset
|
81 |
static ByteSize byte_offset_of_buf() { |
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33792
diff
changeset
|
82 |
return PtrQueue::byte_offset_of_buf<SATBMarkQueue>(); |
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33792
diff
changeset
|
83 |
} |
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33792
diff
changeset
|
84 |
using PtrQueue::byte_width_of_buf; |
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33792
diff
changeset
|
85 |
|
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33792
diff
changeset
|
86 |
static ByteSize byte_offset_of_active() { |
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33792
diff
changeset
|
87 |
return PtrQueue::byte_offset_of_active<SATBMarkQueue>(); |
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33792
diff
changeset
|
88 |
} |
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33792
diff
changeset
|
89 |
using PtrQueue::byte_width_of_active; |
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33792
diff
changeset
|
90 |
|
1374 | 91 |
}; |
92 |
||
93 |
class SATBMarkQueueSet: public PtrQueueSet { |
|
33792 | 94 |
SATBMarkQueue _shared_satb_queue; |
51401
58113ce90caf
8209346: Refactor SATBMarkQueue filter configuration
kbarrett
parents:
51393
diff
changeset
|
95 |
size_t _buffer_enqueue_threshold; |
1374 | 96 |
|
5082
19e725a3d2eb
6935821: G1: threads created during marking do not active their SATB queues
tonyp
parents:
4481
diff
changeset
|
97 |
#ifdef ASSERT |
22497 | 98 |
void dump_active_states(bool expected_active); |
99 |
void verify_active_states(bool expected_active); |
|
5082
19e725a3d2eb
6935821: G1: threads created during marking do not active their SATB queues
tonyp
parents:
4481
diff
changeset
|
100 |
#endif // ASSERT |
1374 | 101 |
|
51393
cc8d309cd05a
8209345: Merge SATBMarkQueueFilter into SATBMarkQueueSet
kbarrett
parents:
51368
diff
changeset
|
102 |
protected: |
1374 | 103 |
SATBMarkQueueSet(); |
51393
cc8d309cd05a
8209345: Merge SATBMarkQueueFilter into SATBMarkQueueSet
kbarrett
parents:
51368
diff
changeset
|
104 |
~SATBMarkQueueSet() {} |
1374 | 105 |
|
51393
cc8d309cd05a
8209345: Merge SATBMarkQueueFilter into SATBMarkQueueSet
kbarrett
parents:
51368
diff
changeset
|
106 |
template<typename Filter> |
cc8d309cd05a
8209345: Merge SATBMarkQueueFilter into SATBMarkQueueSet
kbarrett
parents:
51368
diff
changeset
|
107 |
void apply_filter(Filter filter, SATBMarkQueue* queue) { |
cc8d309cd05a
8209345: Merge SATBMarkQueueFilter into SATBMarkQueueSet
kbarrett
parents:
51368
diff
changeset
|
108 |
queue->apply_filter(filter); |
cc8d309cd05a
8209345: Merge SATBMarkQueueFilter into SATBMarkQueueSet
kbarrett
parents:
51368
diff
changeset
|
109 |
} |
cc8d309cd05a
8209345: Merge SATBMarkQueueFilter into SATBMarkQueueSet
kbarrett
parents:
51368
diff
changeset
|
110 |
|
cc8d309cd05a
8209345: Merge SATBMarkQueueFilter into SATBMarkQueueSet
kbarrett
parents:
51368
diff
changeset
|
111 |
void initialize(Monitor* cbl_mon, Mutex* fl_lock, |
4481 | 112 |
int process_completed_threshold, |
51401
58113ce90caf
8209346: Refactor SATBMarkQueue filter configuration
kbarrett
parents:
51393
diff
changeset
|
113 |
uint buffer_enqueue_threshold_percentage, |
4481 | 114 |
Mutex* lock); |
1374 | 115 |
|
51393
cc8d309cd05a
8209345: Merge SATBMarkQueueFilter into SATBMarkQueueSet
kbarrett
parents:
51368
diff
changeset
|
116 |
public: |
51368
adcb0bb3d1e9
8209118: Abstract SATBMarkQueueSet's ThreadLocalData access
rkennke
parents:
51278
diff
changeset
|
117 |
virtual SATBMarkQueue& satb_queue_for_thread(JavaThread* const t) const = 0; |
1374 | 118 |
|
22497 | 119 |
// Apply "set_active(active)" to all SATB queues in the set. It should be |
5082
19e725a3d2eb
6935821: G1: threads created during marking do not active their SATB queues
tonyp
parents:
4481
diff
changeset
|
120 |
// called only with the world stopped. The method will assert that the |
19e725a3d2eb
6935821: G1: threads created during marking do not active their SATB queues
tonyp
parents:
4481
diff
changeset
|
121 |
// SATB queues of all threads it visits, as well as the SATB queue |
19e725a3d2eb
6935821: G1: threads created during marking do not active their SATB queues
tonyp
parents:
4481
diff
changeset
|
122 |
// set itself, has an active value same as expected_active. |
22497 | 123 |
void set_active_all_threads(bool active, bool expected_active); |
1374 | 124 |
|
51401
58113ce90caf
8209346: Refactor SATBMarkQueue filter configuration
kbarrett
parents:
51393
diff
changeset
|
125 |
size_t buffer_enqueue_threshold() const { return _buffer_enqueue_threshold; } |
51393
cc8d309cd05a
8209345: Merge SATBMarkQueueFilter into SATBMarkQueueSet
kbarrett
parents:
51368
diff
changeset
|
126 |
virtual void filter(SATBMarkQueue* queue) = 0; |
51278
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
127 |
|
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
7920
diff
changeset
|
128 |
// Filter all the currently-active SATB buffers. |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
7920
diff
changeset
|
129 |
void filter_thread_buffers(); |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
7920
diff
changeset
|
130 |
|
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
131 |
// If there exists some completed buffer, pop and process it, and |
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
132 |
// return true. Otherwise return false. Processing a buffer |
37065 | 133 |
// consists of applying the closure to the active range of the |
134 |
// buffer; the leading entries may be excluded due to filtering. |
|
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
135 |
bool apply_closure_to_completed_buffer(SATBBufferClosure* cl); |
1374 | 136 |
|
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
7920
diff
changeset
|
137 |
#ifndef PRODUCT |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
7920
diff
changeset
|
138 |
// Helpful for debugging |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
7920
diff
changeset
|
139 |
void print_all(const char* msg); |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
7920
diff
changeset
|
140 |
#endif // PRODUCT |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
7920
diff
changeset
|
141 |
|
33792 | 142 |
SATBMarkQueue* shared_satb_queue() { return &_shared_satb_queue; } |
1374 | 143 |
|
144 |
// If a marking is being abandoned, reset any unprocessed log buffers. |
|
145 |
void abandon_partial_marking(); |
|
146 |
}; |
|
7397 | 147 |
|
51278
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
148 |
inline void SATBMarkQueue::filter() { |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
149 |
static_cast<SATBMarkQueueSet*>(qset())->filter(this); |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
150 |
} |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
151 |
|
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
152 |
// Removes entries from the buffer that are no longer needed, as |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
153 |
// determined by filter. If e is a void* entry in the buffer, |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
154 |
// filter_out(e) must be a valid expression whose value is convertible |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
155 |
// to bool. Entries are removed (filtered out) if the result is true, |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
156 |
// retained if false. |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
157 |
template<typename Filter> |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
158 |
inline void SATBMarkQueue::apply_filter(Filter filter_out) { |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
159 |
void** buf = this->_buf; |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
160 |
|
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
161 |
if (buf == NULL) { |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
162 |
// nothing to do |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
163 |
return; |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
164 |
} |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
165 |
|
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
166 |
// Two-fingered compaction toward the end. |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
167 |
void** src = &buf[this->index()]; |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
168 |
void** dst = &buf[this->capacity()]; |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
169 |
assert(src <= dst, "invariant"); |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
170 |
for ( ; src < dst; ++src) { |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
171 |
// Search low to high for an entry to keep. |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
172 |
void* entry = *src; |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
173 |
if (!filter_out(entry)) { |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
174 |
// Found keeper. Search high to low for an entry to discard. |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
175 |
while (src < --dst) { |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
176 |
if (filter_out(*dst)) { |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
177 |
*dst = entry; // Replace discard with keeper. |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
178 |
break; |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
179 |
} |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
180 |
} |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
181 |
// If discard search failed (src == dst), the outer loop will also end. |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
182 |
} |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
183 |
} |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
184 |
// dst points to the lowest retained entry, or the end of the buffer |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
185 |
// if all the entries were filtered out. |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
186 |
this->set_index(dst - buf); |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
187 |
} |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
47216
diff
changeset
|
188 |
|
51441
2e91d927e00c
8154343: Make SATB related code available to other GCs
kbarrett
parents:
51401
diff
changeset
|
189 |
#endif // SHARE_GC_SHARED_SATBMARKQUEUE_HPP |