author | stefank |
Thu, 22 Feb 2018 18:36:32 +0100 | |
changeset 49048 | 4e8c86b75428 |
parent 49005 | cc2b457f2589 |
child 49392 | 2956d0ece7a9 |
permissions | -rw-r--r-- |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
1 |
/* |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
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 "memory/allocation.hpp" |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
30 |
#include "utilities/macros.hpp" |
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 |
#if INCLUDE_ALL_GCS |
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 |
////////////////////////////////////////////////////////////////////////////// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
35 |
// Support for parallel and optionally concurrent state iteration. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
36 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
37 |
// Parallel iteration is for the exclusive use of the GC. Other iteration |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
38 |
// clients must use serial iteration. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
39 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
40 |
// Concurrent Iteration |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
41 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
42 |
// Iteration involves the _active_list, which contains all of the blocks owned |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
43 |
// by a storage object. This is a doubly-linked list, linked through |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
44 |
// dedicated fields in the blocks. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
45 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
46 |
// At most one concurrent ParState can exist at a time for a given storage |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
47 |
// object. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
48 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
49 |
// A concurrent ParState sets the associated storage's |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
50 |
// _concurrent_iteration_active flag true when the state is constructed, and |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
51 |
// sets it false when the state is destroyed. These assignments are made with |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
52 |
// _active_mutex locked. Meanwhile, empty block deletion is not done while |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
53 |
// _concurrent_iteration_active is true. The flag check and the dependent |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
54 |
// removal of a block from the _active_list is performed with _active_mutex |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
55 |
// 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
|
56 |
// interfering with with each other. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
57 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
58 |
// Both allocate() and delete_empty_blocks_concurrent() lock the |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
59 |
// _allocate_mutex while performing their respective list manipulations, |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
60 |
// preventing them from interfering with each other. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
61 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
62 |
// When allocate() creates a new block, it is added to the front of the |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
63 |
// _active_list. Then _active_head is set to the new block. When concurrent |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
64 |
// iteration is started (by a parallel worker thread calling the state's |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
65 |
// iterate() function), the current _active_head is used as the initial block |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
66 |
// for the iteration, with iteration proceeding down the list headed by that |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
67 |
// block. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
68 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
69 |
// As a result, the list over which concurrent iteration operates is stable. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
70 |
// However, once the iteration is started, later allocations may add blocks to |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
71 |
// the front of the list that won't be examined by the iteration. And while |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
72 |
// the list is stable, concurrent allocate() and release() operations may |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
73 |
// change the set of allocated entries in a block at any time during the |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
74 |
// iteration. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
75 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
76 |
// 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
|
77 |
// 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
|
78 |
// 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
|
79 |
// 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
|
80 |
// 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
|
81 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
82 |
// An in-progress delete_empty_blocks_concurrent() operation can contend with |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
83 |
// the start of a concurrent iteration over the _active_mutex. Since both are |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
84 |
// under GC control, that potential contention can be eliminated by never |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
85 |
// scheduling both operations to run at the same time. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
86 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
87 |
// ParState<concurrent, is_const> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
88 |
// concurrent must be true if iteration is concurrent with the |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
89 |
// mutator, false if iteration is at a safepoint. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
90 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
91 |
// 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
|
92 |
// 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
|
93 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
94 |
// ParState([const] OopStorage* storage) |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
95 |
// 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
|
96 |
// concurrent ParState, empty block deletion for the associated storage |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
97 |
// is inhibited for the life of the ParState. There can be no more |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
98 |
// than one live concurrent ParState at a time for a given storage object. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
99 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
100 |
// template<typename F> void iterate(F f) |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
101 |
// 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
|
102 |
// 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
|
103 |
// 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
|
104 |
// 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
|
105 |
// 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
|
106 |
// 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
|
107 |
// mutator activity. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
108 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
109 |
// template<typename Closure> void oops_do(Closure* cl) |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
110 |
// Wrapper around iterate, providing an adaptation layer allowing |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
111 |
// 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
|
112 |
// 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
|
113 |
// 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
|
114 |
// 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
|
115 |
// at any time, due to mutator activity. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
116 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
117 |
// Optional operations, provided only if !concurrent && !is_const. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
118 |
// 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
|
119 |
// 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
|
120 |
// 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
|
121 |
// 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
|
122 |
// iteration infrastructure is inappropriate for concurrent iteration; |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
123 |
// 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
|
124 |
// 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
|
125 |
// 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
|
126 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
127 |
// template<typename Closure> void weak_oops_do(Closure* cl) |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
128 |
// template<typename IsAliveClosure, typename Closure> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
129 |
// void weak_oops_do(IsAliveClosure* is_alive, Closure* cl) |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
130 |
// Wrappers around iterate, providing an adaptation layer allowing |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
131 |
// 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
|
132 |
// Assume p is of type oop*. Then |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
133 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
134 |
// - 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
|
135 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
136 |
// - 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
|
137 |
// is convertible to bool. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
138 |
// |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
139 |
// 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
|
140 |
// 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
|
141 |
// invoked on p. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
142 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
143 |
class OopStorage::BasicParState VALUE_OBJ_CLASS_SPEC { |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
144 |
OopStorage* _storage; |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
145 |
void* volatile _next_block; |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
146 |
bool _concurrent; |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
147 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
148 |
// Noncopyable. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
149 |
BasicParState(const BasicParState&); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
150 |
BasicParState& operator=(const BasicParState&); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
151 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
152 |
void update_iteration_state(bool value); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
153 |
void ensure_iteration_started(); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
154 |
Block* claim_next_block(); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
155 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
156 |
// 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
|
157 |
template<typename F> class AlwaysTrueFn; |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
158 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
159 |
public: |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
160 |
BasicParState(OopStorage* storage, bool concurrent); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
161 |
~BasicParState(); |
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 is_const, typename F> void iterate(F f); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
164 |
}; |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
165 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
166 |
template<bool concurrent, bool is_const> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
167 |
class OopStorage::ParState VALUE_OBJ_CLASS_SPEC { |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
168 |
BasicParState _basic_state; |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
169 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
170 |
public: |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
171 |
ParState(const OopStorage* storage) : |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
172 |
// For simplicity, always recorded as non-const. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
173 |
_basic_state(const_cast<OopStorage*>(storage), concurrent) |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
174 |
{} |
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 |
template<typename F> void iterate(F f); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
177 |
template<typename Closure> void oops_do(Closure* cl); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
178 |
}; |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
179 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
180 |
template<> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
181 |
class OopStorage::ParState<false, false> VALUE_OBJ_CLASS_SPEC { |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
182 |
BasicParState _basic_state; |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
183 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
184 |
public: |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
185 |
ParState(OopStorage* storage) : |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
186 |
_basic_state(storage, false) |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
187 |
{} |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
188 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
189 |
template<typename F> void iterate(F f); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
190 |
template<typename Closure> void oops_do(Closure* cl); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
191 |
template<typename Closure> void weak_oops_do(Closure* cl); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
192 |
template<typename IsAliveClosure, typename Closure> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
193 |
void weak_oops_do(IsAliveClosure* is_alive, Closure* cl); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
194 |
}; |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
195 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
196 |
#endif // INCLUDE_ALL_GCS |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
197 |
|
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
diff
changeset
|
198 |
#endif // SHARE_GC_SHARED_OOPSTORAGEPARSTATE_HPP |