Fri, 07 Sep 2012 12:04:16 -0400
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
Summary: Simple renaming to be consistent with instanceKlass->InstanceKlass renaming
Reviewed-by: stefank, jmasa
coleenp@4037 | 1 | /* |
coleenp@4037 | 2 | * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
coleenp@4037 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
coleenp@4037 | 4 | * |
coleenp@4037 | 5 | * This code is free software; you can redistribute it and/or modify it |
coleenp@4037 | 6 | * under the terms of the GNU General Public License version 2 only, as |
coleenp@4037 | 7 | * published by the Free Software Foundation. |
coleenp@4037 | 8 | * |
coleenp@4037 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
coleenp@4037 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
coleenp@4037 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
coleenp@4037 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
coleenp@4037 | 13 | * accompanied this code). |
coleenp@4037 | 14 | * |
coleenp@4037 | 15 | * You should have received a copy of the GNU General Public License version |
coleenp@4037 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
coleenp@4037 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
coleenp@4037 | 18 | * |
coleenp@4037 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
coleenp@4037 | 20 | * or visit www.oracle.com if you need additional information or have any |
coleenp@4037 | 21 | * questions. |
coleenp@4037 | 22 | * |
coleenp@4037 | 23 | */ |
coleenp@4037 | 24 | |
coleenp@4037 | 25 | #include "precompiled.hpp" |
coleenp@4037 | 26 | #include "classfile/javaClasses.hpp" |
coleenp@4037 | 27 | #include "classfile/systemDictionary.hpp" |
coleenp@4037 | 28 | #include "gc_implementation/shared/markSweep.inline.hpp" |
coleenp@4037 | 29 | #include "gc_interface/collectedHeap.inline.hpp" |
coleenp@4037 | 30 | #include "memory/genOopClosures.inline.hpp" |
coleenp@4037 | 31 | #include "memory/oopFactory.hpp" |
coleenp@4037 | 32 | #include "oops/instanceKlass.hpp" |
coleenp@4037 | 33 | #include "oops/instanceClassLoaderKlass.hpp" |
coleenp@4037 | 34 | #include "oops/instanceMirrorKlass.hpp" |
coleenp@4037 | 35 | #include "oops/instanceOop.hpp" |
coleenp@4037 | 36 | #include "oops/oop.inline.hpp" |
coleenp@4037 | 37 | #include "oops/symbol.hpp" |
coleenp@4037 | 38 | #include "runtime/handles.inline.hpp" |
coleenp@4037 | 39 | #ifndef SERIALGC |
coleenp@4037 | 40 | #include "gc_implementation/parNew/parOopClosures.inline.hpp" |
coleenp@4037 | 41 | #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" |
coleenp@4037 | 42 | #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" |
coleenp@4037 | 43 | #include "oops/oop.pcgc.inline.hpp" |
coleenp@4037 | 44 | #endif |
coleenp@4037 | 45 | |
coleenp@4037 | 46 | #define if_do_metadata_checked(closure, nv_suffix) \ |
coleenp@4037 | 47 | /* Make sure the non-virtual and the virtual versions match. */ \ |
coleenp@4037 | 48 | assert(closure->do_metadata##nv_suffix() == closure->do_metadata(), \ |
coleenp@4037 | 49 | "Inconsistency in do_metadata"); \ |
coleenp@4037 | 50 | if (closure->do_metadata##nv_suffix()) |
coleenp@4037 | 51 | |
coleenp@4047 | 52 | // Macro to define InstanceClassLoaderKlass::oop_oop_iterate for virtual/nonvirtual for |
coleenp@4037 | 53 | // all closures. Macros calling macros above for each oop size. |
coleenp@4037 | 54 | // Since ClassLoader objects have only a pointer to the loader_data, they are not |
coleenp@4037 | 55 | // compressed nor does the pointer move. |
coleenp@4037 | 56 | |
coleenp@4037 | 57 | #define InstanceClassLoaderKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix)\ |
coleenp@4037 | 58 | \ |
coleenp@4047 | 59 | int InstanceClassLoaderKlass:: \ |
coleenp@4037 | 60 | oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { \ |
coleenp@4037 | 61 | /* Get size before changing pointers */ \ |
coleenp@4037 | 62 | SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ |
coleenp@4037 | 63 | int size = InstanceKlass::oop_oop_iterate##nv_suffix(obj, closure); \ |
coleenp@4037 | 64 | \ |
coleenp@4037 | 65 | if_do_metadata_checked(closure, nv_suffix) { \ |
coleenp@4037 | 66 | ClassLoaderData* cld = java_lang_ClassLoader::loader_data(obj); \ |
coleenp@4037 | 67 | /* cld can be null if we have a non-registered class loader. */ \ |
coleenp@4037 | 68 | if (cld != NULL) { \ |
coleenp@4037 | 69 | closure->do_class_loader_data(cld); \ |
coleenp@4037 | 70 | } \ |
coleenp@4037 | 71 | } \ |
coleenp@4037 | 72 | \ |
coleenp@4037 | 73 | return size; \ |
coleenp@4037 | 74 | } |
coleenp@4037 | 75 | |
coleenp@4037 | 76 | #ifndef SERIALGC |
coleenp@4037 | 77 | #define InstanceClassLoaderKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \ |
coleenp@4037 | 78 | \ |
coleenp@4047 | 79 | int InstanceClassLoaderKlass:: \ |
coleenp@4037 | 80 | oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) { \ |
coleenp@4037 | 81 | /* Get size before changing pointers */ \ |
coleenp@4037 | 82 | SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ |
coleenp@4037 | 83 | int size = InstanceKlass::oop_oop_iterate_backwards##nv_suffix(obj, closure); \ |
coleenp@4037 | 84 | return size; \ |
coleenp@4037 | 85 | } |
coleenp@4037 | 86 | #endif // !SERIALGC |
coleenp@4037 | 87 | |
coleenp@4037 | 88 | |
coleenp@4037 | 89 | #define InstanceClassLoaderKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix) \ |
coleenp@4037 | 90 | \ |
coleenp@4047 | 91 | int InstanceClassLoaderKlass:: \ |
coleenp@4037 | 92 | oop_oop_iterate##nv_suffix##_m(oop obj, \ |
coleenp@4037 | 93 | OopClosureType* closure, \ |
coleenp@4037 | 94 | MemRegion mr) { \ |
coleenp@4037 | 95 | SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ |
coleenp@4037 | 96 | \ |
coleenp@4037 | 97 | int size = InstanceKlass::oop_oop_iterate##nv_suffix##_m(obj, closure, mr); \ |
coleenp@4037 | 98 | \ |
coleenp@4037 | 99 | if_do_metadata_checked(closure, nv_suffix) { \ |
coleenp@4037 | 100 | if (mr.contains(obj)) { \ |
coleenp@4037 | 101 | ClassLoaderData* cld = java_lang_ClassLoader::loader_data(obj); \ |
coleenp@4037 | 102 | /* cld can be null if we have a non-registered class loader. */ \ |
coleenp@4037 | 103 | if (cld != NULL) { \ |
coleenp@4037 | 104 | closure->do_class_loader_data(cld); \ |
coleenp@4037 | 105 | } \ |
coleenp@4037 | 106 | } \ |
coleenp@4037 | 107 | } \ |
coleenp@4037 | 108 | \ |
coleenp@4037 | 109 | return size; \ |
coleenp@4037 | 110 | } |
coleenp@4037 | 111 | |
coleenp@4037 | 112 | ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceClassLoaderKlass_OOP_OOP_ITERATE_DEFN) |
coleenp@4037 | 113 | ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceClassLoaderKlass_OOP_OOP_ITERATE_DEFN) |
coleenp@4037 | 114 | #ifndef SERIALGC |
coleenp@4037 | 115 | ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceClassLoaderKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN) |
coleenp@4037 | 116 | ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceClassLoaderKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN) |
coleenp@4037 | 117 | #endif // SERIALGC |
coleenp@4037 | 118 | ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceClassLoaderKlass_OOP_OOP_ITERATE_DEFN_m) |
coleenp@4037 | 119 | ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceClassLoaderKlass_OOP_OOP_ITERATE_DEFN_m) |
coleenp@4037 | 120 | |
coleenp@4047 | 121 | void InstanceClassLoaderKlass::oop_follow_contents(oop obj) { |
coleenp@4037 | 122 | InstanceKlass::oop_follow_contents(obj); |
coleenp@4037 | 123 | ClassLoaderData * const loader_data = java_lang_ClassLoader::loader_data(obj); |
coleenp@4037 | 124 | |
coleenp@4037 | 125 | // We must NULL check here, since the class loader |
coleenp@4037 | 126 | // can be found before the loader data has been set up. |
coleenp@4037 | 127 | if(loader_data != NULL) { |
coleenp@4037 | 128 | MarkSweep::follow_class_loader(loader_data); |
coleenp@4037 | 129 | } |
coleenp@4037 | 130 | } |
coleenp@4037 | 131 | |
coleenp@4037 | 132 | #ifndef SERIALGC |
coleenp@4047 | 133 | void InstanceClassLoaderKlass::oop_follow_contents(ParCompactionManager* cm, |
coleenp@4037 | 134 | oop obj) { |
coleenp@4037 | 135 | InstanceKlass::oop_follow_contents(cm, obj); |
coleenp@4037 | 136 | ClassLoaderData * const loader_data = java_lang_ClassLoader::loader_data(obj); |
coleenp@4037 | 137 | if (loader_data != NULL) { |
coleenp@4037 | 138 | PSParallelCompact::follow_class_loader(cm, loader_data); |
coleenp@4037 | 139 | } |
coleenp@4037 | 140 | } |
coleenp@4037 | 141 | |
coleenp@4047 | 142 | void InstanceClassLoaderKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { |
coleenp@4037 | 143 | InstanceKlass::oop_push_contents(pm, obj); |
coleenp@4037 | 144 | |
coleenp@4037 | 145 | // This is called by the young collector. It will already have taken care of |
coleenp@4037 | 146 | // all class loader data. So, we don't have to follow the class loader -> |
coleenp@4037 | 147 | // class loader data link. |
coleenp@4037 | 148 | } |
coleenp@4037 | 149 | |
coleenp@4047 | 150 | int InstanceClassLoaderKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { |
coleenp@4037 | 151 | InstanceKlass::oop_update_pointers(cm, obj); |
coleenp@4037 | 152 | ClassLoaderData * const loader_data = java_lang_ClassLoader::loader_data(obj); |
coleenp@4037 | 153 | if (loader_data != NULL) { |
coleenp@4037 | 154 | PSParallelCompact::adjust_class_loader(cm, loader_data); |
coleenp@4037 | 155 | } |
coleenp@4037 | 156 | return size_helper(); |
coleenp@4037 | 157 | } |
coleenp@4037 | 158 | #endif // SERIALGC |
coleenp@4037 | 159 |