src/hotspot/share/gc/shared/collectedHeap.hpp
changeset 50882 80abf702eed8
parent 50578 e2a7f431f65c
child 51625 c265860d5d45
--- a/src/hotspot/share/gc/shared/collectedHeap.hpp	Thu Jun 28 15:17:44 2018 +0200
+++ b/src/hotspot/share/gc/shared/collectedHeap.hpp	Thu Jun 28 14:22:28 2018 +0200
@@ -95,6 +95,7 @@
   friend class VMStructs;
   friend class JVMCIVMStructs;
   friend class IsGCActiveMark; // Block structured external access to _is_gc_active
+  friend class MemAllocator;
 
  private:
 #ifdef ASSERT
@@ -141,13 +142,6 @@
   // Reinitialize tlabs before resuming mutators.
   virtual void resize_all_tlabs();
 
-  // Allocate from the current thread's TLAB, with broken-out slow path.
-  inline static HeapWord* allocate_from_tlab(Klass* klass, size_t size, TRAPS);
-  static HeapWord* allocate_from_tlab_slow(Klass* klass, size_t size, TRAPS);
-
-  inline static HeapWord* allocate_outside_tlab(Klass* klass, size_t size,
-                                                bool* gc_overhead_limit_was_exceeded, TRAPS);
-
   // Raw memory allocation facilities
   // The obj and array allocate methods are covers for these methods.
   // mem_allocate() should never be
@@ -155,29 +149,6 @@
   virtual HeapWord* mem_allocate(size_t size,
                                  bool* gc_overhead_limit_was_exceeded) = 0;
 
-  // Allocate an uninitialized block of the given size, or returns NULL if
-  // this is impossible.
-  inline static HeapWord* common_mem_allocate_noinit(Klass* klass, size_t size, TRAPS);
-
-  // Like allocate_init, but the block returned by a successful allocation
-  // is guaranteed initialized to zeros.
-  inline static HeapWord* common_mem_allocate_init(Klass* klass, size_t size, TRAPS);
-
-  // Helper functions for (VM) allocation.
-  inline static void post_allocation_setup_common(Klass* klass, HeapWord* obj);
-  inline static void post_allocation_setup_no_klass_install(Klass* klass,
-                                                            HeapWord* objPtr);
-
-  inline static void post_allocation_setup_obj(Klass* klass, HeapWord* obj, int size);
-
-  inline static void post_allocation_setup_array(Klass* klass,
-                                                 HeapWord* obj, int length);
-
-  inline static void post_allocation_setup_class(Klass* klass, HeapWord* obj, int size);
-
-  // Clears an allocated object.
-  inline static void init_obj(HeapWord* obj, size_t size);
-
   // Filler object utilities.
   static inline size_t filler_array_hdr_size();
   static inline size_t filler_array_min_size();
@@ -194,21 +165,7 @@
 
   virtual void trace_heap(GCWhen::Type when, const GCTracer* tracer);
 
-  // Internal allocation methods.
-  inline static HeapWord* common_allocate_memory(Klass* klass, int size,
-                                                 void (*post_setup)(Klass*, HeapWord*, int),
-                                                 int size_for_post, bool init_memory,
-                                                 TRAPS);
-
-  // Internal allocation method for common obj/class/array allocations.
-  inline static HeapWord* allocate_memory(Klass* klass, int size,
-                                          void (*post_setup)(Klass*, HeapWord*, int),
-                                          int size_for_post, bool init_memory,
-                                          TRAPS);
-
   // Verification functions
-  virtual void check_for_bad_heap_word_value(HeapWord* addr, size_t size)
-    PRODUCT_RETURN;
   virtual void check_for_non_bad_heap_word_value(HeapWord* addr, size_t size)
     PRODUCT_RETURN;
   debug_only(static void check_for_valid_allocation_state();)
@@ -328,18 +285,9 @@
   }
   GCCause::Cause gc_cause() { return _gc_cause; }
 
-  // General obj/array allocation facilities.
-  inline static oop obj_allocate(Klass* klass, int size, TRAPS);
-  inline static oop array_allocate(Klass* klass, int size, int length, TRAPS);
-  inline static oop array_allocate_nozero(Klass* klass, int size, int length, TRAPS);
-  inline static oop class_allocate(Klass* klass, int size, TRAPS);
-
-  // Raw memory allocation. This may or may not use TLAB allocations to satisfy the
-  // allocation. A GC implementation may override this function to satisfy the allocation
-  // in any way. But the default is to try a TLAB allocation, and otherwise perform
-  // mem_allocate.
-  virtual HeapWord* obj_allocate_raw(Klass* klass, size_t size,
-                                     bool* gc_overhead_limit_was_exceeded, TRAPS);
+  virtual oop obj_allocate(Klass* klass, int size, TRAPS);
+  virtual oop array_allocate(Klass* klass, int size, int length, bool do_zero, TRAPS);
+  virtual oop class_allocate(Klass* klass, int size, TRAPS);
 
   // Utilities for turning raw memory into filler objects.
   //