_Jv_LookupInterfaceMethod

Godmar Back gback@cs.utah.edu
Wed Dec 1 07:44:00 GMT 1999


>> OK, so how difficult is it going to be to change, in the compiler, the
> definition of _Jv_LookupInterfaceMethod from:
>> (jclass klass, _Jv_Utf8Const *name, _Jv_Utf8Const *signature)
>> to:
>> (jclass klass, jclass iface, int method_idx)
>> I have mostly implemented (in the runtime) Per Bothner's constant-time
> dispatch and type checking algorithms, but it really needs this change
> to tie it all together. If someone do it (or give me explicit
> instructions on how ;-), then we'll get a *huge* performance increase on
> interface invocations.
>
Cool.
The method idx can just be the index of that method in the method
table (including or not including the <clinit> method.) 
Should be really easy to compute.
> Also, I noticed this comment in the code:
>> /* We expand invokeinterface here. _Jv_LookupInterfaceMethod() will
> ensure that the selected method exists, is public and not
> abstract nor static. */
>> Are these checks really the job of _Jv_LookupInterfaceMethod()? It seems
> to me that this is really the job of the compiler (or perhaps verifier
> in the case of interpreted classes). Couldn't I just do this when
> building the interface dispatch tables, and eliminate the extra
> overhead?
>
Checking that the interface includes the method is done at compile time.
Checking that the object on which invokeinterface is invoked indeed
implements that method, and that the method is not abstract or static,
can according to Per done by a more modern, though yet to be implemented
verifier design. For now, I submit you have to do it at run-time, and Per
has outlined how to do it.
Plus, as Per and I discussed in an earlier threads, you still need to
either turn invokeinterface on java.lang.Object methods in invokevirtual
calls or treat java.lang.Object like an interface (you probably don't want to
do the latter.), or fall back to a slow name based lookup if you don't find 
the method in the interface method dispatch table.
Related... maybe it would be a good idea to put some .class files produced 
by foreign javac compilers such as jikes or kjc into the regression suite.
This should help catch such problems as the final field initializer bug
I pointed out, and will also ensure compliance with javac compilers following
the revised language spec, such as jikes.
	- Godmar


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /