8223622: Move Universe usage out of memAllocator.hpp
authorstefank
Thu, 09 May 2019 14:26:03 +0200
changeset 54784 31b27600b5db
parent 54783 3331dad9cb30
child 54785 83b3671d9e30
8223622: Move Universe usage out of memAllocator.hpp Reviewed-by: coleenp, lkorinth
src/hotspot/share/gc/shared/memAllocator.cpp
src/hotspot/share/gc/shared/memAllocator.hpp
--- a/src/hotspot/share/gc/shared/memAllocator.cpp	Thu May 09 14:26:03 2019 +0200
+++ b/src/hotspot/share/gc/shared/memAllocator.cpp	Thu May 09 14:26:03 2019 +0200
@@ -260,12 +260,12 @@
 
 HeapWord* MemAllocator::allocate_outside_tlab(Allocation& allocation) const {
   allocation._allocated_outside_tlab = true;
-  HeapWord* mem = _heap->mem_allocate(_word_size, &allocation._overhead_limit_exceeded);
+  HeapWord* mem = Universe::heap()->mem_allocate(_word_size, &allocation._overhead_limit_exceeded);
   if (mem == NULL) {
     return mem;
   }
 
-  NOT_PRODUCT(_heap->check_for_non_bad_heap_word_value(mem, _word_size));
+  NOT_PRODUCT(Universe::heap()->check_for_non_bad_heap_word_value(mem, _word_size));
   size_t size_in_bytes = _word_size * HeapWordSize;
   _thread->incr_allocated_bytes(size_in_bytes);
 
@@ -322,7 +322,7 @@
   // Allocate a new TLAB requesting new_tlab_size. Any size
   // between minimal and new_tlab_size is accepted.
   size_t min_tlab_size = ThreadLocalAllocBuffer::compute_min_size(_word_size);
-  mem = _heap->allocate_new_tlab(min_tlab_size, new_tlab_size, &allocation._allocated_tlab_size);
+  mem = Universe::heap()->allocate_new_tlab(min_tlab_size, new_tlab_size, &allocation._allocated_tlab_size);
   if (mem == NULL) {
     assert(allocation._allocated_tlab_size == 0,
            "Allocation failed, but actual size was updated. min: " SIZE_FORMAT
--- a/src/hotspot/share/gc/shared/memAllocator.hpp	Thu May 09 14:26:03 2019 +0200
+++ b/src/hotspot/share/gc/shared/memAllocator.hpp	Thu May 09 14:26:03 2019 +0200
@@ -37,7 +37,6 @@
 protected:
   class Allocation;
 
-  CollectedHeap* const _heap;
   Thread* const        _thread;
   Klass* const         _klass;
   const size_t         _word_size;
@@ -50,8 +49,7 @@
 
 protected:
   MemAllocator(Klass* klass, size_t word_size, Thread* thread)
-    : _heap(Universe::heap()),
-      _thread(thread),
+    : _thread(thread),
       _klass(klass),
       _word_size(word_size)
   { }