< prev index next >

src/hotspot/share/memory/memRegion.hpp

Print this page
rev 55281 : [mq]: 8225478-cmrootregions-cleanup


  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_MEMORY_MEMREGION_HPP
  26 #define SHARE_MEMORY_MEMREGION_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "utilities/debug.hpp"
  30 #include "utilities/globalDefinitions.hpp"
  31 
  32 // A very simple data structure representing a contigous region
  33 // region of address space.
  34 
  35 // Note that MemRegions are passed by value, not by reference.
  36 // The intent is that they remain very small and contain no
  37 // objects. The copy constructor and destructor must be trivial,
  38 // to support optimization for pass-by-value.
  39 // These should never be allocated in heap but we do
  40 // create MemRegions (in CardTableBarrierSet) in heap so operator
  41 // new and operator new [] added for this special case.
  42 
  43 class MemRegion {
  44   friend class VMStructs;
  45 private:
  46   HeapWord* _start;
  47   size_t    _word_size;
  48 
  49 public:
  50   MemRegion() : _start(NULL), _word_size(0) {};
  51   MemRegion(HeapWord* start, size_t word_size) :
  52     _start(start), _word_size(word_size) {};
  53   MemRegion(HeapWord* start, HeapWord* end) :
  54     _start(start), _word_size(pointer_delta(end, start)) {
  55     assert(end >= start, "incorrect constructor arguments");
  56   }
  57   MemRegion(MetaWord* start, MetaWord* end) :
  58     _start((HeapWord*)start), _word_size(pointer_delta(end, start)) {
  59     assert(end >= start, "incorrect constructor arguments");
  60   }
  61 




  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_MEMORY_MEMREGION_HPP
  26 #define SHARE_MEMORY_MEMREGION_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "utilities/debug.hpp"
  30 #include "utilities/globalDefinitions.hpp"
  31 
  32 // A very simple data structure representing a contigous region
  33 // region of address space.
  34 
  35 // Note that MemRegions are typically passed by value, not by reference.
  36 // The intent is that they remain very small and contain no
  37 // objects. The copy constructor and destructor must be trivial,
  38 // to support optimization for pass-by-value.
  39 // These should almost never be allocated in heap but we do
  40 // create MemRegions (in CardTable and G1CMRootMemRegions) on the heap so operator
  41 // new and operator new [] were added for these special cases.
  42 
  43 class MemRegion {
  44   friend class VMStructs;
  45 private:
  46   HeapWord* _start;
  47   size_t    _word_size;
  48 
  49 public:
  50   MemRegion() : _start(NULL), _word_size(0) {};
  51   MemRegion(HeapWord* start, size_t word_size) :
  52     _start(start), _word_size(word_size) {};
  53   MemRegion(HeapWord* start, HeapWord* end) :
  54     _start(start), _word_size(pointer_delta(end, start)) {
  55     assert(end >= start, "incorrect constructor arguments");
  56   }
  57   MemRegion(MetaWord* start, MetaWord* end) :
  58     _start((HeapWord*)start), _word_size(pointer_delta(end, start)) {
  59     assert(end >= start, "incorrect constructor arguments");
  60   }
  61 


< prev index next >