author | kbarrett |
Wed, 21 Aug 2019 18:42:30 -0400 | |
changeset 57828 | 35db8fba55f9 |
parent 52421 | 3021c1ad958b |
permissions | -rw-r--r-- |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
1 |
/* |
57828
35db8fba55f9
8227054: ServiceThread needs to know about all OopStorage objects
kbarrett
parents:
52421
diff
changeset
|
2 |
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
4 |
* |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
8 |
* |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
13 |
* accompanied this code). |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
14 |
* |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
18 |
* |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
21 |
* questions. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
22 |
* |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
23 |
*/ |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
24 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
25 |
#ifndef SHARE_GC_SHARED_OOPSTORAGEPARSTATE_HPP |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
26 |
#define SHARE_GC_SHARED_OOPSTORAGEPARSTATE_HPP |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
27 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
28 |
#include "gc/shared/oopStorage.hpp" |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
29 |
#include "utilities/macros.hpp" |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
30 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
31 |
////////////////////////////////////////////////////////////////////////////// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
32 |
// Support for parallel and optionally concurrent state iteration. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
33 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
34 |
// Concurrent Iteration |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
35 |
// |
50209
2fdce199fcb9
8202863: Rename OopStorage inner collection classes
kbarrett
parents:
49977
diff
changeset
|
36 |
// Iteration involves the _active_array (an ActiveArray), which contains all |
2fdce199fcb9
8202863: Rename OopStorage inner collection classes
kbarrett
parents:
49977
diff
changeset
|
37 |
// of the blocks owned by a storage object. |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
38 |
// |
52037
d2a6c3cbc110
8211718: Supporting multiple concurrent OopStorage iterators
eosterlund
parents:
50954
diff
changeset
|
39 |
// A concurrent ParState increments the associated storage's |
d2a6c3cbc110
8211718: Supporting multiple concurrent OopStorage iterators
eosterlund
parents:
50954
diff
changeset
|
40 |
// _concurrent_iteration_count when the state is constructed, and |
d2a6c3cbc110
8211718: Supporting multiple concurrent OopStorage iterators
eosterlund
parents:
50954
diff
changeset
|
41 |
// decrements it when the state is destroyed. These assignments are made with |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
42 |
// _active_mutex locked. Meanwhile, empty block deletion is not done while |
52037
d2a6c3cbc110
8211718: Supporting multiple concurrent OopStorage iterators
eosterlund
parents:
50954
diff
changeset
|
43 |
// _concurrent_iteration_count is non-zero. The counter check and the dependent |
49977
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
44 |
// removal of a block from the _active_array is performed with _active_mutex |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
45 |
// locked. This prevents concurrent iteration and empty block deletion from |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
46 |
// interfering with with each other. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
47 |
// |
52421
3021c1ad958b
8210986: Add OopStorage cleanup to ServiceThread
kbarrett
parents:
52037
diff
changeset
|
48 |
// Both allocate() and delete_empty_blocks() lock the |
50954
f85092465b0c
8204834: Fix confusing "allocate" naming in OopStorage
kbarrett
parents:
50209
diff
changeset
|
49 |
// _allocation_mutex while performing their respective list and array |
49977
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
50 |
// manipulations, preventing them from interfering with each other. |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
51 |
// |
49977
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
52 |
// When allocate() creates a new block, it is added to the end of the |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
53 |
// _active_array. Then _active_array's _block_count is incremented to account |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
54 |
// for the new block. When concurrent iteration is started (by a parallel |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
55 |
// worker thread calling the state's iterate() function), the current |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
56 |
// _active_array and its _block_count are captured for use by the iteration, |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
57 |
// with iteration processing all blocks in that array up to that block count. |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
58 |
// |
49977
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
59 |
// As a result, the sequence over which concurrent iteration operates is |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
60 |
// stable. However, once the iteration is started, later allocations may add |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
61 |
// blocks to the end of the array that won't be examined by the iteration. |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
62 |
// An allocation may even require expansion of the array, so the iteration is |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
63 |
// no longer processing the current array, but rather the previous one. |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
64 |
// And while the sequence is stable, concurrent allocate() and release() |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
65 |
// operations may change the set of allocated entries in a block at any time |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
66 |
// during the iteration. |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
67 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
68 |
// As a result, a concurrent iteration handler must accept that some |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
69 |
// allocations and releases that occur after the iteration started will not be |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
70 |
// seen by the iteration. Further, some may overlap examination by the |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
71 |
// iteration. To help with this, allocate() and release() have an invariant |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
72 |
// that an entry's value must be NULL when it is not in use. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
73 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
74 |
// ParState<concurrent, is_const> |
52037
d2a6c3cbc110
8211718: Supporting multiple concurrent OopStorage iterators
eosterlund
parents:
50954
diff
changeset
|
75 |
// concurrent must be true if iteration may be concurrent with the |
d2a6c3cbc110
8211718: Supporting multiple concurrent OopStorage iterators
eosterlund
parents:
50954
diff
changeset
|
76 |
// mutators. |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
77 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
78 |
// is_const must be true if the iteration is over a constant storage |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
79 |
// object, false if the iteration may modify the storage object. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
80 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
81 |
// ParState([const] OopStorage* storage) |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
82 |
// Construct an object for managing an iteration over storage. For a |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
83 |
// concurrent ParState, empty block deletion for the associated storage |
52037
d2a6c3cbc110
8211718: Supporting multiple concurrent OopStorage iterators
eosterlund
parents:
50954
diff
changeset
|
84 |
// is inhibited for the life of the ParState. |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
85 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
86 |
// template<typename F> void iterate(F f) |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
87 |
// Repeatedly claims a block from the associated storage that has |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
88 |
// not been processed by this iteration (possibly by other threads), |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
89 |
// and applies f to each entry in the claimed block. Assume p is of |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
90 |
// type const oop* or oop*, according to is_const. Then f(p) must be |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
91 |
// a valid expression whose value is ignored. Concurrent uses must |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
92 |
// be prepared for an entry's value to change at any time, due to |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
93 |
// mutator activity. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
94 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
95 |
// template<typename Closure> void oops_do(Closure* cl) |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
96 |
// Wrapper around iterate, providing an adaptation layer allowing |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
97 |
// the use of OopClosures and similar objects for iteration. Assume |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
98 |
// p is of type const oop* or oop*, according to is_const. Then |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
99 |
// cl->do_oop(p) must be a valid expression whose value is ignored. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
100 |
// Concurrent uses must be prepared for the entry's value to change |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
101 |
// at any time, due to mutator activity. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
102 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
103 |
// Optional operations, provided only if !concurrent && !is_const. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
104 |
// These are not provided when is_const, because the storage object |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
105 |
// may be modified by the iteration infrastructure, even if the |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
106 |
// provided closure doesn't modify the storage object. These are not |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
107 |
// provided when concurrent because any pre-filtering behavior by the |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
108 |
// iteration infrastructure is inappropriate for concurrent iteration; |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
109 |
// modifications of the storage by the mutator could result in the |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
110 |
// pre-filtering being applied (successfully or not) to objects that |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
111 |
// are unrelated to what the closure finds in the entry. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
112 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
113 |
// template<typename Closure> void weak_oops_do(Closure* cl) |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
114 |
// template<typename IsAliveClosure, typename Closure> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
115 |
// void weak_oops_do(IsAliveClosure* is_alive, Closure* cl) |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
116 |
// Wrappers around iterate, providing an adaptation layer allowing |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
117 |
// the use of is-alive closures and OopClosures for iteration. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
118 |
// Assume p is of type oop*. Then |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
119 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
120 |
// - cl->do_oop(p) must be a valid expression whose value is ignored. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
121 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
122 |
// - is_alive->do_object_b(*p) must be a valid expression whose value |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
123 |
// is convertible to bool. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
124 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
125 |
// If *p == NULL then neither is_alive nor cl will be invoked for p. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
126 |
// If is_alive->do_object_b(*p) is false, then cl will not be |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
127 |
// invoked on p. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
128 |
|
49392
2956d0ece7a9
8199282: Remove ValueObj class for allocation subclassing for gc code
coleenp
parents:
49005
diff
changeset
|
129 |
class OopStorage::BasicParState { |
49977
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
130 |
const OopStorage* _storage; |
50209
2fdce199fcb9
8202863: Rename OopStorage inner collection classes
kbarrett
parents:
49977
diff
changeset
|
131 |
ActiveArray* _active_array; |
49977
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
132 |
size_t _block_count; |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
133 |
volatile size_t _next_block; |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
134 |
uint _estimated_thread_count; |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
135 |
bool _concurrent; |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
136 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
137 |
// Noncopyable. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
138 |
BasicParState(const BasicParState&); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
139 |
BasicParState& operator=(const BasicParState&); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
140 |
|
49977
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
141 |
struct IterationData; |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
142 |
|
52037
d2a6c3cbc110
8211718: Supporting multiple concurrent OopStorage iterators
eosterlund
parents:
50954
diff
changeset
|
143 |
void update_concurrent_iteration_count(int value); |
49977
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
144 |
bool claim_next_segment(IterationData* data); |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
145 |
bool finish_iteration(const IterationData* data) const; |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
146 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
147 |
// Wrapper for iteration handler; ignore handler result and return true. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
148 |
template<typename F> class AlwaysTrueFn; |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
149 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
150 |
public: |
49977
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
151 |
BasicParState(const OopStorage* storage, |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
152 |
uint estimated_thread_count, |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
153 |
bool concurrent); |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
154 |
~BasicParState(); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
155 |
|
57828
35db8fba55f9
8227054: ServiceThread needs to know about all OopStorage objects
kbarrett
parents:
52421
diff
changeset
|
156 |
const OopStorage* storage() const { return _storage; } |
35db8fba55f9
8227054: ServiceThread needs to know about all OopStorage objects
kbarrett
parents:
52421
diff
changeset
|
157 |
|
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
158 |
template<bool is_const, typename F> void iterate(F f); |
49977
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
159 |
|
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
160 |
static uint default_estimated_thread_count(bool concurrent); |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
161 |
}; |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
162 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
163 |
template<bool concurrent, bool is_const> |
49392
2956d0ece7a9
8199282: Remove ValueObj class for allocation subclassing for gc code
coleenp
parents:
49005
diff
changeset
|
164 |
class OopStorage::ParState { |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
165 |
BasicParState _basic_state; |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
166 |
|
49977
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
167 |
typedef typename Conditional<is_const, |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
168 |
const OopStorage*, |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
169 |
OopStorage*>::type StoragePtr; |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
170 |
|
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
171 |
public: |
49977
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
172 |
ParState(StoragePtr storage, |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
173 |
uint estimated_thread_count = BasicParState::default_estimated_thread_count(concurrent)) : |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
174 |
_basic_state(storage, estimated_thread_count, concurrent) |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
175 |
{} |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
176 |
|
57828
35db8fba55f9
8227054: ServiceThread needs to know about all OopStorage objects
kbarrett
parents:
52421
diff
changeset
|
177 |
const OopStorage* storage() const { return _basic_state.storage(); } |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
178 |
template<typename F> void iterate(F f); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
179 |
template<typename Closure> void oops_do(Closure* cl); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
180 |
}; |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
181 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
182 |
template<> |
49392
2956d0ece7a9
8199282: Remove ValueObj class for allocation subclassing for gc code
coleenp
parents:
49005
diff
changeset
|
183 |
class OopStorage::ParState<false, false> { |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
184 |
BasicParState _basic_state; |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
185 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
186 |
public: |
49977
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
187 |
ParState(OopStorage* storage, |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
188 |
uint estimated_thread_count = BasicParState::default_estimated_thread_count(false)) : |
9f758f0bb058
8200557: OopStorage parallel iteration scales poorly
kbarrett
parents:
49711
diff
changeset
|
189 |
_basic_state(storage, estimated_thread_count, false) |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
190 |
{} |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
191 |
|
57828
35db8fba55f9
8227054: ServiceThread needs to know about all OopStorage objects
kbarrett
parents:
52421
diff
changeset
|
192 |
const OopStorage* storage() const { return _basic_state.storage(); } |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
193 |
template<typename F> void iterate(F f); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
194 |
template<typename Closure> void oops_do(Closure* cl); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
195 |
template<typename Closure> void weak_oops_do(Closure* cl); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
196 |
template<typename IsAliveClosure, typename Closure> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
197 |
void weak_oops_do(IsAliveClosure* is_alive, Closure* cl); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
198 |
}; |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
199 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
200 |
#endif // SHARE_GC_SHARED_OOPSTORAGEPARSTATE_HPP |