Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp @ 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 | c18cbe5936b8 |
comparison
equal
deleted
inserted
replaced
839:bb18957ad21e | 845:df6caf649ff7 |
---|---|
45 | 45 |
46 virtual bool has_write_ref_pre_barrier() { return true; } | 46 virtual bool has_write_ref_pre_barrier() { return true; } |
47 | 47 |
48 // This notes that we don't need to access any BarrierSet data | 48 // This notes that we don't need to access any BarrierSet data |
49 // structures, so this can be called from a static context. | 49 // structures, so this can be called from a static context. |
50 static void write_ref_field_pre_static(void* field, oop newVal) { | 50 template <class T> static void write_ref_field_pre_static(T* field, oop newVal) { |
51 assert(!UseCompressedOops, "Else needs to be templatized"); | 51 T heap_oop = oopDesc::load_heap_oop(field); |
52 oop preVal = *((oop*)field); | 52 if (!oopDesc::is_null(heap_oop)) { |
53 if (preVal != NULL) { | 53 enqueue(oopDesc::decode_heap_oop(heap_oop)); |
54 enqueue(preVal); | |
55 } | 54 } |
56 } | 55 } |
57 | 56 |
58 // When we know the current java thread: | 57 // When we know the current java thread: |
59 static void write_ref_field_pre_static(void* field, oop newVal, | 58 template <class T> static void write_ref_field_pre_static(T* field, oop newVal, |
60 JavaThread* jt); | 59 JavaThread* jt); |
61 | 60 |
62 // We export this to make it available in cases where the static | 61 // We export this to make it available in cases where the static |
63 // type of the barrier set is known. Note that it is non-virtual. | 62 // type of the barrier set is known. Note that it is non-virtual. |
64 inline void inline_write_ref_field_pre(void* field, oop newVal) { | 63 template <class T> inline void inline_write_ref_field_pre(T* field, oop newVal) { |
65 write_ref_field_pre_static(field, newVal); | 64 write_ref_field_pre_static(field, newVal); |
66 } | 65 } |
67 | 66 |
68 // This is the more general virtual version. | 67 // These are the more general virtual versions. |
69 void write_ref_field_pre_work(void* field, oop new_val) { | 68 virtual void write_ref_field_pre_work(oop* field, oop new_val) { |
70 inline_write_ref_field_pre(field, new_val); | 69 inline_write_ref_field_pre(field, new_val); |
71 } | 70 } |
71 virtual void write_ref_field_pre_work(narrowOop* field, oop new_val) { | |
72 inline_write_ref_field_pre(field, new_val); | |
73 } | |
74 virtual void write_ref_field_pre_work(void* field, oop new_val) { | |
75 guarantee(false, "Not needed"); | |
76 } | |
72 | 77 |
73 virtual void write_ref_array_pre(MemRegion mr); | 78 template <class T> void write_ref_array_pre_work(T* dst, int count); |
74 | 79 virtual void write_ref_array_pre(oop* dst, int count) { |
80 write_ref_array_pre_work(dst, count); | |
81 } | |
82 virtual void write_ref_array_pre(narrowOop* dst, int count) { | |
83 write_ref_array_pre_work(dst, count); | |
84 } | |
75 }; | 85 }; |
76 | 86 |
77 // Adds card-table logging to the post-barrier. | 87 // Adds card-table logging to the post-barrier. |
78 // Usual invariant: all dirty cards are logged in the DirtyCardQueueSet. | 88 // Usual invariant: all dirty cards are logged in the DirtyCardQueueSet. |
79 class G1SATBCardTableLoggingModRefBS: public G1SATBCardTableModRefBS { | 89 class G1SATBCardTableLoggingModRefBS: public G1SATBCardTableModRefBS { |