rev 7858 : 8073543: Circular include dependency between psScavenge.inline.hpp and psPromotionManager.inline.hpp
1 /*
2 * Copyright (c) 2011, 2013, 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 #include "precompiled.hpp"
26 #include "classfile/javaClasses.hpp"
27 #include "classfile/systemDictionary.hpp"
28 #include "gc_implementation/shared/markSweep.inline.hpp"
29 #include "gc_interface/collectedHeap.inline.hpp"
30 #include "memory/genOopClosures.inline.hpp"
31 #include "memory/iterator.inline.hpp"
32 #include "memory/oopFactory.hpp"
33 #include "oops/instanceKlass.hpp"
34 #include "oops/instanceClassLoaderKlass.hpp"
35 #include "oops/instanceMirrorKlass.hpp"
36 #include "oops/instanceOop.hpp"
37 #include "oops/oop.inline.hpp"
38 #include "oops/symbol.hpp"
39 #include "runtime/handles.inline.hpp"
40 #include "utilities/macros.hpp"
41 #if INCLUDE_ALL_GCS
42 #include "gc_implementation/parNew/parOopClosures.inline.hpp"
43 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
44 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
45 #include "oops/oop.pcgc.inline.hpp"
46 #endif // INCLUDE_ALL_GCS
47
48 // Macro to define InstanceClassLoaderKlass::oop_oop_iterate for virtual/nonvirtual for
49 // all closures. Macros calling macros above for each oop size.
50 // Since ClassLoader objects have only a pointer to the loader_data, they are not
51 // compressed nor does the pointer move.
52
53 #define InstanceClassLoaderKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix)\
54 \
55 int InstanceClassLoaderKlass:: \
56 oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { \
57 /* Get size before changing pointers */ \
58 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\
59 int size = InstanceKlass::oop_oop_iterate##nv_suffix(obj, closure); \
60 \
61 if_do_metadata_checked(closure, nv_suffix) { \
62 ClassLoaderData* cld = java_lang_ClassLoader::loader_data(obj); \
63 /* cld can be null if we have a non-registered class loader. */ \
64 if (cld != NULL) { \
65 closure->do_class_loader_data(cld); \
66 } \
67 } \
68 \
69 return size; \
70 }
71
72 #if INCLUDE_ALL_GCS
73 #define InstanceClassLoaderKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \
74 \
75 int InstanceClassLoaderKlass:: \
76 oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) { \
77 /* Get size before changing pointers */ \
78 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\
79 int size = InstanceKlass::oop_oop_iterate_backwards##nv_suffix(obj, closure); \
80 return size; \
81 }
82 #endif // INCLUDE_ALL_GCS
83
84
85 #define InstanceClassLoaderKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix) \
86 \
87 int InstanceClassLoaderKlass:: \
88 oop_oop_iterate##nv_suffix##_m(oop obj, \
89 OopClosureType* closure, \
90 MemRegion mr) { \
91 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\
92 \
93 int size = InstanceKlass::oop_oop_iterate##nv_suffix##_m(obj, closure, mr); \
94 \
95 if_do_metadata_checked(closure, nv_suffix) { \
96 if (mr.contains(obj)) { \
97 ClassLoaderData* cld = java_lang_ClassLoader::loader_data(obj); \
98 /* cld can be null if we have a non-registered class loader. */ \
99 if (cld != NULL) { \
100 closure->do_class_loader_data(cld); \
101 } \
102 } \
103 } \
104 \
105 return size; \
106 }
107
108 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceClassLoaderKlass_OOP_OOP_ITERATE_DEFN)
109 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceClassLoaderKlass_OOP_OOP_ITERATE_DEFN)
110 #if INCLUDE_ALL_GCS
111 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceClassLoaderKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
112 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceClassLoaderKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
113 #endif // INCLUDE_ALL_GCS
114 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceClassLoaderKlass_OOP_OOP_ITERATE_DEFN_m)
115 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceClassLoaderKlass_OOP_OOP_ITERATE_DEFN_m)
116
117 void InstanceClassLoaderKlass::oop_follow_contents(oop obj) {
118 InstanceKlass::oop_follow_contents(obj);
119 ClassLoaderData * const loader_data = java_lang_ClassLoader::loader_data(obj);
120
121 // We must NULL check here, since the class loader
122 // can be found before the loader data has been set up.
123 if(loader_data != NULL) {
124 MarkSweep::follow_class_loader(loader_data);
125 }
126 }
127
128 #if INCLUDE_ALL_GCS
129 void InstanceClassLoaderKlass::oop_follow_contents(ParCompactionManager* cm,
130 oop obj) {
131 InstanceKlass::oop_follow_contents(cm, obj);
132 ClassLoaderData * const loader_data = java_lang_ClassLoader::loader_data(obj);
133 if (loader_data != NULL) {
134 PSParallelCompact::follow_class_loader(cm, loader_data);
135 }
136 }
137
138 void InstanceClassLoaderKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
139 InstanceKlass::oop_push_contents(pm, obj);
140
141 // This is called by the young collector. It will already have taken care of
142 // all class loader data. So, we don't have to follow the class loader ->
143 // class loader data link.
144 }
145
146 int InstanceClassLoaderKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
147 InstanceKlass::oop_update_pointers(cm, obj);
148 return size_helper();
149 }
150 #endif // INCLUDE_ALL_GCS
151
--- EOF ---