< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp

Print this page
rev 50092 : [mq]: allocations-rt.patch

@@ -22,10 +22,11 @@
  */
 
 #include "precompiled.hpp"
 #include "memory/allocation.hpp"
 
+#include "gc/shared/collectedHeap.inline.hpp"
 #include "gc/shared/gcTimer.hpp"
 #include "gc/shared/gcTraceTime.inline.hpp"
 #include "gc/shared/parallelCleaning.hpp"
 
 #include "gc/shenandoah/brooksPointer.hpp"

@@ -798,22 +799,34 @@
 HeapWord* ShenandoahHeap::allocate_memory_under_lock(size_t word_size, AllocType type, bool& in_new_region) {
   ShenandoahHeapLocker locker(lock());
   return _free_set->allocate(word_size, type, in_new_region);
 }
 
-HeapWord*  ShenandoahHeap::mem_allocate(size_t size,
+HeapWord* ShenandoahHeap::mem_allocate(size_t size, Klass* klass, Thread* thread,
                                         bool*  gc_overhead_limit_was_exceeded) {
-  HeapWord* filler = allocate_memory(size + BrooksPointer::word_size(), _alloc_shared);
-  HeapWord* result = filler + BrooksPointer::word_size();
-  if (filler != NULL) {
-    BrooksPointer::initialize(oop(result));
 
-    assert(! in_collection_set(result), "never allocate in targetted region");
-    return result;
-  } else {
-    return NULL;
+  size += BrooksPointer::word_size();
+  HeapWord* obj = allocate_from_tlab(klass, thread, size);
+  if (obj == NULL) {
+    obj = allocate_memory(size, _alloc_shared);
   }
+
+  if (obj != NULL) {
+    obj = obj + BrooksPointer::word_size();
+    BrooksPointer::initialize(oop(obj));
+    assert(! in_collection_set(obj), "never allocate in targetted region");
+  }
+  return obj;
+}
+
+void ShenandoahHeap::fill_with_object_impl(HeapWord* start, size_t words, bool zap) {
+  if (words > 0) {
+    start += BrooksPointer::word_size();
+    words -= BrooksPointer::word_size();
+  }
+  CollectedHeap::fill_with_object_impl(start, words, zap);
+  BrooksPointer::initialize(oop(start));
 }
 
 class ShenandoahEvacuateUpdateRootsClosure: public ExtendedOopClosure {
 private:
   ShenandoahHeap* _heap;

@@ -1860,17 +1873,10 @@
 void ShenandoahHeap::set_evacuation_in_progress(bool in_progress) {
   assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Only call this at safepoint");
   set_gc_state_mask(EVACUATION, in_progress);
 }
 
-HeapWord* ShenandoahHeap::tlab_post_allocation_setup(HeapWord* obj) {
-  // Initialize Brooks pointer for the next object
-  HeapWord* result = obj + BrooksPointer::word_size();
-  BrooksPointer::initialize(oop(result));
-  return result;
-}
-
 uint ShenandoahHeap::oop_extra_words() {
   return BrooksPointer::word_size();
 }
 
 ShenandoahForwardedIsAliveClosure::ShenandoahForwardedIsAliveClosure() :
< prev index next >