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

Commit 3ddcd85

Browse files
committed
Fix for generic unboxing stub with x8 return buffer argument
When we have nonstandard args we have to handle them before we setup to expect the return buffer arg. Added additional JitDump information about the call and its return type in impImportCall. All of the ARM64 EXPECTED_PASS tests will now pass when hasFixedRerBufReg is enabled. Additional changes are needed for the IL_STUB_PInvoke to get the Interop tests to pass But these tests are currentlt alreay in the EXPECTED_FAIL catagory.
1 parent 370e414 commit 3ddcd85

File tree

2 files changed

+35
-19
lines changed

2 files changed

+35
-19
lines changed

src/jit/importer.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5989,7 +5989,14 @@ var_types Compiler::impImportCall(OPCODE opcode,
59895989
// assume the worst-case.
59905990
mflags = (calliSig.callConv & CORINFO_CALLCONV_HASTHIS) ? 0 : CORINFO_FLG_STATIC;
59915991

5992-
5992+
#ifdef DEBUG
5993+
if (verbose)
5994+
{
5995+
unsigned structSize = (callRetTyp == TYP_STRUCT) ? info.compCompHnd->getClassSize(calliSig.retTypeSigClass) : 0;
5996+
printf("\nIn Compiler::impImportCall: opcode is %s, kind=%d, callRetType is %s, structSize is %d\n",
5997+
opcodeNames[opcode], callInfo->kind, varTypeName(callRetTyp), structSize);
5998+
}
5999+
#endif
59936000
//This should be checked in impImportBlockCode.
59946001
assert(!compIsForInlining()
59956002
|| !(impInlineInfo->inlineCandidateInfo->dwRestrictions & INLINE_RESPECT_BOUNDARY));
@@ -6021,6 +6028,14 @@ var_types Compiler::impImportCall(OPCODE opcode,
60216028

60226029
mflags = callInfo->methodFlags;
60236030

6031+
#ifdef DEBUG
6032+
if (verbose)
6033+
{
6034+
unsigned structSize = (callRetTyp == TYP_STRUCT) ? info.compCompHnd->getClassSize(sig->retTypeSigClass) : 0;
6035+
printf("\nIn Compiler::impImportCall: opcode is %s, kind=%d, callRetType is %s, structSize is %d\n",
6036+
opcodeNames[opcode], callInfo->kind, varTypeName(callRetTyp), structSize);
6037+
}
6038+
#endif
60246039
if (compIsForInlining())
60256040
{
60266041
/* Does this call site have security boundary restrictions? */

src/jit/morph.cpp

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3683,24 +3683,6 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* callNode)
36833683
assert(size == 1);
36843684
#endif
36853685
#endif
3686-
// If 'expectRetBuffArg' is true then the next argument is the RetBufArg
3687-
// and we may need to change nextRegNum to the theFixedRetBuffReg
3688-
//
3689-
if (expectRetBuffArg)
3690-
{
3691-
assert(passUsingFloatRegs == false);
3692-
3693-
if (hasFixedRetBuffReg())
3694-
{
3695-
// Change the register used to pass the next argument to the fixed return buffer register
3696-
nextRegNum = theFixedRetBuffReg();
3697-
// Note that later in this method we don't increment intArgRegNum when we
3698-
// have setup nextRegRun to be the fixed retrurn buffer register
3699-
}
3700-
3701-
// We no longer are expecting the RetBufArg
3702-
expectRetBuffArg = false;
3703-
}
37043686

37053687
#ifndef LEGACY_BACKEND
37063688
// If there are nonstandard args (outside the calling convention) they were inserted above
@@ -3735,6 +3717,25 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* callNode)
37353717
continue;
37363718
#endif // !LEGACY_BACKEND
37373719

3720+
// If 'expectRetBuffArg' is true then the next argument is the RetBufArg
3721+
// and we may need to change nextRegNum to the theFixedRetBuffReg
3722+
//
3723+
if (expectRetBuffArg)
3724+
{
3725+
assert(passUsingFloatRegs == false);
3726+
3727+
if (hasFixedRetBuffReg())
3728+
{
3729+
// Change the register used to pass the next argument to the fixed return buffer register
3730+
nextRegNum = theFixedRetBuffReg();
3731+
// Note that later in this method we don't increment intArgRegNum when we
3732+
// have setup nextRegRun to be the fixed retrurn buffer register
3733+
}
3734+
3735+
// We no longer are expecting the RetBufArg
3736+
expectRetBuffArg = false;
3737+
}
3738+
37383739
if (!lateArgsComputed)
37393740
{
37403741
// This is a register argument - put it in the table

0 commit comments

Comments
 (0)