author | tschatzl |
Wed, 18 Apr 2018 11:36:48 +0200 | |
changeset 49806 | 2d62570a615c |
parent 49752 | 93d84f667d12 |
child 50375 | bfbe7d8369bb |
permissions | -rw-r--r-- |
1374 | 1 |
/* |
48961
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48784
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:
3262
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3262
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:
3262
diff
changeset
|
21 |
* questions. |
1374 | 22 |
* |
23 |
*/ |
|
24 |
||
49347
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
25 |
#ifndef SHARE_VM_GC_G1_G1BARRIERSET_HPP |
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
26 |
#define SHARE_VM_GC_G1_G1BARRIERSET_HPP |
7397 | 27 |
|
49751
c3a10df652c0
8201316: Move G1-related static members from JavaThread to G1BarrierSet
pliden
parents:
49488
diff
changeset
|
28 |
#include "gc/g1/dirtyCardQueue.hpp" |
c3a10df652c0
8201316: Move G1-related static members from JavaThread to G1BarrierSet
pliden
parents:
49488
diff
changeset
|
29 |
#include "gc/g1/satbMarkQueue.hpp" |
49455
848864ed9b17
8199604: Rename CardTableModRefBS to CardTableBarrierSet
eosterlund
parents:
49347
diff
changeset
|
30 |
#include "gc/shared/cardTableBarrierSet.hpp" |
7397 | 31 |
|
1374 | 32 |
class DirtyCardQueueSet; |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
33 |
class CardTable; |
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
49007
diff
changeset
|
34 |
class G1CardTable; |
1374 | 35 |
|
36 |
// This barrier is specialized to use a logging barrier to support |
|
37 |
// snapshot-at-the-beginning marking. |
|
38 |
||
49455
848864ed9b17
8199604: Rename CardTableModRefBS to CardTableBarrierSet
eosterlund
parents:
49347
diff
changeset
|
39 |
class G1BarrierSet: public CardTableBarrierSet { |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32612
diff
changeset
|
40 |
friend class VMStructs; |
49347
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
41 |
private: |
49751
c3a10df652c0
8201316: Move G1-related static members from JavaThread to G1BarrierSet
pliden
parents:
49488
diff
changeset
|
42 |
static SATBMarkQueueSet _satb_mark_queue_set; |
c3a10df652c0
8201316: Move G1-related static members from JavaThread to G1BarrierSet
pliden
parents:
49488
diff
changeset
|
43 |
static DirtyCardQueueSet _dirty_card_queue_set; |
28830 | 44 |
|
49347
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
45 |
public: |
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
46 |
G1BarrierSet(G1CardTable* table); |
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
47 |
~G1BarrierSet() { } |
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
48 |
|
1374 | 49 |
// Add "pre_val" to a set of objects that may have been disconnected from the |
50 |
// pre-marking object graph. |
|
51 |
static void enqueue(oop pre_val); |
|
52 |
||
48784
899b522ed65c
8194741: Refactor oops in constant pool from CDS to use the Access API
eosterlund
parents:
47998
diff
changeset
|
53 |
static void enqueue_if_weak_or_archive(DecoratorSet decorators, oop value); |
1374 | 54 |
|
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
55 |
template <class T> void write_ref_array_pre_work(T* dst, size_t count); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
56 |
virtual void write_ref_array_pre(oop* dst, size_t count, bool dest_uninitialized); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
57 |
virtual void write_ref_array_pre(narrowOop* dst, size_t count, bool dest_uninitialized); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
58 |
|
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
59 |
static void write_ref_array_pre_oop_entry(oop* dst, size_t length); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
60 |
static void write_ref_array_pre_narrow_oop_entry(narrowOop* dst, size_t length); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
61 |
static void write_ref_array_post_entry(HeapWord* dst, size_t length); |
20309 | 62 |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
63 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
64 |
void write_ref_field_pre(T* field); |
26160 | 65 |
|
1374 | 66 |
// NB: if you do a whole-heap invalidation, the "usual invariant" defined |
67 |
// above no longer applies. |
|
42598
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
35862
diff
changeset
|
68 |
void invalidate(MemRegion mr); |
1374 | 69 |
|
48961
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48784
diff
changeset
|
70 |
void write_region(MemRegion mr) { invalidate(mr); } |
1374 | 71 |
void write_ref_array_work(MemRegion mr) { invalidate(mr); } |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
72 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
73 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
74 |
void write_ref_field_post(T* field, oop new_val); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
75 |
void write_ref_field_post_slow(volatile jbyte* byte); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
76 |
|
49752
93d84f667d12
8201318: Introduce GCThreadLocalData to abstract GC-specific data belonging to a thread
pliden
parents:
49751
diff
changeset
|
77 |
virtual void on_thread_create(Thread* thread); |
93d84f667d12
8201318: Introduce GCThreadLocalData to abstract GC-specific data belonging to a thread
pliden
parents:
49751
diff
changeset
|
78 |
virtual void on_thread_destroy(Thread* thread); |
49007
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
79 |
virtual void on_thread_attach(JavaThread* thread); |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
80 |
virtual void on_thread_detach(JavaThread* thread); |
48961
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48784
diff
changeset
|
81 |
|
49751
c3a10df652c0
8201316: Move G1-related static members from JavaThread to G1BarrierSet
pliden
parents:
49488
diff
changeset
|
82 |
static SATBMarkQueueSet& satb_mark_queue_set() { |
c3a10df652c0
8201316: Move G1-related static members from JavaThread to G1BarrierSet
pliden
parents:
49488
diff
changeset
|
83 |
return _satb_mark_queue_set; |
c3a10df652c0
8201316: Move G1-related static members from JavaThread to G1BarrierSet
pliden
parents:
49488
diff
changeset
|
84 |
} |
c3a10df652c0
8201316: Move G1-related static members from JavaThread to G1BarrierSet
pliden
parents:
49488
diff
changeset
|
85 |
|
c3a10df652c0
8201316: Move G1-related static members from JavaThread to G1BarrierSet
pliden
parents:
49488
diff
changeset
|
86 |
static DirtyCardQueueSet& dirty_card_queue_set() { |
c3a10df652c0
8201316: Move G1-related static members from JavaThread to G1BarrierSet
pliden
parents:
49488
diff
changeset
|
87 |
return _dirty_card_queue_set; |
c3a10df652c0
8201316: Move G1-related static members from JavaThread to G1BarrierSet
pliden
parents:
49488
diff
changeset
|
88 |
} |
c3a10df652c0
8201316: Move G1-related static members from JavaThread to G1BarrierSet
pliden
parents:
49488
diff
changeset
|
89 |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
90 |
// Callbacks for runtime accesses. |
49347
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
91 |
template <DecoratorSet decorators, typename BarrierSetT = G1BarrierSet> |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
92 |
class AccessBarrier: public ModRefBarrierSet::AccessBarrier<decorators, BarrierSetT> { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
93 |
typedef ModRefBarrierSet::AccessBarrier<decorators, BarrierSetT> ModRef; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
94 |
typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
95 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
96 |
public: |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
97 |
// Needed for loads on non-heap weak references |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
98 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
99 |
static oop oop_load_not_in_heap(T* addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
100 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
101 |
// Needed for non-heap stores |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
102 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
103 |
static void oop_store_not_in_heap(T* addr, oop new_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
104 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
105 |
// Needed for weak references |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
106 |
static oop oop_load_in_heap_at(oop base, ptrdiff_t offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
107 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
108 |
// Defensive: will catch weak oops at addresses in heap |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
109 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
110 |
static oop oop_load_in_heap(T* addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
111 |
}; |
1374 | 112 |
}; |
113 |
||
29325 | 114 |
template<> |
49347
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
115 |
struct BarrierSet::GetName<G1BarrierSet> { |
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
116 |
static const BarrierSet::Name value = BarrierSet::G1BarrierSet; |
29325 | 117 |
}; |
118 |
||
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
119 |
template<> |
49347
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
120 |
struct BarrierSet::GetType<BarrierSet::G1BarrierSet> { |
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
121 |
typedef ::G1BarrierSet type; |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
122 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
123 |
|
49347
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
124 |
#endif // SHARE_VM_GC_G1_G1BARRIERSET_HPP |