< prev index next >

src/hotspot/share/gc/shared/collectedHeap.inline.hpp

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

@@ -135,21 +135,12 @@
   if (HAS_PENDING_EXCEPTION) {
     NOT_PRODUCT(guarantee(false, "Should not allocate with exception pending"));
     return NULL;  // caller does a CHECK_0 too
   }
 
-  HeapWord* result = NULL;
-  if (UseTLAB) {
-    result = allocate_from_tlab(klass, THREAD, size);
-    if (result != NULL) {
-      assert(!HAS_PENDING_EXCEPTION,
-             "Unexpected exception, will result in uninitialized storage");
-      return result;
-    }
-  }
   bool gc_overhead_limit_was_exceeded = false;
-  result = Universe::heap()->mem_allocate(size,
+  HeapWord* result = Universe::heap()->mem_allocate(size, klass, THREAD,
                                           &gc_overhead_limit_was_exceeded);
   if (result != NULL) {
     NOT_PRODUCT(Universe::heap()->
       check_for_non_bad_heap_word_value(result, size));
     assert(!HAS_PENDING_EXCEPTION,

@@ -192,20 +183,26 @@
   init_obj(obj, size);
   return obj;
 }
 
 HeapWord* CollectedHeap::allocate_from_tlab(Klass* klass, Thread* thread, size_t size) {
-  assert(UseTLAB, "should use UseTLAB");
-
-  size += Universe::heap()->oop_extra_words();
+  if (UseTLAB) {
   HeapWord* obj = thread->tlab().allocate(size);
   if (obj != NULL) {
-    obj = Universe::heap()->tlab_post_allocation_setup(obj);
+      assert(!thread->has_pending_exception(),
+             "Unexpected exception, will result in uninitialized storage");
     return obj;
   }
   // Otherwise...
-  return allocate_from_tlab_slow(klass, thread, size);
+    obj = allocate_from_tlab_slow(klass, thread, size);
+    if (obj != NULL) {
+      assert(!thread->has_pending_exception(),
+             "Unexpected exception, will result in uninitialized storage");
+    }
+    return obj;
+  }
+  return NULL;
 }
 
 void CollectedHeap::init_obj(HeapWord* obj, size_t size) {
   assert(obj != NULL, "cannot initialize NULL object");
   const size_t hs = oopDesc::header_size();
< prev index next >