diff -r bb18957ad21e -r df6caf649ff7 src/share/vm/memory/referenceProcessor.cpp --- a/src/share/vm/memory/referenceProcessor.cpp Fri Jul 10 16:01:20 2009 -0700 +++ b/src/share/vm/memory/referenceProcessor.cpp Tue Jul 14 15:40:39 2009 -0700 @@ -1013,12 +1013,19 @@ // discovered_addr. oop current_head = refs_list.head(); - // Note: In the case of G1, this pre-barrier is strictly + // Note: In the case of G1, this specific pre-barrier is strictly // not necessary because the only case we are interested in - // here is when *discovered_addr is NULL, so this will expand to - // nothing. As a result, I am just manually eliding this out for G1. + // here is when *discovered_addr is NULL (see the CAS further below), + // so this will expand to nothing. As a result, we have manually + // elided this out for G1, but left in the test for some future + // collector that might have need for a pre-barrier here. if (_discovered_list_needs_barrier && !UseG1GC) { - _bs->write_ref_field_pre((void*)discovered_addr, current_head); guarantee(false, "Needs to be fixed: YSR"); + if (UseCompressedOops) { + _bs->write_ref_field_pre((narrowOop*)discovered_addr, current_head); + } else { + _bs->write_ref_field_pre((oop*)discovered_addr, current_head); + } + guarantee(false, "Need to check non-G1 collector"); } oop retest = oopDesc::atomic_compare_exchange_oop(current_head, discovered_addr, NULL); @@ -1029,9 +1036,8 @@ refs_list.set_head(obj); refs_list.inc_length(1); if (_discovered_list_needs_barrier) { - _bs->write_ref_field((void*)discovered_addr, current_head); guarantee(false, "Needs to be fixed: YSR"); + _bs->write_ref_field((void*)discovered_addr, current_head); } - } else { // If retest was non NULL, another thread beat us to it: // The reference has already been discovered... @@ -1177,11 +1183,16 @@ // pre-value, we can safely elide the pre-barrier here for the case of G1. assert(discovered == NULL, "control point invariant"); if (_discovered_list_needs_barrier && !UseG1GC) { // safe to elide for G1 - _bs->write_ref_field_pre((oop*)discovered_addr, current_head); + if (UseCompressedOops) { + _bs->write_ref_field_pre((narrowOop*)discovered_addr, current_head); + } else { + _bs->write_ref_field_pre((oop*)discovered_addr, current_head); + } + guarantee(false, "Need to check non-G1 collector"); } oop_store_raw(discovered_addr, current_head); if (_discovered_list_needs_barrier) { - _bs->write_ref_field((oop*)discovered_addr, current_head); + _bs->write_ref_field((void*)discovered_addr, current_head); } list->set_head(obj); list->inc_length(1);