comparison src/share/vm/gc_implementation/g1/satbQueue.hpp @ 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 44f61c24ddab
children c18cbe5936b8
comparison
equal deleted inserted replaced
1316:cc98cc548f51 1317:d4197f8d516a
27 27
28 // A ptrQueue whose elements are "oops", pointers to object heads. 28 // A ptrQueue whose elements are "oops", pointers to object heads.
29 class ObjPtrQueue: public PtrQueue { 29 class ObjPtrQueue: public PtrQueue {
30 public: 30 public:
31 ObjPtrQueue(PtrQueueSet* qset_, bool perm = false) : 31 ObjPtrQueue(PtrQueueSet* qset_, bool perm = false) :
32 PtrQueue(qset_, perm) 32 PtrQueue(qset_, perm, qset_->is_active()) { }
33 {}
34 // Apply the closure to all elements, and reset the index to make the 33 // Apply the closure to all elements, and reset the index to make the
35 // buffer empty. 34 // buffer empty.
36 void apply_closure(ObjectClosure* cl); 35 void apply_closure(ObjectClosure* cl);
37 36
38 // Apply the closure to all elements of "buf", down to "index" (inclusive.) 37 // Apply the closure to all elements of "buf", down to "index" (inclusive.)
53 // Utility function to support sequential and parallel versions. If 52 // Utility function to support sequential and parallel versions. If
54 // "par" is true, then "worker" is the par thread id; if "false", worker 53 // "par" is true, then "worker" is the par thread id; if "false", worker
55 // is ignored. 54 // is ignored.
56 bool apply_closure_to_completed_buffer_work(bool par, int worker); 55 bool apply_closure_to_completed_buffer_work(bool par, int worker);
57 56
57 #ifdef ASSERT
58 void dump_active_values(JavaThread* first, bool expected_active);
59 #endif // ASSERT
58 60
59 public: 61 public:
60 SATBMarkQueueSet(); 62 SATBMarkQueueSet();
61 63
62 void initialize(Monitor* cbl_mon, Mutex* fl_lock, 64 void initialize(Monitor* cbl_mon, Mutex* fl_lock,
63 int process_completed_threshold, 65 int process_completed_threshold,
64 Mutex* lock); 66 Mutex* lock);
65 67
66 static void handle_zero_index_for_thread(JavaThread* t); 68 static void handle_zero_index_for_thread(JavaThread* t);
67 69
68 // Apply "set_active(b)" to all thread tloq's. Should be called only 70 // Apply "set_active(b)" to all Java threads' SATB queues. It should be
69 // with the world stopped. 71 // called only with the world stopped. The method will assert that the
70 void set_active_all_threads(bool b); 72 // SATB queues of all threads it visits, as well as the SATB queue
73 // set itself, has an active value same as expected_active.
74 void set_active_all_threads(bool b, bool expected_active);
71 75
72 // Register "blk" as "the closure" for all queues. Only one such closure 76 // Register "blk" as "the closure" for all queues. Only one such closure
73 // is allowed. The "apply_closure_to_completed_buffer" method will apply 77 // is allowed. The "apply_closure_to_completed_buffer" method will apply
74 // this closure to a completed buffer, and "iterate_closure_all_threads" 78 // this closure to a completed buffer, and "iterate_closure_all_threads"
75 // applies it to partially-filled buffers (the latter should only be done 79 // applies it to partially-filled buffers (the latter should only be done