hotspot/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp
template <class T>
inline void G1RemSet::par_write_ref(HeapRegion* from, T* p, int tid) {
{- -------------------------------------------
(1) (変数宣言など)
---------------------------------------- -}
oop obj = oopDesc::load_decode_heap_oop(p);
{- -------------------------------------------
(1) (ASSERT)
---------------------------------------- -}
#ifdef ASSERT
// can't do because of races
// assert(obj == NULL || obj->is_oop(), "expected an oop");
// Do the safe subset of is_oop
if (obj != NULL) {
#ifdef CHECK_UNHANDLED_OOPS
oopDesc* o = obj.obj();
#else
oopDesc* o = obj;
#endif // CHECK_UNHANDLED_OOPS
assert((intptr_t)o % MinObjAlignmentInBytes == 0, "not oop aligned");
assert(Universe::heap()->is_in_reserved(obj), "must be in heap");
}
#endif // ASSERT
{- -------------------------------------------
(1) (assert)
---------------------------------------- -}
assert(from == NULL || from->is_in_reserved(p), "p is not in from");
{- -------------------------------------------
(1) HeapRegionRemSet::add_reference(OopOrNarrowOopStar from, int tid) を呼んで,
Remembered Set に情報を追加する.
(ただし, 処理対象のオブジェクトに対応する HeapRegion が見つからなければ何もしない.
また, 参照元が同一 HeapRegion 内にある場合も何もしない.)
---------------------------------------- -}
HeapRegion* to = _g1->heap_region_containing(obj);
if (to != NULL && from != to) {
#if G1_REM_SET_LOGGING
gclog_or_tty->print_cr("Adding " PTR_FORMAT " (" PTR_FORMAT ") to RS"
" for region [" PTR_FORMAT ", " PTR_FORMAT ")",
p, obj,
to->bottom(), to->end());
#endif
assert(to->rem_set() != NULL, "Need per-region 'into' remsets.");
to->rem_set()->add_reference(p, tid);
}
}
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.