author | eosterlund |
Tue, 12 Nov 2019 20:01:23 +0000 | |
changeset 59038 | b9a42ca342db |
parent 58709 | 662d9e1e2a60 |
permissions | -rw-r--r-- |
58705
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
1 |
/* |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
4 |
* |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
8 |
* |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
13 |
* accompanied this code). |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
14 |
* |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
18 |
* |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
21 |
* questions. |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
22 |
*/ |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
23 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
24 |
#ifndef SHARE_GC_Z_ZVALUE_INLINE_HPP |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
25 |
#define SHARE_GC_Z_ZVALUE_INLINE_HPP |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
26 |
|
58709 | 27 |
#include "gc/z/zCPU.inline.hpp" |
58705
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
28 |
#include "gc/z/zGlobals.hpp" |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
29 |
#include "gc/z/zNUMA.hpp" |
58706
d8e211419aaf
8232236: ZGC: Move ZThread inline funtions to zThread.inline.hpp
pliden
parents:
58705
diff
changeset
|
30 |
#include "gc/z/zThread.inline.hpp" |
58705
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
31 |
#include "gc/z/zUtils.hpp" |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
32 |
#include "gc/z/zValue.hpp" |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
33 |
#include "runtime/globals.hpp" |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
34 |
#include "utilities/align.hpp" |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
35 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
36 |
// |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
37 |
// Storage |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
38 |
// |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
39 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
40 |
template <typename T> uintptr_t ZValueStorage<T>::_end = 0; |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
41 |
template <typename T> uintptr_t ZValueStorage<T>::_top = 0; |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
42 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
43 |
template <typename S> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
44 |
uintptr_t ZValueStorage<S>::alloc(size_t size) { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
45 |
assert(size <= offset, "Allocation too large"); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
46 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
47 |
// Allocate entry in existing memory block |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
48 |
const uintptr_t addr = align_up(_top, S::alignment()); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
49 |
_top = addr + size; |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
50 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
51 |
if (_top < _end) { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
52 |
// Success |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
53 |
return addr; |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
54 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
55 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
56 |
// Allocate new block of memory |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
57 |
const size_t block_alignment = offset; |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
58 |
const size_t block_size = offset * S::count(); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
59 |
_top = ZUtils::alloc_aligned(block_alignment, block_size); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
60 |
_end = _top + offset; |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
61 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
62 |
// Retry allocation |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
63 |
return alloc(size); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
64 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
65 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
66 |
inline size_t ZContendedStorage::alignment() { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
67 |
return ZCacheLineSize; |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
68 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
69 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
70 |
inline uint32_t ZContendedStorage::count() { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
71 |
return 1; |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
72 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
73 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
74 |
inline uint32_t ZContendedStorage::id() { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
75 |
return 0; |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
76 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
77 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
78 |
inline size_t ZPerCPUStorage::alignment() { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
79 |
return sizeof(uintptr_t); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
80 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
81 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
82 |
inline uint32_t ZPerCPUStorage::count() { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
83 |
return ZCPU::count(); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
84 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
85 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
86 |
inline uint32_t ZPerCPUStorage::id() { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
87 |
return ZCPU::id(); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
88 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
89 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
90 |
inline size_t ZPerNUMAStorage::alignment() { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
91 |
return sizeof(uintptr_t); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
92 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
93 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
94 |
inline uint32_t ZPerNUMAStorage::count() { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
95 |
return ZNUMA::count(); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
96 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
97 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
98 |
inline uint32_t ZPerNUMAStorage::id() { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
99 |
return ZNUMA::id(); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
100 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
101 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
102 |
inline size_t ZPerWorkerStorage::alignment() { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
103 |
return sizeof(uintptr_t); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
104 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
105 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
106 |
inline uint32_t ZPerWorkerStorage::count() { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
107 |
return MAX2(ParallelGCThreads, ConcGCThreads); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
108 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
109 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
110 |
inline uint32_t ZPerWorkerStorage::id() { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
111 |
return ZThread::worker_id(); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
112 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
113 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
114 |
// |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
115 |
// Value |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
116 |
// |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
117 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
118 |
template <typename S, typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
119 |
inline uintptr_t ZValue<S, T>::value_addr(uint32_t value_id) const { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
120 |
return _addr + (value_id * S::offset); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
121 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
122 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
123 |
template <typename S, typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
124 |
inline ZValue<S, T>::ZValue() : |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
125 |
_addr(S::alloc(sizeof(T))) { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
126 |
// Initialize all instances |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
127 |
ZValueIterator<S, T> iter(this); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
128 |
for (T* addr; iter.next(&addr);) { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
129 |
::new (addr) T; |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
130 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
131 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
132 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
133 |
template <typename S, typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
134 |
inline ZValue<S, T>::ZValue(const T& value) : |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
135 |
_addr(S::alloc(sizeof(T))) { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
136 |
// Initialize all instances |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
137 |
ZValueIterator<S, T> iter(this); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
138 |
for (T* addr; iter.next(&addr);) { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
139 |
::new (addr) T(value); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
140 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
141 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
142 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
143 |
template <typename S, typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
144 |
inline const T* ZValue<S, T>::addr(uint32_t value_id) const { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
145 |
return reinterpret_cast<const T*>(value_addr(value_id)); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
146 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
147 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
148 |
template <typename S, typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
149 |
inline T* ZValue<S, T>::addr(uint32_t value_id) { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
150 |
return reinterpret_cast<T*>(value_addr(value_id)); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
151 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
152 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
153 |
template <typename S, typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
154 |
inline const T& ZValue<S, T>::get(uint32_t value_id) const { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
155 |
return *addr(value_id); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
156 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
157 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
158 |
template <typename S, typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
159 |
inline T& ZValue<S, T>::get(uint32_t value_id) { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
160 |
return *addr(value_id); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
161 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
162 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
163 |
template <typename S, typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
164 |
inline void ZValue<S, T>::set(const T& value, uint32_t value_id) { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
165 |
get(value_id) = value; |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
166 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
167 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
168 |
template <typename S, typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
169 |
inline void ZValue<S, T>::set_all(const T& value) { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
170 |
ZValueIterator<S, T> iter(this); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
171 |
for (T* addr; iter.next(&addr);) { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
172 |
*addr = value; |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
173 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
174 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
175 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
176 |
template <typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
177 |
inline ZContended<T>::ZContended() : |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
178 |
ZValue<ZContendedStorage, T>() {} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
179 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
180 |
template <typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
181 |
inline ZContended<T>::ZContended(const T& value) : |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
182 |
ZValue<ZContendedStorage, T>(value) {} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
183 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
184 |
template <typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
185 |
inline ZPerCPU<T>::ZPerCPU() : |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
186 |
ZValue<ZPerCPUStorage, T>() {} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
187 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
188 |
template <typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
189 |
inline ZPerCPU<T>::ZPerCPU(const T& value) : |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
190 |
ZValue<ZPerCPUStorage, T>(value) {} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
191 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
192 |
template <typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
193 |
inline ZPerNUMA<T>::ZPerNUMA() : |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
194 |
ZValue<ZPerNUMAStorage, T>() {} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
195 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
196 |
template <typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
197 |
inline ZPerNUMA<T>::ZPerNUMA(const T& value) : |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
198 |
ZValue<ZPerNUMAStorage, T>(value) {} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
199 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
200 |
template <typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
201 |
inline ZPerWorker<T>::ZPerWorker() : |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
202 |
ZValue<ZPerWorkerStorage, T>() {} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
203 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
204 |
template <typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
205 |
inline ZPerWorker<T>::ZPerWorker(const T& value) : |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
206 |
ZValue<ZPerWorkerStorage, T>(value) {} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
207 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
208 |
// |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
209 |
// Iterator |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
210 |
// |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
211 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
212 |
template <typename S, typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
213 |
inline ZValueIterator<S, T>::ZValueIterator(ZValue<S, T>* value) : |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
214 |
_value(value), |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
215 |
_value_id(0) {} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
216 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
217 |
template <typename S, typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
218 |
inline bool ZValueIterator<S, T>::next(T** value) { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
219 |
if (_value_id < S::count()) { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
220 |
*value = _value->addr(_value_id++); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
221 |
return true; |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
222 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
223 |
return false; |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
224 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
225 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
226 |
template <typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
227 |
inline ZPerCPUIterator<T>::ZPerCPUIterator(ZPerCPU<T>* value) : |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
228 |
ZValueIterator<ZPerCPUStorage, T>(value) {} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
229 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
230 |
template <typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
231 |
inline ZPerNUMAIterator<T>::ZPerNUMAIterator(ZPerNUMA<T>* value) : |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
232 |
ZValueIterator<ZPerNUMAStorage, T>(value) {} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
233 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
234 |
template <typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
235 |
inline ZPerWorkerIterator<T>::ZPerWorkerIterator(ZPerWorker<T>* value) : |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
236 |
ZValueIterator<ZPerWorkerStorage, T>(value) {} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
237 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
238 |
template <typename S, typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
239 |
inline ZValueConstIterator<S, T>::ZValueConstIterator(const ZValue<S, T>* value) : |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
240 |
_value(value), |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
241 |
_value_id(0) {} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
242 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
243 |
template <typename S, typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
244 |
inline bool ZValueConstIterator<S, T>::next(const T** value) { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
245 |
if (_value_id < S::count()) { |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
246 |
*value = _value->addr(_value_id++); |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
247 |
return true; |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
248 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
249 |
return false; |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
250 |
} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
251 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
252 |
template <typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
253 |
inline ZPerCPUConstIterator<T>::ZPerCPUConstIterator(const ZPerCPU<T>* value) : |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
254 |
ZValueConstIterator<ZPerCPUStorage, T>(value) {} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
255 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
256 |
template <typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
257 |
inline ZPerNUMAConstIterator<T>::ZPerNUMAConstIterator(const ZPerNUMA<T>* value) : |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
258 |
ZValueConstIterator<ZPerNUMAStorage, T>(value) {} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
259 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
260 |
template <typename T> |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
261 |
inline ZPerWorkerConstIterator<T>::ZPerWorkerConstIterator(const ZPerWorker<T>* value) : |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
262 |
ZValueConstIterator<ZPerWorkerStorage, T>(value) {} |
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
263 |
|
f5662bdbee4a
8232235: ZGC: Move ZValue inline funtions to zValue.inline.hpp
pliden
parents:
diff
changeset
|
264 |
#endif // SHARE_GC_Z_ZVALUE_INLINE_HPP |