Re: Optimization of late bindings in Java (Dave Harris)
5 Mar 1997 13:39:09 -0500

          From comp.compilers

Related articles
Optimization of late bindings in Java (Jim Baker) (1997-03-01)
Re: Optimization of late bindings in Java (1997-03-05)
| List of all articles for this month |

From: (Dave Harris)
Newsgroups: comp.compilers
Date: 5 Mar 1997 13:39:09 -0500
Organization: Compilers Central
References: 97-03-012
Keywords: Java, performance

In comp.compilers Jim Baker <> wrote:

> The Java VM supports quick instructions to replace method
> lookup for an interface once the implementing class is determined.

That does not sound right to me. I thought the quick instructions were
caching the result of the type check. For example, in:
        void proc( SomeInterface o ) {
              o.someMethod( 42 );

the JVM has to check that SomeInterface actually has a function called
someMethod() which takes an integer argument. (This will already have been
checked by the compiler, but the JVM does not consider compilers to be

Also, up until this point the function will be stored as a string rather
than an index (to reduce binary inter-module dependencies). The JVM must
convert the string into a vtbl index (or similar) and the
quick-instruction serves to cache that result too.

The actual dynamic method lookup is not optimised out by the quick
instructions. It's just now able to be implemented as something fast, like
an integer index into a virtual function table. This is necessary because
the "implementing class" can't usually be determined on a per-call-site
basis. If you call the above proc() with different classes implementing
SomeInterface, the right different overrides of someMethod() must get

      Dave Harris, Swansea, UK

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.