7195622: CheckUnhandledOops has limited usefulness now

Enable CHECK_UNHANDLED_OOPS in fastdebug builds across all supported platforms.

Reviewed-by: coleenp, hseigel, dholmes, stefank, twisti, ihse, rdurbin
This commit is contained in:
Lois Foltan 2013-09-26 10:25:02 -04:00 committed by Harold Seigel
parent 18550f7774
commit 7bf953d005
62 changed files with 208 additions and 173 deletions

View file

@ -9065,7 +9065,7 @@ bool CMSCollector::take_from_overflow_list(size_t num, CMSMarkStack* stack) {
return !stack->isEmpty();
}
#define BUSY (oop(0x1aff1aff))
#define BUSY (cast_to_oop<intptr_t>(0x1aff1aff))
// (MT-safe) Get a prefix of at most "num" from the list.
// The overflow list is chained through the mark word of
// each object in the list. We fetch the entire list,
@ -9098,7 +9098,7 @@ bool CMSCollector::par_take_from_overflow_list(size_t num,
return false;
}
// Grab the entire list; we'll put back a suffix
oop prefix = (oop)Atomic::xchg_ptr(BUSY, &_overflow_list);
oop prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list));
Thread* tid = Thread::current();
// Before "no_of_gc_threads" was introduced CMSOverflowSpinCount was
// set to ParallelGCThreads.
@ -9113,7 +9113,7 @@ bool CMSCollector::par_take_from_overflow_list(size_t num,
return false;
} else if (_overflow_list != BUSY) {
// Try and grab the prefix
prefix = (oop)Atomic::xchg_ptr(BUSY, &_overflow_list);
prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list));
}
}
// If the list was found to be empty, or we spun long

View file

@ -2694,7 +2694,7 @@ public:
if (print_it) {
_out->print_cr(" "PTR_FORMAT"%s",
o, (over_tams) ? " >" : (marked) ? " M" : "");
(void *)o, (over_tams) ? " >" : (marked) ? " M" : "");
PrintReachableOopClosure oopCl(_out, _vo, _all);
o->oop_iterate_no_header(&oopCl);
}

View file

@ -4615,7 +4615,7 @@ bool G1ParScanThreadState::verify_ref(narrowOop* ref) const {
assert(!has_partial_array_mask(ref), err_msg("ref=" PTR_FORMAT, ref));
oop p = oopDesc::load_decode_heap_oop(ref);
assert(_g1h->is_in_g1_reserved(p),
err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, intptr_t(p)));
err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, (void *)p));
return true;
}
@ -4625,11 +4625,11 @@ bool G1ParScanThreadState::verify_ref(oop* ref) const {
// Must be in the collection set--it's already been copied.
oop p = clear_partial_array_mask(ref);
assert(_g1h->obj_in_cs(p),
err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, intptr_t(p)));
err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, (void *)p));
} else {
oop p = oopDesc::load_decode_heap_oop(ref);
assert(_g1h->is_in_g1_reserved(p),
err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, intptr_t(p)));
err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, (void *)p));
}
return true;
}

View file

@ -703,7 +703,7 @@ public:
if (_g1_committed.contains((HeapWord*) obj)) {
// no need to subtract the bottom of the heap from obj,
// _in_cset_fast_test is biased
uintx index = (uintx) obj >> HeapRegion::LogOfHRGrainBytes;
uintx index = cast_from_oop<uintx>(obj) >> HeapRegion::LogOfHRGrainBytes;
bool ret = _in_cset_fast_test[index];
// let's make sure the result is consistent with what the slower
// test returns

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -91,12 +91,12 @@ template <class T> inline bool has_partial_array_mask(T* ref) {
}
template <class T> inline T* set_partial_array_mask(T obj) {
assert(((uintptr_t)obj & G1_PARTIAL_ARRAY_MASK) == 0, "Information loss!");
return (T*) ((uintptr_t)obj | G1_PARTIAL_ARRAY_MASK);
assert(((uintptr_t)(void *)obj & G1_PARTIAL_ARRAY_MASK) == 0, "Information loss!");
return (T*) ((uintptr_t)(void *)obj | G1_PARTIAL_ARRAY_MASK);
}
template <class T> inline oop clear_partial_array_mask(T* ref) {
return oop((intptr_t)ref & ~G1_PARTIAL_ARRAY_MASK);
return cast_to_oop((intptr_t)ref & ~G1_PARTIAL_ARRAY_MASK);
}
class G1ParScanPartialArrayClosure : public G1ParClosureSuper {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -95,7 +95,7 @@ void
G1SATBCardTableLoggingModRefBS::write_ref_field_static(void* field,
oop new_val) {
uintptr_t field_uint = (uintptr_t)field;
uintptr_t new_val_uint = (uintptr_t)new_val;
uintptr_t new_val_uint = cast_from_oop<uintptr_t>(new_val);
uintptr_t comb = field_uint ^ new_val_uint;
comb = comb >> HeapRegion::LogOfHRGrainBytes;
if (comb == 0) return;

View file

@ -637,7 +637,7 @@ class VerifyStrongCodeRootOopClosure: public OopClosure {
gclog_or_tty->print_cr("Object "PTR_FORMAT" in region "
"["PTR_FORMAT", "PTR_FORMAT") is above "
"top "PTR_FORMAT,
obj, _hr->bottom(), _hr->end(), _hr->top());
(void *)obj, _hr->bottom(), _hr->end(), _hr->top());
_failures = true;
return;
}
@ -951,12 +951,12 @@ void HeapRegion::verify(VerifyOption vo,
Klass* klass = obj->klass();
if (!klass->is_metaspace_object()) {
gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" "
"not metadata", klass, obj);
"not metadata", klass, (void *)obj);
*failures = true;
return;
} else if (!klass->is_klass()) {
gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" "
"not a klass", klass, obj);
"not a klass", klass, (void *)obj);
*failures = true;
return;
} else {
@ -971,7 +971,7 @@ void HeapRegion::verify(VerifyOption vo,
}
}
} else {
gclog_or_tty->print_cr(PTR_FORMAT" no an oop", obj);
gclog_or_tty->print_cr(PTR_FORMAT" no an oop", (void *)obj);
*failures = true;
return;
}

View file

@ -91,8 +91,8 @@ protected:
gclog_or_tty->print_cr(" PRT::Add_reference_work(" PTR_FORMAT "->" PTR_FORMAT").",
from,
UseCompressedOops
? oopDesc::load_decode_heap_oop((narrowOop*)from)
: oopDesc::load_decode_heap_oop((oop*)from));
? (void *)oopDesc::load_decode_heap_oop((narrowOop*)from)
: (void *)oopDesc::load_decode_heap_oop((oop*)from));
}
HeapRegion* loc_hr = hr();
@ -403,8 +403,8 @@ void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, int tid) {
gclog_or_tty->print_cr("ORT::add_reference_work(" PTR_FORMAT "->" PTR_FORMAT ").",
from,
UseCompressedOops
? oopDesc::load_decode_heap_oop((narrowOop*)from)
: oopDesc::load_decode_heap_oop((oop*)from));
? (void *)oopDesc::load_decode_heap_oop((narrowOop*)from)
: (void *)oopDesc::load_decode_heap_oop((oop*)from));
}
int from_card = (int)(uintptr_t(from) >> CardTableModRefBS::card_shift);

View file

@ -1103,7 +1103,7 @@ void ParNewGeneration::waste_some_time() {
}
}
static const oop ClaimedForwardPtr = oop(0x4);
static const oop ClaimedForwardPtr = cast_to_oop<intptr_t>(0x4);
// Because of concurrency, there are times where an object for which
// "is_forwarded()" is true contains an "interim" forwarding pointer
@ -1226,7 +1226,7 @@ oop ParNewGeneration::copy_to_survivor_space_avoiding_promotion_undo(
if (TraceScavenge) {
gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
is_in_reserved(new_obj) ? "copying" : "tenuring",
new_obj->klass()->internal_name(), old, new_obj, new_obj->size());
new_obj->klass()->internal_name(), (void *)old, (void *)new_obj, new_obj->size());
}
#endif
@ -1347,7 +1347,7 @@ oop ParNewGeneration::copy_to_survivor_space_with_undo(
if (TraceScavenge) {
gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
is_in_reserved(new_obj) ? "copying" : "tenuring",
new_obj->klass()->internal_name(), old, new_obj, new_obj->size());
new_obj->klass()->internal_name(), (void *)old, (void *)new_obj, new_obj->size());
}
#endif
@ -1436,7 +1436,7 @@ bool ParNewGeneration::should_simulate_overflow() {
// (although some performance comparisons would be useful since
// single global lists have their own performance disadvantages
// as we were made painfully aware not long ago, see 6786503).
#define BUSY (oop(0x1aff1aff))
#define BUSY (cast_to_oop<intptr_t>(0x1aff1aff))
void ParNewGeneration::push_on_overflow_list(oop from_space_obj, ParScanThreadState* par_scan_state) {
assert(is_in_reserved(from_space_obj), "Should be from this generation");
if (ParGCUseLocalOverflow) {
@ -1512,7 +1512,7 @@ bool ParNewGeneration::take_from_overflow_list_work(ParScanThreadState* par_scan
if (_overflow_list == NULL) return false;
// Otherwise, there was something there; try claiming the list.
oop prefix = (oop)Atomic::xchg_ptr(BUSY, &_overflow_list);
oop prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list));
// Trim off a prefix of at most objsFromOverflow items
Thread* tid = Thread::current();
size_t spin_count = (size_t)ParallelGCThreads;
@ -1526,7 +1526,7 @@ bool ParNewGeneration::take_from_overflow_list_work(ParScanThreadState* par_scan
return false;
} else if (_overflow_list != BUSY) {
// try and grab the prefix
prefix = (oop)Atomic::xchg_ptr(BUSY, &_overflow_list);
prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list));
}
}
if (prefix == NULL || prefix == BUSY) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -84,7 +84,7 @@ inline void ParScanClosure::do_oop_work(T* p,
Space* sp = gch->space_containing(p);
oop obj = oop(sp->block_start(p));
assert((HeapWord*)obj < (HeapWord*)p, "Error");
tty->print_cr("Object: " PTR_FORMAT, obj);
tty->print_cr("Object: " PTR_FORMAT, (void *)obj);
tty->print_cr("-------");
obj->print();
tty->print_cr("-----");
@ -110,7 +110,7 @@ inline void ParScanClosure::do_oop_work(T* p,
if (TraceScavenge) {
gclog_or_tty->print_cr("{%s %s ( " PTR_FORMAT " ) " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
"forwarded ",
new_obj->klass()->internal_name(), p, obj, new_obj, new_obj->size());
new_obj->klass()->internal_name(), p, (void *)obj, (void *)new_obj, new_obj->size());
}
#endif

View file

@ -333,7 +333,7 @@ oop PSPromotionManager::oop_promotion_failed(oop obj, markOop obj_mark) {
gclog_or_tty->print_cr("{%s %s 0x%x (%d)}",
"promotion-failure",
obj->klass()->internal_name(),
obj, obj->size());
(void *)obj, obj->size());
}
#endif

View file

@ -126,7 +126,7 @@ class PSPromotionManager VALUE_OBJ_CLASS_SPEC {
oop* mask_chunked_array_oop(oop obj) {
assert(!is_oop_masked((oop*) obj), "invariant");
oop* ret = (oop*) ((uintptr_t)obj | PS_CHUNKED_ARRAY_OOP_MASK);
oop* ret = (oop*) (cast_from_oop<uintptr_t>(obj) | PS_CHUNKED_ARRAY_OOP_MASK);
assert(is_oop_masked(ret), "invariant");
return ret;
}

View file

@ -225,7 +225,7 @@ oop PSPromotionManager::copy_to_survivor_space(oop o) {
if (TraceScavenge) {
gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
PSScavenge::should_scavenge(&new_obj) ? "copying" : "tenuring",
new_obj->klass()->internal_name(), o, new_obj, new_obj->size());
new_obj->klass()->internal_name(), (void *)o, (void *)new_obj, new_obj->size());
}
#endif

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -81,7 +81,7 @@ inline void PSScavenge::copy_and_push_safe_barrier(PSPromotionManager* pm,
if (TraceScavenge && o->is_forwarded()) {
gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
"forwarding",
new_obj->klass()->internal_name(), o, new_obj, new_obj->size());
new_obj->klass()->internal_name(), (void *)o, (void *)new_obj, new_obj->size());
}
#endif