< prev index next >

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

Print this page
rev 8852 : [mq]: 8133470-fix-plab-inline
rev 8853 : imported patch mikael-erik-suggestions
rev 8854 : imported patch 8073013-add-detailed-information-about-plab-memory-usage
rev 8857 : imported patch mikael-comments
rev 8866 : imported patch 8067339-PLAB-reallocation-might-result-in-failure-to-allocate
rev 8867 : [mq]: bengt-refactoring

@@ -72,11 +72,11 @@
   // Initializes the buffer to be empty, but with the given "word_sz".
   // Must get initialized with "set_buf" for an allocation to succeed.
   PLAB(size_t word_sz);
   virtual ~PLAB() {}
 
-  static size_t alignment_reserve() { return AlignmentReserve; }
+  static size_t size_required_for_allocation(size_t word_size) { return word_size + AlignmentReserve; }
 
   // Minimum PLAB size.
   static size_t min_size();
   // Maximum PLAB size.
   static size_t max_size();

@@ -107,17 +107,10 @@
   size_t word_sz() { return _word_sz; }
 
   size_t waste() { return _wasted; }
   size_t undo_waste() { return _undo_wasted; }
 
-  // Should only be done if we are about to reset with a new buffer of the
-  // given size.
-  void set_word_size(size_t new_word_sz) {
-    assert(new_word_sz > AlignmentReserve, "Too small");
-    _word_sz = new_word_sz;
-  }
-
   // The number of words of unallocated space remaining in the buffer.
   size_t words_remaining() {
     assert(_end >= _top, "Negative buffer");
     return pointer_delta(_end, _top, HeapWordSize);
   }

@@ -125,11 +118,14 @@
   bool contains(void* addr) {
     return (void*)_bottom <= addr && addr < (void*)_hard_end;
   }
 
   // Sets the space of the buffer to be [buf, space+word_sz()).
-  virtual void set_buf(HeapWord* buf) {
+  virtual void set_buf(HeapWord* buf, size_t new_word_sz) {
+    assert(new_word_sz > AlignmentReserve, "Too small");
+    _word_sz = new_word_sz;
+
     _bottom   = buf;
     _top      = _bottom;
     _hard_end = _bottom + word_sz();
     _end      = _hard_end - AlignmentReserve;
     assert(_end >= _top, "Negative buffer");
< prev index next >