Mercurial > hg > truffle
comparison src/share/vm/oops/instanceRefKlass.cpp @ 342:37f87013dfd8
6711316: Open source the Garbage-First garbage collector
Summary: First mercurial integration of the code for the Garbage-First garbage collector.
Reviewed-by: apetrusenko, iveresov, jmasa, sgoldman, tonyp, ysr
author | ysr |
---|---|
date | Thu, 05 Jun 2008 15:57:56 -0700 |
parents | ba764ed4b6f2 |
children | 1ee8caae33af |
comparison
equal
deleted
inserted
replaced
189:0b27f3512f9e | 342:37f87013dfd8 |
---|---|
174 } | 174 } |
175 return size; | 175 return size; |
176 } | 176 } |
177 | 177 |
178 #define InstanceRefKlass_SPECIALIZED_OOP_ITERATE(T, nv_suffix, contains) \ | 178 #define InstanceRefKlass_SPECIALIZED_OOP_ITERATE(T, nv_suffix, contains) \ |
179 if (closure->apply_to_weak_ref_discovered_field()) { \ | |
180 T* disc_addr = (T*)java_lang_ref_Reference::discovered_addr(obj); \ | |
181 closure->do_oop##nv_suffix(disc_addr); \ | |
182 } \ | |
183 \ | |
179 T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); \ | 184 T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); \ |
180 oop referent = oopDesc::load_decode_heap_oop(referent_addr); \ | 185 oop referent = oopDesc::load_decode_heap_oop(referent_addr); \ |
181 if (referent != NULL && contains(referent_addr)) { \ | 186 if (referent != NULL && contains(referent_addr)) { \ |
182 ReferenceProcessor* rp = closure->_ref_processor; \ | 187 ReferenceProcessor* rp = closure->_ref_processor; \ |
183 if (!referent->is_gc_marked() && (rp != NULL) && \ | 188 if (!referent->is_gc_marked() && (rp != NULL) && \ |
217 } else { \ | 222 } else { \ |
218 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, contains); \ | 223 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, contains); \ |
219 } \ | 224 } \ |
220 } | 225 } |
221 | 226 |
227 #ifndef SERIALGC | |
228 #define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \ | |
229 \ | |
230 int instanceRefKlass:: \ | |
231 oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) { \ | |
232 /* Get size before changing pointers */ \ | |
233 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ | |
234 \ | |
235 int size = instanceKlass::oop_oop_iterate_backwards##nv_suffix(obj, closure); \ | |
236 \ | |
237 if (UseCompressedOops) { \ | |
238 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, contains); \ | |
239 } else { \ | |
240 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, contains); \ | |
241 } \ | |
242 } | |
243 #endif // !SERIALGC | |
244 | |
245 | |
222 #define InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix) \ | 246 #define InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix) \ |
223 \ | 247 \ |
224 int instanceRefKlass:: \ | 248 int instanceRefKlass:: \ |
225 oop_oop_iterate##nv_suffix##_m(oop obj, \ | 249 oop_oop_iterate##nv_suffix##_m(oop obj, \ |
226 OopClosureType* closure, \ | 250 OopClosureType* closure, \ |
234 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, mr.contains); \ | 258 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, mr.contains); \ |
235 } \ | 259 } \ |
236 } | 260 } |
237 | 261 |
238 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DEFN) | 262 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DEFN) |
239 ALL_OOP_OOP_ITERATE_CLOSURES_3(InstanceRefKlass_OOP_OOP_ITERATE_DEFN) | 263 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DEFN) |
264 #ifndef SERIALGC | |
265 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN) | |
266 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN) | |
267 #endif // SERIALGC | |
240 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m) | 268 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m) |
241 ALL_OOP_OOP_ITERATE_CLOSURES_3(InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m) | 269 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m) |
242 | 270 |
243 #ifndef SERIALGC | 271 #ifndef SERIALGC |
244 template <class T> | 272 template <class T> |
245 void specialized_oop_copy_contents(instanceRefKlass *ref, | 273 void specialized_oop_copy_contents(instanceRefKlass *ref, |
246 PSPromotionManager* pm, oop obj) { | 274 PSPromotionManager* pm, oop obj) { |
421 } | 449 } |
422 } | 450 } |
423 // Verify next field | 451 // Verify next field |
424 oop next = java_lang_ref_Reference::next(obj); | 452 oop next = java_lang_ref_Reference::next(obj); |
425 if (next != NULL) { | 453 if (next != NULL) { |
426 guarantee(next->is_oop(), "next field verify fa iled"); | 454 guarantee(next->is_oop(), "next field verify failed"); |
427 guarantee(next->is_instanceRef(), "next field verify failed"); | 455 guarantee(next->is_instanceRef(), "next field verify failed"); |
428 if (gch != NULL && !gch->is_in_youngest(obj)) { | 456 if (gch != NULL && !gch->is_in_youngest(obj)) { |
429 // We do a specific remembered set check here since the next field is | 457 // We do a specific remembered set check here since the next field is |
430 // not part of the oop mask and therefore skipped by the regular | 458 // not part of the oop mask and therefore skipped by the regular |
431 // verify code. | 459 // verify code. |