hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp
template <class T> inline void MarkSweep::adjust_pointer(T* p, bool isroot) {
{- -------------------------------------------
(1) 処理対象のオブジェクト(以下の p)が NULL でなければ,
コンパクション先のアドレス(以下の new_obj)を取得し,
oopDesc::encode_store_heap_oop_not_null() で
処理対象のポインタ(p)をコピー先のアドレスに書き換える.
---------------------------------------- -}
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(obj->mark()->decode_pointer());
assert(new_obj != NULL || // is forwarding ptr?
obj->mark() == markOopDesc::prototype() || // not gc marked?
(UseBiasedLocking && obj->mark()->has_bias_pattern()) ||
// not gc marked?
obj->is_shared(), // never forwarded?
"should be forwarded");
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.