< prev index next >
src/hotspot/share/gc/g1/g1CollectedHeap.cpp
Print this page
rev 51258 : 8154343: Make SATB related code available to other GCs
*** 4978,4982 ****
--- 4978,5036 ----
memory_pools.append(_eden_pool);
memory_pools.append(_survivor_pool);
memory_pools.append(_old_pool);
return memory_pools;
}
+
+ // Return true if a SATB buffer entry refers to an object that
+ // requires marking.
+ //
+ // The entry must point into the heap. In particular, it must not
+ // be a NULL pointer. NULL pointers are pre-filtered and never
+ // inserted into a SATB buffer.
+ //
+ // An entry that is below the NTAMS pointer for the containing heap
+ // region requires marking. Such an entry must point to a valid object.
+ //
+ // An entry that is at least the NTAMS pointer for the containing heap
+ // region might be any of the following, none of which should be marked.
+ //
+ // * A reference to an object allocated since marking started.
+ // According to SATB, such objects are implicitly kept live and do
+ // not need to be dealt with via SATB buffer processing.
+ //
+ // * A reference to a young generation object. Young objects are
+ // handled separately and are not marked by concurrent marking.
+ //
+ // * A stale reference to a young generation object. If a young
+ // generation object reference is recorded and not filtered out
+ // before being moved by a young collection, the reference becomes
+ // stale.
+ //
+ // * A stale reference to an eagerly reclaimed humongous object. If a
+ // humongous object is recorded and then reclaimed, the reference
+ // becomes stale.
+ //
+ // The stale reference cases are implicitly handled by the NTAMS
+ // comparison. Because of the possibility of stale references, buffer
+ // processing must be somewhat circumspect and not assume entries
+ // in an unfiltered buffer refer to valid objects.
+ bool G1CollectedHeap::retain_satb_entry(const void* entry) const {
+ // Includes rejection of NULL pointers.
+ assert(is_in_reserved(entry),
+ "Non-heap pointer in SATB buffer: " PTR_FORMAT, p2i(entry));
+
+ HeapRegion* region = heap_region_containing(entry);
+ assert(region != NULL, "No region for " PTR_FORMAT, p2i(entry));
+ if (entry >= region->next_top_at_mark_start()) {
+ return false;
+ }
+
+ assert(oopDesc::is_oop(oop(entry), true /* ignore mark word */),
+ "Invalid oop in SATB buffer: " PTR_FORMAT, p2i(entry));
+
+ return !is_marked_next((oop)entry);
+ }
+
+ SATBMarkQueue* G1CollectedHeap::satb_mark_queue(JavaThread* t) const {
+ return &G1ThreadLocalData::satb_mark_queue(t);
+ }
< prev index next >