Skip to content

Commit

Permalink
JIT: Use small register types for some enregisterable locals (#67274)
Browse files Browse the repository at this point in the history
Fix two cases where small enregisterable locals can't be saved to the stack
using actual (widened) types:
* small memory args for OSX ARM64
* promoted fields of OSR locals

Closes #67152.
Closes #67188.
  • Loading branch information
AndyAyersMS authored Mar 29, 2022
1 parent 6019cda commit 7bf9ae2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/coreclr/jit/lclvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3825,8 +3825,30 @@ var_types LclVarDsc::GetRegisterType() const
// Return Value:
// TYP_UNDEF if the layout is not enregistrable, the register type otherwise.
//
// Notes:
// Special cases are small OSX ARM64 memory params (where args are not widened)
// and small local promoted fields (which use Tier0 frame space as stack homes).
//
var_types LclVarDsc::GetActualRegisterType() const
{
if (varTypeIsSmall(TypeGet()))
{
if (compMacOsArm64Abi() && lvIsParam && !lvIsRegArg)
{
return GetRegisterType();
}

if (lvIsOSRLocal && lvIsStructField)
{
#if defined(TARGET_X86)
// Revisit when we support OSR on x86
unreached();
#else
return GetRegisterType();
#endif
}
}

return genActualType(GetRegisterType());
}

Expand Down

0 comments on commit 7bf9ae2

Please sign in to comment.