8163146: Remove os::check_heap on Windows
Reviewed-by: gtriantafill, coleenp, stuefe
This commit is contained in:
parent
09b2ad770b
commit
f2dafaefc7
@ -3800,10 +3800,6 @@ int os::stat(const char *path, struct stat *sbuf) {
|
||||
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;
|
||||
|
@ -3780,11 +3780,6 @@ int os::compare_file_modified_times(const char* file1, const char* file2) {
|
||||
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;
|
||||
|
@ -5174,10 +5174,6 @@ int os::stat(const char *path, struct stat *sbuf) {
|
||||
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;
|
||||
|
@ -4589,10 +4589,6 @@ void os::make_polling_page_readable(void) {
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
@ -5258,75 +5258,6 @@ int os::fork_and_exec(char* cmd) {
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// 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;
|
||||
|
@ -1129,8 +1129,6 @@ void Universe::initialize_verify_flags() {
|
||||
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 @@ void Universe::verify(VerifyOption option, const char* prefix) {
|
||||
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();
|
||||
|
@ -480,8 +480,7 @@ class Universe: AllStatic {
|
||||
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();
|
||||
|
@ -2242,7 +2242,7 @@ public:
|
||||
"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 @@ public:
|
||||
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)") \
|
||||
|
@ -596,8 +596,6 @@ void* os::malloc(size_t size, MEMFLAGS memflags, const NativeCallStack& stack) {
|
||||
}
|
||||
#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 @@ void* os::realloc(void *memblock, size_t size, MEMFLAGS memflags, const NativeCa
|
||||
// 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 os::free(void *memblock) {
|
||||
}
|
||||
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();
|
||||
|
@ -709,7 +709,6 @@ class os: AllStatic {
|
||||
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);
|
||||
|
@ -279,7 +279,6 @@ void VMThread::run() {
|
||||
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();
|
||||
|
@ -43,12 +43,12 @@ import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
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[^]]+\\])";
|
||||
|
Loading…
x
Reference in New Issue
Block a user