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