author | jwilhelm |
Sun, 25 Feb 2018 04:59:43 +0100 | |
changeset 49067 | c153e9daadce |
parent 49041 | 44122f767467 |
child 49347 | edb65305d3ac |
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 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
25 |
#ifndef SHARE_VM_RUNTIME_ACCESS_INLINE_HPP |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
26 |
#define SHARE_VM_RUNTIME_ACCESS_INLINE_HPP |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
27 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
28 |
#include "gc/shared/barrierSet.inline.hpp" |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
29 |
#include "metaprogramming/conditional.hpp" |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
30 |
#include "metaprogramming/isFloatingPoint.hpp" |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
31 |
#include "metaprogramming/isIntegral.hpp" |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
32 |
#include "metaprogramming/isPointer.hpp" |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
33 |
#include "metaprogramming/isVolatile.hpp" |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
34 |
#include "oops/access.hpp" |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
35 |
#include "oops/accessBackend.inline.hpp" |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
36 |
#include "runtime/atomic.hpp" |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
37 |
#include "runtime/orderAccess.inline.hpp" |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
38 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
39 |
// This file outlines the template pipeline of accesses going through the Access |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
40 |
// API. There are essentially 5 steps for each access. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
41 |
// * Step 1: Set default decorators and decay types. This step gets rid of CV qualifiers |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
42 |
// and sets default decorators to sensible values. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
43 |
// * Step 2: Reduce types. This step makes sure there is only a single T type and not |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
44 |
// multiple types. The P type of the address and T type of the value must |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
45 |
// match. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
46 |
// * Step 3: Pre-runtime dispatch. This step checks whether a runtime call can be |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
47 |
// avoided, and in that case avoids it (calling raw accesses or |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
48 |
// primitive accesses in a build that does not require primitive GC barriers) |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
49 |
// * Step 4: Runtime-dispatch. This step performs a runtime dispatch to the corresponding |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
50 |
// BarrierSet::AccessBarrier accessor that attaches GC-required barriers |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
51 |
// to the access. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
52 |
// * Step 5: Post-runtime dispatch. This step now casts previously unknown types such |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
53 |
// as the address type of an oop on the heap (is it oop* or narrowOop*) to |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
54 |
// the appropriate type. It also splits sufficiently orthogonal accesses into |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
55 |
// different functions, such as whether the access involves oops or primitives |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
56 |
// and whether the access is performed on the heap or outside. Then the |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
57 |
// appropriate BarrierSet::AccessBarrier is called to perform the access. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
58 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
59 |
namespace AccessInternal { |
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 |
// Step 5: Post-runtime dispatch. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
62 |
// This class is the last step before calling the BarrierSet::AccessBarrier. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
63 |
// 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
|
64 |
// 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
|
65 |
// We also split orthogonal barriers such as handling primitives vs oops |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
66 |
// 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
|
67 |
template <class GCBarrierType, BarrierType type, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
68 |
struct PostRuntimeDispatch: public AllStatic { }; |
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 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
71 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_STORE, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
72 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
73 |
static void access_barrier(void* addr, T value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
74 |
GCBarrierType::store_in_heap(reinterpret_cast<T*>(addr), value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
75 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
76 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
77 |
static void oop_access_barrier(void* addr, oop value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
78 |
typedef typename HeapOopType<decorators>::type OopType; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
79 |
if (HasDecorator<decorators, IN_HEAP>::value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
80 |
GCBarrierType::oop_store_in_heap(reinterpret_cast<OopType*>(addr), value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
81 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
82 |
GCBarrierType::oop_store_not_in_heap(reinterpret_cast<OopType*>(addr), value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
83 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
84 |
} |
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 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
88 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_LOAD, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
89 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
90 |
static T access_barrier(void* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
91 |
return GCBarrierType::load_in_heap(reinterpret_cast<T*>(addr)); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
92 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
93 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
94 |
static oop oop_access_barrier(void* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
95 |
typedef typename HeapOopType<decorators>::type OopType; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
96 |
if (HasDecorator<decorators, IN_HEAP>::value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
97 |
return GCBarrierType::oop_load_in_heap(reinterpret_cast<OopType*>(addr)); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
98 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
99 |
return GCBarrierType::oop_load_not_in_heap(reinterpret_cast<OopType*>(addr)); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
100 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
101 |
} |
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 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
105 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_XCHG, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
106 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
107 |
static T access_barrier(T new_value, void* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
108 |
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
|
109 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
110 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
111 |
static oop oop_access_barrier(oop new_value, void* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
112 |
typedef typename HeapOopType<decorators>::type OopType; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
113 |
if (HasDecorator<decorators, IN_HEAP>::value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
114 |
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
|
115 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
116 |
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
|
117 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
118 |
} |
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 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
122 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_CMPXCHG, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
123 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
124 |
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
|
125 |
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
|
126 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
127 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
128 |
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
|
129 |
typedef typename HeapOopType<decorators>::type OopType; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
130 |
if (HasDecorator<decorators, IN_HEAP>::value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
131 |
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
|
132 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
133 |
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
|
134 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
135 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
136 |
}; |
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 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
139 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_ARRAYCOPY, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
140 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
141 |
static bool 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
|
142 |
return GCBarrierType::arraycopy_in_heap(src_obj, dst_obj, src, dst, length); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
143 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
144 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
145 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
146 |
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
|
147 |
typedef typename HeapOopType<decorators>::type OopType; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
148 |
return GCBarrierType::oop_arraycopy_in_heap(src_obj, dst_obj, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
149 |
reinterpret_cast<OopType*>(src), |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
150 |
reinterpret_cast<OopType*>(dst), length); |
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 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
153 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
154 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
155 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_STORE_AT, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
156 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
157 |
static void access_barrier(oop base, ptrdiff_t offset, T value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
158 |
GCBarrierType::store_in_heap_at(base, offset, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
159 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
160 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
161 |
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
|
162 |
GCBarrierType::oop_store_in_heap_at(base, offset, value); |
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 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
165 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
166 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
167 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_LOAD_AT, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
168 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
169 |
static T access_barrier(oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
170 |
return GCBarrierType::template load_in_heap_at<T>(base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
171 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
172 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
173 |
static oop oop_access_barrier(oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
174 |
return GCBarrierType::oop_load_in_heap_at(base, offset); |
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 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
177 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
178 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
179 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_XCHG_AT, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
180 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
181 |
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
|
182 |
return GCBarrierType::atomic_xchg_in_heap_at(new_value, base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
183 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
184 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
185 |
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
|
186 |
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
|
187 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
188 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
189 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
190 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
191 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_CMPXCHG_AT, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
192 |
template <typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
193 |
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
|
194 |
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
|
195 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
196 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
197 |
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
|
198 |
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
|
199 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
200 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
201 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
202 |
template <class GCBarrierType, DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
203 |
struct PostRuntimeDispatch<GCBarrierType, BARRIER_CLONE, decorators>: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
204 |
static void access_barrier(oop src, oop dst, size_t size) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
205 |
GCBarrierType::clone_in_heap(src, dst, size); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
206 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
207 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
208 |
|
49041
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
209 |
template <class GCBarrierType, DecoratorSet decorators> |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
210 |
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
|
211 |
static oop access_barrier(oop obj) { |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
212 |
return GCBarrierType::resolve(obj); |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
213 |
} |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
214 |
}; |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
215 |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
216 |
// 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
|
217 |
// 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
|
218 |
// 2. Expand paths for each BarrierSet available in the system. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
219 |
template <DecoratorSet decorators, typename FunctionPointerT, BarrierType barrier_type> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
220 |
struct BarrierResolver: public AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
221 |
template <DecoratorSet ds> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
222 |
static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
223 |
HasDecorator<ds, INTERNAL_VALUE_IS_OOP>::value, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
224 |
FunctionPointerT>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
225 |
resolve_barrier_gc() { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
226 |
BarrierSet* bs = BarrierSet::barrier_set(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
227 |
assert(bs != NULL, "GC barriers invoked before BarrierSet is set"); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
228 |
switch (bs->kind()) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
229 |
#define BARRIER_SET_RESOLVE_BARRIER_CLOSURE(bs_name) \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
230 |
case BarrierSet::bs_name: { \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
231 |
return PostRuntimeDispatch<typename BarrierSet::GetType<BarrierSet::bs_name>::type:: \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
232 |
AccessBarrier<ds>, barrier_type, ds>::oop_access_barrier; \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
233 |
} \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
234 |
break; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
235 |
FOR_EACH_CONCRETE_BARRIER_SET_DO(BARRIER_SET_RESOLVE_BARRIER_CLOSURE) |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
236 |
#undef BARRIER_SET_RESOLVE_BARRIER_CLOSURE |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
237 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
238 |
default: |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
239 |
fatal("BarrierSet AccessBarrier resolving not implemented"); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
240 |
return NULL; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
241 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
242 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
243 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
244 |
template <DecoratorSet ds> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
245 |
static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
246 |
!HasDecorator<ds, INTERNAL_VALUE_IS_OOP>::value, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
247 |
FunctionPointerT>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
248 |
resolve_barrier_gc() { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
249 |
BarrierSet* bs = BarrierSet::barrier_set(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
250 |
assert(bs != NULL, "GC barriers invoked before BarrierSet is set"); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
251 |
switch (bs->kind()) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
252 |
#define BARRIER_SET_RESOLVE_BARRIER_CLOSURE(bs_name) \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
253 |
case BarrierSet::bs_name: { \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
254 |
return PostRuntimeDispatch<typename BarrierSet::GetType<BarrierSet::bs_name>::type:: \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
255 |
AccessBarrier<ds>, barrier_type, ds>::access_barrier; \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
256 |
} \ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
257 |
break; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
258 |
FOR_EACH_CONCRETE_BARRIER_SET_DO(BARRIER_SET_RESOLVE_BARRIER_CLOSURE) |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
259 |
#undef BARRIER_SET_RESOLVE_BARRIER_CLOSURE |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
260 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
261 |
default: |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
262 |
fatal("BarrierSet AccessBarrier resolving not implemented"); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
263 |
return NULL; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
264 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
265 |
} |
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 |
static FunctionPointerT resolve_barrier_rt() { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
268 |
if (UseCompressedOops) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
269 |
const DecoratorSet expanded_decorators = decorators | INTERNAL_RT_USE_COMPRESSED_OOPS; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
270 |
return resolve_barrier_gc<expanded_decorators>(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
271 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
272 |
return resolve_barrier_gc<decorators>(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
273 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
274 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
275 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
276 |
static FunctionPointerT resolve_barrier() { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
277 |
return resolve_barrier_rt(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
278 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
279 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
280 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
281 |
// Step 4: Runtime dispatch |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
282 |
// 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
|
283 |
// 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
|
284 |
// 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
|
285 |
// 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
|
286 |
// accessor resolution function gets called for each access. Upon first invocation, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
287 |
// 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
|
288 |
// function pointer to this new accessor. |
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, BarrierType type> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
291 |
struct RuntimeDispatch: AllStatic {}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
292 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
293 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
294 |
struct RuntimeDispatch<decorators, T, BARRIER_STORE>: AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
295 |
typedef typename AccessFunction<decorators, T, BARRIER_STORE>::type func_t; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
296 |
static func_t _store_func; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
297 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
298 |
static void store_init(void* addr, T value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
299 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_STORE>::resolve_barrier(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
300 |
_store_func = function; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
301 |
function(addr, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
302 |
} |
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 |
static inline void store(void* addr, T value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
305 |
_store_func(addr, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
306 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
307 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
308 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
309 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
310 |
struct RuntimeDispatch<decorators, T, BARRIER_STORE_AT>: AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
311 |
typedef typename AccessFunction<decorators, T, BARRIER_STORE_AT>::type func_t; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
312 |
static func_t _store_at_func; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
313 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
314 |
static void store_at_init(oop base, ptrdiff_t offset, T value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
315 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_STORE_AT>::resolve_barrier(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
316 |
_store_at_func = function; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
317 |
function(base, offset, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
318 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
319 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
320 |
static inline void store_at(oop base, ptrdiff_t offset, T value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
321 |
_store_at_func(base, offset, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
322 |
} |
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> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
326 |
struct RuntimeDispatch<decorators, T, BARRIER_LOAD>: AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
327 |
typedef typename AccessFunction<decorators, T, BARRIER_LOAD>::type func_t; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
328 |
static func_t _load_func; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
329 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
330 |
static T load_init(void* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
331 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_LOAD>::resolve_barrier(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
332 |
_load_func = function; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
333 |
return function(addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
334 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
335 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
336 |
static inline T load(void* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
337 |
return _load_func(addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
338 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
339 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
340 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
341 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
342 |
struct RuntimeDispatch<decorators, T, BARRIER_LOAD_AT>: AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
343 |
typedef typename AccessFunction<decorators, T, BARRIER_LOAD_AT>::type func_t; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
344 |
static func_t _load_at_func; |
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 |
static T load_at_init(oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
347 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_LOAD_AT>::resolve_barrier(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
348 |
_load_at_func = function; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
349 |
return function(base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
350 |
} |
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 |
static inline T load_at(oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
353 |
return _load_at_func(base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
354 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
355 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
356 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
357 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
358 |
struct RuntimeDispatch<decorators, T, BARRIER_ATOMIC_CMPXCHG>: AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
359 |
typedef typename AccessFunction<decorators, T, BARRIER_ATOMIC_CMPXCHG>::type func_t; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
360 |
static func_t _atomic_cmpxchg_func; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
361 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
362 |
static T atomic_cmpxchg_init(T new_value, void* addr, T compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
363 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_CMPXCHG>::resolve_barrier(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
364 |
_atomic_cmpxchg_func = function; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
365 |
return function(new_value, addr, compare_value); |
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 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
368 |
static inline T atomic_cmpxchg(T new_value, void* addr, T compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
369 |
return _atomic_cmpxchg_func(new_value, addr, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
370 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
371 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
372 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
373 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
374 |
struct RuntimeDispatch<decorators, T, BARRIER_ATOMIC_CMPXCHG_AT>: AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
375 |
typedef typename AccessFunction<decorators, T, BARRIER_ATOMIC_CMPXCHG_AT>::type func_t; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
376 |
static func_t _atomic_cmpxchg_at_func; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
377 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
378 |
static T atomic_cmpxchg_at_init(T new_value, oop base, ptrdiff_t offset, T compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
379 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_CMPXCHG_AT>::resolve_barrier(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
380 |
_atomic_cmpxchg_at_func = function; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
381 |
return function(new_value, base, offset, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
382 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
383 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
384 |
static inline T atomic_cmpxchg_at(T new_value, oop base, ptrdiff_t offset, T compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
385 |
return _atomic_cmpxchg_at_func(new_value, base, offset, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
386 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
387 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
388 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
389 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
390 |
struct RuntimeDispatch<decorators, T, BARRIER_ATOMIC_XCHG>: AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
391 |
typedef typename AccessFunction<decorators, T, BARRIER_ATOMIC_XCHG>::type func_t; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
392 |
static func_t _atomic_xchg_func; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
393 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
394 |
static T atomic_xchg_init(T new_value, void* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
395 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_XCHG>::resolve_barrier(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
396 |
_atomic_xchg_func = function; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
397 |
return function(new_value, addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
398 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
399 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
400 |
static inline T atomic_xchg(T new_value, void* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
401 |
return _atomic_xchg_func(new_value, addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
402 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
403 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
404 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
405 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
406 |
struct RuntimeDispatch<decorators, T, BARRIER_ATOMIC_XCHG_AT>: AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
407 |
typedef typename AccessFunction<decorators, T, BARRIER_ATOMIC_XCHG_AT>::type func_t; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
408 |
static func_t _atomic_xchg_at_func; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
409 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
410 |
static T atomic_xchg_at_init(T new_value, oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
411 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_XCHG_AT>::resolve_barrier(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
412 |
_atomic_xchg_at_func = function; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
413 |
return function(new_value, base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
414 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
415 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
416 |
static inline T atomic_xchg_at(T new_value, oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
417 |
return _atomic_xchg_at_func(new_value, base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
418 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
419 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
420 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
421 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
422 |
struct RuntimeDispatch<decorators, T, BARRIER_ARRAYCOPY>: AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
423 |
typedef typename AccessFunction<decorators, T, BARRIER_ARRAYCOPY>::type func_t; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
424 |
static func_t _arraycopy_func; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
425 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
426 |
static bool arraycopy_init(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
|
427 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_ARRAYCOPY>::resolve_barrier(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
428 |
_arraycopy_func = function; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
429 |
return function(src_obj, dst_obj, src, dst, length); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
430 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
431 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
432 |
static inline bool arraycopy(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
|
433 |
return _arraycopy_func(src_obj, dst_obj, src, dst, length); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
434 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
435 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
436 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
437 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
438 |
struct RuntimeDispatch<decorators, T, BARRIER_CLONE>: AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
439 |
typedef typename AccessFunction<decorators, T, BARRIER_CLONE>::type func_t; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
440 |
static func_t _clone_func; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
441 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
442 |
static void clone_init(oop src, oop dst, size_t size) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
443 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_CLONE>::resolve_barrier(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
444 |
_clone_func = function; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
445 |
function(src, dst, size); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
446 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
447 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
448 |
static inline void clone(oop src, oop dst, size_t size) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
449 |
_clone_func(src, dst, size); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
450 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
451 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
452 |
|
49041
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
453 |
template <DecoratorSet decorators, typename T> |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
454 |
struct RuntimeDispatch<decorators, T, BARRIER_RESOLVE>: AllStatic { |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
455 |
typedef typename AccessFunction<decorators, T, BARRIER_RESOLVE>::type func_t; |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
456 |
static func_t _resolve_func; |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
457 |
|
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
458 |
static oop resolve_init(oop obj) { |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
459 |
func_t function = BarrierResolver<decorators, func_t, BARRIER_RESOLVE>::resolve_barrier(); |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
460 |
_resolve_func = function; |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
461 |
return function(obj); |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
462 |
} |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
463 |
|
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
464 |
static inline oop resolve(oop obj) { |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
465 |
return _resolve_func(obj); |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
466 |
} |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
467 |
}; |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
468 |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
469 |
// Initialize the function pointers to point to the resolving function. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
470 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
471 |
typename AccessFunction<decorators, T, BARRIER_STORE>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
472 |
RuntimeDispatch<decorators, T, BARRIER_STORE>::_store_func = &store_init; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
473 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
474 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
475 |
typename AccessFunction<decorators, T, BARRIER_STORE_AT>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
476 |
RuntimeDispatch<decorators, T, BARRIER_STORE_AT>::_store_at_func = &store_at_init; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
477 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
478 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
479 |
typename AccessFunction<decorators, T, BARRIER_LOAD>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
480 |
RuntimeDispatch<decorators, T, BARRIER_LOAD>::_load_func = &load_init; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
481 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
482 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
483 |
typename AccessFunction<decorators, T, BARRIER_LOAD_AT>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
484 |
RuntimeDispatch<decorators, T, BARRIER_LOAD_AT>::_load_at_func = &load_at_init; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
485 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
486 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
487 |
typename AccessFunction<decorators, T, BARRIER_ATOMIC_CMPXCHG>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
488 |
RuntimeDispatch<decorators, T, BARRIER_ATOMIC_CMPXCHG>::_atomic_cmpxchg_func = &atomic_cmpxchg_init; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
489 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
490 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
491 |
typename AccessFunction<decorators, T, BARRIER_ATOMIC_CMPXCHG_AT>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
492 |
RuntimeDispatch<decorators, T, BARRIER_ATOMIC_CMPXCHG_AT>::_atomic_cmpxchg_at_func = &atomic_cmpxchg_at_init; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
493 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
494 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
495 |
typename AccessFunction<decorators, T, BARRIER_ATOMIC_XCHG>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
496 |
RuntimeDispatch<decorators, T, BARRIER_ATOMIC_XCHG>::_atomic_xchg_func = &atomic_xchg_init; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
497 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
498 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
499 |
typename AccessFunction<decorators, T, BARRIER_ATOMIC_XCHG_AT>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
500 |
RuntimeDispatch<decorators, T, BARRIER_ATOMIC_XCHG_AT>::_atomic_xchg_at_func = &atomic_xchg_at_init; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
501 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
502 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
503 |
typename AccessFunction<decorators, T, BARRIER_ARRAYCOPY>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
504 |
RuntimeDispatch<decorators, T, BARRIER_ARRAYCOPY>::_arraycopy_func = &arraycopy_init; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
505 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
506 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
507 |
typename AccessFunction<decorators, T, BARRIER_CLONE>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
508 |
RuntimeDispatch<decorators, T, BARRIER_CLONE>::_clone_func = &clone_init; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
509 |
|
49041
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
510 |
template <DecoratorSet decorators, typename T> |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
511 |
typename AccessFunction<decorators, T, BARRIER_RESOLVE>::type |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
512 |
RuntimeDispatch<decorators, T, BARRIER_RESOLVE>::_resolve_func = &resolve_init; |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
513 |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
514 |
// Step 3: Pre-runtime dispatching. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
515 |
// The PreRuntimeDispatch class is responsible for filtering the barrier strength |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
516 |
// decorators. That is, for AS_RAW, it hardwires the accesses without a runtime |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
517 |
// dispatch point. Otherwise it goes through a runtime check if hardwiring was |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
518 |
// not possible. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
519 |
struct PreRuntimeDispatch: AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
520 |
template<DecoratorSet decorators> |
48628
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
521 |
struct CanHardwireRaw: public IntegralConstant< |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
522 |
bool, |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
523 |
!HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value || // primitive access |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
524 |
!HasDecorator<decorators, INTERNAL_CONVERT_COMPRESSED_OOP>::value || // don't care about compressed oops (oop* address) |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
525 |
HasDecorator<decorators, INTERNAL_RT_USE_COMPRESSED_OOPS>::value> // we can infer we use compressed oops (narrowOop* address) |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
526 |
{}; |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
527 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
528 |
static const DecoratorSet convert_compressed_oops = INTERNAL_RT_USE_COMPRESSED_OOPS | INTERNAL_CONVERT_COMPRESSED_OOP; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
529 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
530 |
template<DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
531 |
static bool is_hardwired_primitive() { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
532 |
return !HasDecorator<decorators, INTERNAL_BT_BARRIER_ON_PRIMITIVES>::value && |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
533 |
!HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
534 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
535 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
536 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
537 |
inline static typename EnableIf< |
48628
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
538 |
HasDecorator<decorators, AS_RAW>::value && CanHardwireRaw<decorators>::value>::type |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
539 |
store(void* addr, T value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
540 |
typedef RawAccessBarrier<decorators & RAW_DECORATOR_MASK> Raw; |
48628
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
541 |
if (HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value) { |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
542 |
Raw::oop_store(addr, value); |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
543 |
} else { |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
544 |
Raw::store(addr, value); |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
545 |
} |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
546 |
} |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
547 |
|
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
548 |
template <DecoratorSet decorators, typename T> |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
549 |
inline static typename EnableIf< |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
550 |
HasDecorator<decorators, AS_RAW>::value && !CanHardwireRaw<decorators>::value>::type |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
551 |
store(void* addr, T value) { |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
552 |
if (UseCompressedOops) { |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
553 |
const DecoratorSet expanded_decorators = decorators | convert_compressed_oops; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
554 |
PreRuntimeDispatch::store<expanded_decorators>(addr, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
555 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
556 |
const DecoratorSet expanded_decorators = decorators & ~convert_compressed_oops; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
557 |
PreRuntimeDispatch::store<expanded_decorators>(addr, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
558 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
559 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
560 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
561 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
562 |
inline static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
563 |
!HasDecorator<decorators, AS_RAW>::value>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
564 |
store(void* addr, T value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
565 |
if (is_hardwired_primitive<decorators>()) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
566 |
const DecoratorSet expanded_decorators = decorators | AS_RAW; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
567 |
PreRuntimeDispatch::store<expanded_decorators>(addr, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
568 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
569 |
RuntimeDispatch<decorators, T, BARRIER_STORE>::store(addr, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
570 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
571 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
572 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
573 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
574 |
inline static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
575 |
HasDecorator<decorators, AS_RAW>::value>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
576 |
store_at(oop base, ptrdiff_t offset, T value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
577 |
store<decorators>(field_addr(base, offset), value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
578 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
579 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
580 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
581 |
inline static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
582 |
!HasDecorator<decorators, AS_RAW>::value>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
583 |
store_at(oop base, ptrdiff_t offset, T value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
584 |
if (is_hardwired_primitive<decorators>()) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
585 |
const DecoratorSet expanded_decorators = decorators | AS_RAW; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
586 |
PreRuntimeDispatch::store_at<expanded_decorators>(base, offset, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
587 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
588 |
RuntimeDispatch<decorators, T, BARRIER_STORE_AT>::store_at(base, offset, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
589 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
590 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
591 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
592 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
593 |
inline static typename EnableIf< |
48628
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
594 |
HasDecorator<decorators, AS_RAW>::value && CanHardwireRaw<decorators>::value, T>::type |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
595 |
load(void* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
596 |
typedef RawAccessBarrier<decorators & RAW_DECORATOR_MASK> Raw; |
48628
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
597 |
if (HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value) { |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
598 |
return Raw::template oop_load<T>(addr); |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
599 |
} else { |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
600 |
return Raw::template load<T>(addr); |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
601 |
} |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
602 |
} |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
603 |
|
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
604 |
template <DecoratorSet decorators, typename T> |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
605 |
inline static typename EnableIf< |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
606 |
HasDecorator<decorators, AS_RAW>::value && !CanHardwireRaw<decorators>::value, T>::type |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
607 |
load(void* addr) { |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
608 |
if (UseCompressedOops) { |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
609 |
const DecoratorSet expanded_decorators = decorators | convert_compressed_oops; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
610 |
return PreRuntimeDispatch::load<expanded_decorators, T>(addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
611 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
612 |
const DecoratorSet expanded_decorators = decorators & ~convert_compressed_oops; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
613 |
return PreRuntimeDispatch::load<expanded_decorators, T>(addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
614 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
615 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
616 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
617 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
618 |
inline static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
619 |
!HasDecorator<decorators, AS_RAW>::value, T>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
620 |
load(void* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
621 |
if (is_hardwired_primitive<decorators>()) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
622 |
const DecoratorSet expanded_decorators = decorators | AS_RAW; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
623 |
return PreRuntimeDispatch::load<expanded_decorators, T>(addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
624 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
625 |
return RuntimeDispatch<decorators, T, BARRIER_LOAD>::load(addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
626 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
627 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
628 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
629 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
630 |
inline static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
631 |
HasDecorator<decorators, AS_RAW>::value, T>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
632 |
load_at(oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
633 |
return load<decorators, T>(field_addr(base, offset)); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
634 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
635 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
636 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
637 |
inline static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
638 |
!HasDecorator<decorators, AS_RAW>::value, T>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
639 |
load_at(oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
640 |
if (is_hardwired_primitive<decorators>()) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
641 |
const DecoratorSet expanded_decorators = decorators | AS_RAW; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
642 |
return PreRuntimeDispatch::load_at<expanded_decorators, T>(base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
643 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
644 |
return RuntimeDispatch<decorators, T, BARRIER_LOAD_AT>::load_at(base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
645 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
646 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
647 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
648 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
649 |
inline static typename EnableIf< |
48628
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
650 |
HasDecorator<decorators, AS_RAW>::value && CanHardwireRaw<decorators>::value, T>::type |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
651 |
atomic_cmpxchg(T new_value, void* addr, T compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
652 |
typedef RawAccessBarrier<decorators & RAW_DECORATOR_MASK> Raw; |
48628
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
653 |
if (HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value) { |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
654 |
return Raw::oop_atomic_cmpxchg(new_value, addr, compare_value); |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
655 |
} else { |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
656 |
return Raw::atomic_cmpxchg(new_value, addr, compare_value); |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
657 |
} |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
658 |
} |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
659 |
|
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
660 |
template <DecoratorSet decorators, typename T> |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
661 |
inline static typename EnableIf< |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
662 |
HasDecorator<decorators, AS_RAW>::value && !CanHardwireRaw<decorators>::value, T>::type |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
663 |
atomic_cmpxchg(T new_value, void* addr, T compare_value) { |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
664 |
if (UseCompressedOops) { |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
665 |
const DecoratorSet expanded_decorators = decorators | convert_compressed_oops; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
666 |
return PreRuntimeDispatch::atomic_cmpxchg<expanded_decorators>(new_value, addr, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
667 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
668 |
const DecoratorSet expanded_decorators = decorators & ~convert_compressed_oops; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
669 |
return PreRuntimeDispatch::atomic_cmpxchg<expanded_decorators>(new_value, addr, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
670 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
671 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
672 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
673 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
674 |
inline static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
675 |
!HasDecorator<decorators, AS_RAW>::value, T>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
676 |
atomic_cmpxchg(T new_value, void* addr, T compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
677 |
typedef RawAccessBarrier<decorators & RAW_DECORATOR_MASK> Raw; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
678 |
if (is_hardwired_primitive<decorators>()) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
679 |
const DecoratorSet expanded_decorators = decorators | AS_RAW; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
680 |
return PreRuntimeDispatch::atomic_cmpxchg<expanded_decorators>(new_value, addr, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
681 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
682 |
return RuntimeDispatch<decorators, T, BARRIER_ATOMIC_CMPXCHG>::atomic_cmpxchg(new_value, addr, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
683 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
684 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
685 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
686 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
687 |
inline static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
688 |
HasDecorator<decorators, AS_RAW>::value, T>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
689 |
atomic_cmpxchg_at(T new_value, oop base, ptrdiff_t offset, T compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
690 |
return atomic_cmpxchg<decorators>(new_value, field_addr(base, offset), compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
691 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
692 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
693 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
694 |
inline static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
695 |
!HasDecorator<decorators, AS_RAW>::value, T>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
696 |
atomic_cmpxchg_at(T new_value, oop base, ptrdiff_t offset, T compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
697 |
if (is_hardwired_primitive<decorators>()) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
698 |
const DecoratorSet expanded_decorators = decorators | AS_RAW; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
699 |
return PreRuntimeDispatch::atomic_cmpxchg_at<expanded_decorators>(new_value, base, offset, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
700 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
701 |
return RuntimeDispatch<decorators, T, BARRIER_ATOMIC_CMPXCHG_AT>::atomic_cmpxchg_at(new_value, base, offset, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
702 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
703 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
704 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
705 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
706 |
inline static typename EnableIf< |
48628
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
707 |
HasDecorator<decorators, AS_RAW>::value && CanHardwireRaw<decorators>::value, T>::type |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
708 |
atomic_xchg(T new_value, void* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
709 |
typedef RawAccessBarrier<decorators & RAW_DECORATOR_MASK> Raw; |
48628
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
710 |
if (HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value) { |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
711 |
return Raw::oop_atomic_xchg(new_value, addr); |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
712 |
} else { |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
713 |
return Raw::atomic_xchg(new_value, addr); |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
714 |
} |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
715 |
} |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
716 |
|
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
717 |
template <DecoratorSet decorators, typename T> |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
718 |
inline static typename EnableIf< |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
719 |
HasDecorator<decorators, AS_RAW>::value && !CanHardwireRaw<decorators>::value, T>::type |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
720 |
atomic_xchg(T new_value, void* addr) { |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
721 |
if (UseCompressedOops) { |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
722 |
const DecoratorSet expanded_decorators = decorators | convert_compressed_oops; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
723 |
return PreRuntimeDispatch::atomic_xchg<expanded_decorators>(new_value, addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
724 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
725 |
const DecoratorSet expanded_decorators = decorators & ~convert_compressed_oops; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
726 |
return PreRuntimeDispatch::atomic_xchg<expanded_decorators>(new_value, addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
727 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
728 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
729 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
730 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
731 |
inline static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
732 |
!HasDecorator<decorators, AS_RAW>::value, T>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
733 |
atomic_xchg(T new_value, void* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
734 |
if (is_hardwired_primitive<decorators>()) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
735 |
const DecoratorSet expanded_decorators = decorators | AS_RAW; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
736 |
return PreRuntimeDispatch::atomic_xchg<expanded_decorators>(new_value, addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
737 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
738 |
return RuntimeDispatch<decorators, T, BARRIER_ATOMIC_XCHG>::atomic_xchg(new_value, addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
739 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
740 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
741 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
742 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
743 |
inline static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
744 |
HasDecorator<decorators, AS_RAW>::value, T>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
745 |
atomic_xchg_at(T new_value, oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
746 |
return atomic_xchg<decorators>(new_value, field_addr(base, offset)); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
747 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
748 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
749 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
750 |
inline static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
751 |
!HasDecorator<decorators, AS_RAW>::value, T>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
752 |
atomic_xchg_at(T new_value, oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
753 |
if (is_hardwired_primitive<decorators>()) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
754 |
const DecoratorSet expanded_decorators = decorators | AS_RAW; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
755 |
return PreRuntimeDispatch::atomic_xchg<expanded_decorators>(new_value, base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
756 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
757 |
return RuntimeDispatch<decorators, T, BARRIER_ATOMIC_XCHG_AT>::atomic_xchg_at(new_value, base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
758 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
759 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
760 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
761 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
762 |
inline static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
763 |
HasDecorator<decorators, AS_RAW>::value, bool>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
764 |
arraycopy(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
|
765 |
typedef RawAccessBarrier<decorators & RAW_DECORATOR_MASK> Raw; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
766 |
return Raw::arraycopy(src, dst, length); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
767 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
768 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
769 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
770 |
inline static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
771 |
!HasDecorator<decorators, AS_RAW>::value, bool>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
772 |
arraycopy(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
|
773 |
typedef RawAccessBarrier<decorators & RAW_DECORATOR_MASK> Raw; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
774 |
if (is_hardwired_primitive<decorators>()) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
775 |
const DecoratorSet expanded_decorators = decorators | AS_RAW; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
776 |
return PreRuntimeDispatch::arraycopy<expanded_decorators>(src_obj, dst_obj, src, dst, length); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
777 |
} else { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
778 |
return RuntimeDispatch<decorators, T, BARRIER_ARRAYCOPY>::arraycopy(src_obj, dst_obj, src, dst, length); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
779 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
780 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
781 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
782 |
template <DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
783 |
inline static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
784 |
HasDecorator<decorators, AS_RAW>::value>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
785 |
clone(oop src, oop dst, size_t size) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
786 |
typedef RawAccessBarrier<decorators & RAW_DECORATOR_MASK> Raw; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
787 |
Raw::clone(src, dst, size); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
788 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
789 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
790 |
template <DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
791 |
inline static typename EnableIf< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
792 |
!HasDecorator<decorators, AS_RAW>::value>::type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
793 |
clone(oop src, oop dst, size_t size) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
794 |
RuntimeDispatch<decorators, oop, BARRIER_CLONE>::clone(src, dst, size); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
795 |
} |
49041
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
796 |
|
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
797 |
template <DecoratorSet decorators> |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
798 |
inline static typename EnableIf< |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
799 |
HasDecorator<decorators, INTERNAL_BT_TO_SPACE_INVARIANT>::value, oop>::type |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
800 |
resolve(oop obj) { |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
801 |
typedef RawAccessBarrier<decorators & RAW_DECORATOR_MASK> Raw; |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
802 |
return Raw::resolve(obj); |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
803 |
} |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
804 |
|
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
805 |
template <DecoratorSet decorators> |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
806 |
inline static typename EnableIf< |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
807 |
!HasDecorator<decorators, INTERNAL_BT_TO_SPACE_INVARIANT>::value, oop>::type |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
808 |
resolve(oop obj) { |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
809 |
return RuntimeDispatch<decorators, oop, BARRIER_RESOLVE>::resolve(obj); |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
810 |
} |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
811 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
812 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
813 |
// This class adds implied decorators that follow according to decorator rules. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
814 |
// For example adding default reference strength and default memory ordering |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
815 |
// semantics. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
816 |
template <DecoratorSet input_decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
817 |
struct DecoratorFixup: AllStatic { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
818 |
// If no reference strength has been picked, then strong will be picked |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
819 |
static const DecoratorSet ref_strength_default = input_decorators | |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
820 |
(((ON_DECORATOR_MASK & input_decorators) == 0 && (INTERNAL_VALUE_IS_OOP & input_decorators) != 0) ? |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
821 |
ON_STRONG_OOP_REF : INTERNAL_EMPTY); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
822 |
// If no memory ordering has been picked, unordered will be picked |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
823 |
static const DecoratorSet memory_ordering_default = ref_strength_default | |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
824 |
((MO_DECORATOR_MASK & ref_strength_default) == 0 ? MO_UNORDERED : INTERNAL_EMPTY); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
825 |
// If no barrier strength has been picked, normal will be used |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
826 |
static const DecoratorSet barrier_strength_default = memory_ordering_default | |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
827 |
((AS_DECORATOR_MASK & memory_ordering_default) == 0 ? AS_NORMAL : INTERNAL_EMPTY); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
828 |
// Heap array accesses imply it is a heap access |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
829 |
static const DecoratorSet heap_array_is_in_heap = barrier_strength_default | |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
830 |
((IN_HEAP_ARRAY & barrier_strength_default) != 0 ? IN_HEAP : INTERNAL_EMPTY); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
831 |
static const DecoratorSet conc_root_is_root = heap_array_is_in_heap | |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
832 |
((IN_CONCURRENT_ROOT & heap_array_is_in_heap) != 0 ? IN_ROOT : INTERNAL_EMPTY); |
48784
899b522ed65c
8194741: Refactor oops in constant pool from CDS to use the Access API
eosterlund
parents:
48628
diff
changeset
|
833 |
static const DecoratorSet archive_root_is_root = conc_root_is_root | |
899b522ed65c
8194741: Refactor oops in constant pool from CDS to use the Access API
eosterlund
parents:
48628
diff
changeset
|
834 |
((IN_ARCHIVE_ROOT & conc_root_is_root) != 0 ? IN_ROOT : INTERNAL_EMPTY); |
899b522ed65c
8194741: Refactor oops in constant pool from CDS to use the Access API
eosterlund
parents:
48628
diff
changeset
|
835 |
static const DecoratorSet value = archive_root_is_root | BT_BUILDTIME_DECORATORS; |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
836 |
}; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
837 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
838 |
// Step 2: Reduce types. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
839 |
// Enforce that for non-oop types, T and P have to be strictly the same. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
840 |
// P is the type of the address and T is the type of the values. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
841 |
// As for oop types, it is allow to send T in {narrowOop, oop} and |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
842 |
// P in {narrowOop, oop, HeapWord*}. The following rules apply according to |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
843 |
// the subsequent table. (columns are P, rows are T) |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
844 |
// | | HeapWord | oop | narrowOop | |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
845 |
// | oop | rt-comp | hw-none | hw-comp | |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
846 |
// | narrowOop | x | x | hw-none | |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
847 |
// |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
848 |
// x means not allowed |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
849 |
// rt-comp means it must be checked at runtime whether the oop is compressed. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
850 |
// hw-none means it is statically known the oop will not be compressed. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
851 |
// hw-comp means it is statically known the oop will be compressed. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
852 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
853 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
854 |
inline void store_reduce_types(T* addr, T value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
855 |
PreRuntimeDispatch::store<decorators>(addr, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
856 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
857 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
858 |
template <DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
859 |
inline void store_reduce_types(narrowOop* addr, oop value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
860 |
const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP | |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
861 |
INTERNAL_RT_USE_COMPRESSED_OOPS; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
862 |
PreRuntimeDispatch::store<expanded_decorators>(addr, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
863 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
864 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
865 |
template <DecoratorSet decorators> |
48628
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
866 |
inline void store_reduce_types(narrowOop* addr, narrowOop value) { |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
867 |
const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP | |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
868 |
INTERNAL_RT_USE_COMPRESSED_OOPS; |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
869 |
PreRuntimeDispatch::store<expanded_decorators>(addr, value); |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
870 |
} |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
871 |
|
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
872 |
template <DecoratorSet decorators> |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
873 |
inline void store_reduce_types(HeapWord* addr, oop value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
874 |
const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
875 |
PreRuntimeDispatch::store<expanded_decorators>(addr, value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
876 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
877 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
878 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
879 |
inline T atomic_cmpxchg_reduce_types(T new_value, T* addr, T compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
880 |
return PreRuntimeDispatch::atomic_cmpxchg<decorators>(new_value, addr, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
881 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
882 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
883 |
template <DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
884 |
inline oop atomic_cmpxchg_reduce_types(oop new_value, narrowOop* addr, oop compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
885 |
const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP | |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
886 |
INTERNAL_RT_USE_COMPRESSED_OOPS; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
887 |
return PreRuntimeDispatch::atomic_cmpxchg<expanded_decorators>(new_value, addr, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
888 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
889 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
890 |
template <DecoratorSet decorators> |
48628
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
891 |
inline narrowOop atomic_cmpxchg_reduce_types(narrowOop new_value, narrowOop* addr, narrowOop compare_value) { |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
892 |
const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP | |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
893 |
INTERNAL_RT_USE_COMPRESSED_OOPS; |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
894 |
return PreRuntimeDispatch::atomic_cmpxchg<expanded_decorators>(new_value, addr, compare_value); |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
895 |
} |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
896 |
|
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
897 |
template <DecoratorSet decorators> |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
898 |
inline oop atomic_cmpxchg_reduce_types(oop new_value, |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
899 |
HeapWord* addr, |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
900 |
oop compare_value) { |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
901 |
const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
902 |
return PreRuntimeDispatch::atomic_cmpxchg<expanded_decorators>(new_value, addr, compare_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
903 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
904 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
905 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
906 |
inline T atomic_xchg_reduce_types(T new_value, T* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
907 |
const DecoratorSet expanded_decorators = decorators; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
908 |
return PreRuntimeDispatch::atomic_xchg<expanded_decorators>(new_value, addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
909 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
910 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
911 |
template <DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
912 |
inline oop atomic_xchg_reduce_types(oop new_value, narrowOop* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
913 |
const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP | |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
914 |
INTERNAL_RT_USE_COMPRESSED_OOPS; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
915 |
return PreRuntimeDispatch::atomic_xchg<expanded_decorators>(new_value, addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
916 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
917 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
918 |
template <DecoratorSet decorators> |
48628
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
919 |
inline narrowOop atomic_xchg_reduce_types(narrowOop new_value, narrowOop* addr) { |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
920 |
const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP | |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
921 |
INTERNAL_RT_USE_COMPRESSED_OOPS; |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
922 |
return PreRuntimeDispatch::atomic_xchg<expanded_decorators>(new_value, addr); |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
923 |
} |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
924 |
|
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
925 |
template <DecoratorSet decorators> |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
926 |
inline oop atomic_xchg_reduce_types(oop new_value, HeapWord* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
927 |
const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
928 |
return PreRuntimeDispatch::atomic_xchg<expanded_decorators>(new_value, addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
929 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
930 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
931 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
932 |
inline T load_reduce_types(T* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
933 |
return PreRuntimeDispatch::load<decorators, T>(addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
934 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
935 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
936 |
template <DecoratorSet decorators, typename T> |
48628
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
937 |
inline typename OopOrNarrowOop<T>::type load_reduce_types(narrowOop* addr) { |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
938 |
const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP | |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
939 |
INTERNAL_RT_USE_COMPRESSED_OOPS; |
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
940 |
return PreRuntimeDispatch::load<expanded_decorators, typename OopOrNarrowOop<T>::type>(addr); |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
941 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
942 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
943 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
944 |
inline oop load_reduce_types(HeapWord* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
945 |
const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
946 |
return PreRuntimeDispatch::load<expanded_decorators, oop>(addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
947 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
948 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
949 |
// Step 1: Set default decorators. This step remembers if a type was volatile |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
950 |
// and then sets the MO_VOLATILE decorator by default. Otherwise, a default |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
951 |
// memory ordering is set for the access, and the implied decorator rules |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
952 |
// are applied to select sensible defaults for decorators that have not been |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
953 |
// explicitly set. For example, default object referent strength is set to strong. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
954 |
// This step also decays the types passed in (e.g. getting rid of CV qualifiers |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
955 |
// and references from the types). This step also perform some type verification |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
956 |
// that the passed in types make sense. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
957 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
958 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
959 |
static void verify_types(){ |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
960 |
// If this fails to compile, then you have sent in something that is |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
961 |
// not recognized as a valid primitive type to a primitive Access function. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
962 |
STATIC_ASSERT((HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value || // oops have already been validated |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
963 |
(IsPointer<T>::value || IsIntegral<T>::value) || |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
964 |
IsFloatingPoint<T>::value)); // not allowed primitive type |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
965 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
966 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
967 |
template <DecoratorSet decorators, typename P, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
968 |
inline void store(P* addr, T value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
969 |
verify_types<decorators, T>(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
970 |
typedef typename Decay<P>::type DecayedP; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
971 |
typedef typename Decay<T>::type DecayedT; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
972 |
DecayedT decayed_value = value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
973 |
// If a volatile address is passed in but no memory ordering decorator, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
974 |
// set the memory ordering to MO_VOLATILE by default. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
975 |
const DecoratorSet expanded_decorators = DecoratorFixup< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
976 |
(IsVolatile<P>::value && !HasDecorator<decorators, MO_DECORATOR_MASK>::value) ? |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
977 |
(MO_VOLATILE | decorators) : decorators>::value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
978 |
store_reduce_types<expanded_decorators>(const_cast<DecayedP*>(addr), decayed_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
979 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
980 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
981 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
982 |
inline void store_at(oop base, ptrdiff_t offset, T value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
983 |
verify_types<decorators, T>(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
984 |
typedef typename Decay<T>::type DecayedT; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
985 |
DecayedT decayed_value = value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
986 |
const DecoratorSet expanded_decorators = DecoratorFixup<decorators | |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
987 |
(HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value ? |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
988 |
INTERNAL_CONVERT_COMPRESSED_OOP : INTERNAL_EMPTY)>::value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
989 |
PreRuntimeDispatch::store_at<expanded_decorators>(base, offset, decayed_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
990 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
991 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
992 |
template <DecoratorSet decorators, typename P, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
993 |
inline T load(P* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
994 |
verify_types<decorators, T>(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
995 |
typedef typename Decay<P>::type DecayedP; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
996 |
typedef typename Conditional<HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
997 |
typename OopOrNarrowOop<T>::type, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
998 |
typename Decay<T>::type>::type DecayedT; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
999 |
// If a volatile address is passed in but no memory ordering decorator, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1000 |
// set the memory ordering to MO_VOLATILE by default. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1001 |
const DecoratorSet expanded_decorators = DecoratorFixup< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1002 |
(IsVolatile<P>::value && !HasDecorator<decorators, MO_DECORATOR_MASK>::value) ? |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1003 |
(MO_VOLATILE | decorators) : decorators>::value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1004 |
return load_reduce_types<expanded_decorators, DecayedT>(const_cast<DecayedP*>(addr)); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1005 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1006 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1007 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1008 |
inline T load_at(oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1009 |
verify_types<decorators, T>(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1010 |
typedef typename Conditional<HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1011 |
typename OopOrNarrowOop<T>::type, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1012 |
typename Decay<T>::type>::type DecayedT; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1013 |
// Expand the decorators (figure out sensible defaults) |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1014 |
// Potentially remember if we need compressed oop awareness |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1015 |
const DecoratorSet expanded_decorators = DecoratorFixup<decorators | |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1016 |
(HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value ? |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1017 |
INTERNAL_CONVERT_COMPRESSED_OOP : INTERNAL_EMPTY)>::value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1018 |
return PreRuntimeDispatch::load_at<expanded_decorators, DecayedT>(base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1019 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1020 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1021 |
template <DecoratorSet decorators, typename P, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1022 |
inline T atomic_cmpxchg(T new_value, P* addr, T compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1023 |
verify_types<decorators, T>(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1024 |
typedef typename Decay<P>::type DecayedP; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1025 |
typedef typename Decay<T>::type DecayedT; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1026 |
DecayedT new_decayed_value = new_value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1027 |
DecayedT compare_decayed_value = compare_value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1028 |
const DecoratorSet expanded_decorators = DecoratorFixup< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1029 |
(!HasDecorator<decorators, MO_DECORATOR_MASK>::value) ? |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1030 |
(MO_SEQ_CST | decorators) : decorators>::value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1031 |
return atomic_cmpxchg_reduce_types<expanded_decorators>(new_decayed_value, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1032 |
const_cast<DecayedP*>(addr), |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1033 |
compare_decayed_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1034 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1035 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1036 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1037 |
inline T atomic_cmpxchg_at(T new_value, oop base, ptrdiff_t offset, T compare_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1038 |
verify_types<decorators, T>(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1039 |
typedef typename Decay<T>::type DecayedT; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1040 |
DecayedT new_decayed_value = new_value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1041 |
DecayedT compare_decayed_value = compare_value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1042 |
// Determine default memory ordering |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1043 |
const DecoratorSet expanded_decorators = DecoratorFixup< |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1044 |
(!HasDecorator<decorators, MO_DECORATOR_MASK>::value) ? |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1045 |
(MO_SEQ_CST | decorators) : decorators>::value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1046 |
// Potentially remember that we need compressed oop awareness |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1047 |
const DecoratorSet final_decorators = expanded_decorators | |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1048 |
(HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value ? |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1049 |
INTERNAL_CONVERT_COMPRESSED_OOP : INTERNAL_EMPTY); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1050 |
return PreRuntimeDispatch::atomic_cmpxchg_at<final_decorators>(new_decayed_value, base, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1051 |
offset, compare_decayed_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1052 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1053 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1054 |
template <DecoratorSet decorators, typename P, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1055 |
inline T atomic_xchg(T new_value, P* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1056 |
verify_types<decorators, T>(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1057 |
typedef typename Decay<P>::type DecayedP; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1058 |
typedef typename Decay<T>::type DecayedT; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1059 |
DecayedT new_decayed_value = new_value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1060 |
// atomic_xchg is only available in SEQ_CST flavour. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1061 |
const DecoratorSet expanded_decorators = DecoratorFixup<decorators | MO_SEQ_CST>::value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1062 |
return atomic_xchg_reduce_types<expanded_decorators>(new_decayed_value, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1063 |
const_cast<DecayedP*>(addr)); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1064 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1065 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1066 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1067 |
inline T atomic_xchg_at(T new_value, oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1068 |
verify_types<decorators, T>(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1069 |
typedef typename Decay<T>::type DecayedT; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1070 |
DecayedT new_decayed_value = new_value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1071 |
// atomic_xchg is only available in SEQ_CST flavour. |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1072 |
const DecoratorSet expanded_decorators = DecoratorFixup<decorators | MO_SEQ_CST | |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1073 |
(HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value ? |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1074 |
INTERNAL_CONVERT_COMPRESSED_OOP : INTERNAL_EMPTY)>::value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1075 |
return PreRuntimeDispatch::atomic_xchg_at<expanded_decorators>(new_decayed_value, base, offset); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1076 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1077 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1078 |
template <DecoratorSet decorators, typename T> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1079 |
inline bool arraycopy(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
|
1080 |
verify_types<decorators, T>(); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1081 |
typedef typename Decay<T>::type DecayedT; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1082 |
const DecoratorSet expanded_decorators = DecoratorFixup<decorators | IN_HEAP_ARRAY | IN_HEAP | |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1083 |
(HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value ? |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1084 |
INTERNAL_CONVERT_COMPRESSED_OOP : INTERNAL_EMPTY)>::value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1085 |
return PreRuntimeDispatch::arraycopy<expanded_decorators>(src_obj, dst_obj, |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1086 |
const_cast<DecayedT*>(src), |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1087 |
const_cast<DecayedT*>(dst), |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1088 |
length); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1089 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1090 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1091 |
template <DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1092 |
inline void clone(oop src, oop dst, size_t size) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1093 |
const DecoratorSet expanded_decorators = DecoratorFixup<decorators>::value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1094 |
PreRuntimeDispatch::clone<expanded_decorators>(src, dst, size); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1095 |
} |
49041
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
1096 |
|
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
1097 |
template <DecoratorSet decorators> |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
1098 |
inline oop resolve(oop obj) { |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
1099 |
const DecoratorSet expanded_decorators = DecoratorFixup<decorators>::value; |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
1100 |
return PreRuntimeDispatch::resolve<expanded_decorators>(obj); |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48966
diff
changeset
|
1101 |
} |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1102 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1103 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1104 |
template <DecoratorSet decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1105 |
template <DecoratorSet expected_decorators> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1106 |
void Access<decorators>::verify_decorators() { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1107 |
STATIC_ASSERT((~expected_decorators & decorators) == 0); // unexpected decorator used |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1108 |
const DecoratorSet barrier_strength_decorators = decorators & AS_DECORATOR_MASK; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1109 |
STATIC_ASSERT(barrier_strength_decorators == 0 || ( // make sure barrier strength decorators are disjoint if set |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1110 |
(barrier_strength_decorators ^ AS_NO_KEEPALIVE) == 0 || |
48966
e6eb66d2e765
8197454: Need Access decorator for storing oop into uninitialized location
kbarrett
parents:
48784
diff
changeset
|
1111 |
(barrier_strength_decorators ^ AS_DEST_NOT_INITIALIZED) == 0 || |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1112 |
(barrier_strength_decorators ^ AS_RAW) == 0 || |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1113 |
(barrier_strength_decorators ^ AS_NORMAL) == 0 |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1114 |
)); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1115 |
const DecoratorSet ref_strength_decorators = decorators & ON_DECORATOR_MASK; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1116 |
STATIC_ASSERT(ref_strength_decorators == 0 || ( // make sure ref strength decorators are disjoint if set |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1117 |
(ref_strength_decorators ^ ON_STRONG_OOP_REF) == 0 || |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1118 |
(ref_strength_decorators ^ ON_WEAK_OOP_REF) == 0 || |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1119 |
(ref_strength_decorators ^ ON_PHANTOM_OOP_REF) == 0 || |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1120 |
(ref_strength_decorators ^ ON_UNKNOWN_OOP_REF) == 0 |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1121 |
)); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1122 |
const DecoratorSet memory_ordering_decorators = decorators & MO_DECORATOR_MASK; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1123 |
STATIC_ASSERT(memory_ordering_decorators == 0 || ( // make sure memory ordering decorators are disjoint if set |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1124 |
(memory_ordering_decorators ^ MO_UNORDERED) == 0 || |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1125 |
(memory_ordering_decorators ^ MO_VOLATILE) == 0 || |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1126 |
(memory_ordering_decorators ^ MO_RELAXED) == 0 || |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1127 |
(memory_ordering_decorators ^ MO_ACQUIRE) == 0 || |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1128 |
(memory_ordering_decorators ^ MO_RELEASE) == 0 || |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1129 |
(memory_ordering_decorators ^ MO_SEQ_CST) == 0 |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1130 |
)); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1131 |
const DecoratorSet location_decorators = decorators & IN_DECORATOR_MASK; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1132 |
STATIC_ASSERT(location_decorators == 0 || ( // make sure location decorators are disjoint if set |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1133 |
(location_decorators ^ IN_ROOT) == 0 || |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1134 |
(location_decorators ^ IN_HEAP) == 0 || |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1135 |
(location_decorators ^ (IN_HEAP | IN_HEAP_ARRAY)) == 0 || |
48784
899b522ed65c
8194741: Refactor oops in constant pool from CDS to use the Access API
eosterlund
parents:
48628
diff
changeset
|
1136 |
(location_decorators ^ (IN_ROOT | IN_CONCURRENT_ROOT)) == 0 || |
899b522ed65c
8194741: Refactor oops in constant pool from CDS to use the Access API
eosterlund
parents:
48628
diff
changeset
|
1137 |
(location_decorators ^ (IN_ROOT | IN_ARCHIVE_ROOT)) == 0 |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1138 |
)); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1139 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1140 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff
changeset
|
1141 |
#endif // SHARE_VM_RUNTIME_ACCESS_INLINE_HPP |