author | rkennke |
Thu, 05 Jul 2018 19:22:38 +0200 | |
changeset 50940 | 3009952d5985 |
parent 50599 | ecc2af326b5f |
child 52070 | e4d72440d60e |
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" |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49383
diff
changeset
|
34 |
#include "utilities/macros.hpp" |
7397 | 35 |
|
49906 | 36 |
class BarrierSetAssembler; |
37 |
class BarrierSetC1; |
|
50180 | 38 |
class BarrierSetC2; |
48961
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48628
diff
changeset
|
39 |
class JavaThread; |
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48628
diff
changeset
|
40 |
|
1 | 41 |
// This class provides the interface between a barrier implementation and |
42 |
// the rest of the system. |
|
43 |
||
13195 | 44 |
class BarrierSet: public CHeapObj<mtGC> { |
1 | 45 |
friend class VMStructs; |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
46 |
|
49752
93d84f667d12
8201318: Introduce GCThreadLocalData to abstract GC-specific data belonging to a thread
pliden
parents:
49658
diff
changeset
|
47 |
static BarrierSet* _barrier_set; |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
48 |
|
1 | 49 |
public: |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
50 |
enum Name { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
51 |
#define BARRIER_SET_DECLARE_BS_ENUM(bs_name) bs_name , |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
52 |
FOR_EACH_BARRIER_SET_DO(BARRIER_SET_DECLARE_BS_ENUM) |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
53 |
#undef BARRIER_SET_DECLARE_BS_ENUM |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
54 |
UnknownBS |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
55 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
56 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
57 |
protected: |
29325 | 58 |
// Fake RTTI support. For a derived class T to participate |
59 |
// - T must have a corresponding Name entry. |
|
60 |
// - GetName<T> must be specialized to return the corresponding Name |
|
61 |
// entry. |
|
62 |
// - If T is a base class, the constructor must have a FakeRtti |
|
63 |
// parameter and pass it up to its base class, with the tag set |
|
64 |
// augmented with the corresponding Name entry. |
|
65 |
// - If T is a concrete class, the constructor must create a |
|
66 |
// FakeRtti object whose tag set includes the corresponding Name |
|
67 |
// entry, and pass it up to its base class. |
|
68 |
typedef FakeRttiSupport<BarrierSet, Name> FakeRtti; |
|
69 |
||
70 |
private: |
|
71 |
FakeRtti _fake_rtti; |
|
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49383
diff
changeset
|
72 |
BarrierSetAssembler* _barrier_set_assembler; |
49906 | 73 |
BarrierSetC1* _barrier_set_c1; |
50180 | 74 |
BarrierSetC2* _barrier_set_c2; |
29325 | 75 |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
76 |
public: |
29325 | 77 |
// Metafunction mapping a class derived from BarrierSet to the |
78 |
// corresponding Name enum tag. |
|
79 |
template<typename T> struct GetName; |
|
80 |
||
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
81 |
// Metafunction mapping a Name enum type to the corresponding |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
82 |
// lass derived from BarrierSet. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
83 |
template<BarrierSet::Name T> struct GetType; |
29325 | 84 |
|
85 |
// Note: This is not presently the Name corresponding to the |
|
86 |
// concrete class of this object. |
|
87 |
BarrierSet::Name kind() const { return _fake_rtti.concrete_tag(); } |
|
88 |
||
89 |
// Test whether this object is of the type corresponding to bsn. |
|
90 |
bool is_a(BarrierSet::Name bsn) const { return _fake_rtti.has_tag(bsn); } |
|
91 |
||
92 |
// End of fake RTTI support. |
|
93 |
||
1 | 94 |
protected: |
49906 | 95 |
BarrierSet(BarrierSetAssembler* barrier_set_assembler, |
96 |
BarrierSetC1* barrier_set_c1, |
|
50180 | 97 |
BarrierSetC2* barrier_set_c2, |
49906 | 98 |
const FakeRtti& fake_rtti) : |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49383
diff
changeset
|
99 |
_fake_rtti(fake_rtti), |
49906 | 100 |
_barrier_set_assembler(barrier_set_assembler), |
50180 | 101 |
_barrier_set_c1(barrier_set_c1), |
102 |
_barrier_set_c2(barrier_set_c2) {} |
|
28830 | 103 |
~BarrierSet() { } |
104 |
||
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49383
diff
changeset
|
105 |
template <class BarrierSetAssemblerT> |
50521 | 106 |
static BarrierSetAssembler* make_barrier_set_assembler() { |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49383
diff
changeset
|
107 |
return NOT_ZERO(new BarrierSetAssemblerT()) ZERO_ONLY(NULL); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49383
diff
changeset
|
108 |
} |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49383
diff
changeset
|
109 |
|
49906 | 110 |
template <class BarrierSetC1T> |
50521 | 111 |
static BarrierSetC1* make_barrier_set_c1() { |
49906 | 112 |
return COMPILER1_PRESENT(new BarrierSetC1T()) NOT_COMPILER1(NULL); |
113 |
} |
|
114 |
||
50180 | 115 |
template <class BarrierSetC2T> |
50521 | 116 |
static BarrierSetC2* make_barrier_set_c2() { |
50180 | 117 |
return COMPILER2_PRESENT(new BarrierSetC2T()) NOT_COMPILER2(NULL); |
118 |
} |
|
119 |
||
1 | 120 |
public: |
48961
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48628
diff
changeset
|
121 |
// 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
|
122 |
// 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
|
123 |
// 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
|
124 |
// 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
|
125 |
// to be in old. |
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48628
diff
changeset
|
126 |
virtual void on_slowpath_allocation_exit(JavaThread* thread, oop new_obj) {} |
49752
93d84f667d12
8201318: Introduce GCThreadLocalData to abstract GC-specific data belonging to a thread
pliden
parents:
49658
diff
changeset
|
127 |
virtual void on_thread_create(Thread* thread) {} |
93d84f667d12
8201318: Introduce GCThreadLocalData to abstract GC-specific data belonging to a thread
pliden
parents:
49658
diff
changeset
|
128 |
virtual void on_thread_destroy(Thread* thread) {} |
49007
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
129 |
virtual void on_thread_attach(JavaThread* thread) {} |
82d9d5744e5f
8197994: Move JavaThread::initialize_queues() logic to G1SATBCardTableLoggingModRefBS
pliden
parents:
48961
diff
changeset
|
130 |
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
|
131 |
virtual void make_parsable(JavaThread* thread) {} |
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48628
diff
changeset
|
132 |
|
1 | 133 |
public: |
12268 | 134 |
// Print a description of the memory for the barrier set |
135 |
virtual void print_on(outputStream* st) const = 0; |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
136 |
|
49752
93d84f667d12
8201318: Introduce GCThreadLocalData to abstract GC-specific data belonging to a thread
pliden
parents:
49658
diff
changeset
|
137 |
static BarrierSet* barrier_set() { return _barrier_set; } |
93d84f667d12
8201318: Introduce GCThreadLocalData to abstract GC-specific data belonging to a thread
pliden
parents:
49658
diff
changeset
|
138 |
static void set_barrier_set(BarrierSet* barrier_set); |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
139 |
|
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49383
diff
changeset
|
140 |
BarrierSetAssembler* barrier_set_assembler() { |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49383
diff
changeset
|
141 |
assert(_barrier_set_assembler != NULL, "should be set"); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49383
diff
changeset
|
142 |
return _barrier_set_assembler; |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49383
diff
changeset
|
143 |
} |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49383
diff
changeset
|
144 |
|
49906 | 145 |
BarrierSetC1* barrier_set_c1() { |
146 |
assert(_barrier_set_c1 != NULL, "should be set"); |
|
147 |
return _barrier_set_c1; |
|
148 |
} |
|
149 |
||
50180 | 150 |
BarrierSetC2* barrier_set_c2() { |
151 |
assert(_barrier_set_c2 != NULL, "should be set"); |
|
152 |
return _barrier_set_c2; |
|
153 |
} |
|
154 |
||
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
155 |
// 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
|
156 |
// (cf. oops/access.hpp) to perform decorated accesses. GC implementations |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
157 |
// may override these default access operations by declaring an |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
158 |
// AccessBarrier class in its BarrierSet. Its accessors will then be |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
159 |
// automatically resolved at runtime. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
160 |
// |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
161 |
// 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
|
162 |
// the following steps should be taken: |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
163 |
// 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
|
164 |
// 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
|
165 |
// 3) Provide specializations for BarrierSet::GetName and BarrierSet::GetType. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
166 |
template <DecoratorSet decorators, typename BarrierSetT> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
167 |
class AccessBarrier: protected RawAccessBarrier<decorators> { |
48628
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
168 |
private: |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
169 |
typedef RawAccessBarrier<decorators> Raw; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
170 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
171 |
public: |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
172 |
// Primitive heap accesses. These accessors get resolved when |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
173 |
// 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
|
174 |
// 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
|
175 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
176 |
static T load_in_heap(T* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
177 |
return Raw::template load<T>(addr); |
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 load_in_heap_at(oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
182 |
return Raw::template load_at<T>(base, offset); |
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 void store_in_heap(T* addr, T value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
187 |
Raw::store(addr, 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 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
|
192 |
Raw::store_at(base, offset, value); |
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_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
|
197 |
return Raw::atomic_cmpxchg(new_value, addr, compare_value); |
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 T atomic_cmpxchg_in_heap_at(T new_value, oop base, ptrdiff_t offset, T compare_value) { |
50940
3009952d5985
8206407: Primitive atomic_cmpxchg_in_heap_at() in BarrierSet::Access needs to call non-oop raw method
rkennke
parents:
50599
diff
changeset
|
202 |
return Raw::atomic_cmpxchg_at(new_value, base, offset, compare_value); |
47998
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 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
206 |
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
|
207 |
return Raw::atomic_xchg(new_value, addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
208 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
209 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
210 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
211 |
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
|
212 |
return Raw::atomic_xchg_at(new_value, base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
213 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
214 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
215 |
template <typename T> |
50389
7e8c0409a747
8198285: More consistent Access API for arraycopy
rkennke
parents:
50180
diff
changeset
|
216 |
static void arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw, |
7e8c0409a747
8198285: More consistent Access API for arraycopy
rkennke
parents:
50180
diff
changeset
|
217 |
arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw, |
7e8c0409a747
8198285: More consistent Access API for arraycopy
rkennke
parents:
50180
diff
changeset
|
218 |
size_t length) { |
7e8c0409a747
8198285: More consistent Access API for arraycopy
rkennke
parents:
50180
diff
changeset
|
219 |
Raw::arraycopy(src_obj, src_offset_in_bytes, src_raw, |
7e8c0409a747
8198285: More consistent Access API for arraycopy
rkennke
parents:
50180
diff
changeset
|
220 |
dst_obj, dst_offset_in_bytes, dst_raw, |
7e8c0409a747
8198285: More consistent Access API for arraycopy
rkennke
parents:
50180
diff
changeset
|
221 |
length); |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
222 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
223 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
224 |
// Heap oop accesses. These accessors get resolved when |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
225 |
// 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
|
226 |
// an oop_* overload, and the barrier strength is AS_NORMAL. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
227 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
228 |
static oop oop_load_in_heap(T* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
229 |
return Raw::template oop_load<oop>(addr); |
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 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
232 |
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
|
233 |
return Raw::template oop_load_at<oop>(base, offset); |
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 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
236 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
237 |
static void oop_store_in_heap(T* addr, oop value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
238 |
Raw::oop_store(addr, value); |
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 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
241 |
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
|
242 |
Raw::oop_store_at(base, offset, value); |
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 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
245 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
246 |
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
|
247 |
return Raw::oop_atomic_cmpxchg(new_value, addr, compare_value); |
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 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
250 |
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
|
251 |
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
|
252 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
253 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
254 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
255 |
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
|
256 |
return Raw::oop_atomic_xchg(new_value, addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
257 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
258 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
259 |
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
|
260 |
return Raw::oop_atomic_xchg_at(new_value, base, offset); |
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 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
263 |
template <typename T> |
50389
7e8c0409a747
8198285: More consistent Access API for arraycopy
rkennke
parents:
50180
diff
changeset
|
264 |
static bool oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw, |
7e8c0409a747
8198285: More consistent Access API for arraycopy
rkennke
parents:
50180
diff
changeset
|
265 |
arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw, |
7e8c0409a747
8198285: More consistent Access API for arraycopy
rkennke
parents:
50180
diff
changeset
|
266 |
size_t length) { |
7e8c0409a747
8198285: More consistent Access API for arraycopy
rkennke
parents:
50180
diff
changeset
|
267 |
return Raw::oop_arraycopy(src_obj, src_offset_in_bytes, src_raw, |
7e8c0409a747
8198285: More consistent Access API for arraycopy
rkennke
parents:
50180
diff
changeset
|
268 |
dst_obj, dst_offset_in_bytes, dst_raw, |
7e8c0409a747
8198285: More consistent Access API for arraycopy
rkennke
parents:
50180
diff
changeset
|
269 |
length); |
47998
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 |
// Off-heap oop accesses. These accessors get resolved when |
50599
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50521
diff
changeset
|
273 |
// IN_HEAP is not set (e.g. when using the NativeAccess API), it is |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
274 |
// an oop* overload, and the barrier strength is AS_NORMAL. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
275 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
276 |
static oop oop_load_not_in_heap(T* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
277 |
return Raw::template oop_load<oop>(addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
278 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
279 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
280 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
281 |
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
|
282 |
Raw::oop_store(addr, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
283 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
284 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
285 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
286 |
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
|
287 |
return Raw::oop_atomic_cmpxchg(new_value, addr, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
288 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
289 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
290 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
291 |
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
|
292 |
return Raw::oop_atomic_xchg(new_value, addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
293 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
294 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
295 |
// Clone barrier support |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
296 |
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
|
297 |
Raw::clone(src, dst, size); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
298 |
} |
49041
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
49007
diff
changeset
|
299 |
|
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
49007
diff
changeset
|
300 |
static oop resolve(oop obj) { |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
49007
diff
changeset
|
301 |
return Raw::resolve(obj); |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
49007
diff
changeset
|
302 |
} |
49658 | 303 |
|
304 |
static bool equals(oop o1, oop o2) { |
|
305 |
return Raw::equals(o1, o2); |
|
306 |
} |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47794
diff
changeset
|
307 |
}; |
1 | 308 |
}; |
7397 | 309 |
|
29331
b788134d664a
8074319: barrier_set_cast defined via friend injection
jwilhelm
parents:
29325
diff
changeset
|
310 |
template<typename T> |
b788134d664a
8074319: barrier_set_cast defined via friend injection
jwilhelm
parents:
29325
diff
changeset
|
311 |
inline T* barrier_set_cast(BarrierSet* bs) { |
b788134d664a
8074319: barrier_set_cast defined via friend injection
jwilhelm
parents:
29325
diff
changeset
|
312 |
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
|
313 |
return static_cast<T*>(bs); |
b788134d664a
8074319: barrier_set_cast defined via friend injection
jwilhelm
parents:
29325
diff
changeset
|
314 |
} |
b788134d664a
8074319: barrier_set_cast defined via friend injection
jwilhelm
parents:
29325
diff
changeset
|
315 |
|
30764 | 316 |
#endif // SHARE_VM_GC_SHARED_BARRIERSET_HPP |