author | eosterlund |
Mon, 26 Feb 2018 09:34:12 +0100 | |
changeset 49164 | 7e958a8ebcd3 |
parent 49007 | 82d9d5744e5f |
permissions | -rw-r--r-- |
1374 | 1 |
/* |
48961
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48102
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 |
||
7397 | 25 |
#include "precompiled.hpp" |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
26 |
#include "gc/g1/g1CardTable.inline.hpp" |
30764 | 27 |
#include "gc/g1/g1CollectedHeap.inline.hpp" |
35862
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
35061
diff
changeset
|
28 |
#include "gc/g1/g1SATBCardTableModRefBS.inline.hpp" |
30764 | 29 |
#include "gc/g1/heapRegion.hpp" |
33792 | 30 |
#include "gc/g1/satbMarkQueue.hpp" |
35061 | 31 |
#include "logging/log.hpp" |
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
28830
diff
changeset
|
32 |
#include "oops/oop.inline.hpp" |
7397 | 33 |
#include "runtime/mutexLocker.hpp" |
14583
d70ee55535f4
8003935: Simplify the needed includes for using Thread::current()
stefank
parents:
10565
diff
changeset
|
34 |
#include "runtime/thread.inline.hpp" |
1374 | 35 |
|
29325 | 36 |
G1SATBCardTableModRefBS::G1SATBCardTableModRefBS( |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
37 |
G1CardTable* card_table, |
29325 | 38 |
const BarrierSet::FakeRtti& fake_rtti) : |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
39 |
CardTableModRefBS(card_table, fake_rtti.add_tag(BarrierSet::G1SATBCT)) |
29325 | 40 |
{ } |
1374 | 41 |
|
42 |
void G1SATBCardTableModRefBS::enqueue(oop pre_val) { |
|
9176
42d9d1010f38
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
7397
diff
changeset
|
43 |
// Nulls should have been already filtered. |
46968
9119841280f4
8160399: is_oop_or_null involves undefined behavior
coleenp
parents:
42598
diff
changeset
|
44 |
assert(oopDesc::is_oop(pre_val, true), "Error"); |
9176
42d9d1010f38
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
7397
diff
changeset
|
45 |
|
5082
19e725a3d2eb
6935821: G1: threads created during marking do not active their SATB queues
tonyp
parents:
3262
diff
changeset
|
46 |
if (!JavaThread::satb_mark_queue_set().is_active()) return; |
1374 | 47 |
Thread* thr = Thread::current(); |
48 |
if (thr->is_Java_thread()) { |
|
49 |
JavaThread* jt = (JavaThread*)thr; |
|
50 |
jt->satb_mark_queue().enqueue(pre_val); |
|
51 |
} else { |
|
18495
65a0d2ae4b22
8014022: G1: Non Java threads should lock the shared SATB queue lock without safepoint checks.
brutisso
parents:
14583
diff
changeset
|
52 |
MutexLockerEx x(Shared_SATB_Q_lock, Mutex::_no_safepoint_check_flag); |
1374 | 53 |
JavaThread::satb_mark_queue_set().shared_satb_queue()->enqueue(pre_val); |
54 |
} |
|
55 |
} |
|
56 |
||
3262
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
1374
diff
changeset
|
57 |
template <class T> void |
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
1374
diff
changeset
|
58 |
G1SATBCardTableModRefBS::write_ref_array_pre_work(T* dst, int count) { |
5082
19e725a3d2eb
6935821: G1: threads created during marking do not active their SATB queues
tonyp
parents:
3262
diff
changeset
|
59 |
if (!JavaThread::satb_mark_queue_set().is_active()) return; |
3262
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
1374
diff
changeset
|
60 |
T* elem_ptr = dst; |
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
1374
diff
changeset
|
61 |
for (int i = 0; i < count; i++, elem_ptr++) { |
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
1374
diff
changeset
|
62 |
T heap_oop = oopDesc::load_heap_oop(elem_ptr); |
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
1374
diff
changeset
|
63 |
if (!oopDesc::is_null(heap_oop)) { |
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
1374
diff
changeset
|
64 |
enqueue(oopDesc::decode_heap_oop_not_null(heap_oop)); |
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
1374
diff
changeset
|
65 |
} |
1374 | 66 |
} |
67 |
} |
|
68 |
||
25480
190facf4e732
8048214: Linker error when compiling G1SATBCardTableModRefBS after include order changes
mgerdin
parents:
25351
diff
changeset
|
69 |
void G1SATBCardTableModRefBS::write_ref_array_pre(oop* dst, int count, bool dest_uninitialized) { |
190facf4e732
8048214: Linker error when compiling G1SATBCardTableModRefBS after include order changes
mgerdin
parents:
25351
diff
changeset
|
70 |
if (!dest_uninitialized) { |
190facf4e732
8048214: Linker error when compiling G1SATBCardTableModRefBS after include order changes
mgerdin
parents:
25351
diff
changeset
|
71 |
write_ref_array_pre_work(dst, count); |
190facf4e732
8048214: Linker error when compiling G1SATBCardTableModRefBS after include order changes
mgerdin
parents:
25351
diff
changeset
|
72 |
} |
190facf4e732
8048214: Linker error when compiling G1SATBCardTableModRefBS after include order changes
mgerdin
parents:
25351
diff
changeset
|
73 |
} |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
74 |
|
25480
190facf4e732
8048214: Linker error when compiling G1SATBCardTableModRefBS after include order changes
mgerdin
parents:
25351
diff
changeset
|
75 |
void G1SATBCardTableModRefBS::write_ref_array_pre(narrowOop* dst, int count, bool dest_uninitialized) { |
190facf4e732
8048214: Linker error when compiling G1SATBCardTableModRefBS after include order changes
mgerdin
parents:
25351
diff
changeset
|
76 |
if (!dest_uninitialized) { |
190facf4e732
8048214: Linker error when compiling G1SATBCardTableModRefBS after include order changes
mgerdin
parents:
25351
diff
changeset
|
77 |
write_ref_array_pre_work(dst, count); |
190facf4e732
8048214: Linker error when compiling G1SATBCardTableModRefBS after include order changes
mgerdin
parents:
25351
diff
changeset
|
78 |
} |
190facf4e732
8048214: Linker error when compiling G1SATBCardTableModRefBS after include order changes
mgerdin
parents:
25351
diff
changeset
|
79 |
} |
190facf4e732
8048214: Linker error when compiling G1SATBCardTableModRefBS after include order changes
mgerdin
parents:
25351
diff
changeset
|
80 |
|
1374 | 81 |
G1SATBCardTableLoggingModRefBS:: |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
82 |
G1SATBCardTableLoggingModRefBS(G1CardTable* card_table) : |
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
83 |
G1SATBCardTableModRefBS(card_table, BarrierSet::FakeRtti(G1SATBCTLogging)), |
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
84 |
_dcqs(JavaThread::dirty_card_queue_set()) {} |
1374 | 85 |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
86 |
void G1SATBCardTableLoggingModRefBS::write_ref_field_post_slow(volatile jbyte* byte) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
87 |
// In the slow path, we know a card is not young |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
88 |
assert(*byte != G1CardTable::g1_young_card_val(), "slow path invoked without filtering"); |
20403
45a89fbcd8f7
8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents:
20309
diff
changeset
|
89 |
OrderAccess::storeload(); |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
90 |
if (*byte != G1CardTable::dirty_card_val()) { |
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
91 |
*byte = G1CardTable::dirty_card_val(); |
1374 | 92 |
Thread* thr = Thread::current(); |
93 |
if (thr->is_Java_thread()) { |
|
94 |
JavaThread* jt = (JavaThread*)thr; |
|
95 |
jt->dirty_card_queue().enqueue(byte); |
|
96 |
} else { |
|
97 |
MutexLockerEx x(Shared_DirtyCardQ_lock, |
|
98 |
Mutex::_no_safepoint_check_flag); |
|
99 |
_dcqs.shared_dirty_card_queue()->enqueue(byte); |
|
100 |
} |
|
101 |
} |
|
102 |
} |
|
103 |
||
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
104 |
void G1SATBCardTableLoggingModRefBS::invalidate(MemRegion mr) { |
48102
08be4c1e540e
8182050: assert(_whole_heap.contains(p)) failed: Attempt to access p out of bounds of card marking array's _whole_heap
tschatzl
parents:
47998
diff
changeset
|
105 |
if (mr.is_empty()) { |
08be4c1e540e
8182050: assert(_whole_heap.contains(p)) failed: Attempt to access p out of bounds of card marking array's _whole_heap
tschatzl
parents:
47998
diff
changeset
|
106 |
return; |
08be4c1e540e
8182050: assert(_whole_heap.contains(p)) failed: Attempt to access p out of bounds of card marking array's _whole_heap
tschatzl
parents:
47998
diff
changeset
|
107 |
} |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
108 |
volatile jbyte* byte = _card_table->byte_for(mr.start()); |
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
109 |
jbyte* last_byte = _card_table->byte_for(mr.last()); |
1374 | 110 |
Thread* thr = Thread::current(); |
20403
45a89fbcd8f7
8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents:
20309
diff
changeset
|
111 |
// skip all consecutive young cards |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
112 |
for (; byte <= last_byte && *byte == G1CardTable::g1_young_card_val(); byte++); |
20403
45a89fbcd8f7
8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents:
20309
diff
changeset
|
113 |
|
42598
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
40655
diff
changeset
|
114 |
if (byte <= last_byte) { |
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
40655
diff
changeset
|
115 |
OrderAccess::storeload(); |
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
40655
diff
changeset
|
116 |
// Enqueue if necessary. |
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
40655
diff
changeset
|
117 |
if (thr->is_Java_thread()) { |
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
40655
diff
changeset
|
118 |
JavaThread* jt = (JavaThread*)thr; |
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
40655
diff
changeset
|
119 |
for (; byte <= last_byte; byte++) { |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
120 |
if (*byte == G1CardTable::g1_young_card_val()) { |
42598
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
40655
diff
changeset
|
121 |
continue; |
1374 | 122 |
} |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
123 |
if (*byte != G1CardTable::dirty_card_val()) { |
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
124 |
*byte = G1CardTable::dirty_card_val(); |
42598
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
40655
diff
changeset
|
125 |
jt->dirty_card_queue().enqueue(byte); |
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
40655
diff
changeset
|
126 |
} |
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
40655
diff
changeset
|
127 |
} |
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
40655
diff
changeset
|
128 |
} else { |
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
40655
diff
changeset
|
129 |
MutexLockerEx x(Shared_DirtyCardQ_lock, |
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
40655
diff
changeset
|
130 |
Mutex::_no_safepoint_check_flag); |
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
40655
diff
changeset
|
131 |
for (; byte <= last_byte; byte++) { |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
132 |
if (*byte == G1CardTable::g1_young_card_val()) { |
42598
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
40655
diff
changeset
|
133 |
continue; |
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
40655
diff
changeset
|
134 |
} |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
135 |
if (*byte != G1CardTable::dirty_card_val()) { |
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
136 |
*byte = G1CardTable::dirty_card_val(); |
42598
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
40655
diff
changeset
|
137 |
_dcqs.shared_dirty_card_queue()->enqueue(byte); |
1374 | 138 |
} |
139 |
} |
|
140 |
} |
|
141 |
} |
|
142 |
} |
|
48961
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48102
diff
changeset
|
143 |
|
49007
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
144 |
void G1SATBCardTableLoggingModRefBS::on_thread_attach(JavaThread* thread) { |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
145 |
// This method initializes the SATB and dirty card queues before a |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
146 |
// JavaThread is added to the Java thread list. Right now, we don't |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
147 |
// have to do anything to the dirty card queue (it should have been |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
148 |
// activated when the thread was created), but we have to activate |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
149 |
// the SATB queue if the thread is created while a marking cycle is |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
150 |
// in progress. The activation / de-activation of the SATB queues at |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
151 |
// the beginning / end of a marking cycle is done during safepoints |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
152 |
// so we have to make sure this method is called outside one to be |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
153 |
// able to safely read the active field of the SATB queue set. Right |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
154 |
// now, it is called just before the thread is added to the Java |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
155 |
// thread list in the Threads::add() method. That method is holding |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
156 |
// the Threads_lock which ensures we are outside a safepoint. We |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
157 |
// cannot do the obvious and set the active field of the SATB queue |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
158 |
// when the thread is created given that, in some cases, safepoints |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
159 |
// might happen between the JavaThread constructor being called and the |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
160 |
// thread being added to the Java thread list (an example of this is |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
161 |
// when the structure for the DestroyJavaVM thread is created). |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
162 |
assert(!SafepointSynchronize::is_at_safepoint(), "We should not be at a safepoint"); |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
163 |
assert(!thread->satb_mark_queue().is_active(), "SATB queue should not be active"); |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
164 |
assert(thread->satb_mark_queue().is_empty(), "SATB queue should be empty"); |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
165 |
assert(thread->dirty_card_queue().is_active(), "Dirty card queue should be active"); |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
166 |
|
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
167 |
// If we are creating the thread during a marking cycle, we should |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
168 |
// set the active field of the SATB queue to true. |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
169 |
if (thread->satb_mark_queue_set().is_active()) { |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
170 |
thread->satb_mark_queue().set_active(true); |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
171 |
} |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
172 |
} |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
173 |
|
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
174 |
void G1SATBCardTableLoggingModRefBS::on_thread_detach(JavaThread* thread) { |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
175 |
// Flush any deferred card marks, SATB buffers and dirty card queue buffers |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
176 |
CardTableModRefBS::on_thread_detach(thread); |
48961
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48102
diff
changeset
|
177 |
thread->satb_mark_queue().flush(); |
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48102
diff
changeset
|
178 |
thread->dirty_card_queue().flush(); |
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48102
diff
changeset
|
179 |
} |