< prev index next >

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

Print this page

  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/g1DirtyCardQueue.hpp"

 29 #include "gc/g1/g1SATBMarkQueueSet.hpp"
 30 #include "gc/shared/cardTable.hpp"
 31 #include "gc/shared/cardTableBarrierSet.hpp"
 32 #include "gc/shared/bufferNode.hpp"
 33 
 34 class G1CardTable;
 35 
 36 // This barrier is specialized to use a logging barrier to support
 37 // snapshot-at-the-beginning marking.
 38 
 39 class G1BarrierSet: public CardTableBarrierSet {
 40   friend class VMStructs;
 41  private:
 42   BufferNode::Allocator _satb_mark_queue_buffer_allocator;
 43   BufferNode::Allocator _dirty_card_queue_buffer_allocator;
 44   G1SATBMarkQueueSet _satb_mark_queue_set;
 45   G1DirtyCardQueueSet _dirty_card_queue_set;
 46 
 47   static G1BarrierSet* g1_barrier_set() {
 48     return barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());

 74   inline void write_region(MemRegion mr);
 75   void write_region(JavaThread* thread, MemRegion mr);
 76 
 77   template <DecoratorSet decorators, typename T>
 78   void write_ref_field_post(T* field);
 79   void write_ref_field_post_slow(volatile CardValue* byte);
 80 
 81   virtual void on_thread_create(Thread* thread);
 82   virtual void on_thread_destroy(Thread* thread);
 83   virtual void on_thread_attach(Thread* thread);
 84   virtual void on_thread_detach(Thread* thread);
 85 
 86   static G1SATBMarkQueueSet& satb_mark_queue_set() {
 87     return g1_barrier_set()->_satb_mark_queue_set;
 88   }
 89 
 90   static G1DirtyCardQueueSet& dirty_card_queue_set() {
 91     return g1_barrier_set()->_dirty_card_queue_set;
 92   }
 93 


 94   // Callbacks for runtime accesses.
 95   template <DecoratorSet decorators, typename BarrierSetT = G1BarrierSet>
 96   class AccessBarrier: public ModRefBarrierSet::AccessBarrier<decorators, BarrierSetT> {
 97     typedef ModRefBarrierSet::AccessBarrier<decorators, BarrierSetT> ModRef;
 98     typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw;
 99 
100   public:
101     // Needed for loads on non-heap weak references
102     template <typename T>
103     static oop oop_load_not_in_heap(T* addr);
104 
105     // Needed for non-heap stores
106     template <typename T>
107     static void oop_store_not_in_heap(T* addr, oop new_value);
108 
109     // Needed for weak references
110     static oop oop_load_in_heap_at(oop base, ptrdiff_t offset);
111 
112     // Defensive: will catch weak oops at addresses in heap
113     template <typename T>

  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/g1DirtyCardQueue.hpp"
 29 #include "gc/g1/g1HeapRegion.hpp"
 30 #include "gc/g1/g1SATBMarkQueueSet.hpp"
 31 #include "gc/shared/cardTable.hpp"
 32 #include "gc/shared/cardTableBarrierSet.hpp"
 33 #include "gc/shared/bufferNode.hpp"
 34 
 35 class G1CardTable;
 36 
 37 // This barrier is specialized to use a logging barrier to support
 38 // snapshot-at-the-beginning marking.
 39 
 40 class G1BarrierSet: public CardTableBarrierSet {
 41   friend class VMStructs;
 42  private:
 43   BufferNode::Allocator _satb_mark_queue_buffer_allocator;
 44   BufferNode::Allocator _dirty_card_queue_buffer_allocator;
 45   G1SATBMarkQueueSet _satb_mark_queue_set;
 46   G1DirtyCardQueueSet _dirty_card_queue_set;
 47 
 48   static G1BarrierSet* g1_barrier_set() {
 49     return barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());

 75   inline void write_region(MemRegion mr);
 76   void write_region(JavaThread* thread, MemRegion mr);
 77 
 78   template <DecoratorSet decorators, typename T>
 79   void write_ref_field_post(T* field);
 80   void write_ref_field_post_slow(volatile CardValue* byte);
 81 
 82   virtual void on_thread_create(Thread* thread);
 83   virtual void on_thread_destroy(Thread* thread);
 84   virtual void on_thread_attach(Thread* thread);
 85   virtual void on_thread_detach(Thread* thread);
 86 
 87   static G1SATBMarkQueueSet& satb_mark_queue_set() {
 88     return g1_barrier_set()->_satb_mark_queue_set;
 89   }
 90 
 91   static G1DirtyCardQueueSet& dirty_card_queue_set() {
 92     return g1_barrier_set()->_dirty_card_queue_set;
 93   }
 94 
 95   virtual uint grain_shift() { return G1HeapRegion::LogOfHRGrainBytes; }
 96 
 97   // Callbacks for runtime accesses.
 98   template <DecoratorSet decorators, typename BarrierSetT = G1BarrierSet>
 99   class AccessBarrier: public ModRefBarrierSet::AccessBarrier<decorators, BarrierSetT> {
100     typedef ModRefBarrierSet::AccessBarrier<decorators, BarrierSetT> ModRef;
101     typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw;
102 
103   public:
104     // Needed for loads on non-heap weak references
105     template <typename T>
106     static oop oop_load_not_in_heap(T* addr);
107 
108     // Needed for non-heap stores
109     template <typename T>
110     static void oop_store_not_in_heap(T* addr, oop new_value);
111 
112     // Needed for weak references
113     static oop oop_load_in_heap_at(oop base, ptrdiff_t offset);
114 
115     // Defensive: will catch weak oops at addresses in heap
116     template <typename T>
< prev index next >