specialized_oop_closures.hpp revision 8413:92457dfb91bd
1/*
2 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25#ifndef SHARE_VM_GC_SHARED_SPECIALIZED_OOP_CLOSURES_HPP
26#define SHARE_VM_GC_SHARED_SPECIALIZED_OOP_CLOSURES_HPP
27
28#include "utilities/macros.hpp"
29#if INCLUDE_ALL_GCS
30#include "gc/g1/g1_specialized_oop_closures.hpp"
31#endif // INCLUDE_ALL_GCS
32
33// The following OopClosure types get specialized versions of
34// "oop_oop_iterate" that invoke the closures' do_oop methods
35// non-virtually, using a mechanism defined in this file.  Extend these
36// macros in the obvious way to add specializations for new closures.
37
38// Forward declarations.
39class OopClosure;
40class OopsInGenClosure;
41// DefNew
42class ScanClosure;
43class FastScanClosure;
44class FilteringClosure;
45// ParNew
46class ParScanWithBarrierClosure;
47class ParScanWithoutBarrierClosure;
48// CMS
49class MarkRefsIntoAndScanClosure;
50class Par_MarkRefsIntoAndScanClosure;
51class PushAndMarkClosure;
52class Par_PushAndMarkClosure;
53class PushOrMarkClosure;
54class Par_PushOrMarkClosure;
55class CMSKeepAliveClosure;
56class CMSInnerParMarkAndPushClosure;
57// Misc
58class NoHeaderExtendedOopClosure;
59
60// This macro applies an argument macro to all OopClosures for which we
61// want specialized bodies of "oop_oop_iterate".  The arguments to "f" are:
62//   "f(closureType, non_virtual)"
63// where "closureType" is the name of the particular subclass of ExtendedOopClosure,
64// and "non_virtual" will be the string "_nv" if the closure type should
65// have its "do_oop" method invoked non-virtually, or else the
66// string "_v".  ("ExtendedOopClosure" itself will be the only class in the latter
67// category.)
68
69// This is split into several because of a Visual C++ 6.0 compiler bug
70// where very long macros cause the compiler to crash
71
72#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_S(f)       \
73  f(ScanClosure,_nv)                                    \
74  f(FastScanClosure,_nv)                                \
75  f(FilteringClosure,_nv)
76
77#if INCLUDE_ALL_GCS
78#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_P(f)       \
79  f(ParScanWithBarrierClosure,_nv)                      \
80  f(ParScanWithoutBarrierClosure,_nv)
81#else  // INCLUDE_ALL_GCS
82#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_P(f)
83#endif // INCLUDE_ALL_GCS
84
85#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(f)       \
86  f(NoHeaderExtendedOopClosure,_nv)                     \
87  SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_S(f)             \
88  SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_P(f)
89
90#if INCLUDE_ALL_GCS
91#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_CMS(f)     \
92  f(MarkRefsIntoAndScanClosure,_nv)                     \
93  f(Par_MarkRefsIntoAndScanClosure,_nv)                 \
94  f(PushAndMarkClosure,_nv)                             \
95  f(Par_PushAndMarkClosure,_nv)                         \
96  f(PushOrMarkClosure,_nv)                              \
97  f(Par_PushOrMarkClosure,_nv)                          \
98  f(CMSKeepAliveClosure,_nv)                            \
99  f(CMSInnerParMarkAndPushClosure,_nv)
100#endif
101
102#if INCLUDE_ALL_GCS
103#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f)       \
104  SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_CMS(f)           \
105  SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_G1(f)
106#else  // INCLUDE_ALL_GCS
107#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f)
108#endif // INCLUDE_ALL_GCS
109
110
111// We separate these out, because sometime the general one has
112// a different definition from the specialized ones, and sometimes it
113// doesn't.
114
115#define ALL_OOP_OOP_ITERATE_CLOSURES_1(f)               \
116  f(ExtendedOopClosure,_v)                              \
117  SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(f)
118
119#define ALL_OOP_OOP_ITERATE_CLOSURES_2(f)               \
120  SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f)
121
122#if INCLUDE_ALL_GCS
123// This macro applies an argument macro to all OopClosures for which we
124// want specialized bodies of a family of methods related to
125// "par_oop_iterate".  The arguments to f are the same as above.
126// The "root_class" is the most general class to define; this may be
127// "OopClosure" in some applications and "OopsInGenClosure" in others.
128
129#define SPECIALIZED_PAR_OOP_ITERATE_CLOSURES(f)        \
130  f(MarkRefsIntoAndScanClosure,_nv)                    \
131  f(PushAndMarkClosure,_nv)                            \
132  f(Par_MarkRefsIntoAndScanClosure,_nv)                \
133  f(Par_PushAndMarkClosure,_nv)
134
135#define ALL_PAR_OOP_ITERATE_CLOSURES(f)                \
136  f(ExtendedOopClosure,_v)                             \
137  SPECIALIZED_PAR_OOP_ITERATE_CLOSURES(f)
138#endif // INCLUDE_ALL_GCS
139
140// This macro applies an argument macro to all OopClosures for which we
141// want specialized bodies of a family of methods related to
142// "oops_since_save_marks_do".  The arguments to f are the same as above.
143// The "root_class" is the most general class to define; this may be
144// "OopClosure" in some applications and "OopsInGenClosure" in others.
145
146#define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_S(f) \
147  f(ScanClosure,_nv)                                     \
148  f(FastScanClosure,_nv)
149
150#if INCLUDE_ALL_GCS
151#define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_P(f) \
152  f(ParScanWithBarrierClosure,_nv)                       \
153  f(ParScanWithoutBarrierClosure,_nv)
154#else  // INCLUDE_ALL_GCS
155#define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_P(f)
156#endif // INCLUDE_ALL_GCS
157
158#define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG(f)  \
159  SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_S(f)      \
160  SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_P(f)
161
162#define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(f)        \
163  SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG(f)
164
165// We separate these out, because sometime the general one has
166// a different definition from the specialized ones, and sometimes it
167// doesn't.
168
169#define ALL_SINCE_SAVE_MARKS_CLOSURES(f)                \
170  f(OopsInGenClosure,_v)                                \
171  SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(f)
172
173#endif // SHARE_VM_GC_SHARED_SPECIALIZED_OOP_CLOSURES_HPP
174