> From: Scott Furman [mailto:[EMAIL PROTECTED]]
>
> John Keiser wrote:
>
> > The VM doesn't already implement Object--thus the need for
> VMObject, which
> > implements the trivially few methods that actually require the
> VM's input.
> > The point of the VM interfacewas to make the job as easy as
> possible for the
> > VM to implement things (read: as few classes and methods as possible)
> > without taking away their power to optimize and innovate.
>
> But it is somewhat of a de-optimization since it adds a layer of
> indirection.
> With your scheme, the Java implementation of Object's instance
> methods have to
> delegate to a static native method.
>

Yes.  The reasoning I came up with to deal with that is that a JIT could
very easily optimize away either the delegation layer or the call itself.
Especially when a method is final and not defined in superclasses, or is
static.  Note that all the delegated Object functions except clone() are
final, and thus with 100% accuracy you can replace all calls to o.wait()
with VMObject.wait(o).  You are apparently planning on doing agressive
inlining, so these problems should go away.  Is my assumption incorrect?

Nonetheless, it turns out that the VMObject are ones that won't generally be
called in extremely large amounts.

>
> It isn't that the VM needs control of the (trivial) Java code in
> Object.  It's a
> matter of simplicity and efficiency.  Why not  define native
> methods within
> java.lang.Object that the VM is required to implement them with Classpath
> supplying the implementation of the non-native methods ?  This
> would eliminate
> the indirection overhead.
>

Hmm.  At the time it seemed simpler to either have the interface be entirely
from class to class or entirely from class to native method.  It would be
very inefficient to do the latter, so I chose the former.  I don't think the
idea of a hybrid method ever came up.

Thoughts, anyone?  What cons would there be to doing this?  It seems like it
might even make the Japhar port simpler, remove a number of extra methods.

--John Keiser

Reply via email to