RFR: 8167200: AArch64: Broken stack pointer adjustment in interpreter

Kim Barrett kim.barrett at oracle.com
Thu Oct 6 00:27:46 UTC 2016


> On Oct 5, 2016, at 1:56 PM, Andrew Haley <aph at redhat.com> wrote:
> 
> This is a thinko in the template interpreter.
> 
> AArch64 has two stack pointers: the system SP and the expression
> SP. The expression SP must always point to an address greater than or
> equal to the system SP.
> 
> When we allocate a new monitor in the interpreter we move the contents
> of the entire operand stack and then insert a monitor between the
> operand stack and the frame. So, we need to allocate two more words
> (the size of a monitor) on the stack. The expression SP is adjusted to
> allow for this, and we then do a comparison to see if the system SP
> needs also to be moved. This is wrong: whenever we allocate a monitor
> we should also unconditionally adjust the system SP.
> 
> The bug here is that we might decide that we do not need any more
> space in the system stack but later push several items onto the
> expression stack. In this case the expression SP might be lower than
> the system SP, and method arguments are corrupted.
> 
> This patch changes the logic so that whenever we insert a monitor we
> unconditionally adjust the system SP.
> 
> http://cr.openjdk.java.net/~aph/8167200/
> 
> Andrew.

Looks good with Dean’s suggested removal of the now unused no_adjust label.



More information about the hotspot-dev mailing list