< prev index next >

src/share/vm/gc/g1/g1AllocRegion.hpp

Print this page
rev 8854 : imported patch 8073013-add-detailed-information-about-plab-memory-usage
rev 8868 : imported patch 8067336-allow-that-plab-allocations-at-end-of-regions-are-flexible
rev 8869 : [mq]: refactor-desired-actual-size
rev 8870 : [mq]: tom-review

@@ -102,12 +102,17 @@
 
   // Perform a MT-safe allocation out of the given region.
   static inline HeapWord* par_allocate(HeapRegion* alloc_region,
                                        size_t word_size,
                                        bool bot_updates);
+  // Perform a MT-safe allocation out of the given region, with the given
+  // minimum and desired size. Returns the actual size allocated (between
+  // minimum and desired size) in actual_word_size if the allocation has been
+  // successful.
   static inline HeapWord* par_allocate(HeapRegion* alloc_region,
                                        size_t min_word_size,
+                                       size_t desired_word_size,
                                        size_t* actual_word_size,
                                        bool bot_updates);
 
   // Ensure that the region passed as a parameter has been filled up
   // so that noone else can allocate out of it any more.

@@ -163,12 +168,19 @@
   // First-level allocation: Should be called without holding a
   // lock. It will try to allocate lock-free out of the active region,
   // or return NULL if it was unable to.
   inline HeapWord* attempt_allocation(size_t word_size,
                                       bool bot_updates);
+  // Perform an allocation out of the current allocation region, with the given
+  // minimum and desired size. Returns the actual size allocated (between
+  // minimum and desired size) in actual_word_size if the allocation has been
+  // successful.
+  // Should be called without holding a lock. It will try to allocate lock-free
+  // out of the active region, or return NULL if it was unable to.
   inline HeapWord* attempt_allocation(size_t min_word_size,
-                                      size_t* word_size,
+                                      size_t desired_word_size,
+                                      size_t* actual_word_size,
                                       bool bot_updates);
 
   // Second-level allocation: Should be called while holding a
   // lock. It will try to first allocate lock-free out of the active
   // region or, if it's unable to, it will try to replace the active

@@ -177,14 +189,15 @@
   // it conform to its locking protocol.
   inline HeapWord* attempt_allocation_locked(size_t word_size,
                                              bool bot_updates);
   // Same as attempt_allocation_locked(size_t, bool), but allowing specification
   // of minimum word size of the block in min_word_size, and the maximum word
-  // size of the allocation in word_size. The actual size of the block is returned
-  // in word_size.
+  // size of the allocation in desired_word_size. The actual size of the block is
+  // returned in actual_word_size.
   inline HeapWord* attempt_allocation_locked(size_t min_word_size,
-                                             size_t* word_size,
+                                             size_t desired_word_size,
+                                             size_t* actual_word_size,
                                              bool bot_updates);
 
   // Should be called to allocate a new region even if the max of this
   // type of regions has been reached. Should only be called if other
   // allocation attempts have failed and we are not holding a valid

@@ -204,13 +217,21 @@
   // Should be called when we want to release the active region which
   // is returned after it's been retired.
   virtual HeapRegion* release();
 
 #if G1_ALLOC_REGION_TRACING
-  void trace(const char* str, size_t word_size = 0, HeapWord* result = NULL);
+  void trace(const char* str,
+             size_t min_word_size = 0,
+             size_t desired_word_size = 0,
+             size_t actual_word_size = 0,
+             HeapWord* result = NULL);
 #else // G1_ALLOC_REGION_TRACING
-  void trace(const char* str, size_t word_size = 0, HeapWord* result = NULL) { }
+  void trace(const char* str,
+             size_t min_word_size = 0,
+             size_t desired_word_size = 0,
+             size_t actual_word_size = 0,
+             HeapWord* result = NULL) { }
 #endif // G1_ALLOC_REGION_TRACING
 };
 
 class MutatorAllocRegion : public G1AllocRegion {
 protected:
< prev index next >