hotspot/src/share/vm/oops/instanceKlass.cpp
changeset 15484 7395ace8a11a
parent 15437 eabd4555d072
parent 15482 470d0b0c09f1
child 15601 df8faef6efaf
equal deleted inserted replaced
15470:998186997e90 15484:7395ace8a11a
    54 #include "runtime/javaCalls.hpp"
    54 #include "runtime/javaCalls.hpp"
    55 #include "runtime/mutexLocker.hpp"
    55 #include "runtime/mutexLocker.hpp"
    56 #include "runtime/thread.inline.hpp"
    56 #include "runtime/thread.inline.hpp"
    57 #include "services/threadService.hpp"
    57 #include "services/threadService.hpp"
    58 #include "utilities/dtrace.hpp"
    58 #include "utilities/dtrace.hpp"
    59 #ifndef SERIALGC
    59 #include "utilities/macros.hpp"
       
    60 #if INCLUDE_ALL_GCS
    60 #include "gc_implementation/concurrentMarkSweep/cmsOopClosures.inline.hpp"
    61 #include "gc_implementation/concurrentMarkSweep/cmsOopClosures.inline.hpp"
    61 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
    62 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
    62 #include "gc_implementation/g1/g1OopClosures.inline.hpp"
    63 #include "gc_implementation/g1/g1OopClosures.inline.hpp"
    63 #include "gc_implementation/g1/g1RemSet.inline.hpp"
    64 #include "gc_implementation/g1/g1RemSet.inline.hpp"
    64 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
    65 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
    65 #include "gc_implementation/parNew/parOopClosures.inline.hpp"
    66 #include "gc_implementation/parNew/parOopClosures.inline.hpp"
    66 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp"
    67 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp"
    67 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
    68 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
    68 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
    69 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
    69 #include "oops/oop.pcgc.inline.hpp"
    70 #include "oops/oop.pcgc.inline.hpp"
    70 #endif
    71 #endif // INCLUDE_ALL_GCS
    71 #ifdef COMPILER1
    72 #ifdef COMPILER1
    72 #include "c1/c1_Compiler.hpp"
    73 #include "c1/c1_Compiler.hpp"
    73 #endif
    74 #endif
    74 
    75 
    75 #ifdef DTRACE_ENABLED
    76 #ifdef DTRACE_ENABLED
  2041     obj, \
  2042     obj, \
  2042     MarkSweep::mark_and_push(p), \
  2043     MarkSweep::mark_and_push(p), \
  2043     assert_is_in_closed_subset)
  2044     assert_is_in_closed_subset)
  2044 }
  2045 }
  2045 
  2046 
  2046 #ifndef SERIALGC
  2047 #if INCLUDE_ALL_GCS
  2047 void InstanceKlass::oop_follow_contents(ParCompactionManager* cm,
  2048 void InstanceKlass::oop_follow_contents(ParCompactionManager* cm,
  2048                                         oop obj) {
  2049                                         oop obj) {
  2049   assert(obj != NULL, "can't follow the content of NULL object");
  2050   assert(obj != NULL, "can't follow the content of NULL object");
  2050   PSParallelCompact::follow_klass(cm, obj->klass());
  2051   PSParallelCompact::follow_klass(cm, obj->klass());
  2051   // Only mark the header and let the scan of the meta-data mark
  2052   // Only mark the header and let the scan of the meta-data mark
  2053   InstanceKlass_OOP_MAP_ITERATE( \
  2054   InstanceKlass_OOP_MAP_ITERATE( \
  2054     obj, \
  2055     obj, \
  2055     PSParallelCompact::mark_and_push(cm, p), \
  2056     PSParallelCompact::mark_and_push(cm, p), \
  2056     assert_is_in)
  2057     assert_is_in)
  2057 }
  2058 }
  2058 #endif // SERIALGC
  2059 #endif // INCLUDE_ALL_GCS
  2059 
  2060 
  2060 // closure's do_metadata() method dictates whether the given closure should be
  2061 // closure's do_metadata() method dictates whether the given closure should be
  2061 // applied to the klass ptr in the object header.
  2062 // applied to the klass ptr in the object header.
  2062 
  2063 
  2063 #define if_do_metadata_checked(closure, nv_suffix)                    \
  2064 #define if_do_metadata_checked(closure, nv_suffix)                    \
  2081     (closure)->do_oop##nv_suffix(p),                                    \
  2082     (closure)->do_oop##nv_suffix(p),                                    \
  2082     assert_is_in_closed_subset)                                         \
  2083     assert_is_in_closed_subset)                                         \
  2083   return size_helper();                                                 \
  2084   return size_helper();                                                 \
  2084 }
  2085 }
  2085 
  2086 
  2086 #ifndef SERIALGC
  2087 #if INCLUDE_ALL_GCS
  2087 #define InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \
  2088 #define InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \
  2088                                                                                 \
  2089                                                                                 \
  2089 int InstanceKlass::oop_oop_iterate_backwards##nv_suffix(oop obj,                \
  2090 int InstanceKlass::oop_oop_iterate_backwards##nv_suffix(oop obj,                \
  2090                                               OopClosureType* closure) {        \
  2091                                               OopClosureType* closure) {        \
  2091   SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::ik); \
  2092   SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::ik); \
  2099     SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::ik);\
  2100     SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::ik);\
  2100     (closure)->do_oop##nv_suffix(p),                                            \
  2101     (closure)->do_oop##nv_suffix(p),                                            \
  2101     assert_is_in_closed_subset)                                                 \
  2102     assert_is_in_closed_subset)                                                 \
  2102    return size_helper();                                                        \
  2103    return size_helper();                                                        \
  2103 }
  2104 }
  2104 #endif // !SERIALGC
  2105 #endif // INCLUDE_ALL_GCS
  2105 
  2106 
  2106 #define InstanceKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix) \
  2107 #define InstanceKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix) \
  2107                                                                         \
  2108                                                                         \
  2108 int InstanceKlass::oop_oop_iterate##nv_suffix##_m(oop obj,              \
  2109 int InstanceKlass::oop_oop_iterate##nv_suffix##_m(oop obj,              \
  2109                                                   OopClosureType* closure, \
  2110                                                   OopClosureType* closure, \
  2123 
  2124 
  2124 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_DEFN)
  2125 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_DEFN)
  2125 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_DEFN)
  2126 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_DEFN)
  2126 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_DEFN_m)
  2127 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_DEFN_m)
  2127 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_DEFN_m)
  2128 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_DEFN_m)
  2128 #ifndef SERIALGC
  2129 #if INCLUDE_ALL_GCS
  2129 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
  2130 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
  2130 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
  2131 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
  2131 #endif // !SERIALGC
  2132 #endif // INCLUDE_ALL_GCS
  2132 
  2133 
  2133 int InstanceKlass::oop_adjust_pointers(oop obj) {
  2134 int InstanceKlass::oop_adjust_pointers(oop obj) {
  2134   int size = size_helper();
  2135   int size = size_helper();
  2135   InstanceKlass_OOP_MAP_ITERATE( \
  2136   InstanceKlass_OOP_MAP_ITERATE( \
  2136     obj, \
  2137     obj, \
  2138     assert_is_in)
  2139     assert_is_in)
  2139   MarkSweep::adjust_klass(obj->klass());
  2140   MarkSweep::adjust_klass(obj->klass());
  2140   return size;
  2141   return size;
  2141 }
  2142 }
  2142 
  2143 
  2143 #ifndef SERIALGC
  2144 #if INCLUDE_ALL_GCS
  2144 void InstanceKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
  2145 void InstanceKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
  2145   InstanceKlass_OOP_MAP_REVERSE_ITERATE( \
  2146   InstanceKlass_OOP_MAP_REVERSE_ITERATE( \
  2146     obj, \
  2147     obj, \
  2147     if (PSScavenge::should_scavenge(p)) { \
  2148     if (PSScavenge::should_scavenge(p)) { \
  2148       pm->claim_or_forward_depth(p); \
  2149       pm->claim_or_forward_depth(p); \
  2158     assert_is_in)
  2159     assert_is_in)
  2159   obj->update_header(cm);
  2160   obj->update_header(cm);
  2160   return size;
  2161   return size;
  2161 }
  2162 }
  2162 
  2163 
  2163 #endif // SERIALGC
  2164 #endif // INCLUDE_ALL_GCS
  2164 
  2165 
  2165 void InstanceKlass::clean_implementors_list(BoolObjectClosure* is_alive) {
  2166 void InstanceKlass::clean_implementors_list(BoolObjectClosure* is_alive) {
  2166   assert(is_loader_alive(is_alive), "this klass should be live");
  2167   assert(is_loader_alive(is_alive), "this klass should be live");
  2167   if (is_interface()) {
  2168   if (is_interface()) {
  2168     if (ClassUnloading) {
  2169     if (ClassUnloading) {