OpenJDK / zgc / zgc
changeset 40667:f9cf2db7f59f
8163146: Remove os::check_heap on Windows
Reviewed-by: gtriantafill, coleenp, stuefe
author | ctornqvi |
---|---|
date | Tue, 23 Aug 2016 21:49:33 -0400 |
parents | 83beca9dbc5f |
children | 60d799be5dda |
files | hotspot/src/os/aix/vm/os_aix.cpp hotspot/src/os/bsd/vm/os_bsd.cpp hotspot/src/os/linux/vm/os_linux.cpp hotspot/src/os/solaris/vm/os_solaris.cpp hotspot/src/os/windows/vm/os_windows.cpp hotspot/src/share/vm/memory/universe.cpp hotspot/src/share/vm/memory/universe.hpp hotspot/src/share/vm/runtime/globals.hpp hotspot/src/share/vm/runtime/os.cpp hotspot/src/share/vm/runtime/os.hpp hotspot/src/share/vm/runtime/vmThread.cpp hotspot/test/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java |
diffstat | 12 files changed, 4 insertions(+), 113 deletions(-) [+] |
line wrap: on
line diff
--- a/hotspot/src/os/aix/vm/os_aix.cpp Tue Aug 23 22:51:24 2016 +0200 +++ b/hotspot/src/os/aix/vm/os_aix.cpp Tue Aug 23 21:49:33 2016 -0400 @@ -3800,10 +3800,6 @@ return ::stat(pathbuf, sbuf); } -bool os::check_heap(bool force) { - return true; -} - // Is a (classpath) directory empty? bool os::dir_is_empty(const char* path) { DIR *dir = NULL;
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp Tue Aug 23 22:51:24 2016 +0200 +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp Tue Aug 23 21:49:33 2016 -0400 @@ -3780,11 +3780,6 @@ return diff; } - -bool os::check_heap(bool force) { - return true; -} - // Is a (classpath) directory empty? bool os::dir_is_empty(const char* path) { DIR *dir = NULL;
--- a/hotspot/src/os/linux/vm/os_linux.cpp Tue Aug 23 22:51:24 2016 +0200 +++ b/hotspot/src/os/linux/vm/os_linux.cpp Tue Aug 23 21:49:33 2016 -0400 @@ -5174,10 +5174,6 @@ return ::stat(pathbuf, sbuf); } -bool os::check_heap(bool force) { - return true; -} - // Is a (classpath) directory empty? bool os::dir_is_empty(const char* path) { DIR *dir = NULL;
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp Tue Aug 23 22:51:24 2016 +0200 +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Tue Aug 23 21:49:33 2016 -0400 @@ -4589,10 +4589,6 @@ } } -// OS interface. - -bool os::check_heap(bool force) { return true; } - // Is a (classpath) directory empty? bool os::dir_is_empty(const char* path) { DIR *dir = NULL;
--- a/hotspot/src/os/windows/vm/os_windows.cpp Tue Aug 23 22:51:24 2016 +0200 +++ b/hotspot/src/os/windows/vm/os_windows.cpp Tue Aug 23 21:49:33 2016 -0400 @@ -5258,75 +5258,6 @@ } } -//-------------------------------------------------------------------------------------------------- -// Non-product code - -static int mallocDebugIntervalCounter = 0; -static int mallocDebugCounter = 0; - -// For debugging possible bugs inside HeapWalk (a ring buffer) -#define SAVE_COUNT 8 -static PROCESS_HEAP_ENTRY saved_heap_entries[SAVE_COUNT]; -static int saved_heap_entry_index; - -bool os::check_heap(bool force) { - if (++mallocDebugCounter < MallocVerifyStart && !force) return true; - if (++mallocDebugIntervalCounter >= MallocVerifyInterval || force) { - // Note: HeapValidate executes two hardware breakpoints when it finds something - // wrong; at these points, eax contains the address of the offending block (I think). - // To get to the exlicit error message(s) below, just continue twice. - // - // Note: we want to check the CRT heap, which is not necessarily located in the - // process default heap. - HANDLE heap = (HANDLE) _get_heap_handle(); - if (!heap) { - return true; - } - - // If we fail to lock the heap, then gflags.exe has been used - // or some other special heap flag has been set that prevents - // locking. We don't try to walk a heap we can't lock. - if (HeapLock(heap) != 0) { - PROCESS_HEAP_ENTRY phe; - phe.lpData = NULL; - memset(saved_heap_entries, 0, sizeof(saved_heap_entries)); - saved_heap_entry_index = 0; - int count = 0; - - while (HeapWalk(heap, &phe) != 0) { - count ++; - if ((phe.wFlags & PROCESS_HEAP_ENTRY_BUSY) && - !HeapValidate(heap, 0, phe.lpData)) { - tty->print_cr("C heap has been corrupted (time: %d allocations)", mallocDebugCounter); - tty->print_cr("corrupted block near address %#x, length %d, count %d", phe.lpData, phe.cbData, count); - HeapUnlock(heap); - fatal("corrupted C heap"); - } else { - // Save previous seen entries in a ring buffer. We have seen strange - // heap corruption fatal errors that produced mdmp files, but when we load - // these mdmp files in WinDBG, "!heap -triage" shows no error. - // We can examine the saved_heap_entries[] array in the mdmp file to - // diagnose such seemingly spurious errors reported by HeapWalk. - saved_heap_entries[saved_heap_entry_index++] = phe; - if (saved_heap_entry_index >= SAVE_COUNT) { - saved_heap_entry_index = 0; - } - } - } - DWORD err = GetLastError(); - if (err != ERROR_NO_MORE_ITEMS && err != ERROR_CALL_NOT_IMPLEMENTED && - (err == ERROR_INVALID_FUNCTION && phe.lpData != NULL)) { - HeapUnlock(heap); - fatal("heap walk aborted with error %d", err); - } - HeapUnlock(heap); - } - mallocDebugIntervalCounter = 0; - } - return true; -} - - bool os::find(address addr, outputStream* st) { int offset = -1; bool result = false;
--- a/hotspot/src/share/vm/memory/universe.cpp Tue Aug 23 22:51:24 2016 +0200 +++ b/hotspot/src/share/vm/memory/universe.cpp Tue Aug 23 21:49:33 2016 -0400 @@ -1129,8 +1129,6 @@ verify_flags |= Verify_MetaspaceAux; } else if (strcmp(token, "jni_handles") == 0) { verify_flags |= Verify_JNIHandles; - } else if (strcmp(token, "c-heap") == 0) { - verify_flags |= Verify_CHeap; } else if (strcmp(token, "codecache_oops") == 0) { verify_flags |= Verify_CodeCacheOops; } else { @@ -1208,10 +1206,6 @@ log_debug(gc, verify)("JNIHandles"); JNIHandles::verify(); } - if (should_verify_subset(Verify_CHeap)) { - log_debug(gc, verify)("C-heap"); - os::check_heap(); - } if (should_verify_subset(Verify_CodeCacheOops)) { log_debug(gc, verify)("CodeCache Oops"); CodeCache::verify_oops();
--- a/hotspot/src/share/vm/memory/universe.hpp Tue Aug 23 22:51:24 2016 +0200 +++ b/hotspot/src/share/vm/memory/universe.hpp Tue Aug 23 21:49:33 2016 -0400 @@ -480,8 +480,7 @@ Verify_ClassLoaderDataGraph = 64, Verify_MetaspaceAux = 128, Verify_JNIHandles = 256, - Verify_CHeap = 512, - Verify_CodeCacheOops = 1024, + Verify_CodeCacheOops = 512, Verify_All = -1 }; static void initialize_verify_flags();
--- a/hotspot/src/share/vm/runtime/globals.hpp Tue Aug 23 22:51:24 2016 +0200 +++ b/hotspot/src/share/vm/runtime/globals.hpp Tue Aug 23 21:49:33 2016 -0400 @@ -2242,7 +2242,7 @@ "in a comma separated string. Sub-systems are: " \ "threads, heap, symbol_table, string_table, codecache, " \ "dictionary, classloader_data_graph, metaspace, jni_handles, " \ - "c-heap, codecache_oops") \ + "codecache_oops") \ \ diagnostic(bool, GCParallelVerificationEnabled, true, \ "Enable parallel memory system verification") \ @@ -3008,16 +3008,6 @@ notproduct(intx, ZombieALotInterval, 5, \ "Number of exits until ZombieALot kicks in") \ \ - diagnostic(intx, MallocVerifyInterval, 0, \ - "If non-zero, verify C heap after every N calls to " \ - "malloc/realloc/free") \ - range(0, max_intx) \ - \ - diagnostic(intx, MallocVerifyStart, 0, \ - "If non-zero, start verifying C heap after Nth call to " \ - "malloc/realloc/free") \ - range(0, max_intx) \ - \ diagnostic(uintx, MallocMaxTestWords, 0, \ "If non-zero, maximum number of words that malloc/realloc can " \ "allocate (for testing only)") \
--- a/hotspot/src/share/vm/runtime/os.cpp Tue Aug 23 22:51:24 2016 +0200 +++ b/hotspot/src/share/vm/runtime/os.cpp Tue Aug 23 21:49:33 2016 -0400 @@ -596,8 +596,6 @@ } #endif - NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap()); - // For the test flag -XX:MallocMaxTestWords if (has_reached_max_malloc_test_peak(size)) { return NULL; @@ -658,7 +656,6 @@ // NMT support void* membase = MemTracker::malloc_base(memblock); verify_memory(membase); - NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap()); if (size == 0) { return NULL; } @@ -695,7 +692,6 @@ } void* membase = MemTracker::record_free(memblock); verify_memory(membase); - NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap()); GuardedMemory guarded(membase); size_t size = guarded.get_user_size();
--- a/hotspot/src/share/vm/runtime/os.hpp Tue Aug 23 22:51:24 2016 +0200 +++ b/hotspot/src/share/vm/runtime/os.hpp Tue Aug 23 21:49:33 2016 -0400 @@ -709,7 +709,6 @@ static void* realloc (void *memblock, size_t size, MEMFLAGS flag); static void free (void *memblock); - static bool check_heap(bool force = false); // verify C heap integrity static char* strdup(const char *, MEMFLAGS flags = mtInternal); // Like strdup // Like strdup, but exit VM when strdup() returns NULL static char* strdup_check_oom(const char*, MEMFLAGS flags = mtInternal);
--- a/hotspot/src/share/vm/runtime/vmThread.cpp Tue Aug 23 22:51:24 2016 +0200 +++ b/hotspot/src/share/vm/runtime/vmThread.cpp Tue Aug 23 21:49:33 2016 -0400 @@ -279,7 +279,6 @@ HandleMark hm(VMThread::vm_thread()); // Among other things, this ensures that Eden top is correct. Universe::heap()->prepare_for_verify(); - os::check_heap(); // Silent verification so as not to pollute normal output, // unless we really asked for it. Universe::verify();
--- a/hotspot/test/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java Tue Aug 23 22:51:24 2016 +0200 +++ b/hotspot/test/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java Tue Aug 23 21:49:33 2016 -0400 @@ -43,12 +43,12 @@ public class TestVerifyBeforeAndAfterGCFlags { - // VerifyBeforeGC:[Verifying threads heap tenured eden syms strs zone dict metaspace chunks hand C-heap code cache ] + // VerifyBeforeGC:[Verifying threads heap tenured eden syms strs zone dict metaspace chunks hand code cache ] public static final String VERIFY_BEFORE_GC_PATTERN = "Verifying Before GC"; // VerifyBeforeGC: VerifyBeforeGC: VerifyBeforeGC: public static final String VERIFY_BEFORE_GC_CORRUPTED_PATTERN = "VerifyBeforeGC:(?!\\[Verifying[^]]+\\])"; - // VerifyAfterGC:[Verifying threads heap tenured eden syms strs zone dict metaspace chunks hand C-heap code cache ] + // VerifyAfterGC:[Verifying threads heap tenured eden syms strs zone dict metaspace chunks hand code cache ] public static final String VERIFY_AFTER_GC_PATTERN = "Verifying After GC"; // VerifyAfterGC: VerifyAfterGC: VerifyAfterGC: public static final String VERIFY_AFTER_GC_CORRUPTED_PATTERN = "VerifyAfterGC:(?!\\[Verifying[^]]+\\])";