< prev index next >

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

Print this page




  48   HeapWord* allocate_outside_tlab(Allocation& allocation) const;
  49 
  50 protected:
  51   MemAllocator(Klass* klass, size_t word_size, Thread* thread)
  52     : _thread(thread),
  53       _klass(klass),
  54       _word_size(word_size)
  55   { }
  56 
  57   // This function clears the memory of the object
  58   void mem_clear(HeapWord* mem) const;
  59   // This finish constructing an oop by installing the mark word and the Klass* pointer
  60   // last. At the point when the Klass pointer is initialized, this is a constructed object
  61   // that must be parseable as an oop by concurrent collectors.
  62   oop finish(HeapWord* mem) const;
  63 
  64   // Raw memory allocation. This may or may not use TLAB allocations to satisfy the
  65   // allocation. A GC implementation may override this function to satisfy the allocation
  66   // in any way. But the default is to try a TLAB allocation, and otherwise perform
  67   // mem_allocate.
  68   virtual HeapWord* mem_allocate(Allocation& allocation) const;
  69 
  70   virtual MemRegion obj_memory_range(oop obj) const {
  71     return MemRegion((HeapWord*)obj, _word_size);
  72   }
  73 
  74 public:
  75   oop allocate() const;
  76   virtual oop initialize(HeapWord* mem) const = 0;
  77 };
  78 
  79 class ObjAllocator: public MemAllocator {
  80 public:
  81   ObjAllocator(Klass* klass, size_t word_size, Thread* thread = Thread::current())
  82     : MemAllocator(klass, word_size, thread) {}
  83   virtual oop initialize(HeapWord* mem) const;
  84 };
  85 
  86 class ObjArrayAllocator: public MemAllocator {
  87   const int  _length;
  88   const bool _do_zero;
  89 protected:
  90   virtual MemRegion obj_memory_range(oop obj) const;
  91 
  92 public:
  93   ObjArrayAllocator(Klass* klass, size_t word_size, int length, bool do_zero,
  94                     Thread* thread = Thread::current())
  95     : MemAllocator(klass, word_size, thread),


  48   HeapWord* allocate_outside_tlab(Allocation& allocation) const;
  49 
  50 protected:
  51   MemAllocator(Klass* klass, size_t word_size, Thread* thread)
  52     : _thread(thread),
  53       _klass(klass),
  54       _word_size(word_size)
  55   { }
  56 
  57   // This function clears the memory of the object
  58   void mem_clear(HeapWord* mem) const;
  59   // This finish constructing an oop by installing the mark word and the Klass* pointer
  60   // last. At the point when the Klass pointer is initialized, this is a constructed object
  61   // that must be parseable as an oop by concurrent collectors.
  62   oop finish(HeapWord* mem) const;
  63 
  64   // Raw memory allocation. This may or may not use TLAB allocations to satisfy the
  65   // allocation. A GC implementation may override this function to satisfy the allocation
  66   // in any way. But the default is to try a TLAB allocation, and otherwise perform
  67   // mem_allocate.
  68   virtual HeapWord* mem_allocate(Allocation& allocation, bool try_tlab) const;
  69 
  70   virtual MemRegion obj_memory_range(oop obj) const {
  71     return MemRegion((HeapWord*)obj, _word_size);
  72   }
  73 
  74 public:
  75   oop allocate(bool try_tlab = true) const;
  76   virtual oop initialize(HeapWord* mem) const = 0;
  77 };
  78 
  79 class ObjAllocator: public MemAllocator {
  80 public:
  81   ObjAllocator(Klass* klass, size_t word_size, Thread* thread = Thread::current())
  82     : MemAllocator(klass, word_size, thread) {}
  83   virtual oop initialize(HeapWord* mem) const;
  84 };
  85 
  86 class ObjArrayAllocator: public MemAllocator {
  87   const int  _length;
  88   const bool _do_zero;
  89 protected:
  90   virtual MemRegion obj_memory_range(oop obj) const;
  91 
  92 public:
  93   ObjArrayAllocator(Klass* klass, size_t word_size, int length, bool do_zero,
  94                     Thread* thread = Thread::current())
  95     : MemAllocator(klass, word_size, thread),
< prev index next >