comparison src/share/vm/oops/instanceRefKlass.cpp @ 5223:edb5ab0f3fe5

8001107: @Stable annotation for constant folding of lazily evaluated variables Reviewed-by: rbackman, twisti, kvn Contributed-by: john.r.rose@oracle.com, vladimir.x.ivanov@oracle.com
author vlivanov
date Tue, 10 Sep 2013 14:51:48 -0700
parents aed758eda82a
children 190899198332
comparison
equal deleted inserted replaced
24:96f10e4d7899 25:e8ab81d539cc
31 #include "memory/genCollectedHeap.hpp" 31 #include "memory/genCollectedHeap.hpp"
32 #include "memory/genOopClosures.inline.hpp" 32 #include "memory/genOopClosures.inline.hpp"
33 #include "oops/instanceRefKlass.hpp" 33 #include "oops/instanceRefKlass.hpp"
34 #include "oops/oop.inline.hpp" 34 #include "oops/oop.inline.hpp"
35 #include "utilities/preserveException.hpp" 35 #include "utilities/preserveException.hpp"
36 #ifndef SERIALGC 36 #include "utilities/macros.hpp"
37 #if INCLUDE_ALL_GCS
37 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" 38 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
38 #include "gc_implementation/g1/g1OopClosures.inline.hpp" 39 #include "gc_implementation/g1/g1OopClosures.inline.hpp"
39 #include "gc_implementation/g1/g1RemSet.inline.hpp" 40 #include "gc_implementation/g1/g1RemSet.inline.hpp"
40 #include "gc_implementation/g1/heapRegionSeq.inline.hpp" 41 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
41 #include "gc_implementation/parNew/parOopClosures.inline.hpp" 42 #include "gc_implementation/parNew/parOopClosures.inline.hpp"
42 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" 43 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
43 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" 44 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
44 #include "oops/oop.pcgc.inline.hpp" 45 #include "oops/oop.pcgc.inline.hpp"
45 #endif 46 #endif // INCLUDE_ALL_GCS
46 47
47 template <class T> 48 template <class T>
48 void specialized_oop_follow_contents(InstanceRefKlass* ref, oop obj) { 49 void specialized_oop_follow_contents(InstanceRefKlass* ref, oop obj) {
49 T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); 50 T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);
50 T heap_oop = oopDesc::load_heap_oop(referent_addr); 51 T heap_oop = oopDesc::load_heap_oop(referent_addr);
118 } else { 119 } else {
119 specialized_oop_follow_contents<oop>(this, obj); 120 specialized_oop_follow_contents<oop>(this, obj);
120 } 121 }
121 } 122 }
122 123
123 #ifndef SERIALGC 124 #if INCLUDE_ALL_GCS
124 template <class T> 125 template <class T>
125 void specialized_oop_follow_contents(InstanceRefKlass* ref, 126 void specialized_oop_follow_contents(InstanceRefKlass* ref,
126 ParCompactionManager* cm, 127 ParCompactionManager* cm,
127 oop obj) { 128 oop obj) {
128 T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); 129 T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);
192 specialized_oop_follow_contents<narrowOop>(this, cm, obj); 193 specialized_oop_follow_contents<narrowOop>(this, cm, obj);
193 } else { 194 } else {
194 specialized_oop_follow_contents<oop>(this, cm, obj); 195 specialized_oop_follow_contents<oop>(this, cm, obj);
195 } 196 }
196 } 197 }
197 #endif // SERIALGC 198 #endif // INCLUDE_ALL_GCS
198 199
199 #ifdef ASSERT 200 #ifdef ASSERT
200 template <class T> void trace_reference_gc(const char *s, oop obj, 201 template <class T> void trace_reference_gc(const char *s, oop obj,
201 T* referent_addr, 202 T* referent_addr,
202 T* next_addr, 203 T* next_addr,
315 } else { \ 316 } else { \
316 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, contains); \ 317 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, contains); \
317 } \ 318 } \
318 } 319 }
319 320
320 #ifndef SERIALGC 321 #if INCLUDE_ALL_GCS
321 #define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \ 322 #define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \
322 \ 323 \
323 int InstanceRefKlass:: \ 324 int InstanceRefKlass:: \
324 oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) { \ 325 oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) { \
325 /* Get size before changing pointers */ \ 326 /* Get size before changing pointers */ \
331 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, contains); \ 332 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, contains); \
332 } else { \ 333 } else { \
333 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, contains); \ 334 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, contains); \
334 } \ 335 } \
335 } 336 }
336 #endif // !SERIALGC 337 #endif // INCLUDE_ALL_GCS
337 338
338 339
339 #define InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix) \ 340 #define InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix) \
340 \ 341 \
341 int InstanceRefKlass:: \ 342 int InstanceRefKlass:: \
352 } \ 353 } \
353 } 354 }
354 355
355 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DEFN) 356 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DEFN)
356 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DEFN) 357 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DEFN)
357 #ifndef SERIALGC 358 #if INCLUDE_ALL_GCS
358 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN) 359 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
359 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN) 360 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
360 #endif // SERIALGC 361 #endif // INCLUDE_ALL_GCS
361 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m) 362 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m)
362 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m) 363 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m)
363 364
364 #ifndef SERIALGC 365 #if INCLUDE_ALL_GCS
365 template <class T> 366 template <class T>
366 void specialized_oop_push_contents(InstanceRefKlass *ref, 367 void specialized_oop_push_contents(InstanceRefKlass *ref,
367 PSPromotionManager* pm, oop obj) { 368 PSPromotionManager* pm, oop obj) {
368 T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); 369 T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);
369 if (PSScavenge::should_scavenge(referent_addr)) { 370 if (PSScavenge::should_scavenge(referent_addr)) {
442 } else { 443 } else {
443 specialized_oop_update_pointers<oop>(this, cm, obj); 444 specialized_oop_update_pointers<oop>(this, cm, obj);
444 } 445 }
445 return size_helper(); 446 return size_helper();
446 } 447 }
447 #endif // SERIALGC 448 #endif // INCLUDE_ALL_GCS
448 449
449 void InstanceRefKlass::update_nonstatic_oop_maps(Klass* k) { 450 void InstanceRefKlass::update_nonstatic_oop_maps(Klass* k) {
450 // Clear the nonstatic oop-map entries corresponding to referent 451 // Clear the nonstatic oop-map entries corresponding to referent
451 // and nextPending field. They are treated specially by the 452 // and nextPending field. They are treated specially by the
452 // garbage collector. 453 // garbage collector.