< prev index next >

src/share/vm/gc/shared/plab.hpp

Print this page
rev 8816 : [mq]: 8133470-fix-plab-inline
rev 8817 : [mq]: mikael-erik-suggestions
rev 8818 : imported patch 8073013-add-detailed-information-about-plab-memory-usage
rev 8821 : imported patch mikael-comments
rev 8828 : imported patch 8067339-PLAB-reallocation-might-result-in-failure-to-allocate


  57     _bottom = _end;      // Force future contains() queries to return false.
  58     return remaining;
  59   }
  60 
  61   // Fill in remaining space with a dummy object and invalidate the PLAB. Returns
  62   // the amount of remaining space.
  63   size_t retire_internal();
  64 
  65   void add_undo_waste(HeapWord* obj, size_t word_sz);
  66 
  67   // Undo the last allocation in the buffer, which is required to be of the
  68   // "obj" of the given "word_sz".
  69   void undo_last_allocation(HeapWord* obj, size_t word_sz);
  70 
  71 public:
  72   // Initializes the buffer to be empty, but with the given "word_sz".
  73   // Must get initialized with "set_buf" for an allocation to succeed.
  74   PLAB(size_t word_sz);
  75   virtual ~PLAB() {}
  76 


  77   // Minimum PLAB size.
  78   static size_t min_size();
  79   // Maximum PLAB size.
  80   static size_t max_size();
  81 
  82   // If an allocation of the given "word_sz" can be satisfied within the
  83   // buffer, do the allocation, returning a pointer to the start of the
  84   // allocated block.  If the allocation request cannot be satisfied,
  85   // return NULL.
  86   HeapWord* allocate(size_t word_sz) {
  87     HeapWord* res = _top;
  88     if (pointer_delta(_end, _top) >= word_sz) {
  89       _top = _top + word_sz;
  90       return res;
  91     } else {
  92       return NULL;
  93     }
  94   }
  95 
  96   // Allocate the object aligned to "alignment_in_bytes".




  57     _bottom = _end;      // Force future contains() queries to return false.
  58     return remaining;
  59   }
  60 
  61   // Fill in remaining space with a dummy object and invalidate the PLAB. Returns
  62   // the amount of remaining space.
  63   size_t retire_internal();
  64 
  65   void add_undo_waste(HeapWord* obj, size_t word_sz);
  66 
  67   // Undo the last allocation in the buffer, which is required to be of the
  68   // "obj" of the given "word_sz".
  69   void undo_last_allocation(HeapWord* obj, size_t word_sz);
  70 
  71 public:
  72   // Initializes the buffer to be empty, but with the given "word_sz".
  73   // Must get initialized with "set_buf" for an allocation to succeed.
  74   PLAB(size_t word_sz);
  75   virtual ~PLAB() {}
  76 
  77   static size_t alignment_reserve() { return AlignmentReserve; }
  78 
  79   // Minimum PLAB size.
  80   static size_t min_size();
  81   // Maximum PLAB size.
  82   static size_t max_size();
  83 
  84   // If an allocation of the given "word_sz" can be satisfied within the
  85   // buffer, do the allocation, returning a pointer to the start of the
  86   // allocated block.  If the allocation request cannot be satisfied,
  87   // return NULL.
  88   HeapWord* allocate(size_t word_sz) {
  89     HeapWord* res = _top;
  90     if (pointer_delta(_end, _top) >= word_sz) {
  91       _top = _top + word_sz;
  92       return res;
  93     } else {
  94       return NULL;
  95     }
  96   }
  97 
  98   // Allocate the object aligned to "alignment_in_bytes".


< prev index next >