< prev index next >

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

Print this page

  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #ifndef SHARE_GC_G1_G1BARRIERSET_HPP
 26 #define SHARE_GC_G1_G1BARRIERSET_HPP
 27 

 28 #include "gc/g1/g1SATBMarkQueueSet.hpp"
 29 #include "gc/shared/bufferNode.hpp"
 30 #include "gc/shared/cardTable.hpp"
 31 #include "gc/shared/cardTableBarrierSet.hpp"
 32 #include "runtime/atomic.hpp"
 33 
 34 class G1CardTable;
 35 class Thread;
 36 
 37 // This barrier set is specialized to manage two card tables:
 38 // * one the mutator is currently working on ("card table")
 39 // * one the refinement threads or GC during pause are working on ("refinement table")
 40 //
 41 // The card table acts like a regular card table where the mutator dirties cards
 42 // containing potentially interesting references.
 43 //
 44 // When the amount of dirty cards on the card table exceeds a threshold, G1 swaps
 45 // the card tables and has the refinement threads reduce them by "refining"
 46 // them.
 47 // I.e. refinement looks at all dirty cards on the refinement table, and updates

 99 
100   template <DecoratorSet decorators, typename T>
101   void write_ref_field_pre(T* field);
102 
103   virtual void write_region(MemRegion mr);
104 
105   template <DecoratorSet decorators = DECORATORS_NONE, typename T>
106   void write_ref_field_post(T* field);
107 
108   virtual void on_thread_create(Thread* thread);
109   virtual void on_thread_destroy(Thread* thread);
110   virtual void on_thread_attach(Thread* thread);
111   virtual void on_thread_detach(Thread* thread);
112 
113   static G1SATBMarkQueueSet& satb_mark_queue_set() {
114     return g1_barrier_set()->_satb_mark_queue_set;
115   }
116 
117   virtual void print_on(outputStream* st) const;
118 


119   // Callbacks for runtime accesses.
120   template <DecoratorSet decorators, typename BarrierSetT = G1BarrierSet>
121   class AccessBarrier: public CardTableBarrierSet::AccessBarrier<decorators, BarrierSetT> {
122     typedef CardTableBarrierSet::AccessBarrier<decorators, BarrierSetT> CardTableBS;
123     typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw;
124 
125   public:
126     // Needed for loads on non-heap weak references
127     template <typename T>
128     static oop oop_load_not_in_heap(T* addr);
129 
130     // Needed for non-heap stores
131     template <typename T>
132     static void oop_store_not_in_heap(T* addr, oop new_value);
133 
134     // Needed for weak references
135     static oop oop_load_in_heap_at(oop base, ptrdiff_t offset);
136 
137     // Defensive: will catch weak oops at addresses in heap
138     template <typename T>

  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #ifndef SHARE_GC_G1_G1BARRIERSET_HPP
 26 #define SHARE_GC_G1_G1BARRIERSET_HPP
 27 
 28 #include "gc/g1/g1HeapRegion.hpp"
 29 #include "gc/g1/g1SATBMarkQueueSet.hpp"
 30 #include "gc/shared/bufferNode.hpp"
 31 #include "gc/shared/cardTable.hpp"
 32 #include "gc/shared/cardTableBarrierSet.hpp"
 33 #include "runtime/atomic.hpp"
 34 
 35 class G1CardTable;
 36 class Thread;
 37 
 38 // This barrier set is specialized to manage two card tables:
 39 // * one the mutator is currently working on ("card table")
 40 // * one the refinement threads or GC during pause are working on ("refinement table")
 41 //
 42 // The card table acts like a regular card table where the mutator dirties cards
 43 // containing potentially interesting references.
 44 //
 45 // When the amount of dirty cards on the card table exceeds a threshold, G1 swaps
 46 // the card tables and has the refinement threads reduce them by "refining"
 47 // them.
 48 // I.e. refinement looks at all dirty cards on the refinement table, and updates

100 
101   template <DecoratorSet decorators, typename T>
102   void write_ref_field_pre(T* field);
103 
104   virtual void write_region(MemRegion mr);
105 
106   template <DecoratorSet decorators = DECORATORS_NONE, typename T>
107   void write_ref_field_post(T* field);
108 
109   virtual void on_thread_create(Thread* thread);
110   virtual void on_thread_destroy(Thread* thread);
111   virtual void on_thread_attach(Thread* thread);
112   virtual void on_thread_detach(Thread* thread);
113 
114   static G1SATBMarkQueueSet& satb_mark_queue_set() {
115     return g1_barrier_set()->_satb_mark_queue_set;
116   }
117 
118   virtual void print_on(outputStream* st) const;
119 
120   virtual uint grain_shift() { return G1HeapRegion::LogOfHRGrainBytes; }
121 
122   // Callbacks for runtime accesses.
123   template <DecoratorSet decorators, typename BarrierSetT = G1BarrierSet>
124   class AccessBarrier: public CardTableBarrierSet::AccessBarrier<decorators, BarrierSetT> {
125     typedef CardTableBarrierSet::AccessBarrier<decorators, BarrierSetT> CardTableBS;
126     typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw;
127 
128   public:
129     // Needed for loads on non-heap weak references
130     template <typename T>
131     static oop oop_load_not_in_heap(T* addr);
132 
133     // Needed for non-heap stores
134     template <typename T>
135     static void oop_store_not_in_heap(T* addr, oop new_value);
136 
137     // Needed for weak references
138     static oop oop_load_in_heap_at(oop base, ptrdiff_t offset);
139 
140     // Defensive: will catch weak oops at addresses in heap
141     template <typename T>
< prev index next >