< prev index next >

src/share/vm/memory/space.cpp

Print this page
rev 7209 : [mq]: inccms

@@ -682,32 +682,30 @@
     return pointer_delta(end(), (HeapWord*) p);
   }
 }
 
 // This version requires locking.
-inline HeapWord* ContiguousSpace::allocate_impl(size_t size,
-                                                HeapWord* const end_value) {
+inline HeapWord* ContiguousSpace::allocate_impl(size_t size) {
   assert(Heap_lock->owned_by_self() ||
          (SafepointSynchronize::is_at_safepoint() && Thread::current()->is_VM_thread()),
          "not locked");
   HeapWord* obj = top();
-  if (pointer_delta(end_value, obj) >= size) {
+  if (pointer_delta(end(), obj) >= size) {
     HeapWord* new_top = obj + size;
     set_top(new_top);
     assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
     return obj;
   } else {
     return NULL;
   }
 }
 
 // This version is lock-free.
-inline HeapWord* ContiguousSpace::par_allocate_impl(size_t size,
-                                                    HeapWord* const end_value) {
+inline HeapWord* ContiguousSpace::par_allocate_impl(size_t size) {
   do {
     HeapWord* obj = top();
-    if (pointer_delta(end_value, obj) >= size) {
+    if (pointer_delta(end(), obj) >= size) {
       HeapWord* new_top = obj + size;
       HeapWord* result = (HeapWord*)Atomic::cmpxchg_ptr(new_top, top_addr(), obj);
       // result can be one of two:
       //  the old top value: the exchange succeeded
       //  otherwise: the new value of the top is returned.

@@ -742,16 +740,16 @@
   }
 }
 
 // Requires locking.
 HeapWord* ContiguousSpace::allocate(size_t size) {
-  return allocate_impl(size, end());
+  return allocate_impl(size);
 }
 
 // Lock-free.
 HeapWord* ContiguousSpace::par_allocate(size_t size) {
-  return par_allocate_impl(size, end());
+  return par_allocate_impl(size);
 }
 
 void ContiguousSpace::allocate_temporary_filler(int factor) {
   // allocate temporary type array decreasing free size with factor 'factor'
   assert(factor >= 0, "just checking");

@@ -782,53 +780,10 @@
     obj->set_klass_gap(0);
     obj->set_klass(SystemDictionary::Object_klass());
   }
 }
 
-void EdenSpace::clear(bool mangle_space) {
-  ContiguousSpace::clear(mangle_space);
-  set_soft_end(end());
-}
-
-// Requires locking.
-HeapWord* EdenSpace::allocate(size_t size) {
-  return allocate_impl(size, soft_end());
-}
-
-// Lock-free.
-HeapWord* EdenSpace::par_allocate(size_t size) {
-  return par_allocate_impl(size, soft_end());
-}
-
-HeapWord* ConcEdenSpace::par_allocate(size_t size)
-{
-  do {
-    // The invariant is top() should be read before end() because
-    // top() can't be greater than end(), so if an update of _soft_end
-    // occurs between 'end_val = end();' and 'top_val = top();' top()
-    // also can grow up to the new end() and the condition
-    // 'top_val > end_val' is true. To ensure the loading order
-    // OrderAccess::loadload() is required after top() read.
-    HeapWord* obj = top();
-    OrderAccess::loadload();
-    if (pointer_delta(*soft_end_addr(), obj) >= size) {
-      HeapWord* new_top = obj + size;
-      HeapWord* result = (HeapWord*)Atomic::cmpxchg_ptr(new_top, top_addr(), obj);
-      // result can be one of two:
-      //  the old top value: the exchange succeeded
-      //  otherwise: the new value of the top is returned.
-      if (result == obj) {
-        assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
-        return obj;
-      }
-    } else {
-      return NULL;
-    }
-  } while (true);
-}
-
-
 HeapWord* OffsetTableContigSpace::initialize_threshold() {
   return _offsets.initialize_threshold();
 }
 
 HeapWord* OffsetTableContigSpace::cross_threshold(HeapWord* start, HeapWord* end) {
< prev index next >