author | eosterlund |
Thu, 26 Apr 2018 20:42:43 +0200 | |
changeset 49906 | 4bb58f644e4e |
parent 49484 | ee8fa73b90f9 |
child 50180 | ffa644980dff |
permissions | -rw-r--r-- |
1 | 1 |
/* |
48961
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
47998
diff
changeset
|
2 |
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. |
1 | 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:
1388
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1388
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:
1388
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
30764 | 25 |
#ifndef SHARE_VM_GC_SHARED_MODREFBARRIERSET_HPP |
26 |
#define SHARE_VM_GC_SHARED_MODREFBARRIERSET_HPP |
|
7397 | 27 |
|
30764 | 28 |
#include "gc/shared/barrierSet.hpp" |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
29 |
#include "memory/memRegion.hpp" |
7397 | 30 |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
31 |
class Klass; |
1 | 32 |
|
33 |
class ModRefBarrierSet: public BarrierSet { |
|
34 |
protected: |
|
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
35 |
ModRefBarrierSet(BarrierSetAssembler* barrier_set_assembler, |
49906 | 36 |
BarrierSetC1* barrier_set_c1, |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
37 |
const BarrierSet::FakeRtti& fake_rtti) |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
38 |
: BarrierSet(barrier_set_assembler, |
49906 | 39 |
barrier_set_c1, |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
40 |
fake_rtti.add_tag(BarrierSet::ModRef)) { } |
28830 | 41 |
~ModRefBarrierSet() { } |
42 |
||
1 | 43 |
public: |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
44 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
45 |
inline void write_ref_field_pre(T* addr) {} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
46 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
47 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
48 |
inline void write_ref_field_post(T *addr, oop new_value) {} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
49 |
|
42598
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
32612
diff
changeset
|
50 |
// Causes all refs in "mr" to be assumed to be modified. |
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
32612
diff
changeset
|
51 |
virtual void invalidate(MemRegion mr) = 0; |
48961
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
47998
diff
changeset
|
52 |
virtual void write_region(MemRegion mr) = 0; |
1 | 53 |
|
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
54 |
// Operations on arrays, or general regions (e.g., for "clone") may be |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
55 |
// optimized by some barriers. |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
56 |
|
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
57 |
// Below length is the # array elements being written |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
58 |
virtual void write_ref_array_pre(oop* dst, size_t length, |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
59 |
bool dest_uninitialized = false) {} |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
60 |
virtual void write_ref_array_pre(narrowOop* dst, size_t length, |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
61 |
bool dest_uninitialized = false) {} |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
62 |
// Below count is the # array elements being written, starting |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
63 |
// at the address "start", which may not necessarily be HeapWord-aligned |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
64 |
inline void write_ref_array(HeapWord* start, size_t count); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
65 |
|
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
66 |
protected: |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
67 |
virtual void write_ref_array_work(MemRegion mr) = 0; |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
68 |
|
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
69 |
public: |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
70 |
// The ModRef abstraction introduces pre and post barriers |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
71 |
template <DecoratorSet decorators, typename BarrierSetT> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
72 |
class AccessBarrier: public BarrierSet::AccessBarrier<decorators, BarrierSetT> { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
73 |
typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
74 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
75 |
public: |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
76 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
77 |
static void oop_store_in_heap(T* addr, oop value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
78 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
79 |
static oop oop_atomic_cmpxchg_in_heap(oop new_value, T* addr, oop compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
80 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
81 |
static oop oop_atomic_xchg_in_heap(oop new_value, T* addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
82 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
83 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
84 |
static bool oop_arraycopy_in_heap(arrayOop src_obj, arrayOop dst_obj, T* src, T* dst, size_t length); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
85 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
86 |
static void clone_in_heap(oop src, oop dst, size_t size); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
87 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
88 |
static void oop_store_in_heap_at(oop base, ptrdiff_t offset, oop value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
89 |
oop_store_in_heap(AccessInternal::oop_field_addr<decorators>(base, offset), value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
90 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
91 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
92 |
static oop oop_atomic_xchg_in_heap_at(oop new_value, oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
93 |
return oop_atomic_xchg_in_heap(new_value, AccessInternal::oop_field_addr<decorators>(base, offset)); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
94 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
95 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
96 |
static oop oop_atomic_cmpxchg_in_heap_at(oop new_value, oop base, ptrdiff_t offset, oop compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
97 |
return oop_atomic_cmpxchg_in_heap(new_value, AccessInternal::oop_field_addr<decorators>(base, offset), compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
98 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
99 |
}; |
1 | 100 |
}; |
7397 | 101 |
|
29325 | 102 |
template<> |
103 |
struct BarrierSet::GetName<ModRefBarrierSet> { |
|
104 |
static const BarrierSet::Name value = BarrierSet::ModRef; |
|
105 |
}; |
|
106 |
||
30764 | 107 |
#endif // SHARE_VM_GC_SHARED_MODREFBARRIERSET_HPP |