1.1 --- a/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp Fri Jul 10 16:01:20 2009 -0700 1.2 +++ b/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp Tue Jul 14 15:40:39 2009 -0700 1.3 @@ -47,31 +47,41 @@ 1.4 1.5 // This notes that we don't need to access any BarrierSet data 1.6 // structures, so this can be called from a static context. 1.7 - static void write_ref_field_pre_static(void* field, oop newVal) { 1.8 - assert(!UseCompressedOops, "Else needs to be templatized"); 1.9 - oop preVal = *((oop*)field); 1.10 - if (preVal != NULL) { 1.11 - enqueue(preVal); 1.12 + template <class T> static void write_ref_field_pre_static(T* field, oop newVal) { 1.13 + T heap_oop = oopDesc::load_heap_oop(field); 1.14 + if (!oopDesc::is_null(heap_oop)) { 1.15 + enqueue(oopDesc::decode_heap_oop(heap_oop)); 1.16 } 1.17 } 1.18 1.19 // When we know the current java thread: 1.20 - static void write_ref_field_pre_static(void* field, oop newVal, 1.21 - JavaThread* jt); 1.22 + template <class T> static void write_ref_field_pre_static(T* field, oop newVal, 1.23 + JavaThread* jt); 1.24 1.25 // We export this to make it available in cases where the static 1.26 // type of the barrier set is known. Note that it is non-virtual. 1.27 - inline void inline_write_ref_field_pre(void* field, oop newVal) { 1.28 + template <class T> inline void inline_write_ref_field_pre(T* field, oop newVal) { 1.29 write_ref_field_pre_static(field, newVal); 1.30 } 1.31 1.32 - // This is the more general virtual version. 1.33 - void write_ref_field_pre_work(void* field, oop new_val) { 1.34 + // These are the more general virtual versions. 1.35 + virtual void write_ref_field_pre_work(oop* field, oop new_val) { 1.36 inline_write_ref_field_pre(field, new_val); 1.37 } 1.38 + virtual void write_ref_field_pre_work(narrowOop* field, oop new_val) { 1.39 + inline_write_ref_field_pre(field, new_val); 1.40 + } 1.41 + virtual void write_ref_field_pre_work(void* field, oop new_val) { 1.42 + guarantee(false, "Not needed"); 1.43 + } 1.44 1.45 - virtual void write_ref_array_pre(MemRegion mr); 1.46 - 1.47 + template <class T> void write_ref_array_pre_work(T* dst, int count); 1.48 + virtual void write_ref_array_pre(oop* dst, int count) { 1.49 + write_ref_array_pre_work(dst, count); 1.50 + } 1.51 + virtual void write_ref_array_pre(narrowOop* dst, int count) { 1.52 + write_ref_array_pre_work(dst, count); 1.53 + } 1.54 }; 1.55 1.56 // Adds card-table logging to the post-barrier.