Skip to content

Commit 45641d9

Browse files
authored
[NativeAOT/x86] Implement GetConservativeUpperBoundForOutgoingArgs (#99726)
1 parent 5c40bb5 commit 45641d9

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/coreclr/nativeaot/Runtime/windows/CoffNativeCodeManager.cpp

+18-3
Original file line numberDiff line numberDiff line change
@@ -573,9 +573,24 @@ uintptr_t CoffNativeCodeManager::GetConservativeUpperBoundForOutgoingArgs(Method
573573

574574
upperBound = dac_cast<TADDR>(context.Sp);
575575
#else
576-
PORTABILITY_ASSERT("GetConservativeUpperBoundForOutgoingArgs");
577-
upperBound = NULL;
578-
RhFailFast();
576+
PTR_uint8_t gcInfo;
577+
uint32_t codeOffset = GetCodeOffset(pMethodInfo, (PTR_VOID)pRegisterSet->IP, &gcInfo);
578+
579+
hdrInfo infoBuf;
580+
size_t infoSize = DecodeGCHdrInfo(GCInfoToken(gcInfo), codeOffset, &infoBuf);
581+
PTR_CBYTE table = gcInfo + infoSize;
582+
583+
REGDISPLAY registerSet = *pRegisterSet;
584+
585+
::UnwindStackFrameX86(&registerSet,
586+
(PTR_CBYTE)(m_moduleBase + pNativeMethodInfo->mainRuntimeFunction->BeginAddress),
587+
codeOffset,
588+
&infoBuf,
589+
table,
590+
(PTR_CBYTE)(m_moduleBase + pNativeMethodInfo->runtimeFunction->BeginAddress),
591+
(unwindBlockFlags & UBF_FUNC_KIND_MASK) != UBF_FUNC_KIND_ROOT,
592+
true);
593+
upperBound = dac_cast<TADDR>(registerSet.PCTAddr);
579594
#endif
580595
}
581596
return upperBound;

0 commit comments

Comments
 (0)