author | stefank |
Thu, 22 Feb 2018 18:36:07 +0100 | |
changeset 49047 | 8f004146e407 |
parent 49005 | cc2b457f2589 |
child 49392 | 2956d0ece7a9 |
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 "memory/allocation.hpp" |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
31 |
#include "metaprogramming/conditional.hpp" |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
32 |
#include "utilities/macros.hpp" |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
33 |
|
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
34 |
#if INCLUDE_ALL_GCS |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
35 |
|
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
36 |
template<typename F> |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
37 |
class OopStorage::BasicParState::AlwaysTrueFn VALUE_OBJ_CLASS_SPEC { |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
38 |
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 |
public: |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
41 |
AlwaysTrueFn(F f) : _f(f) {} |
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 |
template<typename OopPtr> // [const] oop* |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
44 |
bool operator()(OopPtr ptr) const { _f(ptr); return true; } |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
45 |
}; |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
46 |
|
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
47 |
template<bool is_const, typename F> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
48 |
inline void OopStorage::BasicParState::iterate(F f) { |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
49 |
// 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
|
50 |
AlwaysTrueFn<F> atf_f(f); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
51 |
ensure_iteration_started(); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
52 |
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
|
53 |
while ((block = claim_next_block()) != NULL) { |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
54 |
block->iterate(atf_f); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
55 |
} |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
56 |
} |
48816
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
57 |
|
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
58 |
template<bool concurrent, bool is_const> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
59 |
template<typename F> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
60 |
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
|
61 |
_basic_state.template iterate<is_const>(f); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
62 |
} |
48816
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
63 |
|
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
64 |
template<bool concurrent, bool is_const> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
65 |
template<typename Closure> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
66 |
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
|
67 |
this->iterate(oop_fn(cl)); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
68 |
} |
48816
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
69 |
|
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
70 |
template<typename F> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
71 |
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
|
72 |
_basic_state.template iterate<false>(f); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
73 |
} |
48816
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
74 |
|
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
75 |
template<typename Closure> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
76 |
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
|
77 |
this->iterate(oop_fn(cl)); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
78 |
} |
48816
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
79 |
|
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
80 |
template<typename Closure> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
81 |
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
|
82 |
this->iterate(skip_null_fn(oop_fn(cl))); |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
83 |
} |
48816
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
84 |
|
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
85 |
template<typename IsAliveClosure, typename Closure> |
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
86 |
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
|
87 |
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
|
88 |
} |
48816
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
89 |
|
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
90 |
#endif // INCLUDE_ALL_GCS |
3495d6050efe
8194898: Move OopStorage inline definitions to an .inline.hpp
kbarrett
parents:
diff
changeset
|
91 |
|
49005
cc2b457f2589
8197992: Move the OopStorage::ParState type out of inline.hpp
pliden
parents:
48816
diff
changeset
|
92 |
#endif // SHARE_GC_SHARED_OOPSTORAGEPARSTATE_INLINE_HPP |