author | stefank |
Fri, 06 Apr 2018 11:37:33 +0200 | |
changeset 49711 | 4a7addb5762c |
parent 49392 | 2956d0ece7a9 |
child 49977 | 9f758f0bb058 |
permissions | -rw-r--r-- |
48816
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
1 |
/* |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
4 |
* |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
8 |
* |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
13 |
* accompanied this code). |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
14 |
* |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
18 |
* |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
21 |
* questions. |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
22 |
* |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
23 |
*/ |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
24 |
|
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
25 |
#ifndef SHARE_GC_SHARED_OOPSTORAGEPARSTATE_INLINE_HPP |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
26 |
#define SHARE_GC_SHARED_OOPSTORAGEPARSTATE_INLINE_HPP |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
27 |
|
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
28 |
#include "gc/shared/oopStorage.inline.hpp" |
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
29 |
#include "gc/shared/oopStorageParState.hpp" |
48816
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
30 |
#include "metaprogramming/conditional.hpp" |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
31 |
#include "utilities/macros.hpp" |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
32 |
|
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
33 |
template<typename F> |
49392
2956d0ece7a9
8199282: Remove ValueObj class for allocation subclassing for gc code
coleenp
parents:
49005
diff
changeset
|
34 |
class OopStorage::BasicParState::AlwaysTrueFn { |
48816
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
35 |
F _f; |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
36 |
|
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
37 |
public: |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
38 |
AlwaysTrueFn(F f) : _f(f) {} |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
39 |
|
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
40 |
template<typename OopPtr> // [const] oop* |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
41 |
bool operator()(OopPtr ptr) const { _f(ptr); return true; } |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
42 |
}; |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
43 |
|
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
44 |
template<bool is_const, typename F> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
45 |
inline void OopStorage::BasicParState::iterate(F f) { |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
46 |
// Wrap f in ATF so we can use Block::iterate. |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
47 |
AlwaysTrueFn<F> atf_f(f); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
48 |
ensure_iteration_started(); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
49 |
typename Conditional<is_const, const Block*, Block*>::type block; |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
50 |
while ((block = claim_next_block()) != NULL) { |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
51 |
block->iterate(atf_f); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
52 |
} |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
53 |
} |
48816
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
54 |
|
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
55 |
template<bool concurrent, bool is_const> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
56 |
template<typename F> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
57 |
inline void OopStorage::ParState<concurrent, is_const>::iterate(F f) { |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
58 |
_basic_state.template iterate<is_const>(f); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
59 |
} |
48816
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
60 |
|
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
61 |
template<bool concurrent, bool is_const> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
62 |
template<typename Closure> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
63 |
inline void OopStorage::ParState<concurrent, is_const>::oops_do(Closure* cl) { |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
64 |
this->iterate(oop_fn(cl)); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
65 |
} |
48816
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
66 |
|
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
67 |
template<typename F> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
68 |
inline void OopStorage::ParState<false, false>::iterate(F f) { |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
69 |
_basic_state.template iterate<false>(f); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
70 |
} |
48816
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
71 |
|
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
72 |
template<typename Closure> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
73 |
inline void OopStorage::ParState<false, false>::oops_do(Closure* cl) { |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
74 |
this->iterate(oop_fn(cl)); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
75 |
} |
48816
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
76 |
|
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
77 |
template<typename Closure> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
78 |
inline void OopStorage::ParState<false, false>::weak_oops_do(Closure* cl) { |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
79 |
this->iterate(skip_null_fn(oop_fn(cl))); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
80 |
} |
48816
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
81 |
|
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
82 |
template<typename IsAliveClosure, typename Closure> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
83 |
inline void OopStorage::ParState<false, false>::weak_oops_do(IsAliveClosure* is_alive, Closure* cl) { |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
84 |
this->iterate(if_alive_fn(is_alive, oop_fn(cl))); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
85 |
} |
48816
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
86 |
|
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
87 |
#endif // SHARE_GC_SHARED_OOPSTORAGEPARSTATE_INLINE_HPP |