Mercurial > hg > truffle
diff src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp @ 845:df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
Summary: Modifications to G1 so as to allow the use of compressed oops.
Reviewed-by: apetrusenko, coleenp, jmasa, kvn, never, phh, tonyp
author | ysr |
---|---|
date | Tue, 14 Jul 2009 15:40:39 -0700 |
parents | 37f87013dfd8 |
children | d4197f8d516a |
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp Fri Jul 10 16:01:20 2009 -0700 +++ b/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp Tue Jul 14 15:40:39 2009 -0700 @@ -34,6 +34,7 @@ void G1SATBCardTableModRefBS::enqueue(oop pre_val) { + assert(pre_val->is_oop_or_null(true), "Error"); if (!JavaThread::satb_mark_queue_set().active()) return; Thread* thr = Thread::current(); if (thr->is_Java_thread()) { @@ -46,32 +47,31 @@ } // When we know the current java thread: -void -G1SATBCardTableModRefBS::write_ref_field_pre_static(void* field, - oop newVal, +template <class T> void +G1SATBCardTableModRefBS::write_ref_field_pre_static(T* field, + oop new_val, JavaThread* jt) { if (!JavaThread::satb_mark_queue_set().active()) return; - assert(!UseCompressedOops, "Else will need to modify this to deal with narrowOop"); - oop preVal = *(oop*)field; - if (preVal != NULL) { - jt->satb_mark_queue().enqueue(preVal); + T heap_oop = oopDesc::load_heap_oop(field); + if (!oopDesc::is_null(heap_oop)) { + oop pre_val = oopDesc::decode_heap_oop_not_null(heap_oop); + assert(pre_val->is_oop(true /* ignore mark word */), "Error"); + jt->satb_mark_queue().enqueue(pre_val); } } -void -G1SATBCardTableModRefBS::write_ref_array_pre(MemRegion mr) { +template <class T> void +G1SATBCardTableModRefBS::write_ref_array_pre_work(T* dst, int count) { if (!JavaThread::satb_mark_queue_set().active()) return; - assert(!UseCompressedOops, "Else will need to modify this to deal with narrowOop"); - oop* elem_ptr = (oop*)mr.start(); - while ((HeapWord*)elem_ptr < mr.end()) { - oop elem = *elem_ptr; - if (elem != NULL) enqueue(elem); - elem_ptr++; + T* elem_ptr = dst; + for (int i = 0; i < count; i++, elem_ptr++) { + T heap_oop = oopDesc::load_heap_oop(elem_ptr); + if (!oopDesc::is_null(heap_oop)) { + enqueue(oopDesc::decode_heap_oop_not_null(heap_oop)); + } } } - - G1SATBCardTableLoggingModRefBS:: G1SATBCardTableLoggingModRefBS(MemRegion whole_heap, int max_covered_regions) :