8204554: JFR TLAB tracing broken after 8202776
authoreosterlund
Thu, 07 Jun 2018 17:40:15 +0200
changeset 50448 db8036093504
parent 50447 3111982511ee
child 50449 acdfeede95ff
child 56699 ba8d1fc9ab9a
8204554: JFR TLAB tracing broken after 8202776 Reviewed-by: rkennke, stefank
src/hotspot/share/gc/shared/collectedHeap.cpp
src/hotspot/share/gc/shared/collectedHeap.hpp
src/hotspot/share/gc/shared/collectedHeap.inline.hpp
--- a/src/hotspot/share/gc/shared/collectedHeap.cpp	Thu Jun 07 07:43:29 2018 -0700
+++ b/src/hotspot/share/gc/shared/collectedHeap.cpp	Thu Jun 07 17:40:15 2018 +0200
@@ -373,7 +373,8 @@
       return result;
     }
   }
-  return Universe::heap()->mem_allocate(size, gc_overhead_limit_was_exceeded);
+
+  return allocate_outside_tlab(klass, size, gc_overhead_limit_was_exceeded, THREAD);
 }
 
 HeapWord* CollectedHeap::allocate_from_tlab_slow(Klass* klass, size_t size, TRAPS) {
--- a/src/hotspot/share/gc/shared/collectedHeap.hpp	Thu Jun 07 07:43:29 2018 -0700
+++ b/src/hotspot/share/gc/shared/collectedHeap.hpp	Thu Jun 07 17:40:15 2018 +0200
@@ -144,6 +144,9 @@
   inline static HeapWord* allocate_from_tlab(Klass* klass, size_t size, TRAPS);
   static HeapWord* allocate_from_tlab_slow(Klass* klass, size_t size, TRAPS);
 
+  inline static HeapWord* allocate_outside_tlab(Klass* klass, size_t size,
+                                                bool* gc_overhead_limit_was_exceeded, TRAPS);
+
   // Raw memory allocation facilities
   // The obj and array allocate methods are covers for these methods.
   // mem_allocate() should never be
--- a/src/hotspot/share/gc/shared/collectedHeap.inline.hpp	Thu Jun 07 07:43:29 2018 -0700
+++ b/src/hotspot/share/gc/shared/collectedHeap.inline.hpp	Thu Jun 07 17:40:15 2018 +0200
@@ -142,14 +142,6 @@
   HeapWord* result = heap->obj_allocate_raw(klass, size, &gc_overhead_limit_was_exceeded, THREAD);
 
   if (result != NULL) {
-    NOT_PRODUCT(Universe::heap()->
-      check_for_non_bad_heap_word_value(result, size));
-    assert(!HAS_PENDING_EXCEPTION,
-           "Unexpected exception, will result in uninitialized storage");
-    THREAD->incr_allocated_bytes(size * HeapWordSize);
-
-    AllocTracer::send_allocation_outside_tlab(klass, result, size * HeapWordSize, THREAD);
-
     return result;
   }
 
@@ -198,6 +190,22 @@
   return obj;
 }
 
+HeapWord* CollectedHeap::allocate_outside_tlab(Klass* klass, size_t size,
+                                               bool* gc_overhead_limit_was_exceeded, TRAPS) {
+  HeapWord* result = Universe::heap()->mem_allocate(size, gc_overhead_limit_was_exceeded);
+  if (result == NULL) {
+    return result;
+  }
+
+  NOT_PRODUCT(Universe::heap()->check_for_non_bad_heap_word_value(result, size));
+  assert(!HAS_PENDING_EXCEPTION,
+         "Unexpected exception, will result in uninitialized storage");
+  THREAD->incr_allocated_bytes(size * HeapWordSize);
+
+  AllocTracer::send_allocation_outside_tlab(klass, result, size * HeapWordSize, THREAD);
+  return result;
+}
+
 void CollectedHeap::init_obj(HeapWord* obj, size_t size) {
   assert(obj != NULL, "cannot initialize NULL object");
   const size_t hs = oopDesc::header_size();