8204685: Abstraction for TLAB dummy object
authorrkennke
Wed, 13 Jun 2018 10:15:35 +0200
changeset 50537 d12828b7cd64
parent 50536 8434981a4137
child 50538 f36d08a3e700
8204685: Abstraction for TLAB dummy object Reviewed-by: tschatzl, shade
src/hotspot/share/gc/shared/collectedHeap.cpp
src/hotspot/share/gc/shared/collectedHeap.hpp
src/hotspot/share/gc/shared/plab.cpp
src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp
--- a/src/hotspot/share/gc/shared/collectedHeap.cpp	Wed Jun 13 10:01:53 2018 +0200
+++ b/src/hotspot/share/gc/shared/collectedHeap.cpp	Wed Jun 13 10:15:35 2018 +0200
@@ -526,6 +526,10 @@
   fill_with_object_impl(start, words, zap);
 }
 
+void CollectedHeap::fill_with_dummy_object(HeapWord* start, HeapWord* end, bool zap) {
+  CollectedHeap::fill_with_object(start, end, zap);
+}
+
 HeapWord* CollectedHeap::allocate_new_tlab(size_t min_size,
                                            size_t requested_size,
                                            size_t* actual_size) {
--- a/src/hotspot/share/gc/shared/collectedHeap.hpp	Wed Jun 13 10:01:53 2018 +0200
+++ b/src/hotspot/share/gc/shared/collectedHeap.hpp	Wed Jun 13 10:15:35 2018 +0200
@@ -350,6 +350,8 @@
     fill_with_object(start, pointer_delta(end, start), zap);
   }
 
+  virtual void fill_with_dummy_object(HeapWord* start, HeapWord* end, bool zap);
+
   // Return the address "addr" aligned by "alignment_in_bytes" if such
   // an address is below "end".  Return NULL otherwise.
   inline static HeapWord* align_allocation_or_fail(HeapWord* addr,
--- a/src/hotspot/share/gc/shared/plab.cpp	Wed Jun 13 10:01:53 2018 +0200
+++ b/src/hotspot/share/gc/shared/plab.cpp	Wed Jun 13 10:15:35 2018 +0200
@@ -82,14 +82,14 @@
 size_t PLAB::retire_internal() {
   size_t result = 0;
   if (_top < _hard_end) {
-    CollectedHeap::fill_with_object(_top, _hard_end);
+    Universe::heap()->fill_with_dummy_object(_top, _hard_end, true);
     result += invalidate();
   }
   return result;
 }
 
 void PLAB::add_undo_waste(HeapWord* obj, size_t word_sz) {
-  CollectedHeap::fill_with_object(obj, word_sz);
+  Universe::heap()->fill_with_dummy_object(obj, obj + word_sz, true);
   _undo_wasted += word_sz;
 }
 
--- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp	Wed Jun 13 10:01:53 2018 +0200
+++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp	Wed Jun 13 10:15:35 2018 +0200
@@ -114,7 +114,7 @@
       myThread()->incr_allocated_bytes(used_bytes());
     }
 
-    CollectedHeap::fill_with_object(top(), hard_end(), retire && zap);
+    Universe::heap()->fill_with_dummy_object(top(), hard_end(), retire && zap);
 
     if (retire || ZeroTLAB) {  // "Reset" the TLAB
       set_start(NULL);