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