< prev index next >
src/share/vm/gc/g1/g1ConcurrentMark.inline.hpp
Print this page
rev 13257 : [mq]: 8184346-cleanup-g1cmbitmap
rev 13259 : [mq]: 8184347-move-g1cmbitmap-into-own-files
rev 13261 : imported patch 8184348-merge-par_mark-and_gray_root
rev 13262 : imported patch 8184348-ashipilev-review
rev 13263 : imported patch 8184348-deal-with-references
@@ -31,12 +31,33 @@
#include "gc/g1/g1ConcurrentMarkObjArrayProcessor.inline.hpp"
#include "gc/g1/suspendibleThreadSet.hpp"
#include "gc/shared/taskqueue.inline.hpp"
#include "utilities/bitMap.inline.hpp"
-inline bool G1ConcurrentMark::par_mark(oop obj) {
- return _nextMarkBitMap->par_mark((HeapWord*)obj);
+inline bool G1ConcurrentMark::mark_in_next_bitmap(oop const obj) {
+ HeapRegion* const hr = _g1h->heap_region_containing(obj);
+ return mark_in_next_bitmap(hr, obj);
+}
+
+inline bool G1ConcurrentMark::mark_in_next_bitmap(HeapRegion* const hr, oop const obj) {
+ assert(hr != NULL, "just checking");
+ assert(hr->is_in_reserved(obj),
+ "Attempting to mark object at " PTR_FORMAT " that is not contained in the given region %u",
+ p2i(obj), hr->hrm_index());
+
+ if (hr->obj_allocated_since_next_marking(obj)) {
+ return false;
+ }
+
+ // Some callers may have stale objects to mark above nTAMS after humongous reclaim.
+ assert(obj->is_oop(true /* ignore mark word */), "Address " PTR_FORMAT " to mark is not an oop", p2i(obj));
+ assert(!hr->is_continues_humongous(),
+ "Should not try to mark object " PTR_FORMAT " in Humongous continues region %u above nTAMS " PTR_FORMAT,
+ p2i(obj), hr->hrm_index(), p2i(hr->next_top_at_mark_start()));
+
+ HeapWord* const obj_addr = (HeapWord*)obj;
+ return _nextMarkBitMap->par_mark(obj_addr);
}
#ifndef PRODUCT
template<typename Fn>
inline void G1CMMarkStack::iterate(Fn fn) const {
@@ -138,11 +159,14 @@
obj->oop_iterate(_cm_oop_closure, mr);
return mr.word_size();
}
inline void G1CMTask::make_reference_grey(oop obj) {
- if (_cm->par_mark(obj)) {
+ if (!_cm->mark_in_next_bitmap(obj)) {
+ return;
+ }
+
// No OrderAccess:store_load() is needed. It is implicit in the
// CAS done in G1CMBitMap::parMark() call in the routine above.
HeapWord* global_finger = _cm->finger();
// We only need to push a newly grey object on the mark
@@ -174,30 +198,18 @@
process_grey_task_entry<false>(entry);
} else {
push(entry);
}
}
- }
}
inline void G1CMTask::deal_with_reference(oop obj) {
increment_refs_reached();
-
- HeapWord* objAddr = (HeapWord*) obj;
- assert(obj->is_oop_or_null(true /* ignore mark word */), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
- if (_g1h->is_in_g1_reserved(objAddr)) {
- assert(obj != NULL, "null check is implicit");
- if (!_nextMarkBitMap->is_marked(objAddr)) {
- // Only get the containing region if the object is not marked on the
- // bitmap (otherwise, it's a waste of time since we won't do
- // anything with it).
- HeapRegion* hr = _g1h->heap_region_containing(obj);
- if (!hr->obj_allocated_since_next_marking(obj)) {
- make_reference_grey(obj);
- }
- }
+ if (obj == NULL) {
+ return;
}
+ make_reference_grey(obj);
}
inline void G1ConcurrentMark::markPrev(oop p) {
assert(!_prevMarkBitMap->is_marked((HeapWord*) p), "sanity");
_prevMarkBitMap->mark((HeapWord*) p);
@@ -206,30 +218,10 @@
bool G1ConcurrentMark::isPrevMarked(oop p) const {
assert(p != NULL && p->is_oop(), "expected an oop");
return _prevMarkBitMap->is_marked((HeapWord*)p);
}
-inline void G1ConcurrentMark::grayRoot(oop obj, HeapRegion* hr) {
- assert(obj != NULL, "pre-condition");
- HeapWord* addr = (HeapWord*) obj;
- if (hr == NULL) {
- hr = _g1h->heap_region_containing(addr);
- } else {
- assert(hr->is_in(addr), "pre-condition");
- }
- assert(hr != NULL, "sanity");
- // Given that we're looking for a region that contains an object
- // header it's impossible to get back a HC region.
- assert(!hr->is_continues_humongous(), "sanity");
-
- if (addr < hr->next_top_at_mark_start()) {
- if (!_nextMarkBitMap->is_marked(addr)) {
- par_mark(obj);
- }
- }
-}
-
inline bool G1ConcurrentMark::do_yield_check() {
if (SuspendibleThreadSet::should_yield()) {
SuspendibleThreadSet::yield();
return true;
} else {
< prev index next >