author | iklam |
Thu, 26 Apr 2018 13:40:58 -0700 | |
changeset 50039 | 9fec54fe663d |
parent 49658 | 8237a91c1cca |
child 50389 | 7e8c0409a747 |
permissions | -rw-r--r-- |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1 |
/* |
48628
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
2 |
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
4 |
* |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
8 |
* |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
13 |
* accompanied this code). |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
14 |
* |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
18 |
* |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
21 |
* questions. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
22 |
* |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
23 |
*/ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
24 |
|
49658 | 25 |
#ifndef SHARE_OOPS_ACCESS_INLINE_HPP |
26 |
#define SHARE_OOPS_ACCESS_INLINE_HPP |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
27 |
|
49347
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49041
diff
changeset
|
28 |
#include "gc/shared/barrierSetConfig.inline.hpp" |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
29 |
#include "oops/access.hpp" |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
30 |
#include "oops/accessBackend.inline.hpp" |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
31 |
|
49658 | 32 |
// This file outlines the last 2 steps of the template pipeline of accesses going through |
33 |
// the Access API. |
|
34 |
// * Step 5.a: Barrier resolution. This step is invoked the first time a runtime-dispatch |
|
35 |
// happens for an access. The appropriate BarrierSet::AccessBarrier accessor |
|
36 |
// is resolved, then the function pointer is updated to that accessor for |
|
37 |
// future invocations. |
|
38 |
// * Step 5.b: Post-runtime dispatch. This step now casts previously unknown types such |
|
39 |
// as the address type of an oop on the heap (is it oop* or narrowOop*) to |
|
40 |
// the appropriate type. It also splits sufficiently orthogonal accesses into |
|
41 |
// different functions, such as whether the access involves oops or primitives |
|
42 |
// and whether the access is performed on the heap or outside. Then the |
|
43 |
// appropriate BarrierSet::AccessBarrier is called to perform the access. |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
44 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
45 |
namespace AccessInternal { |
49658 | 46 |
// Step 5.b: Post-runtime dispatch. |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
47 |
// This class is the last step before calling the BarrierSet::AccessBarrier. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
48 |
// Here we make sure to figure out types that were not known prior to the |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
49 |
// runtime dispatch, such as whether an oop on the heap is oop or narrowOop. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
50 |
// We also split orthogonal barriers such as handling primitives vs oops |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
51 |
// and on-heap vs off-heap into different calls to the barrier set. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
52 |
template <class GCBarrierType, BarrierType type, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
53 |
struct PostRuntimeDispatch: public AllStatic { }; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
54 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
55 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
56 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_STORE, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
57 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
58 |
static void access_barrier(void* addr, T value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
59 |
GCBarrierType::store_in_heap(reinterpret_cast<T*>(addr), value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
60 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
61 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
62 |
static void oop_access_barrier(void* addr, oop value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
63 |
typedef typename HeapOopType<decorators>::type OopType; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
64 |
if (HasDecorator<decorators, IN_HEAP>::value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
65 |
GCBarrierType::oop_store_in_heap(reinterpret_cast<OopType*>(addr), value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
66 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
67 |
GCBarrierType::oop_store_not_in_heap(reinterpret_cast<OopType*>(addr), value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
68 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
69 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
70 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
71 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
72 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
73 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_LOAD, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
74 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
75 |
static T access_barrier(void* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
76 |
return GCBarrierType::load_in_heap(reinterpret_cast<T*>(addr)); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
77 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
78 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
79 |
static oop oop_access_barrier(void* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
80 |
typedef typename HeapOopType<decorators>::type OopType; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
81 |
if (HasDecorator<decorators, IN_HEAP>::value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
82 |
return GCBarrierType::oop_load_in_heap(reinterpret_cast<OopType*>(addr)); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
83 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
84 |
return GCBarrierType::oop_load_not_in_heap(reinterpret_cast<OopType*>(addr)); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
85 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
86 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
87 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
88 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
89 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
90 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_XCHG, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
91 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
92 |
static T access_barrier(T new_value, void* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
93 |
return GCBarrierType::atomic_xchg_in_heap(new_value, reinterpret_cast<T*>(addr)); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
94 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
95 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
96 |
static oop oop_access_barrier(oop new_value, void* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
97 |
typedef typename HeapOopType<decorators>::type OopType; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
98 |
if (HasDecorator<decorators, IN_HEAP>::value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
99 |
return GCBarrierType::oop_atomic_xchg_in_heap(new_value, reinterpret_cast<OopType*>(addr)); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
100 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
101 |
return GCBarrierType::oop_atomic_xchg_not_in_heap(new_value, reinterpret_cast<OopType*>(addr)); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
102 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
103 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
104 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
105 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
106 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
107 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_CMPXCHG, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
108 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
109 |
static T access_barrier(T new_value, void* addr, T compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
110 |
return GCBarrierType::atomic_cmpxchg_in_heap(new_value, reinterpret_cast<T*>(addr), compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
111 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
112 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
113 |
static oop oop_access_barrier(oop new_value, void* addr, oop compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
114 |
typedef typename HeapOopType<decorators>::type OopType; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
115 |
if (HasDecorator<decorators, IN_HEAP>::value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
116 |
return GCBarrierType::oop_atomic_cmpxchg_in_heap(new_value, reinterpret_cast<OopType*>(addr), compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
117 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
118 |
return GCBarrierType::oop_atomic_cmpxchg_not_in_heap(new_value, reinterpret_cast<OopType*>(addr), compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
119 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
120 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
121 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
122 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
123 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
124 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_ARRAYCOPY, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
125 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
126 |
static bool access_barrier(arrayOop src_obj, arrayOop dst_obj, T* src, T* dst, size_t length) { |
49383
bf2ff45e592f
8198445: Access API for primitive/native arraycopy
rkennke
parents:
49347
diff
changeset
|
127 |
GCBarrierType::arraycopy_in_heap(src_obj, dst_obj, src, dst, length); |
bf2ff45e592f
8198445: Access API for primitive/native arraycopy
rkennke
parents:
49347
diff
changeset
|
128 |
return true; |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
129 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
130 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
131 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
132 |
static bool oop_access_barrier(arrayOop src_obj, arrayOop dst_obj, T* src, T* dst, size_t length) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
133 |
typedef typename HeapOopType<decorators>::type OopType; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
134 |
return GCBarrierType::oop_arraycopy_in_heap(src_obj, dst_obj, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
135 |
reinterpret_cast<OopType*>(src), |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
136 |
reinterpret_cast<OopType*>(dst), length); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
137 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
138 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
139 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
140 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
141 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_STORE_AT, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
142 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
143 |
static void access_barrier(oop base, ptrdiff_t offset, T value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
144 |
GCBarrierType::store_in_heap_at(base, offset, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
145 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
146 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
147 |
static void oop_access_barrier(oop base, ptrdiff_t offset, oop value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
148 |
GCBarrierType::oop_store_in_heap_at(base, offset, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
149 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
150 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
151 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
152 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
153 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_LOAD_AT, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
154 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
155 |
static T access_barrier(oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
156 |
return GCBarrierType::template load_in_heap_at<T>(base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
157 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
158 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
159 |
static oop oop_access_barrier(oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
160 |
return GCBarrierType::oop_load_in_heap_at(base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
161 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
162 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
163 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
164 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
165 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_XCHG_AT, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
166 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
167 |
static T access_barrier(T new_value, oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
168 |
return GCBarrierType::atomic_xchg_in_heap_at(new_value, base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
169 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
170 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
171 |
static oop oop_access_barrier(oop new_value, oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
172 |
return GCBarrierType::oop_atomic_xchg_in_heap_at(new_value, base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
173 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
174 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
175 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
176 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
177 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_CMPXCHG_AT, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
178 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
179 |
static T access_barrier(T new_value, oop base, ptrdiff_t offset, T compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
180 |
return GCBarrierType::atomic_cmpxchg_in_heap_at(new_value, base, offset, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
181 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
182 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
183 |
static oop oop_access_barrier(oop new_value, oop base, ptrdiff_t offset, oop compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
184 |
return GCBarrierType::oop_atomic_cmpxchg_in_heap_at(new_value, base, offset, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
185 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
186 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
187 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
188 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
189 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_CLONE, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
190 |
static void access_barrier(oop src, oop dst, size_t size) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
191 |
GCBarrierType::clone_in_heap(src, dst, size); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
192 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
193 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
194 |
|
49041
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
195 |
template <class GCBarrierType, DecoratorSet decorators> |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
196 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_RESOLVE, decorators>: public AllStatic { |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
197 |
static oop access_barrier(oop obj) { |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
198 |
return GCBarrierType::resolve(obj); |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
199 |
} |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
200 |
}; |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
201 |
|
49658 | 202 |
template <class GCBarrierType, DecoratorSet decorators> |
203 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_EQUALS, decorators>: public AllStatic { |
|
204 |
static bool access_barrier(oop o1, oop o2) { |
|
205 |
return GCBarrierType::equals(o1, o2); |
|
206 |
} |
|
207 |
}; |
|
208 |
||
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
209 |
// Resolving accessors with barriers from the barrier set happens in two steps. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
210 |
// 1. Expand paths with runtime-decorators, e.g. is UseCompressedOops on or off. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
211 |
// 2. Expand paths for each BarrierSet available in the system. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
212 |
template <DecoratorSet decorators, typename FunctionPointerT, BarrierType barrier_type> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
213 |
struct BarrierResolver: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
214 |
template <DecoratorSet ds> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
215 |
static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
216 |
HasDecorator<ds, INTERNAL_VALUE_IS_OOP>::value, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
217 |
FunctionPointerT>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
218 |
resolve_barrier_gc() { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
219 |
BarrierSet* bs = BarrierSet::barrier_set(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
220 |
assert(bs != NULL, "GC barriers invoked before BarrierSet is set"); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
221 |
switch (bs->kind()) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
222 |
#define BARRIER_SET_RESOLVE_BARRIER_CLOSURE(bs_name) \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
223 |
case BarrierSet::bs_name: { \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
224 |
return PostRuntimeDispatch<typename BarrierSet::GetType<BarrierSet::bs_name>::type:: \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
225 |
AccessBarrier<ds>, barrier_type, ds>::oop_access_barrier; \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
226 |
} \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
227 |
break; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
228 |
FOR_EACH_CONCRETE_BARRIER_SET_DO(BARRIER_SET_RESOLVE_BARRIER_CLOSURE) |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
229 |
#undef BARRIER_SET_RESOLVE_BARRIER_CLOSURE |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
230 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
231 |
default: |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
232 |
fatal("BarrierSet AccessBarrier resolving not implemented"); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
233 |
return NULL; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
234 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
235 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
236 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
237 |
template <DecoratorSet ds> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
238 |
static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
239 |
!HasDecorator<ds, INTERNAL_VALUE_IS_OOP>::value, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
240 |
FunctionPointerT>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
241 |
resolve_barrier_gc() { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
242 |
BarrierSet* bs = BarrierSet::barrier_set(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
243 |
assert(bs != NULL, "GC barriers invoked before BarrierSet is set"); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
244 |
switch (bs->kind()) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
245 |
#define BARRIER_SET_RESOLVE_BARRIER_CLOSURE(bs_name) \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
246 |
case BarrierSet::bs_name: { \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
247 |
return PostRuntimeDispatch<typename BarrierSet::GetType<BarrierSet::bs_name>::type:: \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
248 |
AccessBarrier<ds>, barrier_type, ds>::access_barrier; \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
249 |
} \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
250 |
break; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
251 |
FOR_EACH_CONCRETE_BARRIER_SET_DO(BARRIER_SET_RESOLVE_BARRIER_CLOSURE) |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
252 |
#undef BARRIER_SET_RESOLVE_BARRIER_CLOSURE |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
253 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
254 |
default: |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
255 |
fatal("BarrierSet AccessBarrier resolving not implemented"); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
256 |
return NULL; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
257 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
258 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
259 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
260 |
static FunctionPointerT resolve_barrier_rt() { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
261 |
if (UseCompressedOops) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
262 |
const DecoratorSet expanded_decorators = decorators | INTERNAL_RT_USE_COMPRESSED_OOPS; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
263 |
return resolve_barrier_gc<expanded_decorators>(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
264 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
265 |
return resolve_barrier_gc<decorators>(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
266 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
267 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
268 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
269 |
static FunctionPointerT resolve_barrier() { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
270 |
return resolve_barrier_rt(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
271 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
272 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
273 |
|
49658 | 274 |
// Step 5.a: Barrier resolution |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
275 |
// The RuntimeDispatch class is responsible for performing a runtime dispatch of the |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
276 |
// accessor. This is required when the access either depends on whether compressed oops |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
277 |
// is being used, or it depends on which GC implementation was chosen (e.g. requires GC |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
278 |
// barriers). The way it works is that a function pointer initially pointing to an |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
279 |
// accessor resolution function gets called for each access. Upon first invocation, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
280 |
// it resolves which accessor to be used in future invocations and patches the |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
281 |
// function pointer to this new accessor. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
282 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
283 |
template <DecoratorSet decorators, typename T> |
49658 | 284 |
void RuntimeDispatch<decorators, T, BARRIER_STORE>::store_init(void* addr, T value) { |
285 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_STORE>::resolve_barrier(); |
|
286 |
_store_func = function; |
|
287 |
function(addr, value); |
|
288 |
} |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
289 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
290 |
template <DecoratorSet decorators, typename T> |
49658 | 291 |
void RuntimeDispatch<decorators, T, BARRIER_STORE_AT>::store_at_init(oop base, ptrdiff_t offset, T value) { |
292 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_STORE_AT>::resolve_barrier(); |
|
293 |
_store_at_func = function; |
|
294 |
function(base, offset, value); |
|
295 |
} |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
296 |
|
49041
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
297 |
template <DecoratorSet decorators, typename T> |
49658 | 298 |
T RuntimeDispatch<decorators, T, BARRIER_LOAD>::load_init(void* addr) { |
299 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_LOAD>::resolve_barrier(); |
|
300 |
_load_func = function; |
|
301 |
return function(addr); |
|
302 |
} |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
303 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
304 |
template <DecoratorSet decorators, typename T> |
49658 | 305 |
T RuntimeDispatch<decorators, T, BARRIER_LOAD_AT>::load_at_init(oop base, ptrdiff_t offset) { |
306 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_LOAD_AT>::resolve_barrier(); |
|
307 |
_load_at_func = function; |
|
308 |
return function(base, offset); |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
309 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
310 |
|
49658 | 311 |
template <DecoratorSet decorators, typename T> |
312 |
T RuntimeDispatch<decorators, T, BARRIER_ATOMIC_CMPXCHG>::atomic_cmpxchg_init(T new_value, void* addr, T compare_value) { |
|
313 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_CMPXCHG>::resolve_barrier(); |
|
314 |
_atomic_cmpxchg_func = function; |
|
315 |
return function(new_value, addr, compare_value); |
|
48628
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
316 |
} |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
317 |
|
49658 | 318 |
template <DecoratorSet decorators, typename T> |
319 |
T RuntimeDispatch<decorators, T, BARRIER_ATOMIC_CMPXCHG_AT>::atomic_cmpxchg_at_init(T new_value, oop base, ptrdiff_t offset, T compare_value) { |
|
320 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_CMPXCHG_AT>::resolve_barrier(); |
|
321 |
_atomic_cmpxchg_at_func = function; |
|
322 |
return function(new_value, base, offset, compare_value); |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
323 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
324 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
325 |
template <DecoratorSet decorators, typename T> |
49658 | 326 |
T RuntimeDispatch<decorators, T, BARRIER_ATOMIC_XCHG>::atomic_xchg_init(T new_value, void* addr) { |
327 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_XCHG>::resolve_barrier(); |
|
328 |
_atomic_xchg_func = function; |
|
329 |
return function(new_value, addr); |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
330 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
331 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
332 |
template <DecoratorSet decorators, typename T> |
49658 | 333 |
T RuntimeDispatch<decorators, T, BARRIER_ATOMIC_XCHG_AT>::atomic_xchg_at_init(T new_value, oop base, ptrdiff_t offset) { |
334 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_XCHG_AT>::resolve_barrier(); |
|
335 |
_atomic_xchg_at_func = function; |
|
336 |
return function(new_value, base, offset); |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
337 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
338 |
|
49454
689ebcfe04fd
8199685: Access arraycopy build failure with GCC 7.3.1
eosterlund
parents:
49383
diff
changeset
|
339 |
template <DecoratorSet decorators, typename T> |
49658 | 340 |
bool RuntimeDispatch<decorators, T, BARRIER_ARRAYCOPY>::arraycopy_init(arrayOop src_obj, arrayOop dst_obj, T *src, T* dst, size_t length) { |
341 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_ARRAYCOPY>::resolve_barrier(); |
|
342 |
_arraycopy_func = function; |
|
343 |
return function(src_obj, dst_obj, src, dst, length); |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
344 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
345 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
346 |
template <DecoratorSet decorators, typename T> |
49658 | 347 |
void RuntimeDispatch<decorators, T, BARRIER_CLONE>::clone_init(oop src, oop dst, size_t size) { |
348 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_CLONE>::resolve_barrier(); |
|
349 |
_clone_func = function; |
|
350 |
function(src, dst, size); |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
351 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
352 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
353 |
template <DecoratorSet decorators, typename T> |
49658 | 354 |
oop RuntimeDispatch<decorators, T, BARRIER_RESOLVE>::resolve_init(oop obj) { |
355 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_RESOLVE>::resolve_barrier(); |
|
356 |
_resolve_func = function; |
|
357 |
return function(obj); |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
358 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
359 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
360 |
template <DecoratorSet decorators, typename T> |
49658 | 361 |
bool RuntimeDispatch<decorators, T, BARRIER_EQUALS>::equals_init(oop o1, oop o2) { |
362 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_EQUALS>::resolve_barrier(); |
|
363 |
_equals_func = function; |
|
364 |
return function(o1, o2); |
|
49041
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
365 |
} |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
366 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
367 |
|
49658 | 368 |
#endif // SHARE_OOPS_ACCESS_INLINE_HPP |