src/hotspot/share/gc/shared/barrierSet.hpp
changeset 49752 93d84f667d12
parent 49658 8237a91c1cca
child 49906 4bb58f644e4e
child 56448 76d86de267b9
equal deleted inserted replaced
49751:c3a10df652c0 49752:93d84f667d12
    40 // the rest of the system.
    40 // the rest of the system.
    41 
    41 
    42 class BarrierSet: public CHeapObj<mtGC> {
    42 class BarrierSet: public CHeapObj<mtGC> {
    43   friend class VMStructs;
    43   friend class VMStructs;
    44 
    44 
    45   static BarrierSet* _bs;
    45   static BarrierSet* _barrier_set;
    46 
    46 
    47 public:
    47 public:
    48   enum Name {
    48   enum Name {
    49 #define BARRIER_SET_DECLARE_BS_ENUM(bs_name) bs_name ,
    49 #define BARRIER_SET_DECLARE_BS_ENUM(bs_name) bs_name ,
    50     FOR_EACH_BARRIER_SET_DO(BARRIER_SET_DECLARE_BS_ENUM)
    50     FOR_EACH_BARRIER_SET_DO(BARRIER_SET_DECLARE_BS_ENUM)
    51 #undef BARRIER_SET_DECLARE_BS_ENUM
    51 #undef BARRIER_SET_DECLARE_BS_ENUM
    52     UnknownBS
    52     UnknownBS
    53   };
    53   };
    54 
       
    55   static BarrierSet* barrier_set() { return _bs; }
       
    56 
    54 
    57 protected:
    55 protected:
    58   // Fake RTTI support.  For a derived class T to participate
    56   // Fake RTTI support.  For a derived class T to participate
    59   // - T must have a corresponding Name entry.
    57   // - T must have a corresponding Name entry.
    60   // - GetName<T> must be specialized to return the corresponding Name
    58   // - GetName<T> must be specialized to return the corresponding Name
   105   // that did not enter a TLAB. Used for e.g. ReduceInitialCardMarks.
   103   // that did not enter a TLAB. Used for e.g. ReduceInitialCardMarks.
   106   // The allocation is safe to use iff it returns true. If not, the slow-path allocation
   104   // The allocation is safe to use iff it returns true. If not, the slow-path allocation
   107   // is redone until it succeeds. This can e.g. prevent allocations from the slow path
   105   // is redone until it succeeds. This can e.g. prevent allocations from the slow path
   108   // to be in old.
   106   // to be in old.
   109   virtual void on_slowpath_allocation_exit(JavaThread* thread, oop new_obj) {}
   107   virtual void on_slowpath_allocation_exit(JavaThread* thread, oop new_obj) {}
       
   108   virtual void on_thread_create(Thread* thread) {}
       
   109   virtual void on_thread_destroy(Thread* thread) {}
   110   virtual void on_thread_attach(JavaThread* thread) {}
   110   virtual void on_thread_attach(JavaThread* thread) {}
   111   virtual void on_thread_detach(JavaThread* thread) {}
   111   virtual void on_thread_detach(JavaThread* thread) {}
   112   virtual void make_parsable(JavaThread* thread) {}
   112   virtual void make_parsable(JavaThread* thread) {}
   113 
   113 
   114 public:
   114 public:
   115   // Print a description of the memory for the barrier set
   115   // Print a description of the memory for the barrier set
   116   virtual void print_on(outputStream* st) const = 0;
   116   virtual void print_on(outputStream* st) const = 0;
   117 
   117 
   118   static void set_bs(BarrierSet* bs) { _bs = bs; }
   118   static BarrierSet* barrier_set() { return _barrier_set; }
       
   119   static void set_barrier_set(BarrierSet* barrier_set);
   119 
   120 
   120   BarrierSetAssembler* barrier_set_assembler() {
   121   BarrierSetAssembler* barrier_set_assembler() {
   121     assert(_barrier_set_assembler != NULL, "should be set");
   122     assert(_barrier_set_assembler != NULL, "should be set");
   122     return _barrier_set_assembler;
   123     return _barrier_set_assembler;
   123   }
   124   }