[aarch64-port-dev ] RFR(S): JDK-8203481 Incorrect constraint for unextended_sp in frame:safe_for_sender

Andrew Haley aph at redhat.com
Mon Jun 4 14:30:10 UTC 2018

On 05/23/2018 08:16 AM, Dmitry Samersoff wrote:
> I'll re-check what is happening on AArch64 and come back.

I had a look.  I know what's happening.

While we're interpreting, the machine SP is always <= the Java
expression SP, ESP.  When we enter a new intrpreted frame, the old
machine SP is saved in interpreter_frame_sender_sp in the new frame
and the machine SP is adjusted so that it is just below ESP.
interpreter_frame_sender_sp is used to calculate the unextended_sp
while we're unwinding the frame.

So, A correct frame layout can look like this:

 0x000003ffb61bdf40: 0x000003ffb61bdfb0 #2 method java.security.AccessController.getContext()Ljava/security/AccessControlContext; @ 0
                                        - 1 locals 5 max stack
 0x000003ffb61bdf38: 0x000003ffb61bdf20 interpreter_frame_sender_sp
 0x000003ffb61bdf30: 0x000003ffb61bdef0 interpreter_frame_last_sp
 0x000003ffb61bdf28: 0x000003ff88fb0bc0 interpreter_frame_method
 0x000003ffb61bdf20: 0x0000000000000000 unextended_sp for #3
 0x000003ffb61bdf18: 0x0000000000000000
 0x000003ffb61bdf10: 0x000000070ff06a48 interpreter_frame_mirror
 0x000003ffb61bdf08: 0x000003ff88fb0de8 interpreter_frame_cache
 0x000003ffb61bdf00: 0x000003ffb61bdf50 interpreter_frame_locals
 0x000003ffb61bdef8: 0x000003ff88fb0b90 interpreter_frame_bcp
 0x000003ffb61bdef0: 0x000003ffb61bdef0 interpreter_frame_initial_sp
 0x000003ffb61bdee8: 0x000000070ff06a48
 0x000003ffb61bdee0: 0x0000000000000000 sp for #2
 0x000003ffb61bded8: 0x000003ffa1081360

 0x000003ffb61bded0: 0x000003ffb61bdf40 #1 method java.security.AccessController.getStackAccessControlContext()Ljava/security/AccessControlContext; @ 0
                                        - 0 locals 1 max stack
 0x000003ffb61bdec8: 0x000003ffb61bdeb0 interpreter_frame_sender_sp
 0x000003ffb61bdec0: 0x0000000000000000 interpreter_frame_last_sp
 0x000003ffb61bdeb8: 0x000003ff88fb0a30 interpreter_frame_method
 0x000003ffb61bdeb0: 0x0000000000000000 unextended_sp for #2
 0x000003ffb61bdea8: 0x0000000000000000
 0x000003ffb61bdea0: 0x000000070ff06a48 interpreter_frame_mirror
 0x000003ffb61bde98: 0x000003ff88fb0de8 interpreter_frame_cache
 0x000003ffb61bde90: 0x000003ffb61bdee8 interpreter_frame_locals
 0x000003ffb61bde88: 0x0000000000000000 interpreter_frame_bcp
 0x000003ffb61bde80: 0x000003ffb61bde80 sp for #1
                                        unextended_sp for #1

Note that getStackAccessControlContext()'s saved sender SP from
AccessController.getContext() is 0x000003ffb61bdeb0: this really is
less than 0x000003ffb61bdee0, which was the SP before
getStackAccessControlContext()'s frame was created.  This is OK, and
explains why the assert failed for you.

Given that the unextended_sp can be greater or less than the saved SP,
I think the assert can be removed.

Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671

More information about the hotspot-runtime-dev mailing list