8222558: Rework ResolvedMethodTable verification
Reviewed-by: coleenp
This commit is contained in:
parent
733d251078
commit
3e581f13a0
@ -1151,6 +1151,8 @@ void Universe::initialize_verify_flags() {
|
|||||||
verify_flags |= Verify_JNIHandles;
|
verify_flags |= Verify_JNIHandles;
|
||||||
} else if (strcmp(token, "codecache_oops") == 0) {
|
} else if (strcmp(token, "codecache_oops") == 0) {
|
||||||
verify_flags |= Verify_CodeCacheOops;
|
verify_flags |= Verify_CodeCacheOops;
|
||||||
|
} else if (strcmp(token, "resolved_method_table") == 0) {
|
||||||
|
verify_flags |= Verify_ResolvedMethodTable;
|
||||||
} else {
|
} else {
|
||||||
vm_exit_during_initialization(err_msg("VerifySubSet: \'%s\' memory sub-system is unknown, please correct it", token));
|
vm_exit_during_initialization(err_msg("VerifySubSet: \'%s\' memory sub-system is unknown, please correct it", token));
|
||||||
}
|
}
|
||||||
@ -1230,6 +1232,10 @@ void Universe::verify(VerifyOption option, const char* prefix) {
|
|||||||
log_debug(gc, verify)("CodeCache Oops");
|
log_debug(gc, verify)("CodeCache Oops");
|
||||||
CodeCache::verify_oops();
|
CodeCache::verify_oops();
|
||||||
}
|
}
|
||||||
|
if (should_verify_subset(Verify_ResolvedMethodTable)) {
|
||||||
|
log_debug(gc, verify)("ResolvedMethodTable Oops");
|
||||||
|
ResolvedMethodTable::verify();
|
||||||
|
}
|
||||||
|
|
||||||
_verify_in_progress = false;
|
_verify_in_progress = false;
|
||||||
}
|
}
|
||||||
|
@ -478,6 +478,7 @@ class Universe: AllStatic {
|
|||||||
Verify_MetaspaceUtils = 128,
|
Verify_MetaspaceUtils = 128,
|
||||||
Verify_JNIHandles = 256,
|
Verify_JNIHandles = 256,
|
||||||
Verify_CodeCacheOops = 512,
|
Verify_CodeCacheOops = 512,
|
||||||
|
Verify_ResolvedMethodTable = 1024,
|
||||||
Verify_All = -1
|
Verify_All = -1
|
||||||
};
|
};
|
||||||
static void initialize_verify_flags();
|
static void initialize_verify_flags();
|
||||||
|
@ -346,16 +346,6 @@ void ResolvedMethodTable::inc_dead_counter(size_t ndead) {
|
|||||||
// cleaning. Note it might trigger a resize instead.
|
// cleaning. Note it might trigger a resize instead.
|
||||||
void ResolvedMethodTable::finish_dead_counter() {
|
void ResolvedMethodTable::finish_dead_counter() {
|
||||||
check_concurrent_work();
|
check_concurrent_work();
|
||||||
|
|
||||||
#ifdef ASSERT
|
|
||||||
if (SafepointSynchronize::is_at_safepoint()) {
|
|
||||||
size_t fail_cnt = verify_and_compare_entries();
|
|
||||||
if (fail_cnt != 0) {
|
|
||||||
tty->print_cr("ERROR: fail_cnt=" SIZE_FORMAT, fail_cnt);
|
|
||||||
guarantee(fail_cnt == 0, "unexpected ResolvedMethodTable verification failures");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // ASSERT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if INCLUDE_JVMTI
|
#if INCLUDE_JVMTI
|
||||||
@ -402,26 +392,16 @@ void ResolvedMethodTable::adjust_method_entries(bool * trace_name_printed) {
|
|||||||
}
|
}
|
||||||
#endif // INCLUDE_JVMTI
|
#endif // INCLUDE_JVMTI
|
||||||
|
|
||||||
// Verification and comp
|
// Verification
|
||||||
class VerifyCompResolvedMethod : StackObj {
|
class VerifyResolvedMethod : StackObj {
|
||||||
GrowableArray<oop>* _oops;
|
|
||||||
public:
|
public:
|
||||||
size_t _errors;
|
|
||||||
VerifyCompResolvedMethod(GrowableArray<oop>* oops) : _oops(oops), _errors(0) {}
|
|
||||||
bool operator()(WeakHandle<vm_resolved_method_table_data>* val) {
|
bool operator()(WeakHandle<vm_resolved_method_table_data>* val) {
|
||||||
oop s = val->peek();
|
oop obj = val->peek();
|
||||||
if (s == NULL) {
|
if (obj != NULL) {
|
||||||
return true;
|
Method* method = (Method*)java_lang_invoke_ResolvedMethodName::vmtarget(obj);
|
||||||
|
guarantee(method->is_method(), "Must be");
|
||||||
|
guarantee(!method->is_old(), "Must be");
|
||||||
}
|
}
|
||||||
int len = _oops->length();
|
|
||||||
for (int i = 0; i < len; i++) {
|
|
||||||
bool eq = s == _oops->at(i);
|
|
||||||
assert(!eq, "Duplicate entries");
|
|
||||||
if (eq) {
|
|
||||||
_errors++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_oops->push(s);
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -430,16 +410,9 @@ size_t ResolvedMethodTable::items_count() {
|
|||||||
return _items_count;
|
return _items_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ResolvedMethodTable::verify_and_compare_entries() {
|
void ResolvedMethodTable::verify() {
|
||||||
Thread* thr = Thread::current();
|
VerifyResolvedMethod vcs;
|
||||||
GrowableArray<oop>* oops =
|
if (!_local_table->try_scan(Thread::current(), vcs)) {
|
||||||
new (ResourceObj::C_HEAP, mtInternal)
|
|
||||||
GrowableArray<oop>((int)_current_size, true);
|
|
||||||
|
|
||||||
VerifyCompResolvedMethod vcs(oops);
|
|
||||||
if (!_local_table->try_scan(thr, vcs)) {
|
|
||||||
log_info(membername, table)("verify unavailable at this moment");
|
log_info(membername, table)("verify unavailable at this moment");
|
||||||
}
|
}
|
||||||
delete oops;
|
|
||||||
return vcs._errors;
|
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ public:
|
|||||||
|
|
||||||
// Debugging
|
// Debugging
|
||||||
static size_t items_count();
|
static size_t items_count();
|
||||||
static size_t verify_and_compare_entries();
|
static void verify();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SHARE_PRIMS_RESOLVEDMETHODTABLE_HPP
|
#endif // SHARE_PRIMS_RESOLVEDMETHODTABLE_HPP
|
||||||
|
@ -103,11 +103,13 @@ public class MemberNameLeak {
|
|||||||
System.err.println("test(" + gc + ", " + doConcurrent + ")");
|
System.err.println("test(" + gc + ", " + doConcurrent + ")");
|
||||||
// Run this Leak class with logging
|
// Run this Leak class with logging
|
||||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||||
"-Xlog:membername+table=trace",
|
"-Xlog:membername+table=trace,gc+verify=debug",
|
||||||
"-XX:+UnlockExperimentalVMOptions",
|
"-XX:+UnlockExperimentalVMOptions",
|
||||||
"-XX:+UnlockDiagnosticVMOptions",
|
"-XX:+UnlockDiagnosticVMOptions",
|
||||||
"-XX:+WhiteBoxAPI",
|
"-XX:+WhiteBoxAPI",
|
||||||
"-Xbootclasspath/a:.",
|
"-Xbootclasspath/a:.",
|
||||||
|
"-XX:+VerifyBeforeGC",
|
||||||
|
"-XX:+VerifyAfterGC",
|
||||||
doConcurrent ? "-XX:+ExplicitGCInvokesConcurrent" : "-XX:-ExplicitGCInvokesConcurrent",
|
doConcurrent ? "-XX:+ExplicitGCInvokesConcurrent" : "-XX:-ExplicitGCInvokesConcurrent",
|
||||||
"-XX:+ClassUnloading",
|
"-XX:+ClassUnloading",
|
||||||
"-XX:+ClassUnloadingWithConcurrentMark",
|
"-XX:+ClassUnloadingWithConcurrentMark",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user