author | eosterlund |
Wed, 21 Mar 2018 14:38:32 +0100 | |
changeset 49484 | ee8fa73b90f9 |
parent 49164 | 7e958a8ebcd3 |
child 49906 | 4bb58f644e4e |
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, |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
36 |
const BarrierSet::FakeRtti& fake_rtti) |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
37 |
: BarrierSet(barrier_set_assembler, |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
38 |
fake_rtti.add_tag(BarrierSet::ModRef)) { } |
28830 | 39 |
~ModRefBarrierSet() { } |
40 |
||
1 | 41 |
public: |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
42 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
43 |
inline void write_ref_field_pre(T* addr) {} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
44 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
45 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
46 |
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
|
47 |
|
42598
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
32612
diff
changeset
|
48 |
// 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
|
49 |
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
|
50 |
virtual void write_region(MemRegion mr) = 0; |
1 | 51 |
|
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
52 |
// 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
|
53 |
// optimized by some barriers. |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
54 |
|
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
55 |
// Below length is the # array elements being written |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
56 |
virtual void write_ref_array_pre(oop* dst, size_t length, |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
57 |
bool dest_uninitialized = false) {} |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
58 |
virtual void write_ref_array_pre(narrowOop* 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 |
// Below count is the # array elements being written, starting |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
61 |
// at the address "start", which may not necessarily be HeapWord-aligned |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
62 |
inline void write_ref_array(HeapWord* start, size_t count); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
63 |
|
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
64 |
protected: |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
65 |
virtual void write_ref_array_work(MemRegion mr) = 0; |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
66 |
|
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49164
diff
changeset
|
67 |
public: |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
68 |
// The ModRef abstraction introduces pre and post barriers |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
69 |
template <DecoratorSet decorators, typename BarrierSetT> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
70 |
class AccessBarrier: public BarrierSet::AccessBarrier<decorators, BarrierSetT> { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
71 |
typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
72 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
73 |
public: |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
74 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
75 |
static void oop_store_in_heap(T* addr, oop value); |
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 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
|
78 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
79 |
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
|
80 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
81 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
82 |
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
|
83 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
84 |
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
|
85 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
86 |
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
|
87 |
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
|
88 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
89 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
90 |
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
|
91 |
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
|
92 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
93 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
94 |
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
|
95 |
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
|
96 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
97 |
}; |
1 | 98 |
}; |
7397 | 99 |
|
29325 | 100 |
template<> |
101 |
struct BarrierSet::GetName<ModRefBarrierSet> { |
|
102 |
static const BarrierSet::Name value = BarrierSet::ModRef; |
|
103 |
}; |
|
104 |
||
30764 | 105 |
#endif // SHARE_VM_GC_SHARED_MODREFBARRIERSET_HPP |