hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp
template <class T>
inline void PSParallelCompact::adjust_pointer(T* p, bool isroot) {
{- -------------------------------------------
(1) ParallelCompactData::calc_new_pointer() で, 処理対象のオブジェクトが移動する先のアドレスを求め,
oopDesc::encode_store_heap_oop_not_null() で, ポインタの値を移動先のアドレスに書き換える.
(ただし, 処理対象のオブジェクトが NULL の場合には何も行わない)
---------------------------------------- -}
T heap_oop = oopDesc::load_heap_oop(p);
if (!oopDesc::is_null(heap_oop)) {
oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
oop new_obj = (oop)summary_data().calc_new_pointer(obj);
assert(new_obj != NULL || // is forwarding ptr?
obj->is_shared(), // never forwarded?
"should be forwarded");
// Just always do the update unconditionally?
if (new_obj != NULL) {
assert(Universe::heap()->is_in_reserved(new_obj),
"should be in object space");
oopDesc::encode_store_heap_oop_not_null(p, new_obj);
}
}
{- -------------------------------------------
(1) (verify)
---------------------------------------- -}
VALIDATE_MARK_SWEEP_ONLY(track_adjusted_pointer(p, isroot));
}
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.