Mercurial > hg > graal-jvmci-8
comparison 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 |
comparison
equal
deleted
inserted
replaced
839:bb18957ad21e | 845:df6caf649ff7 |
---|---|
32 _kind = G1SATBCT; | 32 _kind = G1SATBCT; |
33 } | 33 } |
34 | 34 |
35 | 35 |
36 void G1SATBCardTableModRefBS::enqueue(oop pre_val) { | 36 void G1SATBCardTableModRefBS::enqueue(oop pre_val) { |
37 assert(pre_val->is_oop_or_null(true), "Error"); | |
37 if (!JavaThread::satb_mark_queue_set().active()) return; | 38 if (!JavaThread::satb_mark_queue_set().active()) return; |
38 Thread* thr = Thread::current(); | 39 Thread* thr = Thread::current(); |
39 if (thr->is_Java_thread()) { | 40 if (thr->is_Java_thread()) { |
40 JavaThread* jt = (JavaThread*)thr; | 41 JavaThread* jt = (JavaThread*)thr; |
41 jt->satb_mark_queue().enqueue(pre_val); | 42 jt->satb_mark_queue().enqueue(pre_val); |
44 JavaThread::satb_mark_queue_set().shared_satb_queue()->enqueue(pre_val); | 45 JavaThread::satb_mark_queue_set().shared_satb_queue()->enqueue(pre_val); |
45 } | 46 } |
46 } | 47 } |
47 | 48 |
48 // When we know the current java thread: | 49 // When we know the current java thread: |
49 void | 50 template <class T> void |
50 G1SATBCardTableModRefBS::write_ref_field_pre_static(void* field, | 51 G1SATBCardTableModRefBS::write_ref_field_pre_static(T* field, |
51 oop newVal, | 52 oop new_val, |
52 JavaThread* jt) { | 53 JavaThread* jt) { |
53 if (!JavaThread::satb_mark_queue_set().active()) return; | 54 if (!JavaThread::satb_mark_queue_set().active()) return; |
54 assert(!UseCompressedOops, "Else will need to modify this to deal with narrowOop"); | 55 T heap_oop = oopDesc::load_heap_oop(field); |
55 oop preVal = *(oop*)field; | 56 if (!oopDesc::is_null(heap_oop)) { |
56 if (preVal != NULL) { | 57 oop pre_val = oopDesc::decode_heap_oop_not_null(heap_oop); |
57 jt->satb_mark_queue().enqueue(preVal); | 58 assert(pre_val->is_oop(true /* ignore mark word */), "Error"); |
59 jt->satb_mark_queue().enqueue(pre_val); | |
58 } | 60 } |
59 } | 61 } |
60 | 62 |
61 void | 63 template <class T> void |
62 G1SATBCardTableModRefBS::write_ref_array_pre(MemRegion mr) { | 64 G1SATBCardTableModRefBS::write_ref_array_pre_work(T* dst, int count) { |
63 if (!JavaThread::satb_mark_queue_set().active()) return; | 65 if (!JavaThread::satb_mark_queue_set().active()) return; |
64 assert(!UseCompressedOops, "Else will need to modify this to deal with narrowOop"); | 66 T* elem_ptr = dst; |
65 oop* elem_ptr = (oop*)mr.start(); | 67 for (int i = 0; i < count; i++, elem_ptr++) { |
66 while ((HeapWord*)elem_ptr < mr.end()) { | 68 T heap_oop = oopDesc::load_heap_oop(elem_ptr); |
67 oop elem = *elem_ptr; | 69 if (!oopDesc::is_null(heap_oop)) { |
68 if (elem != NULL) enqueue(elem); | 70 enqueue(oopDesc::decode_heap_oop_not_null(heap_oop)); |
69 elem_ptr++; | 71 } |
70 } | 72 } |
71 } | 73 } |
72 | |
73 | |
74 | 74 |
75 G1SATBCardTableLoggingModRefBS:: | 75 G1SATBCardTableLoggingModRefBS:: |
76 G1SATBCardTableLoggingModRefBS(MemRegion whole_heap, | 76 G1SATBCardTableLoggingModRefBS(MemRegion whole_heap, |
77 int max_covered_regions) : | 77 int max_covered_regions) : |
78 G1SATBCardTableModRefBS(whole_heap, max_covered_regions), | 78 G1SATBCardTableModRefBS(whole_heap, max_covered_regions), |