mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8013132: Add a flag to turn off the output of the verbose verification code
Reviewed-by: johnc, brutisso
This commit is contained in:
parent
19d99e3d92
commit
f0ae855b07
15 changed files with 49 additions and 61 deletions
|
@ -2444,8 +2444,7 @@ void CMSCollector::collect_in_foreground(bool clear_all_soft_refs) {
|
|||
// initial marking in checkpointRootsInitialWork has been completed
|
||||
if (VerifyDuringGC &&
|
||||
GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
|
||||
gclog_or_tty->print("Verify before initial mark: ");
|
||||
Universe::verify();
|
||||
Universe::verify("Verify before initial mark: ");
|
||||
}
|
||||
{
|
||||
bool res = markFromRoots(false);
|
||||
|
@ -2456,8 +2455,7 @@ void CMSCollector::collect_in_foreground(bool clear_all_soft_refs) {
|
|||
case FinalMarking:
|
||||
if (VerifyDuringGC &&
|
||||
GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
|
||||
gclog_or_tty->print("Verify before re-mark: ");
|
||||
Universe::verify();
|
||||
Universe::verify("Verify before re-mark: ");
|
||||
}
|
||||
checkpointRootsFinal(false, clear_all_soft_refs,
|
||||
init_mark_was_synchronous);
|
||||
|
@ -2468,8 +2466,7 @@ void CMSCollector::collect_in_foreground(bool clear_all_soft_refs) {
|
|||
// final marking in checkpointRootsFinal has been completed
|
||||
if (VerifyDuringGC &&
|
||||
GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
|
||||
gclog_or_tty->print("Verify before sweep: ");
|
||||
Universe::verify();
|
||||
Universe::verify("Verify before sweep: ");
|
||||
}
|
||||
sweep(false);
|
||||
assert(_collectorState == Resizing, "Incorrect state");
|
||||
|
@ -2484,8 +2481,7 @@ void CMSCollector::collect_in_foreground(bool clear_all_soft_refs) {
|
|||
// The heap has been resized.
|
||||
if (VerifyDuringGC &&
|
||||
GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
|
||||
gclog_or_tty->print("Verify before reset: ");
|
||||
Universe::verify();
|
||||
Universe::verify("Verify before reset: ");
|
||||
}
|
||||
reset(false);
|
||||
assert(_collectorState == Idling, "Collector state should "
|
||||
|
@ -2853,8 +2849,8 @@ class VerifyMarkedClosure: public BitMapClosure {
|
|||
bool failed() { return _failed; }
|
||||
};
|
||||
|
||||
bool CMSCollector::verify_after_remark() {
|
||||
gclog_or_tty->print(" [Verifying CMS Marking... ");
|
||||
bool CMSCollector::verify_after_remark(bool silent) {
|
||||
if (!silent) gclog_or_tty->print(" [Verifying CMS Marking... ");
|
||||
MutexLockerEx ml(verification_mark_bm()->lock(), Mutex::_no_safepoint_check_flag);
|
||||
static bool init = false;
|
||||
|
||||
|
@ -2915,7 +2911,7 @@ bool CMSCollector::verify_after_remark() {
|
|||
warning("Unrecognized value %d for CMSRemarkVerifyVariant",
|
||||
CMSRemarkVerifyVariant);
|
||||
}
|
||||
gclog_or_tty->print(" done] ");
|
||||
if (!silent) gclog_or_tty->print(" done] ");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -990,7 +990,7 @@ class CMSCollector: public CHeapObj<mtGC> {
|
|||
|
||||
// debugging
|
||||
void verify();
|
||||
bool verify_after_remark();
|
||||
bool verify_after_remark(bool silent = VerifySilently);
|
||||
void verify_ok_to_terminate() const PRODUCT_RETURN;
|
||||
void verify_work_stacks_empty() const PRODUCT_RETURN;
|
||||
void verify_overflow_empty() const PRODUCT_RETURN;
|
||||
|
|
|
@ -1273,10 +1273,9 @@ void ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) {
|
|||
|
||||
if (VerifyDuringGC) {
|
||||
HandleMark hm; // handle scope
|
||||
gclog_or_tty->print(" VerifyDuringGC:(before)");
|
||||
Universe::heap()->prepare_for_verify();
|
||||
Universe::verify(/* silent */ false,
|
||||
/* option */ VerifyOption_G1UsePrevMarking);
|
||||
Universe::verify(VerifyOption_G1UsePrevMarking,
|
||||
" VerifyDuringGC:(before)");
|
||||
}
|
||||
|
||||
G1CollectorPolicy* g1p = g1h->g1_policy();
|
||||
|
@ -1300,10 +1299,9 @@ void ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) {
|
|||
// Verify the heap w.r.t. the previous marking bitmap.
|
||||
if (VerifyDuringGC) {
|
||||
HandleMark hm; // handle scope
|
||||
gclog_or_tty->print(" VerifyDuringGC:(overflow)");
|
||||
Universe::heap()->prepare_for_verify();
|
||||
Universe::verify(/* silent */ false,
|
||||
/* option */ VerifyOption_G1UsePrevMarking);
|
||||
Universe::verify(VerifyOption_G1UsePrevMarking,
|
||||
" VerifyDuringGC:(overflow)");
|
||||
}
|
||||
|
||||
// Clear the marking state because we will be restarting
|
||||
|
@ -1323,10 +1321,9 @@ void ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) {
|
|||
|
||||
if (VerifyDuringGC) {
|
||||
HandleMark hm; // handle scope
|
||||
gclog_or_tty->print(" VerifyDuringGC:(after)");
|
||||
Universe::heap()->prepare_for_verify();
|
||||
Universe::verify(/* silent */ false,
|
||||
/* option */ VerifyOption_G1UseNextMarking);
|
||||
Universe::verify(VerifyOption_G1UseNextMarking,
|
||||
" VerifyDuringGC:(after)");
|
||||
}
|
||||
assert(!restart_for_overflow(), "sanity");
|
||||
// Completely reset the marking state since marking completed
|
||||
|
@ -1972,10 +1969,9 @@ void ConcurrentMark::cleanup() {
|
|||
|
||||
if (VerifyDuringGC) {
|
||||
HandleMark hm; // handle scope
|
||||
gclog_or_tty->print(" VerifyDuringGC:(before)");
|
||||
Universe::heap()->prepare_for_verify();
|
||||
Universe::verify(/* silent */ false,
|
||||
/* option */ VerifyOption_G1UsePrevMarking);
|
||||
Universe::verify(VerifyOption_G1UsePrevMarking,
|
||||
" VerifyDuringGC:(before)");
|
||||
}
|
||||
|
||||
G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy();
|
||||
|
@ -2127,10 +2123,9 @@ void ConcurrentMark::cleanup() {
|
|||
|
||||
if (VerifyDuringGC) {
|
||||
HandleMark hm; // handle scope
|
||||
gclog_or_tty->print(" VerifyDuringGC:(after)");
|
||||
Universe::heap()->prepare_for_verify();
|
||||
Universe::verify(/* silent */ false,
|
||||
/* option */ VerifyOption_G1UsePrevMarking);
|
||||
Universe::verify(VerifyOption_G1UsePrevMarking,
|
||||
" VerifyDuringGC:(after)");
|
||||
}
|
||||
|
||||
g1h->verify_region_sets_optional();
|
||||
|
|
|
@ -1271,9 +1271,8 @@ double G1CollectedHeap::verify(bool guard, const char* msg) {
|
|||
if (guard && total_collections() >= VerifyGCStartAt) {
|
||||
double verify_start = os::elapsedTime();
|
||||
HandleMark hm; // Discard invalid handles created during verification
|
||||
gclog_or_tty->print(msg);
|
||||
prepare_for_verify();
|
||||
Universe::verify(false /* silent */, VerifyOption_G1UsePrevMarking);
|
||||
Universe::verify(VerifyOption_G1UsePrevMarking, msg);
|
||||
verify_time_ms = (os::elapsedTime() - verify_start) * 1000;
|
||||
}
|
||||
|
||||
|
|
|
@ -170,7 +170,6 @@ void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading,
|
|||
if (VerifyDuringGC) {
|
||||
HandleMark hm; // handle scope
|
||||
COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact);
|
||||
gclog_or_tty->print(" VerifyDuringGC:(full)[Verifying ");
|
||||
Universe::heap()->prepare_for_verify();
|
||||
// Note: we can verify only the heap here. When an object is
|
||||
// marked, the previous value of the mark word (including
|
||||
|
@ -182,12 +181,14 @@ void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading,
|
|||
// fail. At the end of the GC, the orginal mark word values
|
||||
// (including hash values) are restored to the appropriate
|
||||
// objects.
|
||||
Universe::heap()->verify(/* silent */ false,
|
||||
/* option */ VerifyOption_G1UseMarkWord);
|
||||
|
||||
G1CollectedHeap* g1h = G1CollectedHeap::heap();
|
||||
if (!VerifySilently) {
|
||||
gclog_or_tty->print(" VerifyDuringGC:(full)[Verifying ");
|
||||
}
|
||||
Universe::heap()->verify(VerifySilently, VerifyOption_G1UseMarkWord);
|
||||
if (!VerifySilently) {
|
||||
gclog_or_tty->print_cr("]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class G1PrepareCompactClosure: public HeapRegionClosure {
|
||||
|
|
|
@ -138,8 +138,7 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
|
|||
|
||||
if (VerifyBeforeGC && heap->total_collections() >= VerifyGCStartAt) {
|
||||
HandleMark hm; // Discard invalid handles created during verification
|
||||
gclog_or_tty->print(" VerifyBeforeGC:");
|
||||
Universe::verify();
|
||||
Universe::verify(" VerifyBeforeGC:");
|
||||
}
|
||||
|
||||
// Verify object start arrays
|
||||
|
@ -341,8 +340,7 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
|
|||
|
||||
if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
|
||||
HandleMark hm; // Discard invalid handles created during verification
|
||||
gclog_or_tty->print(" VerifyAfterGC:");
|
||||
Universe::verify();
|
||||
Universe::verify(" VerifyAfterGC:");
|
||||
}
|
||||
|
||||
// Re-verify object start arrays
|
||||
|
|
|
@ -966,8 +966,7 @@ void PSParallelCompact::pre_compact(PreGCValues* pre_gc_values)
|
|||
|
||||
if (VerifyBeforeGC && heap->total_collections() >= VerifyGCStartAt) {
|
||||
HandleMark hm; // Discard invalid handles created during verification
|
||||
gclog_or_tty->print(" VerifyBeforeGC:");
|
||||
Universe::verify();
|
||||
Universe::verify(" VerifyBeforeGC:");
|
||||
}
|
||||
|
||||
// Verify object start arrays
|
||||
|
@ -2168,8 +2167,7 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
|
|||
|
||||
if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
|
||||
HandleMark hm; // Discard invalid handles created during verification
|
||||
gclog_or_tty->print(" VerifyAfterGC:");
|
||||
Universe::verify();
|
||||
Universe::verify(" VerifyAfterGC:");
|
||||
}
|
||||
|
||||
// Re-verify object start arrays
|
||||
|
|
|
@ -314,8 +314,7 @@ bool PSScavenge::invoke_no_policy() {
|
|||
|
||||
if (VerifyBeforeGC && heap->total_collections() >= VerifyGCStartAt) {
|
||||
HandleMark hm; // Discard invalid handles created during verification
|
||||
gclog_or_tty->print(" VerifyBeforeGC:");
|
||||
Universe::verify();
|
||||
Universe::verify(" VerifyBeforeGC:");
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -638,8 +637,7 @@ bool PSScavenge::invoke_no_policy() {
|
|||
|
||||
if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
|
||||
HandleMark hm; // Discard invalid handles created during verification
|
||||
gclog_or_tty->print(" VerifyAfterGC:");
|
||||
Universe::verify();
|
||||
Universe::verify(" VerifyAfterGC:");
|
||||
}
|
||||
|
||||
heap->print_heap_after_gc();
|
||||
|
|
|
@ -447,8 +447,7 @@ void GenCollectedHeap::do_collection(bool full,
|
|||
prepare_for_verify();
|
||||
prepared_for_verification = true;
|
||||
}
|
||||
gclog_or_tty->print(" VerifyBeforeGC:");
|
||||
Universe::verify();
|
||||
Universe::verify(" VerifyBeforeGC:");
|
||||
}
|
||||
COMPILER2_PRESENT(DerivedPointerTable::clear());
|
||||
|
||||
|
@ -519,8 +518,7 @@ void GenCollectedHeap::do_collection(bool full,
|
|||
if (VerifyAfterGC && i >= VerifyGCLevel &&
|
||||
total_collections() >= VerifyGCStartAt) {
|
||||
HandleMark hm; // Discard invalid handles created during verification
|
||||
gclog_or_tty->print(" VerifyAfterGC:");
|
||||
Universe::verify();
|
||||
Universe::verify(" VerifyAfterGC:");
|
||||
}
|
||||
|
||||
if (PrintGCDetails) {
|
||||
|
|
|
@ -1270,7 +1270,7 @@ void Universe::print_heap_after_gc(outputStream* st, bool ignore_extended) {
|
|||
st->print_cr("}");
|
||||
}
|
||||
|
||||
void Universe::verify(bool silent, VerifyOption option) {
|
||||
void Universe::verify(VerifyOption option, const char* prefix, bool silent) {
|
||||
// The use of _verify_in_progress is a temporary work around for
|
||||
// 6320749. Don't bother with a creating a class to set and clear
|
||||
// it since it is only used in this method and the control flow is
|
||||
|
@ -1287,11 +1287,12 @@ void Universe::verify(bool silent, VerifyOption option) {
|
|||
HandleMark hm; // Handles created during verification can be zapped
|
||||
_verify_count++;
|
||||
|
||||
if (!silent) gclog_or_tty->print(prefix);
|
||||
if (!silent) gclog_or_tty->print("[Verifying ");
|
||||
if (!silent) gclog_or_tty->print("threads ");
|
||||
Threads::verify();
|
||||
if (!silent) gclog_or_tty->print("heap ");
|
||||
heap()->verify(silent, option);
|
||||
|
||||
if (!silent) gclog_or_tty->print("syms ");
|
||||
SymbolTable::verify();
|
||||
if (!silent) gclog_or_tty->print("strs ");
|
||||
|
|
|
@ -445,12 +445,12 @@ class Universe: AllStatic {
|
|||
|
||||
// Debugging
|
||||
static bool verify_in_progress() { return _verify_in_progress; }
|
||||
static void verify(bool silent, VerifyOption option);
|
||||
static void verify(bool silent) {
|
||||
verify(silent, VerifyOption_Default /* option */);
|
||||
static void verify(VerifyOption option, const char* prefix, bool silent = VerifySilently);
|
||||
static void verify(const char* prefix, bool silent = VerifySilently) {
|
||||
verify(VerifyOption_Default, prefix, silent);
|
||||
}
|
||||
static void verify() {
|
||||
verify(false /* silent */);
|
||||
static void verify(bool silent = VerifySilently) {
|
||||
verify("", silent);
|
||||
}
|
||||
|
||||
static int verify_count() { return _verify_count; }
|
||||
|
|
|
@ -2123,6 +2123,9 @@ class CommandLineFlags {
|
|||
product(intx, PrefetchFieldsAhead, -1, \
|
||||
"How many fields ahead to prefetch in oop scan (<= 0 means off)") \
|
||||
\
|
||||
diagnostic(bool, VerifySilently, false, \
|
||||
"Don't print print the verification progress") \
|
||||
\
|
||||
diagnostic(bool, VerifyDuringStartup, false, \
|
||||
"Verify memory system before executing any Java code " \
|
||||
"during VM initialization") \
|
||||
|
|
|
@ -3447,7 +3447,8 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
|
|||
|
||||
assert (Universe::is_fully_initialized(), "not initialized");
|
||||
if (VerifyDuringStartup) {
|
||||
VM_Verify verify_op(false /* silent */); // make sure we're starting with a clean slate
|
||||
// Make sure we're starting with a clean slate.
|
||||
VM_Verify verify_op;
|
||||
VMThread::execute(&verify_op);
|
||||
}
|
||||
|
||||
|
|
|
@ -293,7 +293,7 @@ void VMThread::run() {
|
|||
os::check_heap();
|
||||
// Silent verification so as not to pollute normal output,
|
||||
// unless we really asked for it.
|
||||
Universe::verify(!(PrintGCDetails || Verbose));
|
||||
Universe::verify(!(PrintGCDetails || Verbose) || VerifySilently);
|
||||
}
|
||||
|
||||
CompileBroker::set_should_block();
|
||||
|
|
|
@ -302,7 +302,7 @@ class VM_Verify: public VM_Operation {
|
|||
private:
|
||||
bool _silent;
|
||||
public:
|
||||
VM_Verify(bool silent) : _silent(silent) {}
|
||||
VM_Verify(bool silent = VerifySilently) : _silent(silent) {}
|
||||
VMOp_Type type() const { return VMOp_Verify; }
|
||||
void doit();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue