1.1 --- a/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp Fri Jul 10 16:01:20 2009 -0700 1.2 +++ b/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp Tue Jul 14 15:40:39 2009 -0700 1.3 @@ -34,6 +34,7 @@ 1.4 1.5 1.6 void G1SATBCardTableModRefBS::enqueue(oop pre_val) { 1.7 + assert(pre_val->is_oop_or_null(true), "Error"); 1.8 if (!JavaThread::satb_mark_queue_set().active()) return; 1.9 Thread* thr = Thread::current(); 1.10 if (thr->is_Java_thread()) { 1.11 @@ -46,32 +47,31 @@ 1.12 } 1.13 1.14 // When we know the current java thread: 1.15 -void 1.16 -G1SATBCardTableModRefBS::write_ref_field_pre_static(void* field, 1.17 - oop newVal, 1.18 +template <class T> void 1.19 +G1SATBCardTableModRefBS::write_ref_field_pre_static(T* field, 1.20 + oop new_val, 1.21 JavaThread* jt) { 1.22 if (!JavaThread::satb_mark_queue_set().active()) return; 1.23 - assert(!UseCompressedOops, "Else will need to modify this to deal with narrowOop"); 1.24 - oop preVal = *(oop*)field; 1.25 - if (preVal != NULL) { 1.26 - jt->satb_mark_queue().enqueue(preVal); 1.27 + T heap_oop = oopDesc::load_heap_oop(field); 1.28 + if (!oopDesc::is_null(heap_oop)) { 1.29 + oop pre_val = oopDesc::decode_heap_oop_not_null(heap_oop); 1.30 + assert(pre_val->is_oop(true /* ignore mark word */), "Error"); 1.31 + jt->satb_mark_queue().enqueue(pre_val); 1.32 } 1.33 } 1.34 1.35 -void 1.36 -G1SATBCardTableModRefBS::write_ref_array_pre(MemRegion mr) { 1.37 +template <class T> void 1.38 +G1SATBCardTableModRefBS::write_ref_array_pre_work(T* dst, int count) { 1.39 if (!JavaThread::satb_mark_queue_set().active()) return; 1.40 - assert(!UseCompressedOops, "Else will need to modify this to deal with narrowOop"); 1.41 - oop* elem_ptr = (oop*)mr.start(); 1.42 - while ((HeapWord*)elem_ptr < mr.end()) { 1.43 - oop elem = *elem_ptr; 1.44 - if (elem != NULL) enqueue(elem); 1.45 - elem_ptr++; 1.46 + T* elem_ptr = dst; 1.47 + for (int i = 0; i < count; i++, elem_ptr++) { 1.48 + T heap_oop = oopDesc::load_heap_oop(elem_ptr); 1.49 + if (!oopDesc::is_null(heap_oop)) { 1.50 + enqueue(oopDesc::decode_heap_oop_not_null(heap_oop)); 1.51 + } 1.52 } 1.53 } 1.54 1.55 - 1.56 - 1.57 G1SATBCardTableLoggingModRefBS:: 1.58 G1SATBCardTableLoggingModRefBS(MemRegion whole_heap, 1.59 int max_covered_regions) :