This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patches for faster interface dispatch, type checking


Godmar Back wrote:

>  Cool!
>
> >From a quick look at it though, I don't think it's 100% correct.
> I don't see any checks for NoSuchMethodError and I also don't see
> how you handle the java.lang.Object case.
>
> I may be mistaken though: Does it work?

I don't think there is any need to check for NoSuchMethodError in
_Jv_LookupInterfaceMethod (). The compiler won't call
_Jv_LookupInterfaceMethod unless the object is known to implement the
interface - the interface reference must have passed through a
_Jv_CheckCast() test first if it is not directly assignable from the
class in question.

If a class claims to implement a given interface but doesn't (which
could happen if it was compiled against a different version of the
interface), this is detected when the idispatch tables are generated
(prior to class initialization) in _Jv_AppendPartialITable():

         if (! _Jv_equalUtf8Consts (iface->methods[j].name,
clinit_name))
           JvThrow (new java::lang::NoSuchMethodError
                    (_Jv_GetMethodString (klass,
iface->methods[j].name)));

There are also checks for method access and abstract/static methods.

What is the java.lang.Object case?

regards

  [ bryce ]



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]