Skip to content

Commit

Permalink
Fix ArgIteratorTemplate::GetNextOffset() for struct{Arr[], float} (do…
Browse files Browse the repository at this point in the history
  • Loading branch information
tomeksowi authored Jun 7, 2024
1 parent fb1fe7f commit 4aedd62
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,11 @@ public int GetNextOffset()
_hasArgLocDescForStructInRegs = true;
_argLocDescForStructInRegs.m_floatFlags = floatFieldFlags;

int argOfsInner = _transitionBlock.OffsetOfFloatArgumentRegisters + _riscv64IdxFPReg * 8;
int argOfsInner =
((floatFieldFlags & (uint)StructFloatFieldInfoFlags.STRUCT_FLOAT_FIELD_SECOND) != 0)
? _transitionBlock.OffsetOfArgumentRegisters + _riscv64IdxGenReg * 8
: _transitionBlock.OffsetOfFloatArgumentRegisters + _riscv64IdxFPReg * 8;

_riscv64IdxFPReg++;
_riscv64IdxGenReg++;
return argOfsInner;
Expand Down
6 changes: 4 additions & 2 deletions src/coreclr/vm/callingconvention.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ struct TransitionBlock
{
return argLocDescForStructInRegs->m_cFloatReg > 0;
}
#elif defined(TARGET_LOONGARCH64)
#elif defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64)
if (argLocDescForStructInRegs != NULL)
{
return argLocDescForStructInRegs->m_cFloatReg > 0;
Expand Down Expand Up @@ -1849,7 +1849,9 @@ int ArgIteratorTemplate<ARGITERATOR_BASE>::GetNextOffset()
m_argLocDescForStructInRegs.Init();
m_argLocDescForStructInRegs.m_idxFloatReg = m_idxFPReg;
m_argLocDescForStructInRegs.m_cFloatReg = 1;
int argOfs = TransitionBlock::GetOffsetOfFloatArgumentRegisters() + m_idxFPReg * 8;
int argOfs = (flags & STRUCT_FLOAT_FIELD_SECOND)
? TransitionBlock::GetOffsetOfArgumentRegisters() + m_idxGenReg * 8
: TransitionBlock::GetOffsetOfFloatArgumentRegisters() + m_idxFPReg * 8;
m_idxFPReg += 1;

m_argLocDescForStructInRegs.m_structFields = flags;
Expand Down

0 comments on commit 4aedd62

Please sign in to comment.