Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 4da11d5

Browse files
committed
Fix Stack Alignment Check
This fixes https://github.com/dotnet/coreclr/issues/3747. If JIT saves the first single store (not pair store) with stack adjustment required (```spDelta != 0```), we expect the offset to be 8 to account for alignment. This API ```genPrologSaveReg``` is invoked twice from INT and FP saving respectively while JIT stores/allocates stacks once for these saving registers back to back. So, the assertion is not quite right. For instance when we have 1 INT and 1 FP registers to be saved, JIT failed to assert the offset to be 8 in the first invocation for INT. In fact, for this case, the offset should be 0 (no alignment is required) since we store 2 registers which are already aligned on 16 byte. We should consider whether or not the total number of saved registers is odd. Not only that, even for the pair store, we should assert the offset either 0 or 8 depending on the total number of saved registers. For instance, 2 INT and 3 FP, we want the offset to be 8 when we store the first pair with stack adjustment required (```spDelta != 0```). I refactored the code to reflect this issue in ```genSaveCalleeSavedRegistersHelp``` while taking out the existing assertion in ```genPrologSaveReg``` which is too local. Similar change is made for the restore case.
1 parent 25b3709 commit 4da11d5

File tree

2 files changed

+175
-161
lines changed

2 files changed

+175
-161
lines changed

0 commit comments

Comments
 (0)