< prev index next >

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

Print this page




  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
  60   void mem_clear(HeapWord* mem) const;
  61   // This finish constructing an oop by installing the mark word and the Klass* pointer
  62   // last. At the point when the Klass pointer is initialized, this is a constructed object
  63   // that must be parseable as an oop by concurrent collectors.

  64   oop finish(HeapWord* mem) const;


  65 
  66   // Raw memory allocation. This may or may not use TLAB allocations to satisfy the
  67   // allocation. A GC implementation may override this function to satisfy the allocation
  68   // in any way. But the default is to try a TLAB allocation, and otherwise perform
  69   // mem_allocate.
  70   virtual HeapWord* mem_allocate(Allocation& allocation) const;
  71 
  72   virtual MemRegion obj_memory_range(oop obj) const {
  73     return MemRegion((HeapWord*)obj, _word_size);
  74   }
  75 
  76 public:
  77   oop allocate() const;
  78   virtual oop initialize(HeapWord* mem) const = 0;
  79 };
  80 
  81 class ObjAllocator: public MemAllocator {
  82 public:
  83   ObjAllocator(Klass* klass, size_t word_size, Thread* thread = Thread::current())
  84     : MemAllocator(klass, word_size, thread) {}




  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
  60   void mem_clear(HeapWord* mem) const;
  61   // This finish constructing an oop by installing the mark word and the Klass* pointer
  62   // last. At the point when the Klass pointer is initialized, this is a constructed object
  63   // that must be parseable as an oop by concurrent collectors.
  64   inline void finish_mark(HeapWord* mem) const;
  65   oop finish(HeapWord* mem) const;
  66   // Encode any extra metadata properties for arrays
  67   oop finish_with_properties(HeapWord* mem, ArrayStorageProperties storage_props) const;
  68 
  69   // Raw memory allocation. This may or may not use TLAB allocations to satisfy the
  70   // allocation. A GC implementation may override this function to satisfy the allocation
  71   // in any way. But the default is to try a TLAB allocation, and otherwise perform
  72   // mem_allocate.
  73   virtual HeapWord* mem_allocate(Allocation& allocation) const;
  74 
  75   virtual MemRegion obj_memory_range(oop obj) const {
  76     return MemRegion((HeapWord*)obj, _word_size);
  77   }
  78 
  79 public:
  80   oop allocate() const;
  81   virtual oop initialize(HeapWord* mem) const = 0;
  82 };
  83 
  84 class ObjAllocator: public MemAllocator {
  85 public:
  86   ObjAllocator(Klass* klass, size_t word_size, Thread* thread = Thread::current())
  87     : MemAllocator(klass, word_size, thread) {}


< prev index next >