Skip to content

Commit 334bdb9

Browse files
committed
Fix the assert and add a comment.
1 parent d07e14c commit 334bdb9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/hotspot/share/prims/jvmtiRedefineClasses.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3776,7 +3776,12 @@ void VM_RedefineClasses::AdjustAndCleanMetadata::do_klass(Klass* k) {
37763776
void VM_RedefineClasses::update_jmethod_ids() {
37773777
for (int j = 0; j < _matching_methods_length; ++j) {
37783778
Method* old_method = _matching_old_methods[j];
3779-
assert(old_method->method_idnum() < _matching_methods_length,
3779+
// The method_idnum should be within the range of 1..number-of-methods
3780+
// until incremented later for obsolete methods.
3781+
// The increment is so if a jmethodID is created for an old obsolete method
3782+
// it gets a new jmethodID cache slot in the InstanceKlass.
3783+
// They're cleaned out later when all methods of the previous version are purged.
3784+
assert(old_method->method_idnum() <= _old_methods->length(),
37803785
"shouldn't be incremented yet for obsolete methods");
37813786
jmethodID jmid = old_method->find_jmethod_id_or_null();
37823787
if (jmid != nullptr) {

0 commit comments

Comments
 (0)