< prev index next >

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

8198949_arraycopy

35 
36 class G1BarrierSet: public CardTableModRefBS {                                                                                       
37   friend class VMStructs;                                                                                                            
38  private:                                                                                                                            
39   DirtyCardQueueSet& _dcqs;                                                                                                          
40 
41  public:                                                                                                                             
42   G1BarrierSet(G1CardTable* table);                                                                                                  
43   ~G1BarrierSet() { }                                                                                                                
44 
45   // Add "pre_val" to a set of objects that may have been disconnected from the                                                      
46   // pre-marking object graph.                                                                                                       
47   static void enqueue(oop pre_val);                                                                                                  
48 
49   static void enqueue_if_weak_or_archive(DecoratorSet decorators, oop value);                                                        
50 
51   template <class T> void write_ref_array_pre_work(T* dst, int count);                                                               
52   virtual void write_ref_array_pre(oop* dst, int count, bool dest_uninitialized);                                                    
53   virtual void write_ref_array_pre(narrowOop* dst, int count, bool dest_uninitialized);                                              
54 
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
55   template <DecoratorSet decorators, typename T>                                                                                     
56   void write_ref_field_pre(T* field);                                                                                                
57 
58   // NB: if you do a whole-heap invalidation, the "usual invariant" defined                                                          
59   // above no longer applies.                                                                                                        
60   void invalidate(MemRegion mr);                                                                                                     
61 
62   void write_region(MemRegion mr)         { invalidate(mr); }                                                                        
63   void write_ref_array_work(MemRegion mr) { invalidate(mr); }                                                                        
64 
65   template <DecoratorSet decorators, typename T>                                                                                     
66   void write_ref_field_post(T* field, oop new_val);                                                                                  
67   void write_ref_field_post_slow(volatile jbyte* byte);                                                                              
68 
69   virtual void on_thread_attach(JavaThread* thread);                                                                                 
70   virtual void on_thread_detach(JavaThread* thread);                                                                                 
71 
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
72   // Callbacks for runtime accesses.                                                                                                 
73   template <DecoratorSet decorators, typename BarrierSetT = G1BarrierSet>                                                            
74   class AccessBarrier: public ModRefBarrierSet::AccessBarrier<decorators, BarrierSetT> {                                             
75     typedef ModRefBarrierSet::AccessBarrier<decorators, BarrierSetT> ModRef;                                                         
76     typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw;                                                                  
77 
78   public:                                                                                                                            
79     // Needed for loads on non-heap weak references                                                                                  
80     template <typename T>                                                                                                            
81     static oop oop_load_not_in_heap(T* addr);                                                                                        
82 
83     // Needed for non-heap stores                                                                                                    
84     template <typename T>                                                                                                            
85     static void oop_store_not_in_heap(T* addr, oop new_value);                                                                       
86 
87     // Needed for weak references                                                                                                    
88     static oop oop_load_in_heap_at(oop base, ptrdiff_t offset);                                                                      
89 
90     // Defensive: will catch weak oops at addresses in heap                                                                          

35 
36 class G1BarrierSet: public CardTableModRefBS {
37   friend class VMStructs;
38  private:
39   DirtyCardQueueSet& _dcqs;
40 
41  public:
42   G1BarrierSet(G1CardTable* table);
43   ~G1BarrierSet() { }
44 
45   // Add "pre_val" to a set of objects that may have been disconnected from the
46   // pre-marking object graph.
47   static void enqueue(oop pre_val);
48 
49   static void enqueue_if_weak_or_archive(DecoratorSet decorators, oop value);
50 
51   template <class T> void write_ref_array_pre_work(T* dst, int count);
52   virtual void write_ref_array_pre(oop* dst, int count, bool dest_uninitialized);
53   virtual void write_ref_array_pre(narrowOop* dst, int count, bool dest_uninitialized);
54 
55   static void write_ref_array_pre_oop_entry(oop* dst, size_t length);
56   static void write_ref_array_pre_narrow_oop_entry(narrowOop* dst, size_t length);
57   static void write_ref_array_post_entry(HeapWord* dst, size_t length);
58 
59   template <DecoratorSet decorators, typename T>
60   void write_ref_field_pre(T* field);
61 
62   // NB: if you do a whole-heap invalidation, the "usual invariant" defined
63   // above no longer applies.
64   void invalidate(MemRegion mr);
65 
66   void write_region(MemRegion mr)         { invalidate(mr); }
67   void write_ref_array_work(MemRegion mr) { invalidate(mr); }
68 
69   template <DecoratorSet decorators, typename T>
70   void write_ref_field_post(T* field, oop new_val);
71   void write_ref_field_post_slow(volatile jbyte* byte);
72 
73   virtual void on_thread_attach(JavaThread* thread);
74   virtual void on_thread_detach(JavaThread* thread);
75 
76 protected:
77   virtual BarrierSetCodeGen *make_code_gen();
78 
79 public:
80   // Callbacks for runtime accesses.
81   template <DecoratorSet decorators, typename BarrierSetT = G1BarrierSet>
82   class AccessBarrier: public ModRefBarrierSet::AccessBarrier<decorators, BarrierSetT> {
83     typedef ModRefBarrierSet::AccessBarrier<decorators, BarrierSetT> ModRef;
84     typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw;
85 
86   public:
87     // Needed for loads on non-heap weak references
88     template <typename T>
89     static oop oop_load_not_in_heap(T* addr);
90 
91     // Needed for non-heap stores
92     template <typename T>
93     static void oop_store_not_in_heap(T* addr, oop new_value);
94 
95     // Needed for weak references
96     static oop oop_load_in_heap_at(oop base, ptrdiff_t offset);
97 
98     // Defensive: will catch weak oops at addresses in heap
< prev index next >