1.1 --- a/src/share/vm/memory/referenceProcessor.cpp Fri Jul 10 16:01:20 2009 -0700 1.2 +++ b/src/share/vm/memory/referenceProcessor.cpp Tue Jul 14 15:40:39 2009 -0700 1.3 @@ -1013,12 +1013,19 @@ 1.4 // discovered_addr. 1.5 oop current_head = refs_list.head(); 1.6 1.7 - // Note: In the case of G1, this pre-barrier is strictly 1.8 + // Note: In the case of G1, this specific pre-barrier is strictly 1.9 // not necessary because the only case we are interested in 1.10 - // here is when *discovered_addr is NULL, so this will expand to 1.11 - // nothing. As a result, I am just manually eliding this out for G1. 1.12 + // here is when *discovered_addr is NULL (see the CAS further below), 1.13 + // so this will expand to nothing. As a result, we have manually 1.14 + // elided this out for G1, but left in the test for some future 1.15 + // collector that might have need for a pre-barrier here. 1.16 if (_discovered_list_needs_barrier && !UseG1GC) { 1.17 - _bs->write_ref_field_pre((void*)discovered_addr, current_head); guarantee(false, "Needs to be fixed: YSR"); 1.18 + if (UseCompressedOops) { 1.19 + _bs->write_ref_field_pre((narrowOop*)discovered_addr, current_head); 1.20 + } else { 1.21 + _bs->write_ref_field_pre((oop*)discovered_addr, current_head); 1.22 + } 1.23 + guarantee(false, "Need to check non-G1 collector"); 1.24 } 1.25 oop retest = oopDesc::atomic_compare_exchange_oop(current_head, discovered_addr, 1.26 NULL); 1.27 @@ -1029,9 +1036,8 @@ 1.28 refs_list.set_head(obj); 1.29 refs_list.inc_length(1); 1.30 if (_discovered_list_needs_barrier) { 1.31 - _bs->write_ref_field((void*)discovered_addr, current_head); guarantee(false, "Needs to be fixed: YSR"); 1.32 + _bs->write_ref_field((void*)discovered_addr, current_head); 1.33 } 1.34 - 1.35 } else { 1.36 // If retest was non NULL, another thread beat us to it: 1.37 // The reference has already been discovered... 1.38 @@ -1177,11 +1183,16 @@ 1.39 // pre-value, we can safely elide the pre-barrier here for the case of G1. 1.40 assert(discovered == NULL, "control point invariant"); 1.41 if (_discovered_list_needs_barrier && !UseG1GC) { // safe to elide for G1 1.42 - _bs->write_ref_field_pre((oop*)discovered_addr, current_head); 1.43 + if (UseCompressedOops) { 1.44 + _bs->write_ref_field_pre((narrowOop*)discovered_addr, current_head); 1.45 + } else { 1.46 + _bs->write_ref_field_pre((oop*)discovered_addr, current_head); 1.47 + } 1.48 + guarantee(false, "Need to check non-G1 collector"); 1.49 } 1.50 oop_store_raw(discovered_addr, current_head); 1.51 if (_discovered_list_needs_barrier) { 1.52 - _bs->write_ref_field((oop*)discovered_addr, current_head); 1.53 + _bs->write_ref_field((void*)discovered_addr, current_head); 1.54 } 1.55 list->set_head(obj); 1.56 list->inc_length(1);