3 ms·
Java is slightly more complicated. It can make assumptions about the code (even if it can't prove they always hold!) and specialize some things but not others.
by kjeetgill 6y ago
Java is slightly more complicated. It can make assumptions about the code (even if it can't prove they always hold!) and specialize some things but not others.
Generally, the jit can specialize the code making assumptions about the real type under interfaces/polymorphism, which types the generic parameters will be, or even which target virtual dispatch will always hit.
But for the objects themselves, it never specializes layout in any way (short of removing an allocation entirely).
... I think. I'm no expert in this, ask chrisseaton.