Re: Any Checkstyle users?



On Tue, 31 Jan 2006 15:14:29 +1000, "Tony Morris" <not@xxxxxxxxxxx>
wrote, quoted or indirectly quoted someone who said :

> I'm sure (at least, I hope) you'll agree. In
>fact, it has nothing at all to do with interfaces, and everything to do with
>the level of depth in "virtuality" of the lookup, which class types can also
>"suffer" from.

Not at all. Calls to methods via interfaces are much trickier than
calls to virtual instance methods.. For classes, the method lives at
a fixed offset in a vtbl for the calls. Bjarne Stroustrup, the father
of C++, invented the vtbl. I am impressed all to heck since I tried
for years to invent it on my own for my own language, coming up with
nothing nearly as elegant. All you need is the method number and the
vtbl for the class this object ACTUALLY is and away you go , not that
much worse that a call to a static method.

But for a call to a method via an interface reference the method is at
a different offset in every implementing method. Various goofy
schemes are used from linearly scanning for it on every call, caching
the last hit or two, miniature HashMaps where you look up the
interface to get the offset of the method to implement each call...

I understand that much research has gone into efficiently implementing
calls to methods via interface references and the penalties are not
nearly so severe as in past.

People use interface references in preference to class references, to
the point making up dummy interfaces that have only one implementor
and always will. I think you should only use interface references
when there is a likely benefit.


--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
.



Relevant Pages

  • Re: [Q] Information hiding of components on forms...
    ... So how do I hide MyComponent and FormCreate? ... You cannot reduce the visibility of a class member. ... You could use an interface. ... interface references instead of form references outside that unit. ...
    (borland.public.delphi.language.objectpascal)
  • Re: TOM queryinterface problem
    ... > my RichEdit is TRichEdit98..but no diffrence if using another thing like TRichEdit. ... The problem is that the variables holding the interface references live longer ...
    (borland.public.delphi.nativeapi)
  • Re: TWebBrowser.Create
    ... > The TWinControl casts should be unnecessary. ... The casrt to TWinControl allows access to the "Delphi" Interface rather than ... Interface references may lead to the object going ...
    (alt.comp.lang.borland-delphi)
  • Re: Why is it so big?!
    ... Java class files are not like object or exe files. ... In each object is a pointer to it's class's vtbl. ... for an interface call, it is much hairier. ...
    (comp.lang.java.help)
  • Re: vTable offsets
    ... What about starting by posting the interface in question you are ... >> have to build all vtables by hand. ... The vTable offset starts ... >> Microsoft MVP, MCSD ...
    (microsoft.public.win32.programmer.ole)