On Wednesday, 10 April 2013 at 11:00:17 UTC, Manu wrote:
On 10 April 2013 20:53, Regan Heath <[email protected]> wrote:


False. In this first example we are compiling A and B together (into an exe - I left that off) so the compiler has all sources and all uses of all
methods of A (and B).


And if the program calls LoadLibrary() somewhere?


 notVirt is virtual.


It may actually be (I don't know) but it certainly does not have to be (compiler has all sources/uses) and my impression was that it /should/ not
be.


It doesn't have all sources. It could load a library. That can never be
guaranteed.

That is the main reason why most JITs do code rewriting every time the world changes.

For example, on Hotspot, depending how many subclasses you have loaded many virtual calls are actually direct calls, until this is no longer possible and code regeneration is required.

This of course works way better on server side, or with layered JITs like Java 7 has.

--
Paulo

Reply via email to