< prev index next >

src/hotspot/share/gc/parallel/mutableSpace.cpp

Print this page

        

*** 190,200 **** HeapWord* MutableSpace::cas_allocate(size_t size) { do { HeapWord* obj = top(); 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. if (result != obj) { continue; // another thread beat us to the allocation, try again --- 190,200 ---- HeapWord* MutableSpace::cas_allocate(size_t size) { do { HeapWord* obj = top(); if (pointer_delta(end(), obj) >= size) { HeapWord* new_top = obj + size; ! HeapWord* result = Atomic::cmpxchg(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) { continue; // another thread beat us to the allocation, try again
*** 209,219 **** } // Try to deallocate previous allocation. Returns true upon success. bool MutableSpace::cas_deallocate(HeapWord *obj, size_t size) { HeapWord* expected_top = obj + size; ! return (HeapWord*)Atomic::cmpxchg_ptr(obj, top_addr(), expected_top) == expected_top; } void MutableSpace::oop_iterate_no_header(OopClosure* cl) { HeapWord* obj_addr = bottom(); HeapWord* t = top(); --- 209,219 ---- } // Try to deallocate previous allocation. Returns true upon success. bool MutableSpace::cas_deallocate(HeapWord *obj, size_t size) { HeapWord* expected_top = obj + size; ! return Atomic::cmpxchg(obj, top_addr(), expected_top) == expected_top; } void MutableSpace::oop_iterate_no_header(OopClosure* cl) { HeapWord* obj_addr = bottom(); HeapWord* t = top();
< prev index next >