8185348: Major performance regression in GetMethodDeclaringClass and other JVMTI Method functions

Reviewed-by: phh
This commit is contained in:
Zhengyu Gu 2025-08-05 19:23:49 +00:00
parent 16949879ae
commit 8234312bb0
2 changed files with 5 additions and 3 deletions

View File

@ -1903,9 +1903,6 @@ bool Method::is_method_id(jmethodID mid) {
Method* Method::checked_resolve_jmethod_id(jmethodID mid) {
if (mid == NULL) return NULL;
if (!Method::is_method_id(mid)) {
return NULL;
}
Method* o = resolve_jmethod_id(mid);
if (o == NULL || o == JNIMethodBlock::_free_method || !((Metadata*)o)->is_method()) {
return NULL;

View File

@ -468,6 +468,11 @@ Method* jniCheck::validate_jmethod_id(JavaThread* thr, jmethodID method_id) {
if (moop == NULL) {
ReportJNIFatalError(thr, fatal_wrong_class_or_method);
}
// jmethodIDs are supposed to be weak handles in the class loader data,
// but that can be expensive so check it last
else if (!Method::is_method_id(method_id)) {
ReportJNIFatalError(thr, fatal_non_weak_method);
}
return moop;
}