< prev index next >

src/share/vm/gc/shared/barrierSet.hpp

Print this page
rev 8362 : 8079792: GC directory structure cleanup
Reviewed-by:


   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   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_VM_MEMORY_BARRIERSET_HPP
  26 #define SHARE_VM_MEMORY_BARRIERSET_HPP
  27 
  28 #include "memory/memRegion.hpp"
  29 #include "oops/oopsHierarchy.hpp"
  30 #include "utilities/fakeRttiSupport.hpp"
  31 
  32 // This class provides the interface between a barrier implementation and
  33 // the rest of the system.
  34 
  35 class BarrierSet: public CHeapObj<mtGC> {
  36   friend class VMStructs;
  37 public:
  38   // Fake RTTI support.  For a derived class T to participate
  39   // - T must have a corresponding Name entry.
  40   // - GetName<T> must be specialized to return the corresponding Name
  41   //   entry.
  42   // - If T is a base class, the constructor must have a FakeRtti
  43   //   parameter and pass it up to its base class, with the tag set
  44   //   augmented with the corresponding Name entry.
  45   // - If T is a concrete class, the constructor must create a
  46   //   FakeRtti object whose tag set includes the corresponding Name


 201 public:
 202   // Inform the BarrierSet that the the covered heap region that starts
 203   // with "base" has been changed to have the given size (possibly from 0,
 204   // for initialization.)
 205   virtual void resize_covered_region(MemRegion new_region) = 0;
 206 
 207   // If the barrier set imposes any alignment restrictions on boundaries
 208   // within the heap, this function tells whether they are met.
 209   virtual bool is_aligned(HeapWord* addr) = 0;
 210 
 211   // Print a description of the memory for the barrier set
 212   virtual void print_on(outputStream* st) const = 0;
 213 };
 214 
 215 template<typename T>
 216 inline T* barrier_set_cast(BarrierSet* bs) {
 217   assert(bs->is_a(BarrierSet::GetName<T>::value), "wrong type of barrier set");
 218   return static_cast<T*>(bs);
 219 }
 220 
 221 #endif // SHARE_VM_MEMORY_BARRIERSET_HPP


   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   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_VM_GC_SHARED_BARRIERSET_HPP
  26 #define SHARE_VM_GC_SHARED_BARRIERSET_HPP
  27 
  28 #include "memory/memRegion.hpp"
  29 #include "oops/oopsHierarchy.hpp"
  30 #include "utilities/fakeRttiSupport.hpp"
  31 
  32 // This class provides the interface between a barrier implementation and
  33 // the rest of the system.
  34 
  35 class BarrierSet: public CHeapObj<mtGC> {
  36   friend class VMStructs;
  37 public:
  38   // Fake RTTI support.  For a derived class T to participate
  39   // - T must have a corresponding Name entry.
  40   // - GetName<T> must be specialized to return the corresponding Name
  41   //   entry.
  42   // - If T is a base class, the constructor must have a FakeRtti
  43   //   parameter and pass it up to its base class, with the tag set
  44   //   augmented with the corresponding Name entry.
  45   // - If T is a concrete class, the constructor must create a
  46   //   FakeRtti object whose tag set includes the corresponding Name


 201 public:
 202   // Inform the BarrierSet that the the covered heap region that starts
 203   // with "base" has been changed to have the given size (possibly from 0,
 204   // for initialization.)
 205   virtual void resize_covered_region(MemRegion new_region) = 0;
 206 
 207   // If the barrier set imposes any alignment restrictions on boundaries
 208   // within the heap, this function tells whether they are met.
 209   virtual bool is_aligned(HeapWord* addr) = 0;
 210 
 211   // Print a description of the memory for the barrier set
 212   virtual void print_on(outputStream* st) const = 0;
 213 };
 214 
 215 template<typename T>
 216 inline T* barrier_set_cast(BarrierSet* bs) {
 217   assert(bs->is_a(BarrierSet::GetName<T>::value), "wrong type of barrier set");
 218   return static_cast<T*>(bs);
 219 }
 220 
 221 #endif // SHARE_VM_GC_SHARED_BARRIERSET_HPP
< prev index next >