class A {
final int foo() { return 3; }
}
Given this class, any call to Inlining the method provides the following benefits at the call site:
In the past, programmers often inserted the "final" keyword for exactly this reason. Or to better facilitate inlining and increase execution speed, they would combine many smaller methods into one larger method. But in many ways, such techniques defeat the entire facility of modularization and reusability built into the programming language. Unlike traditional virtual machines, the Java HotSpot VM is able to inline the class without the "final" keyword:
class B {
int foo() { return 3; }
}
As long as there are no subclasses that override
class C extends B {
int foo() { return 6; }
}
Now, any code that inlined calls to
Until class Such problem areas are detected by recording for every compilation, all of the assumptions that the code makes. On every class load, all these assumptions are checked and, if violated, the now-incorrect compiled code is retired (deoptimized).
_______ | ||||||||
|
| ||||||||||||