194
195 // This is the promotion failed test, and code handling.
196 // The code belongs here for two reasons. It is slightly
197 // different than the code below, and cannot share the
198 // CAS testing code. Keeping the code here also minimizes
199 // the impact on the common case fast path code.
200
201 if (new_obj == NULL) {
202 _old_gen_is_full = true;
203 return oop_promotion_failed(o, test_mark);
204 }
205 }
206 }
207
208 assert(new_obj != NULL, "allocation should have succeeded");
209
210 // Copy obj
211 Copy::aligned_disjoint_words((HeapWord*)o, (HeapWord*)new_obj, new_obj_size);
212
213 // Now we have to CAS in the header.
214 if (o->cas_forward_to(new_obj, test_mark)) {
215 // We won any races, we "own" this object.
216 assert(new_obj == o->forwardee(), "Sanity");
217
218 // Increment age if obj still in new generation. Now that
219 // we're dealing with a markOop that cannot change, it is
220 // okay to use the non mt safe oop methods.
221 if (!new_obj_is_tenured) {
222 new_obj->incr_age();
223 assert(young_space()->contains(new_obj), "Attempt to push non-promoted obj");
224 }
225
226 // Do the size comparison first with new_obj_size, which we
227 // already have. Hopefully, only a few objects are larger than
228 // _min_array_size_for_chunking, and most of them will be arrays.
229 // So, the is->objArray() test would be very infrequent.
230 if (new_obj_size > _min_array_size_for_chunking &&
231 new_obj->is_objArray() &&
232 PSChunkLargeArrays) {
233 // we'll chunk it
234 oop* const masked_o = mask_chunked_array_oop(o);
|
194
195 // This is the promotion failed test, and code handling.
196 // The code belongs here for two reasons. It is slightly
197 // different than the code below, and cannot share the
198 // CAS testing code. Keeping the code here also minimizes
199 // the impact on the common case fast path code.
200
201 if (new_obj == NULL) {
202 _old_gen_is_full = true;
203 return oop_promotion_failed(o, test_mark);
204 }
205 }
206 }
207
208 assert(new_obj != NULL, "allocation should have succeeded");
209
210 // Copy obj
211 Copy::aligned_disjoint_words((HeapWord*)o, (HeapWord*)new_obj, new_obj_size);
212
213 // Now we have to CAS in the header.
214 if (o->cas_forward_to(new_obj, test_mark, memory_order_relaxed)) {
215 // We won any races, we "own" this object.
216 assert(new_obj == o->forwardee(), "Sanity");
217
218 // Increment age if obj still in new generation. Now that
219 // we're dealing with a markOop that cannot change, it is
220 // okay to use the non mt safe oop methods.
221 if (!new_obj_is_tenured) {
222 new_obj->incr_age();
223 assert(young_space()->contains(new_obj), "Attempt to push non-promoted obj");
224 }
225
226 // Do the size comparison first with new_obj_size, which we
227 // already have. Hopefully, only a few objects are larger than
228 // _min_array_size_for_chunking, and most of them will be arrays.
229 // So, the is->objArray() test would be very infrequent.
230 if (new_obj_size > _min_array_size_for_chunking &&
231 new_obj->is_objArray() &&
232 PSChunkLargeArrays) {
233 // we'll chunk it
234 oop* const masked_o = mask_chunked_array_oop(o);
|