comparison src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp @ 1317:d4197f8d516a

6935821: G1: threads created during marking do not active their SATB queues Summary: Newly-created threads always had the active field of their SATB queue initialized to false, even if they were created during marking. As a result, updates from threads created during a marking cycle were never enqueued and never processed. The fix includes remaining a method from active() to is_active() for readability and naming consistency. Reviewed-by: ysr, johnc
author tonyp
date Thu, 18 Mar 2010 12:14:59 -0400
parents df6caf649ff7
children c18cbe5936b8
comparison
equal deleted inserted replaced
1316:cc98cc548f51 1317:d4197f8d516a
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 assert(pre_val->is_oop_or_null(true), "Error");
38 if (!JavaThread::satb_mark_queue_set().active()) return; 38 if (!JavaThread::satb_mark_queue_set().is_active()) return;
39 Thread* thr = Thread::current(); 39 Thread* thr = Thread::current();
40 if (thr->is_Java_thread()) { 40 if (thr->is_Java_thread()) {
41 JavaThread* jt = (JavaThread*)thr; 41 JavaThread* jt = (JavaThread*)thr;
42 jt->satb_mark_queue().enqueue(pre_val); 42 jt->satb_mark_queue().enqueue(pre_val);
43 } else { 43 } else {
49 // When we know the current java thread: 49 // When we know the current java thread:
50 template <class T> void 50 template <class T> void
51 G1SATBCardTableModRefBS::write_ref_field_pre_static(T* field, 51 G1SATBCardTableModRefBS::write_ref_field_pre_static(T* field,
52 oop new_val, 52 oop new_val,
53 JavaThread* jt) { 53 JavaThread* jt) {
54 if (!JavaThread::satb_mark_queue_set().active()) return; 54 if (!JavaThread::satb_mark_queue_set().is_active()) return;
55 T heap_oop = oopDesc::load_heap_oop(field); 55 T heap_oop = oopDesc::load_heap_oop(field);
56 if (!oopDesc::is_null(heap_oop)) { 56 if (!oopDesc::is_null(heap_oop)) {
57 oop pre_val = oopDesc::decode_heap_oop_not_null(heap_oop); 57 oop pre_val = oopDesc::decode_heap_oop_not_null(heap_oop);
58 assert(pre_val->is_oop(true /* ignore mark word */), "Error"); 58 assert(pre_val->is_oop(true /* ignore mark word */), "Error");
59 jt->satb_mark_queue().enqueue(pre_val); 59 jt->satb_mark_queue().enqueue(pre_val);
60 } 60 }
61 } 61 }
62 62
63 template <class T> void 63 template <class T> void
64 G1SATBCardTableModRefBS::write_ref_array_pre_work(T* dst, int count) { 64 G1SATBCardTableModRefBS::write_ref_array_pre_work(T* dst, int count) {
65 if (!JavaThread::satb_mark_queue_set().active()) return; 65 if (!JavaThread::satb_mark_queue_set().is_active()) return;
66 T* elem_ptr = dst; 66 T* elem_ptr = dst;
67 for (int i = 0; i < count; i++, elem_ptr++) { 67 for (int i = 0; i < count; i++, elem_ptr++) {
68 T heap_oop = oopDesc::load_heap_oop(elem_ptr); 68 T heap_oop = oopDesc::load_heap_oop(elem_ptr);
69 if (!oopDesc::is_null(heap_oop)) { 69 if (!oopDesc::is_null(heap_oop)) {
70 enqueue(oopDesc::decode_heap_oop_not_null(heap_oop)); 70 enqueue(oopDesc::decode_heap_oop_not_null(heap_oop));