hotspot/src/share/vm/oops/instanceRefKlass.cpp
changeset 3579 b18b94266d60
parent 3262 30d1c247fc25
child 3693 af387bf37e8d
equal deleted inserted replaced
3578:411436f0a4a2 3579:b18b94266d60
    26 # include "incls/_instanceRefKlass.cpp.incl"
    26 # include "incls/_instanceRefKlass.cpp.incl"
    27 
    27 
    28 template <class T>
    28 template <class T>
    29 static void specialized_oop_follow_contents(instanceRefKlass* ref, oop obj) {
    29 static void specialized_oop_follow_contents(instanceRefKlass* ref, oop obj) {
    30   T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);
    30   T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);
    31   oop referent = oopDesc::load_decode_heap_oop(referent_addr);
    31   T heap_oop = oopDesc::load_heap_oop(referent_addr);
    32   debug_only(
    32   debug_only(
    33     if(TraceReferenceGC && PrintGCDetails) {
    33     if(TraceReferenceGC && PrintGCDetails) {
    34       gclog_or_tty->print_cr("instanceRefKlass::oop_follow_contents " INTPTR_FORMAT, obj);
    34       gclog_or_tty->print_cr("instanceRefKlass::oop_follow_contents " INTPTR_FORMAT, obj);
    35     }
    35     }
    36   )
    36   )
    37   if (referent != NULL) {
    37   if (!oopDesc::is_null(heap_oop)) {
       
    38     oop referent = oopDesc::decode_heap_oop_not_null(heap_oop);
    38     if (!referent->is_gc_marked() &&
    39     if (!referent->is_gc_marked() &&
    39         MarkSweep::ref_processor()->
    40         MarkSweep::ref_processor()->
    40           discover_reference(obj, ref->reference_type())) {
    41           discover_reference(obj, ref->reference_type())) {
    41       // reference already enqueued, referent will be traversed later
    42       // reference already enqueued, referent will be traversed later
    42       ref->instanceKlass::oop_follow_contents(obj);
    43       ref->instanceKlass::oop_follow_contents(obj);
    79 template <class T>
    80 template <class T>
    80 static void specialized_oop_follow_contents(instanceRefKlass* ref,
    81 static void specialized_oop_follow_contents(instanceRefKlass* ref,
    81                                             ParCompactionManager* cm,
    82                                             ParCompactionManager* cm,
    82                                             oop obj) {
    83                                             oop obj) {
    83   T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);
    84   T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);
    84   oop referent = oopDesc::load_decode_heap_oop(referent_addr);
    85   T heap_oop = oopDesc::load_heap_oop(referent_addr);
    85   debug_only(
    86   debug_only(
    86     if(TraceReferenceGC && PrintGCDetails) {
    87     if(TraceReferenceGC && PrintGCDetails) {
    87       gclog_or_tty->print_cr("instanceRefKlass::oop_follow_contents " INTPTR_FORMAT, obj);
    88       gclog_or_tty->print_cr("instanceRefKlass::oop_follow_contents " INTPTR_FORMAT, obj);
    88     }
    89     }
    89   )
    90   )
    90   if (referent != NULL) {
    91   if (!oopDesc::is_null(heap_oop)) {
       
    92     oop referent = oopDesc::decode_heap_oop_not_null(heap_oop);
    91     if (PSParallelCompact::mark_bitmap()->is_unmarked(referent) &&
    93     if (PSParallelCompact::mark_bitmap()->is_unmarked(referent) &&
    92         PSParallelCompact::ref_processor()->
    94         PSParallelCompact::ref_processor()->
    93           discover_reference(obj, ref->reference_type())) {
    95           discover_reference(obj, ref->reference_type())) {
    94       // reference already enqueued, referent will be traversed later
    96       // reference already enqueued, referent will be traversed later
    95       ref->instanceKlass::oop_follow_contents(cm, obj);
    97       ref->instanceKlass::oop_follow_contents(cm, obj);
   180     T* disc_addr = (T*)java_lang_ref_Reference::discovered_addr(obj);           \
   182     T* disc_addr = (T*)java_lang_ref_Reference::discovered_addr(obj);           \
   181     closure->do_oop##nv_suffix(disc_addr);                                      \
   183     closure->do_oop##nv_suffix(disc_addr);                                      \
   182   }                                                                             \
   184   }                                                                             \
   183                                                                                 \
   185                                                                                 \
   184   T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);           \
   186   T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);           \
   185   oop referent = oopDesc::load_decode_heap_oop(referent_addr);                  \
   187   T heap_oop = oopDesc::load_heap_oop(referent_addr);                           \
   186   if (referent != NULL && contains(referent_addr)) {                            \
   188   if (!oopDesc::is_null(heap_oop) && contains(referent_addr)) {                 \
   187     ReferenceProcessor* rp = closure->_ref_processor;                           \
   189     ReferenceProcessor* rp = closure->_ref_processor;                           \
       
   190     oop referent = oopDesc::decode_heap_oop_not_null(heap_oop);                 \
   188     if (!referent->is_gc_marked() && (rp != NULL) &&                            \
   191     if (!referent->is_gc_marked() && (rp != NULL) &&                            \
   189         rp->discover_reference(obj, reference_type())) {                        \
   192         rp->discover_reference(obj, reference_type())) {                        \
   190       return size;                                                              \
   193       return size;                                                              \
   191     } else {                                                                    \
   194     } else {                                                                    \
   192       /* treat referent as normal oop */                                        \
   195       /* treat referent as normal oop */                                        \