< prev index next >

src/hotspot/share/gc/shared/spaceDecorator.hpp

Print this page
rev 56811 : imported patch 8189737-heapregion-remove-space-inheritance


   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_SHARED_SPACEDECORATOR_HPP
  26 #define SHARE_GC_SHARED_SPACEDECORATOR_HPP
  27 
  28 #include "gc/parallel/mutableSpace.hpp"
  29 #include "gc/shared/space.hpp"
  30 #include "utilities/globalDefinitions.hpp"
  31 
  32 class SpaceDecorator: public AllStatic {
  33  public:
  34   // Initialization flags.
  35   static const bool Clear               = true;
  36   static const bool DontClear           = false;
  37   static const bool Mangle              = true;
  38   static const bool DontMangle          = false;
  39 };
  40 
  41 // Functionality for use with class Space and class MutableSpace.
  42 //   The approach taken with the mangling is to mangle all
  43 // the space initially and then to mangle areas that have
  44 // been allocated since the last collection.  Mangling is
  45 // done in the context of a generation and in the context
  46 // of a space.
  47 //   The space in a generation is mangled when it is first
  48 // initialized and when the generation grows.  The spaces
  49 // are not necessarily up-to-date when this mangling occurs


 103 
 104   // Overwrites the unused portion of this space.
 105   // Mangle only the region not previously mangled [top, top_previously_mangled)
 106   void mangle_unused_area();
 107   // Mangle all the unused region [top, end)
 108   void mangle_unused_area_complete();
 109   // Do some sparse checking on the area that should have been mangled.
 110   void check_mangled_unused_area(HeapWord* limit) PRODUCT_RETURN;
 111   // Do a complete check of the area that should be mangled.
 112   void check_mangled_unused_area_complete() PRODUCT_RETURN;
 113 
 114   // Mangle the MemRegion.  This is a non-space specific mangler.  It
 115   // is used during the initial mangling of a space before the space
 116   // is fully constructed.  Also is used when a generation is expanded
 117   // and possibly before the spaces have been reshaped to to the new
 118   // size of the generation.
 119   static void mangle_region(MemRegion mr) PRODUCT_RETURN;
 120 };
 121 
 122 class ContiguousSpace;

 123 
 124 // For use with GenCollectedHeap's
 125 class GenSpaceMangler: public SpaceMangler {
 126   ContiguousSpace* _sp;
 127 
 128   ContiguousSpace* sp() { return _sp; }
 129 
 130   HeapWord* top() const { return _sp->top(); }
 131   HeapWord* end() const { return _sp->end(); }
 132 
 133  public:
 134   GenSpaceMangler(ContiguousSpace* sp) : SpaceMangler(), _sp(sp) {}
 135 };
 136 
 137 // For use with ParallelScavengeHeap's.
 138 class MutableSpaceMangler: public SpaceMangler {
 139   MutableSpace* _sp;
 140 
 141   MutableSpace* sp() { return _sp; }
 142 
 143   HeapWord* top() const { return _sp->top(); }
 144   HeapWord* end() const { return _sp->end(); }
 145 
 146  public:
 147   MutableSpaceMangler(MutableSpace* sp) : SpaceMangler(), _sp(sp) {}
 148 };
 149 
 150 #endif // SHARE_GC_SHARED_SPACEDECORATOR_HPP


   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_SHARED_SPACEDECORATOR_HPP
  26 #define SHARE_GC_SHARED_SPACEDECORATOR_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "memory/memRegion.hpp"
  30 #include "utilities/globalDefinitions.hpp"
  31 
  32 class SpaceDecorator: public AllStatic {
  33  public:
  34   // Initialization flags.
  35   static const bool Clear               = true;
  36   static const bool DontClear           = false;
  37   static const bool Mangle              = true;
  38   static const bool DontMangle          = false;
  39 };
  40 
  41 // Functionality for use with class Space and class MutableSpace.
  42 //   The approach taken with the mangling is to mangle all
  43 // the space initially and then to mangle areas that have
  44 // been allocated since the last collection.  Mangling is
  45 // done in the context of a generation and in the context
  46 // of a space.
  47 //   The space in a generation is mangled when it is first
  48 // initialized and when the generation grows.  The spaces
  49 // are not necessarily up-to-date when this mangling occurs


 103 
 104   // Overwrites the unused portion of this space.
 105   // Mangle only the region not previously mangled [top, top_previously_mangled)
 106   void mangle_unused_area();
 107   // Mangle all the unused region [top, end)
 108   void mangle_unused_area_complete();
 109   // Do some sparse checking on the area that should have been mangled.
 110   void check_mangled_unused_area(HeapWord* limit) PRODUCT_RETURN;
 111   // Do a complete check of the area that should be mangled.
 112   void check_mangled_unused_area_complete() PRODUCT_RETURN;
 113 
 114   // Mangle the MemRegion.  This is a non-space specific mangler.  It
 115   // is used during the initial mangling of a space before the space
 116   // is fully constructed.  Also is used when a generation is expanded
 117   // and possibly before the spaces have been reshaped to to the new
 118   // size of the generation.
 119   static void mangle_region(MemRegion mr) PRODUCT_RETURN;
 120 };
 121 
 122 class ContiguousSpace;
 123 class MutableSpace;
 124 
 125 // For use with GenCollectedHeap's
 126 class GenSpaceMangler: public SpaceMangler {
 127   ContiguousSpace* _sp;
 128 
 129   ContiguousSpace* sp() { return _sp; }
 130 
 131   HeapWord* top() const;
 132   HeapWord* end() const;
 133 
 134  public:
 135   GenSpaceMangler(ContiguousSpace* sp) : SpaceMangler(), _sp(sp) {}
 136 };
 137 
 138 // For use with ParallelScavengeHeap's.
 139 class MutableSpaceMangler: public SpaceMangler {
 140   MutableSpace* _sp;
 141 
 142   MutableSpace* sp() { return _sp; }
 143 
 144   HeapWord* top() const;
 145   HeapWord* end() const;
 146 
 147  public:
 148   MutableSpaceMangler(MutableSpace* sp) : SpaceMangler(), _sp(sp) {}
 149 };
 150 
 151 #endif // SHARE_GC_SHARED_SPACEDECORATOR_HPP
< prev index next >