src/share/vm/oops/instanceClassLoaderKlass.cpp

Wed, 23 Jan 2013 13:02:39 -0500

author
jprovino
date
Wed, 23 Jan 2013 13:02:39 -0500
changeset 4542
db9981fd3124
parent 4047
aed758eda82a
child 6169
ad72068ac41e
permissions
-rw-r--r--

8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
Summary: Rename INCLUDE_ALTERNATE_GCS to INCLUDE_ALL_GCS and replace SERIALGC with INCLUDE_ALL_GCS.
Reviewed-by: coleenp, stefank

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

mercurial