tail call optimisation question

John Rose John.Rose at Sun.COM
Mon Mar 16 15:56:45 PDT 2009


On Mar 16, 2009, at 7:27 AM, Ben Evans wrote:

> The idea being that the wide opcode indicates that this call should  
> be optimised as a tail call, and that the interpreter part of  
> HotSpot will then (if allowed by protection restrictions) rewrite  
> the current native stack frame rather than create a new one.

Not optimized:  It is a hard tail call.  There is not a choice about  
whether the stack frame should disappear.  If the tail call is  
defeated, there has to be some sort of notification, such as an  
exception.

You might ask "then why is the areturn required afterwards"?  The  
answer is to make it somewhat easier for bytecode-conscious tools to  
adapt to the new instruction format.  In particular, it simplifies the  
changes to the verifier.  (Complex verifier changes are bad.)

-- John



More information about the mlvm-dev mailing list