< prev index next >
src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp
Print this page
*** 938,948 ****
res = _cmsSpace->promote(obj, obj_size);
}
if (res != NULL) {
// See comment in allocate() about when objects should
// be allocated live.
! assert(obj->is_oop(), "Will dereference klass pointer below");
collector()->promoted(false, // Not parallel
(HeapWord*)res, obj->is_objArray(), obj_size);
// promotion counters
NOT_PRODUCT(
_numObjectsPromoted++;
--- 938,948 ----
res = _cmsSpace->promote(obj, obj_size);
}
if (res != NULL) {
// See comment in allocate() about when objects should
// be allocated live.
! assert(oopDesc::is_oop(obj), "Will dereference klass pointer below");
collector()->promoted(false, // Not parallel
(HeapWord*)res, obj->is_objArray(), obj_size);
// promotion counters
NOT_PRODUCT(
_numObjectsPromoted++;
*** 1061,1077 ****
if (promoInfo->tracking()) {
promoInfo->track((PromotedObject*)obj, old->klass());
}
assert(obj->klass_or_null() == NULL, "Object should be uninitialized here.");
assert(!((FreeChunk*)obj_ptr)->is_free(), "Error, block will look free but show wrong size");
! assert(old->is_oop(), "Will use and dereference old klass ptr below");
// Finally, install the klass pointer (this should be volatile).
OrderAccess::storestore();
obj->set_klass(old->klass());
// We should now be able to calculate the right size for this object
! assert(obj->is_oop() && obj->size() == (int)word_sz, "Error, incorrect size computed for promoted object");
collector()->promoted(true, // parallel
obj_ptr, old->is_objArray(), word_sz);
NOT_PRODUCT(
--- 1061,1077 ----
if (promoInfo->tracking()) {
promoInfo->track((PromotedObject*)obj, old->klass());
}
assert(obj->klass_or_null() == NULL, "Object should be uninitialized here.");
assert(!((FreeChunk*)obj_ptr)->is_free(), "Error, block will look free but show wrong size");
! assert(oopDesc::is_oop(old), "Will use and dereference old klass ptr below");
// Finally, install the klass pointer (this should be volatile).
OrderAccess::storestore();
obj->set_klass(old->klass());
// We should now be able to calculate the right size for this object
! assert(oopDesc::is_oop(obj) && obj->size() == (int)word_sz, "Error, incorrect size computed for promoted object");
collector()->promoted(true, // parallel
obj_ptr, old->is_objArray(), word_sz);
NOT_PRODUCT(
*** 3346,3356 ****
// that are in these stolen objects being scanned must
// already have been initialized (else they would not have
// been published), so we do not need to check for
// uninitialized objects before pushing here.
void ParConcMarkingClosure::do_oop(oop obj) {
! assert(obj->is_oop_or_null(true), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj;
// Check if oop points into the CMS generation
// and is not marked
if (_span.contains(addr) && !_bit_map->isMarked(addr)) {
// a white object ...
--- 3346,3356 ----
// that are in these stolen objects being scanned must
// already have been initialized (else they would not have
// been published), so we do not need to check for
// uninitialized objects before pushing here.
void ParConcMarkingClosure::do_oop(oop obj) {
! assert(oopDesc::is_oop_or_null(obj, true), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj;
// Check if oop points into the CMS generation
// and is not marked
if (_span.contains(addr) && !_bit_map->isMarked(addr)) {
// a white object ...
*** 3388,3398 ****
void ParConcMarkingClosure::trim_queue(size_t max) {
while (_work_queue->size() > max) {
oop new_oop;
if (_work_queue->pop_local(new_oop)) {
! assert(new_oop->is_oop(), "Should be an oop");
assert(_bit_map->isMarked((HeapWord*)new_oop), "Grey object");
assert(_span.contains((HeapWord*)new_oop), "Not in span");
new_oop->oop_iterate(this); // do_oop() above
do_yield_check();
}
--- 3388,3398 ----
void ParConcMarkingClosure::trim_queue(size_t max) {
while (_work_queue->size() > max) {
oop new_oop;
if (_work_queue->pop_local(new_oop)) {
! assert(oopDesc::is_oop(new_oop), "Should be an oop");
assert(_bit_map->isMarked((HeapWord*)new_oop), "Grey object");
assert(_span.contains((HeapWord*)new_oop), "Not in span");
new_oop->oop_iterate(this); // do_oop() above
do_yield_check();
}
*** 3429,3439 ****
// Can't assert below because the work obtained from the
// overflow stack may already have been stolen from us.
// assert(work_q->size() > 0, "Work from overflow stack");
continue;
} else if (task_queues()->steal(i, seed, /* reference */ obj_to_scan)) {
! assert(obj_to_scan->is_oop(), "Should be an oop");
assert(bm->isMarked((HeapWord*)obj_to_scan), "Grey object");
obj_to_scan->oop_iterate(&cl);
} else if (terminator()->offer_termination(&_term_term)) {
assert(work_q->size() == 0, "Impossible!");
break;
--- 3429,3439 ----
// Can't assert below because the work obtained from the
// overflow stack may already have been stolen from us.
// assert(work_q->size() > 0, "Work from overflow stack");
continue;
} else if (task_queues()->steal(i, seed, /* reference */ obj_to_scan)) {
! assert(oopDesc::is_oop(obj_to_scan), "Should be an oop");
assert(bm->isMarked((HeapWord*)obj_to_scan), "Grey object");
obj_to_scan->oop_iterate(&cl);
} else if (terminator()->offer_termination(&_term_term)) {
assert(work_q->size() == 0, "Impossible!");
break;
*** 4520,4530 ****
MemRegion mr(start, end);
// Verify that mr is in space
assert(mr.is_empty() || space->used_region().contains(mr),
"Should be in space");
// Verify that "start" is an object boundary
! assert(mr.is_empty() || oop(mr.start())->is_oop(),
"Should be an oop");
space->par_oop_iterate(mr, cl);
}
pst->all_tasks_completed();
}
--- 4520,4530 ----
MemRegion mr(start, end);
// Verify that mr is in space
assert(mr.is_empty() || space->used_region().contains(mr),
"Should be in space");
// Verify that "start" is an object boundary
! assert(mr.is_empty() || oopDesc::is_oop(oop(mr.start())),
"Should be an oop");
space->par_oop_iterate(mr, cl);
}
pst->all_tasks_completed();
}
*** 4654,4664 ****
// Verify that we have no work before we resort to stealing
assert(work_q->size() == 0, "Have work, shouldn't steal");
// Try to steal from other queues that have work
if (task_queues()->steal(i, seed, /* reference */ obj_to_scan)) {
NOT_PRODUCT(num_steals++;)
! assert(obj_to_scan->is_oop(), "Oops, not an oop!");
assert(bm->isMarked((HeapWord*)obj_to_scan), "Stole an unmarked oop?");
// Do scanning work
obj_to_scan->oop_iterate(cl);
// Loop around, finish this work, and try to steal some more
} else if (terminator()->offer_termination()) {
--- 4654,4664 ----
// Verify that we have no work before we resort to stealing
assert(work_q->size() == 0, "Have work, shouldn't steal");
// Try to steal from other queues that have work
if (task_queues()->steal(i, seed, /* reference */ obj_to_scan)) {
NOT_PRODUCT(num_steals++;)
! assert(oopDesc::is_oop(obj_to_scan), "Oops, not an oop!");
assert(bm->isMarked((HeapWord*)obj_to_scan), "Stole an unmarked oop?");
// Do scanning work
obj_to_scan->oop_iterate(cl);
// Loop around, finish this work, and try to steal some more
} else if (terminator()->offer_termination()) {
*** 5133,5143 ****
// Verify that we have no work before we resort to stealing
assert(work_q->size() == 0, "Have work, shouldn't steal");
// Try to steal from other queues that have work
if (task_queues()->steal(i, seed, /* reference */ obj_to_scan)) {
NOT_PRODUCT(num_steals++;)
! assert(obj_to_scan->is_oop(), "Oops, not an oop!");
assert(_mark_bit_map->isMarked((HeapWord*)obj_to_scan), "Stole an unmarked oop?");
// Do scanning work
obj_to_scan->oop_iterate(keep_alive);
// Loop around, finish this work, and try to steal some more
} else if (terminator()->offer_termination()) {
--- 5133,5143 ----
// Verify that we have no work before we resort to stealing
assert(work_q->size() == 0, "Have work, shouldn't steal");
// Try to steal from other queues that have work
if (task_queues()->steal(i, seed, /* reference */ obj_to_scan)) {
NOT_PRODUCT(num_steals++;)
! assert(oopDesc::is_oop(obj_to_scan), "Oops, not an oop!");
assert(_mark_bit_map->isMarked((HeapWord*)obj_to_scan), "Stole an unmarked oop?");
// Do scanning work
obj_to_scan->oop_iterate(keep_alive);
// Loop around, finish this work, and try to steal some more
} else if (terminator()->offer_termination()) {
*** 5823,5833 ****
assert(_bitMap->covers(_span), "_bitMap/_span mismatch");
}
void MarkRefsIntoClosure::do_oop(oop obj) {
// if p points into _span, then mark corresponding bit in _markBitMap
! assert(obj->is_oop(), "expected an oop");
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr)) {
// this should be made more efficient
_bitMap->mark(addr);
}
--- 5823,5833 ----
assert(_bitMap->covers(_span), "_bitMap/_span mismatch");
}
void MarkRefsIntoClosure::do_oop(oop obj) {
// if p points into _span, then mark corresponding bit in _markBitMap
! assert(oopDesc::is_oop(obj), "expected an oop");
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr)) {
// this should be made more efficient
_bitMap->mark(addr);
}
*** 5845,5855 ****
assert(_bitMap->covers(_span), "_bitMap/_span mismatch");
}
void ParMarkRefsIntoClosure::do_oop(oop obj) {
// if p points into _span, then mark corresponding bit in _markBitMap
! assert(obj->is_oop(), "expected an oop");
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr)) {
// this should be made more efficient
_bitMap->par_mark(addr);
}
--- 5845,5855 ----
assert(_bitMap->covers(_span), "_bitMap/_span mismatch");
}
void ParMarkRefsIntoClosure::do_oop(oop obj) {
// if p points into _span, then mark corresponding bit in _markBitMap
! assert(oopDesc::is_oop(obj), "expected an oop");
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr)) {
// this should be made more efficient
_bitMap->par_mark(addr);
}
*** 5869,5879 ****
assert(_verification_bm->covers(_span), "_verification_bm/_span mismatch");
}
void MarkRefsIntoVerifyClosure::do_oop(oop obj) {
// if p points into _span, then mark corresponding bit in _markBitMap
! assert(obj->is_oop(), "expected an oop");
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr)) {
_verification_bm->mark(addr);
if (!_cms_bm->isMarked(addr)) {
Log(gc, verify) log;
--- 5869,5879 ----
assert(_verification_bm->covers(_span), "_verification_bm/_span mismatch");
}
void MarkRefsIntoVerifyClosure::do_oop(oop obj) {
// if p points into _span, then mark corresponding bit in _markBitMap
! assert(oopDesc::is_oop(obj), "expected an oop");
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr)) {
_verification_bm->mark(addr);
if (!_cms_bm->isMarked(addr)) {
Log(gc, verify) log;
*** 5923,5933 ****
// The marks are made in the marking bit map and the marking stack is
// used for keeping the (newly) grey objects during the scan.
// The parallel version (Par_...) appears further below.
void MarkRefsIntoAndScanClosure::do_oop(oop obj) {
if (obj != NULL) {
! assert(obj->is_oop(), "expected an oop");
HeapWord* addr = (HeapWord*)obj;
assert(_mark_stack->isEmpty(), "pre-condition (eager drainage)");
assert(_collector->overflow_list_is_empty(),
"overflow list should be empty");
if (_span.contains(addr) &&
--- 5923,5933 ----
// The marks are made in the marking bit map and the marking stack is
// used for keeping the (newly) grey objects during the scan.
// The parallel version (Par_...) appears further below.
void MarkRefsIntoAndScanClosure::do_oop(oop obj) {
if (obj != NULL) {
! assert(oopDesc::is_oop(obj), "expected an oop");
HeapWord* addr = (HeapWord*)obj;
assert(_mark_stack->isEmpty(), "pre-condition (eager drainage)");
assert(_collector->overflow_list_is_empty(),
"overflow list should be empty");
if (_span.contains(addr) &&
*** 5939,5949 ****
// from the stack (i.e. blacken the grey objects)
bool res = _mark_stack->push(obj);
assert(res, "Should have space to push on empty stack");
do {
oop new_oop = _mark_stack->pop();
! assert(new_oop != NULL && new_oop->is_oop(), "Expected an oop");
assert(_bit_map->isMarked((HeapWord*)new_oop),
"only grey objects on this stack");
// iterate over the oops in this oop, marking and pushing
// the ones in CMS heap (i.e. in _span).
new_oop->oop_iterate(&_pushAndMarkClosure);
--- 5939,5949 ----
// from the stack (i.e. blacken the grey objects)
bool res = _mark_stack->push(obj);
assert(res, "Should have space to push on empty stack");
do {
oop new_oop = _mark_stack->pop();
! assert(new_oop != NULL && oopDesc::is_oop(new_oop), "Expected an oop");
assert(_bit_map->isMarked((HeapWord*)new_oop),
"only grey objects on this stack");
// iterate over the oops in this oop, marking and pushing
// the ones in CMS heap (i.e. in _span).
new_oop->oop_iterate(&_pushAndMarkClosure);
*** 6021,6031 ****
// synchronized (via CAS).
void ParMarkRefsIntoAndScanClosure::do_oop(oop obj) {
if (obj != NULL) {
// Ignore mark word because this could be an already marked oop
// that may be chained at the end of the overflow list.
! assert(obj->is_oop(true), "expected an oop");
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr) &&
!_bit_map->isMarked(addr)) {
// mark bit map (object will become grey):
// It is possible for several threads to be
--- 6021,6031 ----
// synchronized (via CAS).
void ParMarkRefsIntoAndScanClosure::do_oop(oop obj) {
if (obj != NULL) {
// Ignore mark word because this could be an already marked oop
// that may be chained at the end of the overflow list.
! assert(oopDesc::is_oop(obj, true), "expected an oop");
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr) &&
!_bit_map->isMarked(addr)) {
// mark bit map (object will become grey):
// It is possible for several threads to be
*** 6067,6077 ****
if (_bitMap->isMarked(addr)) {
// it's marked; is it potentially uninitialized?
if (p->klass_or_null_acquire() != NULL) {
// an initialized object; ignore mark word in verification below
// since we are running concurrent with mutators
! assert(p->is_oop(true), "should be an oop");
if (p->is_objArray()) {
// objArrays are precisely marked; restrict scanning
// to dirty cards only.
size = CompactibleFreeListSpace::adjustObjectSize(
p->oop_iterate_size(_scanningClosure, mr));
--- 6067,6077 ----
if (_bitMap->isMarked(addr)) {
// it's marked; is it potentially uninitialized?
if (p->klass_or_null_acquire() != NULL) {
// an initialized object; ignore mark word in verification below
// since we are running concurrent with mutators
! assert(oopDesc::is_oop(p, true), "should be an oop");
if (p->is_objArray()) {
// objArrays are precisely marked; restrict scanning
// to dirty cards only.
size = CompactibleFreeListSpace::adjustObjectSize(
p->oop_iterate_size(_scanningClosure, mr));
*** 6116,6126 ****
// we may not be able to read its P-bits yet.
assert(size == 0, "Initial value");
} else {
// An object not (yet) reached by marking: we merely need to
// compute its size so as to go look at the next block.
! assert(p->is_oop(true), "should be an oop");
size = CompactibleFreeListSpace::adjustObjectSize(p->size());
}
}
DEBUG_ONLY(_collector->verify_work_stacks_empty();)
return size;
--- 6116,6126 ----
// we may not be able to read its P-bits yet.
assert(size == 0, "Initial value");
} else {
// An object not (yet) reached by marking: we merely need to
// compute its size so as to go look at the next block.
! assert(oopDesc::is_oop(p, true), "should be an oop");
size = CompactibleFreeListSpace::adjustObjectSize(p->size());
}
}
DEBUG_ONLY(_collector->verify_work_stacks_empty();)
return size;
*** 6163,6173 ****
DEBUG_ONLY(_collector->verify_work_stacks_empty();)
assert(!_span.contains(addr), "we are scanning the survivor spaces");
assert(p->klass_or_null() != NULL, "object should be initialized");
// an initialized object; ignore mark word in verification below
// since we are running concurrent with mutators
! assert(p->is_oop(true), "should be an oop");
// Note that we do not yield while we iterate over
// the interior oops of p, pushing the relevant ones
// on our marking stack.
size_t size = p->oop_iterate_size(_scanning_closure);
do_yield_check();
--- 6163,6173 ----
DEBUG_ONLY(_collector->verify_work_stacks_empty();)
assert(!_span.contains(addr), "we are scanning the survivor spaces");
assert(p->klass_or_null() != NULL, "object should be initialized");
// an initialized object; ignore mark word in verification below
// since we are running concurrent with mutators
! assert(oopDesc::is_oop(p, true), "should be an oop");
// Note that we do not yield while we iterate over
// the interior oops of p, pushing the relevant ones
// on our marking stack.
size_t size = p->oop_iterate_size(_scanning_closure);
do_yield_check();
*** 6177,6187 ****
// some existing assertions. In general, it may be a
// good idea to abort immediately and complete the marking
// from the grey objects at a later time.
while (!_mark_stack->isEmpty()) {
oop new_oop = _mark_stack->pop();
! assert(new_oop != NULL && new_oop->is_oop(), "Expected an oop");
assert(_bit_map->isMarked((HeapWord*)new_oop),
"only grey objects on this stack");
// iterate over the oops in this oop, marking and pushing
// the ones in CMS heap (i.e. in _span).
new_oop->oop_iterate(_scanning_closure);
--- 6177,6187 ----
// some existing assertions. In general, it may be a
// good idea to abort immediately and complete the marking
// from the grey objects at a later time.
while (!_mark_stack->isEmpty()) {
oop new_oop = _mark_stack->pop();
! assert(new_oop != NULL && oopDesc::is_oop(new_oop), "Expected an oop");
assert(_bit_map->isMarked((HeapWord*)new_oop),
"only grey objects on this stack");
// iterate over the oops in this oop, marking and pushing
// the ones in CMS heap (i.e. in _span).
new_oop->oop_iterate(_scanning_closure);
*** 6221,6231 ****
// in the mod union table and the card table proper. In the parallel
// case, although the bitMap is shared, we do a single read so the
// isMarked() query is "safe".
bool ScanMarkedObjectsAgainClosure::do_object_bm(oop p, MemRegion mr) {
// Ignore mark word because we are running concurrent with mutators
! assert(p->is_oop_or_null(true), "Expected an oop or NULL at " PTR_FORMAT, p2i(p));
HeapWord* addr = (HeapWord*)p;
assert(_span.contains(addr), "we are scanning the CMS generation");
bool is_obj_array = false;
#ifdef ASSERT
if (!_parallel) {
--- 6221,6231 ----
// in the mod union table and the card table proper. In the parallel
// case, although the bitMap is shared, we do a single read so the
// isMarked() query is "safe".
bool ScanMarkedObjectsAgainClosure::do_object_bm(oop p, MemRegion mr) {
// Ignore mark word because we are running concurrent with mutators
! assert(oopDesc::is_oop_or_null(p, true), "Expected an oop or NULL at " PTR_FORMAT, p2i(p));
HeapWord* addr = (HeapWord*)p;
assert(_span.contains(addr), "we are scanning the CMS generation");
bool is_obj_array = false;
#ifdef ASSERT
if (!_parallel) {
*** 6374,6384 ****
"should drain stack to limit stack usage");
// convert ptr to an oop preparatory to scanning
oop obj = oop(ptr);
// Ignore mark word in verification below, since we
// may be running concurrent with mutators.
! assert(obj->is_oop(true), "should be an oop");
assert(_finger <= ptr, "_finger runneth ahead");
// advance the finger to right end of this object
_finger = ptr + obj->size();
assert(_finger > ptr, "we just incremented it above");
// On large heaps, it may take us some time to get through
--- 6374,6384 ----
"should drain stack to limit stack usage");
// convert ptr to an oop preparatory to scanning
oop obj = oop(ptr);
// Ignore mark word in verification below, since we
// may be running concurrent with mutators.
! assert(oopDesc::is_oop(obj, true), "should be an oop");
assert(_finger <= ptr, "_finger runneth ahead");
// advance the finger to right end of this object
_finger = ptr + obj->size();
assert(_finger > ptr, "we just incremented it above");
// On large heaps, it may take us some time to get through
*** 6421,6431 ****
assert(res, "Empty non-zero size stack should have space for single push");
while (!_markStack->isEmpty()) {
oop new_oop = _markStack->pop();
// Skip verifying header mark word below because we are
// running concurrent with mutators.
! assert(new_oop->is_oop(true), "Oops! expected to pop an oop");
// now scan this oop's oops
new_oop->oop_iterate(&pushOrMarkClosure);
do_yield_check();
}
assert(_markStack->isEmpty(), "tautology, emphasizing post-condition");
--- 6421,6431 ----
assert(res, "Empty non-zero size stack should have space for single push");
while (!_markStack->isEmpty()) {
oop new_oop = _markStack->pop();
// Skip verifying header mark word below because we are
// running concurrent with mutators.
! assert(oopDesc::is_oop(new_oop, true), "Oops! expected to pop an oop");
// now scan this oop's oops
new_oop->oop_iterate(&pushOrMarkClosure);
do_yield_check();
}
assert(_markStack->isEmpty(), "tautology, emphasizing post-condition");
*** 6487,6497 ****
"should drain stack to limit stack usage");
// convert ptr to an oop preparatory to scanning
oop obj = oop(ptr);
// Ignore mark word in verification below, since we
// may be running concurrent with mutators.
! assert(obj->is_oop(true), "should be an oop");
assert(_finger <= ptr, "_finger runneth ahead");
// advance the finger to right end of this object
_finger = ptr + obj->size();
assert(_finger > ptr, "we just incremented it above");
// On large heaps, it may take us some time to get through
--- 6487,6497 ----
"should drain stack to limit stack usage");
// convert ptr to an oop preparatory to scanning
oop obj = oop(ptr);
// Ignore mark word in verification below, since we
// may be running concurrent with mutators.
! assert(oopDesc::is_oop(obj, true), "should be an oop");
assert(_finger <= ptr, "_finger runneth ahead");
// advance the finger to right end of this object
_finger = ptr + obj->size();
assert(_finger > ptr, "we just incremented it above");
// On large heaps, it may take us some time to get through
*** 6548,6558 ****
break;
}
}
// Skip verifying header mark word below because we are
// running concurrent with mutators.
! assert(new_oop->is_oop(true), "Oops! expected to pop an oop");
// now scan this oop's oops
new_oop->oop_iterate(&pushOrMarkClosure);
do_yield_check();
}
assert(_work_queue->size() == 0, "tautology, emphasizing post-condition");
--- 6548,6558 ----
break;
}
}
// Skip verifying header mark word below because we are
// running concurrent with mutators.
! assert(oopDesc::is_oop(new_oop, true), "Oops! expected to pop an oop");
// now scan this oop's oops
new_oop->oop_iterate(&pushOrMarkClosure);
do_yield_check();
}
assert(_work_queue->size() == 0, "tautology, emphasizing post-condition");
*** 6602,6623 ****
assert(_mark_stack->isEmpty(),
"should drain stack to limit stack usage");
// convert addr to an oop preparatory to scanning
oop obj = oop(addr);
! assert(obj->is_oop(), "should be an oop");
assert(_finger <= addr, "_finger runneth ahead");
// advance the finger to right end of this object
_finger = addr + obj->size();
assert(_finger > addr, "we just incremented it above");
// Note: the finger doesn't advance while we drain
// the stack below.
bool res = _mark_stack->push(obj);
assert(res, "Empty non-zero size stack should have space for single push");
while (!_mark_stack->isEmpty()) {
oop new_oop = _mark_stack->pop();
! assert(new_oop->is_oop(), "Oops! expected to pop an oop");
// now scan this oop's oops
new_oop->oop_iterate(&_pam_verify_closure);
}
assert(_mark_stack->isEmpty(), "tautology, emphasizing post-condition");
return true;
--- 6602,6623 ----
assert(_mark_stack->isEmpty(),
"should drain stack to limit stack usage");
// convert addr to an oop preparatory to scanning
oop obj = oop(addr);
! assert(oopDesc::is_oop(obj), "should be an oop");
assert(_finger <= addr, "_finger runneth ahead");
// advance the finger to right end of this object
_finger = addr + obj->size();
assert(_finger > addr, "we just incremented it above");
// Note: the finger doesn't advance while we drain
// the stack below.
bool res = _mark_stack->push(obj);
assert(res, "Empty non-zero size stack should have space for single push");
while (!_mark_stack->isEmpty()) {
oop new_oop = _mark_stack->pop();
! assert(oopDesc::is_oop(new_oop), "Oops! expected to pop an oop");
// now scan this oop's oops
new_oop->oop_iterate(&_pam_verify_closure);
}
assert(_mark_stack->isEmpty(), "tautology, emphasizing post-condition");
return true;
*** 6648,6658 ****
_mark_stack->reset(); // discard stack contents
_mark_stack->expand(); // expand the stack if possible
}
void PushAndMarkVerifyClosure::do_oop(oop obj) {
! assert(obj->is_oop_or_null(), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr) && !_verification_bm->isMarked(addr)) {
// Oop lies in _span and isn't yet grey or black
_verification_bm->mark(addr); // now grey
if (!_cms_bm->isMarked(addr)) {
--- 6648,6658 ----
_mark_stack->reset(); // discard stack contents
_mark_stack->expand(); // expand the stack if possible
}
void PushAndMarkVerifyClosure::do_oop(oop obj) {
! assert(oopDesc::is_oop_or_null(obj), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr) && !_verification_bm->isMarked(addr)) {
// Oop lies in _span and isn't yet grey or black
_verification_bm->mark(addr); // now grey
if (!_cms_bm->isMarked(addr)) {
*** 6745,6755 ****
_overflow_stack->expand(); // expand the stack if possible
}
void PushOrMarkClosure::do_oop(oop obj) {
// Ignore mark word because we are running concurrent with mutators.
! assert(obj->is_oop_or_null(true), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr) && !_bitMap->isMarked(addr)) {
// Oop lies in _span and isn't yet grey or black
_bitMap->mark(addr); // now grey
if (addr < _finger) {
--- 6745,6755 ----
_overflow_stack->expand(); // expand the stack if possible
}
void PushOrMarkClosure::do_oop(oop obj) {
// Ignore mark word because we are running concurrent with mutators.
! assert(oopDesc::is_oop_or_null(obj, true), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr) && !_bitMap->isMarked(addr)) {
// Oop lies in _span and isn't yet grey or black
_bitMap->mark(addr); // now grey
if (addr < _finger) {
*** 6780,6790 ****
void PushOrMarkClosure::do_oop(oop* p) { PushOrMarkClosure::do_oop_work(p); }
void PushOrMarkClosure::do_oop(narrowOop* p) { PushOrMarkClosure::do_oop_work(p); }
void ParPushOrMarkClosure::do_oop(oop obj) {
// Ignore mark word because we are running concurrent with mutators.
! assert(obj->is_oop_or_null(true), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj;
if (_whole_span.contains(addr) && !_bit_map->isMarked(addr)) {
// Oop lies in _span and isn't yet grey or black
// We read the global_finger (volatile read) strictly after marking oop
bool res = _bit_map->par_mark(addr); // now grey
--- 6780,6790 ----
void PushOrMarkClosure::do_oop(oop* p) { PushOrMarkClosure::do_oop_work(p); }
void PushOrMarkClosure::do_oop(narrowOop* p) { PushOrMarkClosure::do_oop_work(p); }
void ParPushOrMarkClosure::do_oop(oop obj) {
// Ignore mark word because we are running concurrent with mutators.
! assert(oopDesc::is_oop_or_null(obj, true), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj;
if (_whole_span.contains(addr) && !_bit_map->isMarked(addr)) {
// Oop lies in _span and isn't yet grey or black
// We read the global_finger (volatile read) strictly after marking oop
bool res = _bit_map->par_mark(addr); // now grey
*** 6853,6863 ****
// Ignore mark word verification. If during concurrent precleaning,
// the object monitor may be locked. If during the checkpoint
// phases, the object may already have been reached by a different
// path and may be at the end of the global overflow list (so
// the mark word may be NULL).
! assert(obj->is_oop_or_null(true /* ignore mark word */),
"Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj;
// Check if oop points into the CMS generation
// and is not marked
if (_span.contains(addr) && !_bit_map->isMarked(addr)) {
--- 6853,6863 ----
// Ignore mark word verification. If during concurrent precleaning,
// the object monitor may be locked. If during the checkpoint
// phases, the object may already have been reached by a different
// path and may be at the end of the global overflow list (so
// the mark word may be NULL).
! assert(oopDesc::is_oop_or_null(obj, true /* ignore mark word */),
"Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj;
// Check if oop points into the CMS generation
// and is not marked
if (_span.contains(addr) && !_bit_map->isMarked(addr)) {
*** 6932,6942 ****
// have been subsequently popped off the global overflow
// stack, and the mark word possibly restored to the prototypical
// value, by the time we get to examined this failing assert in
// the debugger, is_oop_or_null(false) may subsequently start
// to hold.
! assert(obj->is_oop_or_null(true),
"Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj;
// Check if oop points into the CMS generation
// and is not marked
if (_span.contains(addr) && !_bit_map->isMarked(addr)) {
--- 6932,6942 ----
// have been subsequently popped off the global overflow
// stack, and the mark word possibly restored to the prototypical
// value, by the time we get to examined this failing assert in
// the debugger, is_oop_or_null(false) may subsequently start
// to hold.
! assert(oopDesc::is_oop_or_null(obj, true),
"Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
HeapWord* addr = (HeapWord*)obj;
// Check if oop points into the CMS generation
// and is not marked
if (_span.contains(addr) && !_bit_map->isMarked(addr)) {
*** 7323,7333 ****
flush_cur_free_chunk(freeFinger(), pointer_delta(addr, freeFinger()));
}
// This object is live: we'd normally expect this to be
// an oop, and like to assert the following:
! // assert(oop(addr)->is_oop(), "live block should be an oop");
// However, as we commented above, this may be an object whose
// header hasn't yet been initialized.
size_t size;
assert(_bitMap->isMarked(addr), "Tautology for this control point");
if (_bitMap->isMarked(addr + 1)) {
--- 7323,7333 ----
flush_cur_free_chunk(freeFinger(), pointer_delta(addr, freeFinger()));
}
// This object is live: we'd normally expect this to be
// an oop, and like to assert the following:
! // assert(oopDesc::is_oop(oop(addr)), "live block should be an oop");
// However, as we commented above, this may be an object whose
// header hasn't yet been initialized.
size_t size;
assert(_bitMap->isMarked(addr), "Tautology for this control point");
if (_bitMap->isMarked(addr + 1)) {
*** 7339,7349 ****
"alignment problem");
#ifdef ASSERT
if (oop(addr)->klass_or_null_acquire() != NULL) {
// Ignore mark word because we are running concurrent with mutators
! assert(oop(addr)->is_oop(true), "live block should be an oop");
assert(size ==
CompactibleFreeListSpace::adjustObjectSize(oop(addr)->size()),
"P-mark and computed size do not agree");
}
#endif
--- 7339,7349 ----
"alignment problem");
#ifdef ASSERT
if (oop(addr)->klass_or_null_acquire() != NULL) {
// Ignore mark word because we are running concurrent with mutators
! assert(oopDesc::is_oop(oop(addr), true), "live block should be an oop");
assert(size ==
CompactibleFreeListSpace::adjustObjectSize(oop(addr)->size()),
"P-mark and computed size do not agree");
}
#endif
*** 7351,7361 ****
} else {
// This should be an initialized object that's alive.
assert(oop(addr)->klass_or_null_acquire() != NULL,
"Should be an initialized object");
// Ignore mark word because we are running concurrent with mutators
! assert(oop(addr)->is_oop(true), "live block should be an oop");
// Verify that the bit map has no bits marked between
// addr and purported end of this block.
size = CompactibleFreeListSpace::adjustObjectSize(oop(addr)->size());
assert(size >= 3, "Necessary for Printezis marks to work");
assert(!_bitMap->isMarked(addr+1), "Tautology for this control point");
--- 7351,7361 ----
} else {
// This should be an initialized object that's alive.
assert(oop(addr)->klass_or_null_acquire() != NULL,
"Should be an initialized object");
// Ignore mark word because we are running concurrent with mutators
! assert(oopDesc::is_oop(oop(addr), true), "live block should be an oop");
// Verify that the bit map has no bits marked between
// addr and purported end of this block.
size = CompactibleFreeListSpace::adjustObjectSize(oop(addr)->size());
assert(size >= 3, "Necessary for Printezis marks to work");
assert(!_bitMap->isMarked(addr+1), "Tautology for this control point");
*** 7659,7669 ****
void CMSParKeepAliveClosure::trim_queue(uint max) {
while (_work_queue->size() > max) {
oop new_oop;
if (_work_queue->pop_local(new_oop)) {
! assert(new_oop != NULL && new_oop->is_oop(), "Expected an oop");
assert(_bit_map->isMarked((HeapWord*)new_oop),
"no white objects on this stack!");
assert(_span.contains((HeapWord*)new_oop), "Out of bounds oop");
// iterate over the oops in this oop, marking and pushing
// the ones in CMS heap (i.e. in _span).
--- 7659,7669 ----
void CMSParKeepAliveClosure::trim_queue(uint max) {
while (_work_queue->size() > max) {
oop new_oop;
if (_work_queue->pop_local(new_oop)) {
! assert(new_oop != NULL && oopDesc::is_oop(new_oop), "Expected an oop");
assert(_bit_map->isMarked((HeapWord*)new_oop),
"no white objects on this stack!");
assert(_span.contains((HeapWord*)new_oop), "Out of bounds oop");
// iterate over the oops in this oop, marking and pushing
// the ones in CMS heap (i.e. in _span).
*** 7739,7749 ****
_collector->take_from_overflow_list(num, _mark_stack)) {
oop obj = _mark_stack->pop();
HeapWord* addr = (HeapWord*)obj;
assert(_span.contains(addr), "Should be within span");
assert(_bit_map->isMarked(addr), "Should be marked");
! assert(obj->is_oop(), "Should be an oop");
obj->oop_iterate(_keep_alive);
}
}
void CMSParDrainMarkingStackClosure::do_void() {
--- 7739,7749 ----
_collector->take_from_overflow_list(num, _mark_stack)) {
oop obj = _mark_stack->pop();
HeapWord* addr = (HeapWord*)obj;
assert(_span.contains(addr), "Should be within span");
assert(_bit_map->isMarked(addr), "Should be marked");
! assert(oopDesc::is_oop(obj), "Should be an oop");
obj->oop_iterate(_keep_alive);
}
}
void CMSParDrainMarkingStackClosure::do_void() {
*** 7754,7764 ****
// Trim our work_queue so its length is below max at return
void CMSParDrainMarkingStackClosure::trim_queue(uint max) {
while (_work_queue->size() > max) {
oop new_oop;
if (_work_queue->pop_local(new_oop)) {
! assert(new_oop->is_oop(), "Expected an oop");
assert(_bit_map->isMarked((HeapWord*)new_oop),
"no white objects on this stack!");
assert(_span.contains((HeapWord*)new_oop), "Out of bounds oop");
// iterate over the oops in this oop, marking and pushing
// the ones in CMS heap (i.e. in _span).
--- 7754,7764 ----
// Trim our work_queue so its length is below max at return
void CMSParDrainMarkingStackClosure::trim_queue(uint max) {
while (_work_queue->size() > max) {
oop new_oop;
if (_work_queue->pop_local(new_oop)) {
! assert(oopDesc::is_oop(new_oop), "Expected an oop");
assert(_bit_map->isMarked((HeapWord*)new_oop),
"no white objects on this stack!");
assert(_span.contains((HeapWord*)new_oop), "Out of bounds oop");
// iterate over the oops in this oop, marking and pushing
// the ones in CMS heap (i.e. in _span).
*** 7805,7815 ****
const markOop proto = markOopDesc::prototype();
NOT_PRODUCT(ssize_t n = 0;)
for (oop next; i > 0 && cur != NULL; cur = next, i--) {
next = oop(cur->mark());
cur->set_mark(proto); // until proven otherwise
! assert(cur->is_oop(), "Should be an oop");
bool res = stack->push(cur);
assert(res, "Bit off more than can chew?");
NOT_PRODUCT(n++;)
}
_overflow_list = cur;
--- 7805,7815 ----
const markOop proto = markOopDesc::prototype();
NOT_PRODUCT(ssize_t n = 0;)
for (oop next; i > 0 && cur != NULL; cur = next, i--) {
next = oop(cur->mark());
cur->set_mark(proto); // until proven otherwise
! assert(oopDesc::is_oop(cur), "Should be an oop");
bool res = stack->push(cur);
assert(res, "Bit off more than can chew?");
NOT_PRODUCT(n++;)
}
_overflow_list = cur;
*** 7949,7959 ****
oop next;
NOT_PRODUCT(ssize_t n = 0;)
for (cur = prefix; cur != NULL; cur = next) {
next = oop(cur->mark());
cur->set_mark(proto); // until proven otherwise
! assert(cur->is_oop(), "Should be an oop");
bool res = work_q->push(cur);
assert(res, "Bit off more than we can chew?");
NOT_PRODUCT(n++;)
}
#ifndef PRODUCT
--- 7949,7959 ----
oop next;
NOT_PRODUCT(ssize_t n = 0;)
for (cur = prefix; cur != NULL; cur = next) {
next = oop(cur->mark());
cur->set_mark(proto); // until proven otherwise
! assert(oopDesc::is_oop(cur), "Should be an oop");
bool res = work_q->push(cur);
assert(res, "Bit off more than we can chew?");
NOT_PRODUCT(n++;)
}
#ifndef PRODUCT
*** 7964,7983 ****
}
// Single-threaded
void CMSCollector::push_on_overflow_list(oop p) {
NOT_PRODUCT(_num_par_pushes++;)
! assert(p->is_oop(), "Not an oop");
preserve_mark_if_necessary(p);
p->set_mark((markOop)_overflow_list);
_overflow_list = p;
}
// Multi-threaded; use CAS to prepend to overflow list
void CMSCollector::par_push_on_overflow_list(oop p) {
NOT_PRODUCT(Atomic::inc_ptr(&_num_par_pushes);)
! assert(p->is_oop(), "Not an oop");
par_preserve_mark_if_necessary(p);
oop observed_overflow_list = _overflow_list;
oop cur_overflow_list;
do {
cur_overflow_list = observed_overflow_list;
--- 7964,7983 ----
}
// Single-threaded
void CMSCollector::push_on_overflow_list(oop p) {
NOT_PRODUCT(_num_par_pushes++;)
! assert(oopDesc::is_oop(p), "Not an oop");
preserve_mark_if_necessary(p);
p->set_mark((markOop)_overflow_list);
_overflow_list = p;
}
// Multi-threaded; use CAS to prepend to overflow list
void CMSCollector::par_push_on_overflow_list(oop p) {
NOT_PRODUCT(Atomic::inc_ptr(&_num_par_pushes);)
! assert(oopDesc::is_oop(p), "Not an oop");
par_preserve_mark_if_necessary(p);
oop observed_overflow_list = _overflow_list;
oop cur_overflow_list;
do {
cur_overflow_list = observed_overflow_list;
*** 8060,8070 ****
assert(_preserved_oop_stack.size() == _preserved_mark_stack.size(),
"bijection");
while (!_preserved_oop_stack.is_empty()) {
oop p = _preserved_oop_stack.pop();
! assert(p->is_oop(), "Should be an oop");
assert(_span.contains(p), "oop should be in _span");
assert(p->mark() == markOopDesc::prototype(),
"Set when taken from overflow list");
markOop m = _preserved_mark_stack.pop();
p->set_mark(m);
--- 8060,8070 ----
assert(_preserved_oop_stack.size() == _preserved_mark_stack.size(),
"bijection");
while (!_preserved_oop_stack.is_empty()) {
oop p = _preserved_oop_stack.pop();
! assert(oopDesc::is_oop(p), "Should be an oop");
assert(_span.contains(p), "oop should be in _span");
assert(p->mark() == markOopDesc::prototype(),
"Set when taken from overflow list");
markOop m = _preserved_mark_stack.pop();
p->set_mark(m);
< prev index next >