< prev index next >

src/hotspot/share/memory/memRegion.cpp

Print this page
rev 58060 : [mq]: 8238999-iklam-review
   1 /*
   2  * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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  *


  85     // strictly above
  86     return MemRegion(start(), end());
  87   }
  88   if (mr2.start() >= start() && mr2.end() >= end()) {
  89     // overlap ending
  90     return MemRegion(start(), mr2.start());
  91   }
  92   if (mr2.start() <= start() && mr2.end() >= end()) {
  93     // completely overlapping
  94     return MemRegion();
  95   }
  96   if (mr2.start() > start() && mr2.end() < end()) {
  97     // interior
  98     guarantee(false, "MemRegion::minus, but interior");
  99     return MemRegion();
 100   }
 101   ShouldNotReachHere();
 102   return MemRegion();
 103 }
 104 
 105 void* MemRegion::operator new(size_t size) throw() {
 106   return (address)AllocateHeap(size, mtGC, CURRENT_PC,
 107     AllocFailStrategy::RETURN_NULL);
 108 }
 109 
 110 void* MemRegion::operator new [](size_t size) throw() {
 111   return (address)AllocateHeap(size, mtGC, CURRENT_PC,
 112     AllocFailStrategy::RETURN_NULL);
 113 }
 114 void  MemRegion::operator delete(void* p) {
 115   FreeHeap(p);
 116 }
 117 
 118 void  MemRegion::operator delete [](void* p) {
 119   FreeHeap(p);
 120 }
   1 /*
   2  * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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  *


  85     // strictly above
  86     return MemRegion(start(), end());
  87   }
  88   if (mr2.start() >= start() && mr2.end() >= end()) {
  89     // overlap ending
  90     return MemRegion(start(), mr2.start());
  91   }
  92   if (mr2.start() <= start() && mr2.end() >= end()) {
  93     // completely overlapping
  94     return MemRegion();
  95   }
  96   if (mr2.start() > start() && mr2.end() < end()) {
  97     // interior
  98     guarantee(false, "MemRegion::minus, but interior");
  99     return MemRegion();
 100   }
 101   ShouldNotReachHere();
 102   return MemRegion();
 103 }
 104 
 105 MemRegion* MemRegion::create(uint length, MEMFLAGS flags) {
 106   MemRegion* result = NEW_C_HEAP_ARRAY(MemRegion, length, flags);
 107   for (uint i = 0; i < length; i++) {
 108     ::new (&result[i]) MemRegion();
 109   }
 110   return result;









 111 }
< prev index next >