< prev index next >

src/hotspot/share/gc/z/zCollectedHeap.cpp

Print this page




   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 #include "precompiled.hpp"
  25 #include "gc/shared/gcHeapSummary.hpp"

  26 #include "gc/shared/suspendibleThreadSet.hpp"
  27 #include "gc/z/zCollectedHeap.hpp"
  28 #include "gc/z/zGlobals.hpp"
  29 #include "gc/z/zHeap.inline.hpp"
  30 #include "gc/z/zNMethod.hpp"
  31 #include "gc/z/zServiceability.hpp"
  32 #include "gc/z/zStat.hpp"
  33 #include "gc/z/zUtils.inline.hpp"
  34 #include "memory/universe.hpp"
  35 #include "runtime/mutexLocker.hpp"
  36 
  37 ZCollectedHeap* ZCollectedHeap::heap() {
  38   CollectedHeap* heap = Universe::heap();
  39   assert(heap != NULL, "Uninitialized access to ZCollectedHeap::heap()");
  40   assert(heap->kind() == CollectedHeap::Z, "Invalid name");
  41   return (ZCollectedHeap*)heap;
  42 }
  43 
  44 ZCollectedHeap::ZCollectedHeap() :
  45     _soft_ref_policy(),


  97 size_t ZCollectedHeap::used() const {
  98   return _heap.used();
  99 }
 100 
 101 size_t ZCollectedHeap::unused() const {
 102   return _heap.unused();
 103 }
 104 
 105 bool ZCollectedHeap::is_maximal_no_gc() const {
 106   // Not supported
 107   ShouldNotReachHere();
 108   return false;
 109 }
 110 
 111 bool ZCollectedHeap::is_in(const void* p) const {
 112   return _heap.is_in((uintptr_t)p);
 113 }
 114 
 115 uint32_t ZCollectedHeap::hash_oop(oop obj) const {
 116   return _heap.hash_oop(obj);





 117 }
 118 
 119 HeapWord* ZCollectedHeap::allocate_new_tlab(size_t min_size, size_t requested_size, size_t* actual_size) {
 120   const size_t size_in_bytes = ZUtils::words_to_bytes(align_object_size(requested_size));
 121   const uintptr_t addr = _heap.alloc_tlab(size_in_bytes);
 122 
 123   if (addr != 0) {
 124     *actual_size = requested_size;
 125   }
 126 
 127   return (HeapWord*)addr;
 128 }
 129 
 130 HeapWord* ZCollectedHeap::mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded) {
 131   const size_t size_in_bytes = ZUtils::words_to_bytes(align_object_size(size));
 132   return (HeapWord*)_heap.alloc_object(size_in_bytes);
 133 }
 134 
 135 MetaWord* ZCollectedHeap::satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
 136                                                              size_t size,




   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 #include "precompiled.hpp"
  25 #include "gc/shared/gcHeapSummary.hpp"
  26 #include "gc/shared/memAllocator.hpp"
  27 #include "gc/shared/suspendibleThreadSet.hpp"
  28 #include "gc/z/zCollectedHeap.hpp"
  29 #include "gc/z/zGlobals.hpp"
  30 #include "gc/z/zHeap.inline.hpp"
  31 #include "gc/z/zNMethod.hpp"
  32 #include "gc/z/zServiceability.hpp"
  33 #include "gc/z/zStat.hpp"
  34 #include "gc/z/zUtils.inline.hpp"
  35 #include "memory/universe.hpp"
  36 #include "runtime/mutexLocker.hpp"
  37 
  38 ZCollectedHeap* ZCollectedHeap::heap() {
  39   CollectedHeap* heap = Universe::heap();
  40   assert(heap != NULL, "Uninitialized access to ZCollectedHeap::heap()");
  41   assert(heap->kind() == CollectedHeap::Z, "Invalid name");
  42   return (ZCollectedHeap*)heap;
  43 }
  44 
  45 ZCollectedHeap::ZCollectedHeap() :
  46     _soft_ref_policy(),


  98 size_t ZCollectedHeap::used() const {
  99   return _heap.used();
 100 }
 101 
 102 size_t ZCollectedHeap::unused() const {
 103   return _heap.unused();
 104 }
 105 
 106 bool ZCollectedHeap::is_maximal_no_gc() const {
 107   // Not supported
 108   ShouldNotReachHere();
 109   return false;
 110 }
 111 
 112 bool ZCollectedHeap::is_in(const void* p) const {
 113   return _heap.is_in((uintptr_t)p);
 114 }
 115 
 116 uint32_t ZCollectedHeap::hash_oop(oop obj) const {
 117   return _heap.hash_oop(obj);
 118 }
 119 
 120 oop ZCollectedHeap::array_allocate(Klass* klass, int size, int length, bool do_zero, TRAPS) {
 121   ObjArrayAllocator allocator(klass, size, length, false /* do_zero */, THREAD);
 122   return allocator.allocate();
 123 }
 124 
 125 HeapWord* ZCollectedHeap::allocate_new_tlab(size_t min_size, size_t requested_size, size_t* actual_size) {
 126   const size_t size_in_bytes = ZUtils::words_to_bytes(align_object_size(requested_size));
 127   const uintptr_t addr = _heap.alloc_tlab(size_in_bytes);
 128 
 129   if (addr != 0) {
 130     *actual_size = requested_size;
 131   }
 132 
 133   return (HeapWord*)addr;
 134 }
 135 
 136 HeapWord* ZCollectedHeap::mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded) {
 137   const size_t size_in_bytes = ZUtils::words_to_bytes(align_object_size(size));
 138   return (HeapWord*)_heap.alloc_object(size_in_bytes);
 139 }
 140 
 141 MetaWord* ZCollectedHeap::satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
 142                                                              size_t size,


< prev index next >