equal
deleted
inserted
replaced
175 "not locked"); |
175 "not locked"); |
176 HeapWord* obj = top(); |
176 HeapWord* obj = top(); |
177 if (pointer_delta(end(), obj) >= size) { |
177 if (pointer_delta(end(), obj) >= size) { |
178 HeapWord* new_top = obj + size; |
178 HeapWord* new_top = obj + size; |
179 set_top(new_top); |
179 set_top(new_top); |
180 assert(is_ptr_object_aligned(obj) && is_ptr_object_aligned(new_top), |
180 assert(is_object_aligned(obj) && is_object_aligned(new_top), |
181 "checking alignment"); |
181 "checking alignment"); |
182 return obj; |
182 return obj; |
183 } else { |
183 } else { |
184 return NULL; |
184 return NULL; |
185 } |
185 } |
196 // the old top value: the exchange succeeded |
196 // the old top value: the exchange succeeded |
197 // otherwise: the new value of the top is returned. |
197 // otherwise: the new value of the top is returned. |
198 if (result != obj) { |
198 if (result != obj) { |
199 continue; // another thread beat us to the allocation, try again |
199 continue; // another thread beat us to the allocation, try again |
200 } |
200 } |
201 assert(is_ptr_object_aligned(obj) && is_ptr_object_aligned(new_top), |
201 assert(is_object_aligned(obj) && is_object_aligned(new_top), |
202 "checking alignment"); |
202 "checking alignment"); |
203 return obj; |
203 return obj; |
204 } else { |
204 } else { |
205 return NULL; |
205 return NULL; |
206 } |
206 } |