RFR 8227040 [lworld][c1] Must repair stack frame before calling buffer_value_args

Ioi Lam ioi.lam at oracle.com
Wed Jul 3 05:13:23 UTC 2019


https://bugs.openjdk.java.net/browse/JDK-8227040
http://cr.openjdk.java.net/~iklam/valhalla/8227040-repair-frame-before-buffer_value_args.v01/

When a C1-compiled method is called by C2, it needs to pack all the fields
of its value arguments back to buffered objects. In some cases, usually 
when the
value arguments have floating point fields, the C1 callee may require more
stack than what has been provided by the C2 caller. On x64, this is handled
by the following "stack repair" instructions in the "Verified Entry Point"
of the callee

     pop %r13
     sub <sp_inc>,%rsp
     push %r13
     movq <real_frame_size>,<frame_size - 8>(%rsp)

The stack must be repaired before it can be walked (for GC, etc). This bug
happens because we call Runtime1::buffer_value_args, which may GC, before
the stack is repaired.

The fix is to move the stack repair code before calling buffer_value_args.
I also added one test case that would reliably catch this type of error.

Thanks
- Ioi



More information about the valhalla-dev mailing list