< prev index next >

src/hotspot/share/gc/shared/memAllocator.hpp

Print this page




  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_GC_SHARED_MEM_ALLOCATOR_HPP
  26 #define SHARE_GC_SHARED_MEM_ALLOCATOR_HPP
  27 
  28 #include "gc/shared/collectedHeap.hpp"
  29 #include "memory/memRegion.hpp"
  30 #include "oops/oopsHierarchy.hpp"
  31 #include "utilities/exceptions.hpp"
  32 #include "utilities/macros.hpp"
  33 
  34 // These fascilities are used for allocating, and initializing newly allocated objects.
  35 
  36 class MemAllocator: StackObj {

  37   class Allocation;
  38 
  39 protected:
  40   CollectedHeap* const _heap;
  41   Thread* const        _thread;
  42   Klass* const         _klass;
  43   const size_t         _word_size;
  44 
  45 private:
  46   // Allocate from the current thread's TLAB, with broken-out slow path.
  47   HeapWord* allocate_inside_tlab(Allocation& allocation) const;
  48   HeapWord* allocate_inside_tlab_slow(Allocation& allocation) const;
  49   HeapWord* allocate_outside_tlab(Allocation& allocation) const;
  50 
  51 protected:
  52   MemAllocator(Klass* klass, size_t word_size, Thread* thread)
  53     : _heap(Universe::heap()),
  54       _thread(thread),
  55       _klass(klass),
  56       _word_size(word_size)
  57   { }
  58 
  59   // This function clears the memory of the object




  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_GC_SHARED_MEM_ALLOCATOR_HPP
  26 #define SHARE_GC_SHARED_MEM_ALLOCATOR_HPP
  27 
  28 #include "gc/shared/collectedHeap.hpp"
  29 #include "memory/memRegion.hpp"
  30 #include "oops/oopsHierarchy.hpp"
  31 #include "utilities/exceptions.hpp"
  32 #include "utilities/macros.hpp"
  33 
  34 // These fascilities are used for allocating, and initializing newly allocated objects.
  35 
  36 class MemAllocator: StackObj {
  37 protected:
  38   class Allocation;
  39 

  40   CollectedHeap* const _heap;
  41   Thread* const        _thread;
  42   Klass* const         _klass;
  43   const size_t         _word_size;
  44 
  45 private:
  46   // Allocate from the current thread's TLAB, with broken-out slow path.
  47   HeapWord* allocate_inside_tlab(Allocation& allocation) const;
  48   HeapWord* allocate_inside_tlab_slow(Allocation& allocation) const;
  49   HeapWord* allocate_outside_tlab(Allocation& allocation) const;
  50 
  51 protected:
  52   MemAllocator(Klass* klass, size_t word_size, Thread* thread)
  53     : _heap(Universe::heap()),
  54       _thread(thread),
  55       _klass(klass),
  56       _word_size(word_size)
  57   { }
  58 
  59   // This function clears the memory of the object


< prev index next >