Only update XMM save unwind operation offsets when using a FP.

This commit prevents updating the XMM save unwind operation offsets when a
frame pointer is not used, even though currently Cranelift always uses a
frame pointer.

This will prevent incorrect unwind information in the future when we start
omitting frame pointers.
This commit is contained in:
Peter Huene
2020-05-21 16:46:30 -07:00
parent 54f9cd255f
commit ce5f3e153b

View File

@@ -136,9 +136,12 @@ pub(crate) fn create_unwind_info(
assert!(found_end);
// When using a frame register, certain unwind operations, such as XMM saves, are relative to the frame
// register minus some offset, forming a "base address". This attempts to calculate the frame register offset
// while updating the XMM save offsets to be relative from this "base address" rather than RSP.
let mut frame_register_offset = 0;
if xmm_save_count > 0 {
// If there are XMM saves, determine the number of 16-byte slots used for all CSRs (including GPRs)
if frame_register.is_some() && xmm_save_count > 0 {
// Determine the number of 16-byte slots used for all CSRs (including GPRs)
// The "frame register offset" will point at the last slot used (i.e. the last saved FPR)
// Assumption: each FPR is stored at a lower address than the previous one
let mut last_stack_offset = None;