Skip to content

[GR-63590] Fix trying to invalidate a leaf method assumption for a final method. #10985

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -97,8 +97,7 @@ private void updateVirtualAndInterfaceTables(ObjectKlass.KlassVersion newKlassVe
// We only reach here for concrete classes, we need to be careful that there might
// be some "leaf" methods that have already been overridden in abstract classes
// those must be taken care of now that we see a concrete subclass
ObjectKlass newKlass = newKlassVersion.getKlass();
Method.MethodVersion[] vTable = newKlass.getVTable();
Method.MethodVersion[] vTable = newKlassVersion.getVtable();
for (int i = 0; i < vTable.length; i++) {
Method.MethodVersion m = vTable[i];
ObjectKlass current = newKlassVersion.getSuperKlass();
@@ -108,7 +107,7 @@ private void updateVirtualAndInterfaceTables(ObjectKlass.KlassVersion newKlassVe
break;
}
Method.MethodVersion overridden = superVTable[i];
if (overridden != m) {
if (overridden.getMethod() != m.getMethod()) {
overridden.getMethod().getLeafAssumption(ClassHierarchyAccessor.accessor).invalidate();
}
if (current.isConcrete()) {
Original file line number Diff line number Diff line change
@@ -1751,7 +1751,9 @@ private KlassVersion(KlassVersion oldVersion, RuntimeConstantPool pool, LinkedKl
for (Method.MethodVersion removedMethod : removedMethods) {
virtualMethodsModified |= isVirtual(removedMethod.getLinkedMethod().getParserMethod());
ParserMethod parserMethod = removedMethod.getLinkedMethod().getParserMethod();
checkSuperMethods(superKlass, parserMethod.getFlags(), parserMethod.getName(), parserMethod.getSignature(), invalidatedClasses);
if (invalidatedClasses != null) {
checkSuperMethods(superKlass, parserMethod.getFlags(), parserMethod.getName(), parserMethod.getSignature(), invalidatedClasses);
}
removedMethod.getMethod().removedByRedefinition();
ClassRedefinition.LOGGER.fine(
() -> "Removed method " + removedMethod.getMethod().getDeclaringKlass().getName() + "." + removedMethod.getLinkedMethod().getName());
@@ -1762,11 +1764,13 @@ private KlassVersion(KlassVersion oldVersion, RuntimeConstantPool pool, LinkedKl
Method.MethodVersion added = new Method(this, linkedMethod, pool).getMethodVersion();
newDeclaredMethods.addLast(added);
virtualMethodsModified |= isVirtual(addedMethod);
checkSuperMethods(superKlass, addedMethod.getFlags(), addedMethod.getName(), addedMethod.getSignature(), invalidatedClasses);
if (invalidatedClasses != null) {
checkSuperMethods(superKlass, addedMethod.getFlags(), addedMethod.getName(), addedMethod.getSignature(), invalidatedClasses);
}
ClassRedefinition.LOGGER.fine(() -> "Added method " + added.getMethod().getDeclaringKlass().getName() + "." + added.getName());
}

if (virtualMethodsModified) {
if (virtualMethodsModified && invalidatedClasses != null) {
invalidatedClasses.addAll(getSubTypes());
}

@@ -1856,7 +1860,7 @@ public KlassVersion replace() {
}

ChangePacket packet = new ChangePacket(null, linkedKlass.getParserKlass(), null, detectedChange);
return new KlassVersion(this, pool, linkedKlass, packet, Collections.emptyList());
return new KlassVersion(this, pool, linkedKlass, packet, null);
}

public Method.MethodVersion[][] getItable() {