Cleanup LclVar alignment requirements. #46026
Labels
area-CodeGen-coreclr
CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
design-discussion
Ongoing discussion about design without consensus
Milestone
The current alignment mechanism for jit local vars is very complex, I think it is worth a cleanup.
Requirements:
1.1 the incoming argument requirements are simple, esp. without vector calling convention.
2.1 there are more correctness requirements for armArch, less for XARCH;
I propose to create 2 functions:
What do we have now:
There is
genTypeAlignments
table that is defined in "typelist.h" and is used only inInferOpSizeAlign
for ArmArch, for arm64 it is used only in a stress mode, for arm32 it is used infgInitArgInfo
;How do we get alignment for arm64? It happens in
lvaAllocLocalAndSetVirtualOffset
, but this function has correct code only for 64-bit target, for arm32 we set the correct alignment before calling it:runtime/src/coreclr/jit/lclvars.cpp
Line 6496 in d0121ea
and then call the function that handles 64-bit"
runtime/src/coreclr/jit/lclvars.cpp
Line 6536 in d0121ea
the correctness requirements are hardcoded into the code, they are not coming from "typelist.h".
TARGET_POINTER_SIZE
and it works as long as we don't have vector calling convention, if we get it we will have the wrong alignment for arm/arm64.With the new requirements for arm64 apple I had to check and change all of these places for the new ABI.
I suggest to delete alignment information from "typelist.h", delete
genTypeAlignments
, replace code inlvaAllocLocalAndSetVirtualOffset
andlvaAssignVirtualFrameOffsetsToLocals
with a call togetAlignmentForLocal
;Stress code in
lvaStressLclFldCB
also should be changed to usegetAlignmentForLocal
, the old code that was working only for armArch should be deleted.category:design
theme:alignment
skill-level:intermediate
cost:medium
impact:small
The text was updated successfully, but these errors were encountered: