author | stefank |
Thu, 22 Feb 2018 18:36:07 +0100 | |
changeset 49047 | 8f004146e407 |
parent 49041 | 44122f767467 |
child 49164 | 7e958a8ebcd3 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
48628
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
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:
4886
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4886
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:
4886
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
30764 | 25 |
#ifndef SHARE_VM_GC_SHARED_BARRIERSET_HPP |
26 |
#define SHARE_VM_GC_SHARED_BARRIERSET_HPP |
|
7397 | 27 |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
28 |
#include "gc/shared/barrierSetConfig.hpp" |
7397 | 29 |
#include "memory/memRegion.hpp" |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
30 |
#include "oops/access.hpp" |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
31 |
#include "oops/accessBackend.hpp" |
7397 | 32 |
#include "oops/oopsHierarchy.hpp" |
29325 | 33 |
#include "utilities/fakeRttiSupport.hpp" |
7397 | 34 |
|
48961
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48628
diff
changeset
|
35 |
class JavaThread; |
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48628
diff
changeset
|
36 |
|
1 | 37 |
// This class provides the interface between a barrier implementation and |
38 |
// the rest of the system. |
|
39 |
||
13195 | 40 |
class BarrierSet: public CHeapObj<mtGC> { |
1 | 41 |
friend class VMStructs; |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
42 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
43 |
static BarrierSet* _bs; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
44 |
|
1 | 45 |
public: |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
46 |
enum Name { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
47 |
#define BARRIER_SET_DECLARE_BS_ENUM(bs_name) bs_name , |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
48 |
FOR_EACH_BARRIER_SET_DO(BARRIER_SET_DECLARE_BS_ENUM) |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
49 |
#undef BARRIER_SET_DECLARE_BS_ENUM |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
50 |
UnknownBS |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
51 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
52 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
53 |
static BarrierSet* barrier_set() { return _bs; } |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
54 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
55 |
protected: |
29325 | 56 |
// Fake RTTI support. For a derived class T to participate |
57 |
// - T must have a corresponding Name entry. |
|
58 |
// - GetName<T> must be specialized to return the corresponding Name |
|
59 |
// entry. |
|
60 |
// - If T is a base class, the constructor must have a FakeRtti |
|
61 |
// parameter and pass it up to its base class, with the tag set |
|
62 |
// augmented with the corresponding Name entry. |
|
63 |
// - If T is a concrete class, the constructor must create a |
|
64 |
// FakeRtti object whose tag set includes the corresponding Name |
|
65 |
// entry, and pass it up to its base class. |
|
66 |
typedef FakeRttiSupport<BarrierSet, Name> FakeRtti; |
|
67 |
||
68 |
private: |
|
69 |
FakeRtti _fake_rtti; |
|
70 |
||
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
71 |
public: |
29325 | 72 |
// Metafunction mapping a class derived from BarrierSet to the |
73 |
// corresponding Name enum tag. |
|
74 |
template<typename T> struct GetName; |
|
75 |
||
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
76 |
// Metafunction mapping a Name enum type to the corresponding |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
77 |
// lass derived from BarrierSet. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
78 |
template<BarrierSet::Name T> struct GetType; |
29325 | 79 |
|
80 |
// Note: This is not presently the Name corresponding to the |
|
81 |
// concrete class of this object. |
|
82 |
BarrierSet::Name kind() const { return _fake_rtti.concrete_tag(); } |
|
83 |
||
84 |
// Test whether this object is of the type corresponding to bsn. |
|
85 |
bool is_a(BarrierSet::Name bsn) const { return _fake_rtti.has_tag(bsn); } |
|
86 |
||
87 |
// End of fake RTTI support. |
|
88 |
||
1 | 89 |
protected: |
29325 | 90 |
BarrierSet(const FakeRtti& fake_rtti) : _fake_rtti(fake_rtti) { } |
28830 | 91 |
~BarrierSet() { } |
92 |
||
1 | 93 |
public: |
94 |
// Operations on arrays, or general regions (e.g., for "clone") may be |
|
95 |
// optimized by some barriers. |
|
96 |
||
4461
c17c526d36ef
6906727: UseCompressedOops: some card-marking fixes related to object arrays
ysr
parents:
3262
diff
changeset
|
97 |
// Below length is the # array elements being written |
8498 | 98 |
virtual void write_ref_array_pre(oop* dst, int length, |
99 |
bool dest_uninitialized = false) {} |
|
100 |
virtual void write_ref_array_pre(narrowOop* dst, int length, |
|
101 |
bool dest_uninitialized = false) {} |
|
4461
c17c526d36ef
6906727: UseCompressedOops: some card-marking fixes related to object arrays
ysr
parents:
3262
diff
changeset
|
102 |
// Below count is the # array elements being written, starting |
c17c526d36ef
6906727: UseCompressedOops: some card-marking fixes related to object arrays
ysr
parents:
3262
diff
changeset
|
103 |
// at the address "start", which may not necessarily be HeapWord-aligned |
c17c526d36ef
6906727: UseCompressedOops: some card-marking fixes related to object arrays
ysr
parents:
3262
diff
changeset
|
104 |
inline void write_ref_array(HeapWord* start, size_t count); |
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
105 |
|
4461
c17c526d36ef
6906727: UseCompressedOops: some card-marking fixes related to object arrays
ysr
parents:
3262
diff
changeset
|
106 |
// Static versions, suitable for calling from generated code; |
c17c526d36ef
6906727: UseCompressedOops: some card-marking fixes related to object arrays
ysr
parents:
3262
diff
changeset
|
107 |
// count is # array elements being written, starting with "start", |
c17c526d36ef
6906727: UseCompressedOops: some card-marking fixes related to object arrays
ysr
parents:
3262
diff
changeset
|
108 |
// which may not necessarily be HeapWord-aligned. |
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
109 |
static void static_write_ref_array_pre(HeapWord* start, size_t count); |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
110 |
static void static_write_ref_array_post(HeapWord* start, size_t count); |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
111 |
|
48961
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48628
diff
changeset
|
112 |
// Support for optimizing compilers to call the barrier set on slow path allocations |
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48628
diff
changeset
|
113 |
// that did not enter a TLAB. Used for e.g. ReduceInitialCardMarks. |
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48628
diff
changeset
|
114 |
// The allocation is safe to use iff it returns true. If not, the slow-path allocation |
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48628
diff
changeset
|
115 |
// is redone until it succeeds. This can e.g. prevent allocations from the slow path |
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48628
diff
changeset
|
116 |
// to be in old. |
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48628
diff
changeset
|
117 |
virtual void on_slowpath_allocation_exit(JavaThread* thread, oop new_obj) {} |
49007
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
118 |
virtual void on_thread_attach(JavaThread* thread) {} |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
119 |
virtual void on_thread_detach(JavaThread* thread) {} |
48961
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48628
diff
changeset
|
120 |
virtual void make_parsable(JavaThread* thread) {} |
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48628
diff
changeset
|
121 |
|
1 | 122 |
protected: |
123 |
virtual void write_ref_array_work(MemRegion mr) = 0; |
|
47658
c2b7fb8e5144
8189355: Cleanup of BarrierSet barrier functions
eosterlund
parents:
47216
diff
changeset
|
124 |
|
1 | 125 |
public: |
126 |
// Inform the BarrierSet that the the covered heap region that starts |
|
127 |
// with "base" has been changed to have the given size (possibly from 0, |
|
128 |
// for initialization.) |
|
129 |
virtual void resize_covered_region(MemRegion new_region) = 0; |
|
130 |
||
131 |
// If the barrier set imposes any alignment restrictions on boundaries |
|
132 |
// within the heap, this function tells whether they are met. |
|
133 |
virtual bool is_aligned(HeapWord* addr) = 0; |
|
134 |
||
12268 | 135 |
// Print a description of the memory for the barrier set |
136 |
virtual void print_on(outputStream* st) const = 0; |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
137 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
138 |
static void set_bs(BarrierSet* bs) { _bs = bs; } |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
139 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
140 |
// The AccessBarrier of a BarrierSet subclass is called by the Access API |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
141 |
// (cf. oops/access.hpp) to perform decorated accesses. GC implementations |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
142 |
// may override these default access operations by declaring an |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
143 |
// AccessBarrier class in its BarrierSet. Its accessors will then be |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
144 |
// automatically resolved at runtime. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
145 |
// |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
146 |
// In order to register a new FooBarrierSet::AccessBarrier with the Access API, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
147 |
// the following steps should be taken: |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
148 |
// 1) Provide an enum "name" for the BarrierSet in barrierSetConfig.hpp |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
149 |
// 2) Make sure the barrier set headers are included from barrierSetConfig.inline.hpp |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
150 |
// 3) Provide specializations for BarrierSet::GetName and BarrierSet::GetType. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
151 |
template <DecoratorSet decorators, typename BarrierSetT> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
152 |
class AccessBarrier: protected RawAccessBarrier<decorators> { |
48628
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
153 |
private: |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
154 |
typedef RawAccessBarrier<decorators> Raw; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
155 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
156 |
public: |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
157 |
// Primitive heap accesses. These accessors get resolved when |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
158 |
// IN_HEAP is set (e.g. when using the HeapAccess API), it is |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
159 |
// not an oop_* overload, and the barrier strength is AS_NORMAL. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
160 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
161 |
static T load_in_heap(T* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
162 |
return Raw::template load<T>(addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
163 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
164 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
165 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
166 |
static T load_in_heap_at(oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
167 |
return Raw::template load_at<T>(base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
168 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
169 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
170 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
171 |
static void store_in_heap(T* addr, T value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
172 |
Raw::store(addr, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
173 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
174 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
175 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
176 |
static void store_in_heap_at(oop base, ptrdiff_t offset, T value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
177 |
Raw::store_at(base, offset, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
178 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
179 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
180 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
181 |
static T atomic_cmpxchg_in_heap(T new_value, T* addr, T compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
182 |
return Raw::atomic_cmpxchg(new_value, addr, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
183 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
184 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
185 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
186 |
static T atomic_cmpxchg_in_heap_at(T new_value, oop base, ptrdiff_t offset, T compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
187 |
return Raw::oop_atomic_cmpxchg_at(new_value, base, offset, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
188 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
189 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
190 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
191 |
static T atomic_xchg_in_heap(T new_value, T* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
192 |
return Raw::atomic_xchg(new_value, addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
193 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
194 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
195 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
196 |
static T atomic_xchg_in_heap_at(T new_value, oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
197 |
return Raw::atomic_xchg_at(new_value, base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
198 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
199 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
200 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
201 |
static bool 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:
47794
diff
changeset
|
202 |
return Raw::arraycopy(src_obj, dst_obj, src, dst, length); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
203 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
204 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
205 |
// Heap oop accesses. These accessors get resolved when |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
206 |
// IN_HEAP is set (e.g. when using the HeapAccess API), it is |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
207 |
// an oop_* overload, and the barrier strength is AS_NORMAL. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
208 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
209 |
static oop oop_load_in_heap(T* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
210 |
return Raw::template oop_load<oop>(addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
211 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
212 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
213 |
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
|
214 |
return Raw::template oop_load_at<oop>(base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
215 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
216 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
217 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
218 |
static void oop_store_in_heap(T* addr, oop value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
219 |
Raw::oop_store(addr, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
220 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
221 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
222 |
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:
47794
diff
changeset
|
223 |
Raw::oop_store_at(base, offset, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
224 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
225 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
226 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
227 |
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:
47794
diff
changeset
|
228 |
return Raw::oop_atomic_cmpxchg(new_value, addr, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
229 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
230 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
231 |
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:
47794
diff
changeset
|
232 |
return Raw::oop_atomic_cmpxchg_at(new_value, base, offset, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
233 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
234 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
235 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
236 |
static oop oop_atomic_xchg_in_heap(oop new_value, T* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
237 |
return Raw::oop_atomic_xchg(new_value, addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
238 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
239 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
240 |
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:
47794
diff
changeset
|
241 |
return Raw::oop_atomic_xchg_at(new_value, base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
242 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
243 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
244 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
245 |
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:
47794
diff
changeset
|
246 |
return Raw::oop_arraycopy(src_obj, dst_obj, src, dst, length); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
247 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
248 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
249 |
// Off-heap oop accesses. These accessors get resolved when |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
250 |
// IN_HEAP is not set (e.g. when using the RootAccess API), it is |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
251 |
// an oop* overload, and the barrier strength is AS_NORMAL. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
252 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
253 |
static oop oop_load_not_in_heap(T* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
254 |
return Raw::template oop_load<oop>(addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
255 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
256 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
257 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
258 |
static void oop_store_not_in_heap(T* addr, oop value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
259 |
Raw::oop_store(addr, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
260 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
261 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
262 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
263 |
static oop oop_atomic_cmpxchg_not_in_heap(oop new_value, T* addr, oop compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
264 |
return Raw::oop_atomic_cmpxchg(new_value, addr, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
265 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
266 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
267 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
268 |
static oop oop_atomic_xchg_not_in_heap(oop new_value, T* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
269 |
return Raw::oop_atomic_xchg(new_value, addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
270 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
271 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
272 |
// Clone barrier support |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
273 |
static void clone_in_heap(oop src, oop dst, size_t size) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
274 |
Raw::clone(src, dst, size); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
275 |
} |
49041
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
49007
diff
changeset
|
276 |
|
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
49007
diff
changeset
|
277 |
static oop resolve(oop obj) { |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
49007
diff
changeset
|
278 |
return Raw::resolve(obj); |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
49007
diff
changeset
|
279 |
} |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
280 |
}; |
1 | 281 |
}; |
7397 | 282 |
|
29331
b788134d664a
8074319: barrier_set_cast defined via friend injection
jwilhelm
parents:
29325
diff
changeset
|
283 |
template<typename T> |
b788134d664a
8074319: barrier_set_cast defined via friend injection
jwilhelm
parents:
29325
diff
changeset
|
284 |
inline T* barrier_set_cast(BarrierSet* bs) { |
b788134d664a
8074319: barrier_set_cast defined via friend injection
jwilhelm
parents:
29325
diff
changeset
|
285 |
assert(bs->is_a(BarrierSet::GetName<T>::value), "wrong type of barrier set"); |
b788134d664a
8074319: barrier_set_cast defined via friend injection
jwilhelm
parents:
29325
diff
changeset
|
286 |
return static_cast<T*>(bs); |
b788134d664a
8074319: barrier_set_cast defined via friend injection
jwilhelm
parents:
29325
diff
changeset
|
287 |
} |
b788134d664a
8074319: barrier_set_cast defined via friend injection
jwilhelm
parents:
29325
diff
changeset
|
288 |
|
30764 | 289 |
#endif // SHARE_VM_GC_SHARED_BARRIERSET_HPP |