author | stefank |
Thu, 22 Feb 2018 18:36:32 +0100 | |
changeset 49048 | 4e8c86b75428 |
parent 48961 | 120b61d50f85 |
child 49164 | 7e958a8ebcd3 |
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: |
|
29325 | 35 |
ModRefBarrierSet(const BarrierSet::FakeRtti& fake_rtti) |
36 |
: BarrierSet(fake_rtti.add_tag(BarrierSet::ModRef)) { } |
|
28830 | 37 |
~ModRefBarrierSet() { } |
38 |
||
1 | 39 |
public: |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
40 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
41 |
inline void write_ref_field_pre(T* addr) {} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
42 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
43 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
44 |
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
|
45 |
|
42598
45562c0473fb
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
lmesnik
parents:
32612
diff
changeset
|
46 |
// 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
|
47 |
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
|
48 |
virtual void write_region(MemRegion mr) = 0; |
1 | 49 |
|
50 |
// The caller guarantees that "mr" contains no references. (Perhaps it's |
|
51 |
// objects have been moved elsewhere.) |
|
52 |
virtual void clear(MemRegion mr) = 0; |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
53 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
54 |
// The ModRef abstraction introduces pre and post barriers |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
55 |
template <DecoratorSet decorators, typename BarrierSetT> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
56 |
class AccessBarrier: public BarrierSet::AccessBarrier<decorators, BarrierSetT> { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
57 |
typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
58 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
59 |
public: |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
60 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
61 |
static void oop_store_in_heap(T* addr, oop value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
62 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
63 |
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
|
64 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
65 |
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
|
66 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
67 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
68 |
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
|
69 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
70 |
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
|
71 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
72 |
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
|
73 |
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
|
74 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
75 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
76 |
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
|
77 |
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
|
78 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
79 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
80 |
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
|
81 |
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
|
82 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
83 |
}; |
1 | 84 |
}; |
7397 | 85 |
|
29325 | 86 |
template<> |
87 |
struct BarrierSet::GetName<ModRefBarrierSet> { |
|
88 |
static const BarrierSet::Name value = BarrierSet::ModRef; |
|
89 |
}; |
|
90 |
||
30764 | 91 |
#endif // SHARE_VM_GC_SHARED_MODREFBARRIERSET_HPP |