comparison src/share/vm/oops/instanceKlass.cpp @ 20268:4c1b88a53c74

8046670: Make CMS metadata aware closures applicable for other collectors Reviewed-by: ehelin, mgerdin
author stefank
date Tue, 24 Jun 2014 16:20:15 +0200
parents 27188ae8bbbb
children 2c6ef90f030a
comparison
equal deleted inserted replaced
20267:ff1e37e7eb83 20268:4c1b88a53c74
33 #include "interpreter/oopMapCache.hpp" 33 #include "interpreter/oopMapCache.hpp"
34 #include "interpreter/rewriter.hpp" 34 #include "interpreter/rewriter.hpp"
35 #include "jvmtifiles/jvmti.h" 35 #include "jvmtifiles/jvmti.h"
36 #include "memory/genOopClosures.inline.hpp" 36 #include "memory/genOopClosures.inline.hpp"
37 #include "memory/heapInspection.hpp" 37 #include "memory/heapInspection.hpp"
38 #include "memory/iterator.inline.hpp"
38 #include "memory/metadataFactory.hpp" 39 #include "memory/metadataFactory.hpp"
39 #include "memory/oopFactory.hpp" 40 #include "memory/oopFactory.hpp"
40 #include "oops/fieldStreams.hpp" 41 #include "oops/fieldStreams.hpp"
41 #include "oops/instanceClassLoaderKlass.hpp" 42 #include "oops/instanceClassLoaderKlass.hpp"
42 #include "oops/instanceKlass.hpp" 43 #include "oops/instanceKlass.hpp"
2130 #endif // INCLUDE_ALL_GCS 2131 #endif // INCLUDE_ALL_GCS
2131 2132
2132 // closure's do_metadata() method dictates whether the given closure should be 2133 // closure's do_metadata() method dictates whether the given closure should be
2133 // applied to the klass ptr in the object header. 2134 // applied to the klass ptr in the object header.
2134 2135
2135 #define if_do_metadata_checked(closure, nv_suffix) \
2136 /* Make sure the non-virtual and the virtual versions match. */ \
2137 assert(closure->do_metadata##nv_suffix() == closure->do_metadata(), \
2138 "Inconsistency in do_metadata"); \
2139 if (closure->do_metadata##nv_suffix())
2140
2141 #define InstanceKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \ 2136 #define InstanceKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \
2142 \ 2137 \
2143 int InstanceKlass::oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { \ 2138 int InstanceKlass::oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { \
2144 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::ik);\ 2139 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::ik);\
2145 /* header */ \ 2140 /* header */ \
2159 #define InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \ 2154 #define InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \
2160 \ 2155 \
2161 int InstanceKlass::oop_oop_iterate_backwards##nv_suffix(oop obj, \ 2156 int InstanceKlass::oop_oop_iterate_backwards##nv_suffix(oop obj, \
2162 OopClosureType* closure) { \ 2157 OopClosureType* closure) { \
2163 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::ik); \ 2158 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::ik); \
2164 /* header */ \ 2159 \
2165 if_do_metadata_checked(closure, nv_suffix) { \ 2160 assert_should_ignore_metadata(closure, nv_suffix); \
2166 closure->do_klass##nv_suffix(obj->klass()); \ 2161 \
2167 } \
2168 /* instance variables */ \ 2162 /* instance variables */ \
2169 InstanceKlass_OOP_MAP_REVERSE_ITERATE( \ 2163 InstanceKlass_OOP_MAP_REVERSE_ITERATE( \
2170 obj, \ 2164 obj, \
2171 SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::ik);\ 2165 SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::ik);\
2172 (closure)->do_oop##nv_suffix(p), \ 2166 (closure)->do_oop##nv_suffix(p), \