happy new year!
arnold.schwaighofer at gmail.com
Wed Jan 21 03:46:09 PST 2009
i am working on the project to bring tail calls to Hotspot.
A prototype was implemented on x86-32 and will hopefully be soon
availabe on the mlvm site.
The modified hotspot supports tail calls in the interpreter, client
and server compiler.
To mark a call as tail call the programmer emits a 'wide' byte code
before the various invoke... instructions.
The verifier checks that the call really is a tail call (i.e the last
thing the method does before it returns etc.).
Hotspot guarantees that a series of such tail calls execute in bounded
stack space. That is no stackoverflow exception happens.
The vm implements most tail calls by removing the calling stack frame.
Some stack frames can not be removed because of java's access security
mechanism. Every stack frame points to a protection domain via which
permissions can be computed. On access to a guarded resource
permissions are computed by intersecting all protection domains that
are on the stack. If caller and callee protection domain are different
we can not remove the caller's stack frame (or we would have to look
whether an ancestor frame already has the same pd on every call - not
very efficient). In such a case the tail call proceeds like a normal
function call i.e leaving a stack frame. If a series of tail calls
with different pds happen the stack grows. Eventually if the recursion
is deep enough a stack overflow would happen. The implementation
catches this situation and compresses the stack by removing stack
frames that have the same protection domain.
The prototype is mostly finished. I am currently writing my thesis
describing the changes and hope to be finished mid february. By then i
hope to have cleaned up the code and will probably post it here on the
On Tue, Jan 20, 2009 at 10:50 AM, Patrick Wright <pdoubleya at gmail.com> wrote:
> Thanks for the update.
>> 5. encourage the great work that people are doing or will do on tail
>> call, continuations, interface injection, invokedynamic, etc.
>> (Cheers, Arnold, Lukas, Tobias, Remi.)
> It would be great to get an update on how these sub-projects are
> going, what they are (currently, realistically) aiming to achieve,
> etc. Perhaps the people involved can give us a brief status update?
> mlvm-dev mailing list
> mlvm-dev at openjdk.java.net
More information about the mlvm-dev