< prev index next >

src/hotspot/share/gc/g1/g1BarrierSet.cpp

Move G1 runtime barrier entries

54   CardTableBarrierSet(make_barrier_set_assembler<G1BarrierSetAssembler>(),                                                           
55                       make_barrier_set_c1<G1BarrierSetC1>(),                                                                         
56                       make_barrier_set_c2<G1BarrierSetC2>(),                                                                         
57                       card_table,                                                                                                    
58                       BarrierSet::FakeRtti(BarrierSet::G1BarrierSet)) {}                                                             
59 
60 void G1BarrierSet::enqueue(oop pre_val) {                                                                                            
61   // Nulls should have been already filtered.                                                                                        
62   assert(oopDesc::is_oop(pre_val, true), "Error");                                                                                   
63 
64   if (!_satb_mark_queue_set.is_active()) return;                                                                                     
65   Thread* thr = Thread::current();                                                                                                   
66   if (thr->is_Java_thread()) {                                                                                                       
67     G1ThreadLocalData::satb_mark_queue(thr).enqueue(pre_val);                                                                        
68   } else {                                                                                                                           
69     MutexLockerEx x(Shared_SATB_Q_lock, Mutex::_no_safepoint_check_flag);                                                            
70     _satb_mark_queue_set.shared_satb_queue()->enqueue(pre_val);                                                                      
71   }                                                                                                                                  
72 }                                                                                                                                    
73 
74 void G1BarrierSet::write_ref_array_pre_oop_entry(oop* dst, size_t length) {                                                          
75   G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());                                                      
76   bs->write_ref_array_pre(dst, length, false);                                                                                       
77 }                                                                                                                                    
78                                                                                                                                      
79 void G1BarrierSet::write_ref_array_pre_narrow_oop_entry(narrowOop* dst, size_t length) {                                             
80   G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());                                                      
81   bs->write_ref_array_pre(dst, length, false);                                                                                       
82 }                                                                                                                                    
83                                                                                                                                      
84 void G1BarrierSet::write_ref_array_post_entry(HeapWord* dst, size_t length) {                                                        
85   G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());                                                      
86   bs->G1BarrierSet::write_ref_array(dst, length);                                                                                    
87 }                                                                                                                                    
88                                                                                                                                      
89 template <class T> void                                                                                                              
90 G1BarrierSet::write_ref_array_pre_work(T* dst, size_t count) {                                                                       
91   if (!_satb_mark_queue_set.is_active()) return;                                                                                     
92   T* elem_ptr = dst;                                                                                                                 
93   for (size_t i = 0; i < count; i++, elem_ptr++) {                                                                                   
94     T heap_oop = RawAccess<>::oop_load(elem_ptr);                                                                                    
95     if (!CompressedOops::is_null(heap_oop)) {                                                                                        
96       enqueue(CompressedOops::decode_not_null(heap_oop));                                                                            
97     }                                                                                                                                
98   }                                                                                                                                  
99 }                                                                                                                                    
100 
101 void G1BarrierSet::write_ref_array_pre(oop* dst, size_t count, bool dest_uninitialized) {                                            
102   if (!dest_uninitialized) {                                                                                                         
103     write_ref_array_pre_work(dst, count);                                                                                            
104   }                                                                                                                                  
105 }                                                                                                                                    
106 
107 void G1BarrierSet::write_ref_array_pre(narrowOop* dst, size_t count, bool dest_uninitialized) {                                      

54   CardTableBarrierSet(make_barrier_set_assembler<G1BarrierSetAssembler>(),
55                       make_barrier_set_c1<G1BarrierSetC1>(),
56                       make_barrier_set_c2<G1BarrierSetC2>(),
57                       card_table,
58                       BarrierSet::FakeRtti(BarrierSet::G1BarrierSet)) {}
59 
60 void G1BarrierSet::enqueue(oop pre_val) {
61   // Nulls should have been already filtered.
62   assert(oopDesc::is_oop(pre_val, true), "Error");
63 
64   if (!_satb_mark_queue_set.is_active()) return;
65   Thread* thr = Thread::current();
66   if (thr->is_Java_thread()) {
67     G1ThreadLocalData::satb_mark_queue(thr).enqueue(pre_val);
68   } else {
69     MutexLockerEx x(Shared_SATB_Q_lock, Mutex::_no_safepoint_check_flag);
70     _satb_mark_queue_set.shared_satb_queue()->enqueue(pre_val);
71   }
72 }
73 















74 template <class T> void
75 G1BarrierSet::write_ref_array_pre_work(T* dst, size_t count) {
76   if (!_satb_mark_queue_set.is_active()) return;
77   T* elem_ptr = dst;
78   for (size_t i = 0; i < count; i++, elem_ptr++) {
79     T heap_oop = RawAccess<>::oop_load(elem_ptr);
80     if (!CompressedOops::is_null(heap_oop)) {
81       enqueue(CompressedOops::decode_not_null(heap_oop));
82     }
83   }
84 }
85 
86 void G1BarrierSet::write_ref_array_pre(oop* dst, size_t count, bool dest_uninitialized) {
87   if (!dest_uninitialized) {
88     write_ref_array_pre_work(dst, count);
89   }
90 }
91 
92 void G1BarrierSet::write_ref_array_pre(narrowOop* dst, size_t count, bool dest_uninitialized) {
< prev index next >