With this backport, interface call could be inlined if there is only one implementation of the invoked method after class hierarchy analysis, as shown in the following case.
interface I1 {
public int m();
}
abstract class C1 implements I1 {}
class C2 extends C1 {
public int m() {
return 0;
}
}
class Test {
public static void main(String[] args) {
run(new C2());
}
public static void run(C1 c1) {
c1.m(); // will inline C2.m because only class C2 implements method m after Class Hierarchy Analysis
}
}
Related commits are:
[Backport] 8036580: CHA: improve default method support
[Backport] 8065760: CHA: Improve abstract method support
[Backport] 8266074: Vtable-based CHA implementation
[Backport] 8264548: Dependencies: ClassHierarchyWalker::is_witness() cleanups
[Backport] 8261954: Dependencies: Improve iteration over class hierarchy under context class
[Backport] 8223171: Redundant nmethod dependencies for effectively final methods
[Backport] 6986483: CHA: optimize calls through interfaces
With this backport, interface call could be inlined if there is only one implementation of the invoked method after class hierarchy analysis, as shown in the following case.
Related commits are: [Backport] 8036580: CHA: improve default method support [Backport] 8065760: CHA: Improve abstract method support [Backport] 8266074: Vtable-based CHA implementation [Backport] 8264548: Dependencies: ClassHierarchyWalker::is_witness() cleanups [Backport] 8261954: Dependencies: Improve iteration over class hierarchy under context class [Backport] 8223171: Redundant nmethod dependencies for effectively final methods [Backport] 6986483: CHA: optimize calls through interfaces