348 return mark_raw().is_marked(); |
348 return mark_raw().is_marked(); |
349 } |
349 } |
350 |
350 |
351 // Used by scavengers |
351 // Used by scavengers |
352 void oopDesc::forward_to(oop p) { |
352 void oopDesc::forward_to(oop p) { |
353 assert(check_obj_alignment(p), |
353 verify_forwardee(p); |
354 "forwarding to something not aligned"); |
|
355 assert(Universe::heap()->is_in_reserved(p), |
|
356 "forwarding to something not in heap"); |
|
357 assert(!is_archived_object(oop(this)) && |
|
358 !is_archived_object(p), |
|
359 "forwarding archive object"); |
|
360 markWord m = markWord::encode_pointer_as_mark(p); |
354 markWord m = markWord::encode_pointer_as_mark(p); |
361 assert(m.decode_pointer() == p, "encoding must be reversable"); |
355 assert(m.decode_pointer() == p, "encoding must be reversable"); |
362 set_mark_raw(m); |
356 set_mark_raw(m); |
363 } |
357 } |
364 |
358 |
365 // Used by parallel scavengers |
359 // Used by parallel scavengers |
366 bool oopDesc::cas_forward_to(oop p, markWord compare, atomic_memory_order order) { |
360 bool oopDesc::cas_forward_to(oop p, markWord compare, atomic_memory_order order) { |
367 assert(check_obj_alignment(p), |
361 verify_forwardee(p); |
368 "forwarding to something not aligned"); |
|
369 assert(Universe::heap()->is_in_reserved(p), |
|
370 "forwarding to something not in heap"); |
|
371 markWord m = markWord::encode_pointer_as_mark(p); |
362 markWord m = markWord::encode_pointer_as_mark(p); |
372 assert(m.decode_pointer() == p, "encoding must be reversable"); |
363 assert(m.decode_pointer() == p, "encoding must be reversable"); |
373 return cas_set_mark_raw(m, compare, order) == compare; |
364 return cas_set_mark_raw(m, compare, order) == compare; |
374 } |
365 } |
375 |
366 |
376 oop oopDesc::forward_to_atomic(oop p, markWord compare, atomic_memory_order order) { |
367 oop oopDesc::forward_to_atomic(oop p, markWord compare, atomic_memory_order order) { |
377 // CMS forwards some non-heap value into the mark oop to reserve oops during |
368 verify_forwardee(p); |
378 // promotion, so the next two asserts do not hold. |
|
379 assert(UseConcMarkSweepGC || check_obj_alignment(p), |
|
380 "forwarding to something not aligned"); |
|
381 assert(UseConcMarkSweepGC || Universe::heap()->is_in_reserved(p), |
|
382 "forwarding to something not in heap"); |
|
383 markWord m = markWord::encode_pointer_as_mark(p); |
369 markWord m = markWord::encode_pointer_as_mark(p); |
384 assert(m.decode_pointer() == p, "encoding must be reversable"); |
370 assert(m.decode_pointer() == p, "encoding must be reversable"); |
385 markWord old_mark = cas_set_mark_raw(m, compare, order); |
371 markWord old_mark = cas_set_mark_raw(m, compare, order); |
386 if (old_mark == compare) { |
372 if (old_mark == compare) { |
387 return NULL; |
373 return NULL; |