JBR-8316 DCEVM: Allow idnum to exceed total method count

This commit is contained in:
Vladimir Dvorak
2025-05-14 20:09:02 +02:00
parent 5fc78ed3da
commit a6cdff5987
2 changed files with 10 additions and 8 deletions

View File

@@ -375,8 +375,6 @@ inline int Backtrace::get_line_number(Method* method, int bci) {
// "no LineNumberTable". JDK tests for -2.
line_number = -2;
} else {
// (DCEVM): Line numbers from the newest version must be used
method = method->newest_version();
// Returns -1 if no LineNumberTable, and otherwise actual line number
line_number = method->line_number_from_bci(bci);
}

View File

@@ -4433,15 +4433,19 @@ Method* InstanceKlass::method_with_idnum(int idnum) {
Method* InstanceKlass::method_with_orig_idnum(int idnum) {
if (idnum >= methods()->length()) {
return nullptr;
}
Method* m = methods()->at(idnum);
if (m != nullptr && m->orig_method_idnum() == idnum) {
return m;
// (DCEVM) The provided idnum may exceed the current number of methods.
if (!AllowEnhancedClassRedefinition) {
return nullptr;
}
} else {
Method* m = methods()->at(idnum);
if (m != nullptr && m->orig_method_idnum() == idnum) {
return m;
}
}
// Obsolete method idnum does not match the original idnum
for (int index = 0; index < methods()->length(); ++index) {
m = methods()->at(index);
Method* m = methods()->at(index);
if (m->orig_method_idnum() == idnum) {
return m;
}