diff --git a/src/share/vm/classfile/systemDictionary.cpp b/src/share/vm/classfile/systemDictionary.cpp index 42571b68a4bea66efa9e6a522fe8c2591de73a51..39850490f5686b3aac741d0dae6b15d3a1011709 100644 --- a/src/share/vm/classfile/systemDictionary.cpp +++ b/src/share/vm/classfile/systemDictionary.cpp @@ -1592,9 +1592,10 @@ Symbol* SystemDictionary::find_placeholder(Symbol* class_name, // Used for assertions and verification only Klass* SystemDictionary::find_class(Symbol* class_name, ClassLoaderData* loader_data) { #ifndef ASSERT - guarantee(VerifyBeforeGC || - VerifyDuringGC || - VerifyBeforeExit || + guarantee(VerifyBeforeGC || + VerifyDuringGC || + VerifyBeforeExit || + VerifyDuringStartup || VerifyAfterGC, "too expensive"); #endif assert_locked_or_safepoint(SystemDictionary_lock); diff --git a/src/share/vm/memory/genCollectedHeap.cpp b/src/share/vm/memory/genCollectedHeap.cpp index 6b7402c8203daba5c52213a770ef155ddd2ae9a8..60f577a2cea22f147896db5cfc659f4723000cd9 100644 --- a/src/share/vm/memory/genCollectedHeap.cpp +++ b/src/share/vm/memory/genCollectedHeap.cpp @@ -819,12 +819,13 @@ bool GenCollectedHeap::is_in_young(oop p) { // Returns "TRUE" iff "p" points into the committed areas of the heap. bool GenCollectedHeap::is_in(const void* p) const { #ifndef ASSERT - guarantee(VerifyBeforeGC || - VerifyDuringGC || - VerifyBeforeExit || - PrintAssembly || - tty->count() != 0 || // already printing - VerifyAfterGC || + guarantee(VerifyBeforeGC || + VerifyDuringGC || + VerifyBeforeExit || + VerifyDuringStartup || + PrintAssembly || + tty->count() != 0 || // already printing + VerifyAfterGC || VMError::fatal_error_in_progress(), "too expensive"); #endif diff --git a/src/share/vm/runtime/arguments.cpp b/src/share/vm/runtime/arguments.cpp index c66c73ed28c0e0b5f88a81f436b48b7ec230e893..17ef8b5afd533c388597925320f97a869e7ff13e 100644 --- a/src/share/vm/runtime/arguments.cpp +++ b/src/share/vm/runtime/arguments.cpp @@ -2006,11 +2006,12 @@ bool Arguments::check_vm_args_consistency() { // than just disable the lock verification. This will be fixed under // bug 4788986. if (UseConcMarkSweepGC && FLSVerifyAllHeapReferences) { - if (VerifyGCStartAt == 0) { + if (VerifyDuringStartup) { warning("Heap verification at start-up disabled " "(due to current incompatibility with FLSVerifyAllHeapReferences)"); - VerifyGCStartAt = 1; // Disable verification at start-up + VerifyDuringStartup = false; // Disable verification at start-up } + if (VerifyBeforeExit) { warning("Heap verification at shutdown disabled " "(due to current incompatibility with FLSVerifyAllHeapReferences)"); diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp index 5f1e0c646ccc38816fe4eefa5de3228d026bb7f8..49f734ab97c2dfee5a76da728cae4db293c33afe 100644 --- a/src/share/vm/runtime/globals.hpp +++ b/src/share/vm/runtime/globals.hpp @@ -2123,6 +2123,10 @@ class CommandLineFlags { product(intx, PrefetchFieldsAhead, -1, \ "How many fields ahead to prefetch in oop scan (<= 0 means off)") \ \ + diagnostic(bool, VerifyDuringStartup, false, \ + "Verify memory system before executing any Java code " \ + "during VM initialization") \ + \ diagnostic(bool, VerifyBeforeExit, trueInDebug, \ "Verify system before exiting") \ \ diff --git a/src/share/vm/runtime/thread.cpp b/src/share/vm/runtime/thread.cpp index 577901a2861ca9bdce490db4f3d9bf4172cac3e2..cf0297de0992a5f5a9c91c327c03c60daf827dd9 100644 --- a/src/share/vm/runtime/thread.cpp +++ b/src/share/vm/runtime/thread.cpp @@ -3446,9 +3446,9 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { } assert (Universe::is_fully_initialized(), "not initialized"); - if (VerifyBeforeGC && VerifyGCStartAt == 0) { - Universe::heap()->prepare_for_verify(); - Universe::verify(); // make sure we're starting with a clean slate + if (VerifyDuringStartup) { + VM_Verify verify_op(false /* silent */); // make sure we're starting with a clean slate + VMThread::execute(&verify_op); } EXCEPTION_MARK; diff --git a/src/share/vm/runtime/vm_operations.cpp b/src/share/vm/runtime/vm_operations.cpp index 99e367cdf1a3a1fe7e7a89017a383b0ce61c3e8d..53ea0bd98523973a54f1ea30e2131a06f5805277 100644 --- a/src/share/vm/runtime/vm_operations.cpp +++ b/src/share/vm/runtime/vm_operations.cpp @@ -175,7 +175,8 @@ void VM_HandleFullCodeCache::doit() { } void VM_Verify::doit() { - Universe::verify(); + Universe::heap()->prepare_for_verify(); + Universe::verify(_silent); } bool VM_PrintThreads::doit_prologue() { diff --git a/src/share/vm/runtime/vm_operations.hpp b/src/share/vm/runtime/vm_operations.hpp index ec3e851996887d6290f19f15a9ab8deac8ed258c..c1fc53607c02fc9c0271bae1dbfd3755715bdde5 100644 --- a/src/share/vm/runtime/vm_operations.hpp +++ b/src/share/vm/runtime/vm_operations.hpp @@ -300,9 +300,9 @@ class VM_UnlinkSymbols: public VM_Operation { class VM_Verify: public VM_Operation { private: - KlassHandle _dependee; + bool _silent; public: - VM_Verify() {} + VM_Verify(bool silent) : _silent(silent) {} VMOp_Type type() const { return VMOp_Verify; } void doit(); }; diff --git a/test/gc/TestVerifyBeforeGCDuringStartup.java b/test/gc/TestVerifyDuringStartup.java similarity index 86% rename from test/gc/TestVerifyBeforeGCDuringStartup.java rename to test/gc/TestVerifyDuringStartup.java index 109e45e4bd9fe3fb9c0e843a4a348861c96525c1..f0796f35946db510f485b6ba42d7dd342f94fb14 100644 --- a/test/gc/TestVerifyBeforeGCDuringStartup.java +++ b/test/gc/TestVerifyDuringStartup.java @@ -21,23 +21,23 @@ * questions. */ -/* @test TestVerifyBeforeGCDuringStartup.java +/* @test TestVerifyDuringStartup.java * @key gc * @bug 8010463 - * @summary Simple test run with -XX:+VerifyBeforeGC -XX:-UseTLAB to verify 8010463 + * @summary Simple test run with -XX:+VerifyDuringStartup -XX:-UseTLAB to verify 8010463 * @library /testlibrary */ import com.oracle.java.testlibrary.OutputAnalyzer; import com.oracle.java.testlibrary.ProcessTools; -public class TestVerifyBeforeGCDuringStartup { +public class TestVerifyDuringStartup { public static void main(String args[]) throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(System.getProperty("test.vm.opts"), "-XX:-UseTLAB", "-XX:+UnlockDiagnosticVMOptions", - "-XX:+VerifyBeforeGC", "-version"); + "-XX:+VerifyDuringStartup", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("[Verifying"); output.shouldHaveExitValue(0);