hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp
// This closure is applied to the fields of the objects that have just been copied.
template <class T> inline void G1ParScanClosure::do_oop_nv(T* p) {
{- -------------------------------------------
(1) 以下の 3通りのどれかを行う.
* 引数で渡されたポインタが NULL の場合には何もしない.
* NULL でなく, かつ collection set を指しているようであれば,
_par_scan_state というフィールドに格納している G1ParScanThreadState オブジェクトに
そのポインタを詰めていく.
* NULL でなく, collection set を指していない場合には,
G1ParScanThreadState::update_rs() で Remembered Set(G1RemSet オブジェクト) を更新する処理を行う.
---------------------------------------- -}
T heap_oop = oopDesc::load_heap_oop(p);
if (!oopDesc::is_null(heap_oop)) {
oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
if (_g1->in_cset_fast_test(obj)) {
// We're not going to even bother checking whether the object is
// already forwarded or not, as this usually causes an immediate
// stall. We'll try to prefetch the object (for write, given that
// we might need to install the forwarding reference) and we'll
// get back to it when pop it from the queue
Prefetch::write(obj->mark_addr(), 0);
Prefetch::read(obj->mark_addr(), (HeapWordSize*2));
// slightly paranoid test; I'm trying to catch potential
// problems before we go into push_on_queue to know where the
// problem is coming from
assert(obj == oopDesc::load_decode_heap_oop(p),
"p should still be pointing to obj");
_par_scan_state->push_on_queue(p);
} else {
_par_scan_state->update_rs(_from, p, _par_scan_state->queue_num());
}
}
}
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.