summaryrefslogtreecommitdiff
path: root/src/vm/callingconvention.h
diff options
context:
space:
mode:
authorJUNG DONG-HEON <dheon.jung@samsung.com>2020-06-08 10:20:14 +0900
committer이형주/Common Platform Lab(SR)/Staff Engineer/삼성전자 <leee.lee@samsung.com>2020-06-18 07:38:46 +0900
commit7d6fa13ce85654174b882c9e934c000dfd2222fe (patch)
tree46c473fdedd5747c2ad281170c0416407b74a503 /src/vm/callingconvention.h
parent488be5d790020489f7f4dd7d43680f43b101dbd4 (diff)
downloadcoreclr-7d6fa13ce85654174b882c9e934c000dfd2222fe.tar.gz
coreclr-7d6fa13ce85654174b882c9e934c000dfd2222fe.tar.bz2
coreclr-7d6fa13ce85654174b882c9e934c000dfd2222fe.zip
Implement instantiating and unboxing through portable stublinker code… (#106)
* Implement instantiating and unboxing through portable stublinker code - Handle only the cases with register to register moves - Shares abi processing logic with delegate shuffle thunk creation - Architecture specific logic is relatively simple - Do not permit use of HELPERREG in computed instantiating stubs - Fix GetArgLoc such that it works on all architectures and OS combinations Add a JIT stress test case for testing all of the various combinations - Use the same calling convention test architecture that was used as part of tail call work Rename secure delegates to wrapper delegates - Secure delegates are no longer a feature of the runtime - But the wrapper delegate lives on as a workaround for a weird detail of the ARM32 abi
Diffstat (limited to 'src/vm/callingconvention.h')
-rw-r--r--src/vm/callingconvention.h56
1 files changed, 49 insertions, 7 deletions
diff --git a/src/vm/callingconvention.h b/src/vm/callingconvention.h
index cbc6aad5c4..43cc93bd85 100644
--- a/src/vm/callingconvention.h
+++ b/src/vm/callingconvention.h
@@ -546,6 +546,29 @@ public:
#endif
}
+#ifdef _TARGET_X86_
+ // Get layout information for the argument that the ArgIterator is currently visiting.
+ void GetArgLoc(int argOffset, ArgLocDesc *pLoc)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ pLoc->Init();
+
+ int cSlots = (GetArgSize() + 3) / 4;
+ if (!TransitionBlock::IsStackArgumentOffset(argOffset))
+ {
+ pLoc->m_idxGenReg = TransitionBlock::GetArgumentIndexFromOffset(argOffset);
+ _ASSERTE(cSlots == 1);
+ pLoc->m_cGenReg = cSlots;
+ }
+ else
+ {
+ pLoc->m_idxStack = TransitionBlock::GetStackArgumentIndexFromOffset(argOffset);
+ pLoc->m_cStack = cSlots;
+ }
+ }
+#endif
+
#ifdef _TARGET_ARM_
// Get layout information for the argument that the ArgIterator is currently visiting.
void GetArgLoc(int argOffset, ArgLocDesc *pLoc)
@@ -643,7 +666,7 @@ public:
}
#endif // _TARGET_ARM64_
-#if defined(_TARGET_AMD64_) && defined(UNIX_AMD64_ABI)
+#if defined(_TARGET_AMD64_)
// Get layout information for the argument that the ArgIterator is currently visiting.
void GetArgLoc(int argOffset, ArgLocDesc* pLoc)
{
@@ -655,7 +678,6 @@ public:
*pLoc = m_argLocDescForStructInRegs;
return;
}
-#endif // UNIX_AMD64_ABI
if (argOffset == TransitionBlock::StructInRegsOffset)
{
@@ -664,27 +686,47 @@ public:
_ASSERTE(false);
return;
}
+#endif // UNIX_AMD64_ABI
pLoc->Init();
+#if defined(UNIX_AMD64_ABI)
if (TransitionBlock::IsFloatArgumentRegisterOffset(argOffset))
{
// Dividing by 16 as size of each register in FloatArgumentRegisters is 16 bytes.
pLoc->m_idxFloatReg = (argOffset - TransitionBlock::GetOffsetOfFloatArgumentRegisters()) / 16;
pLoc->m_cFloatReg = 1;
}
- else if (!TransitionBlock::IsStackArgumentOffset(argOffset))
+ else
+#endif // UNIX_AMD64_ABI
+ if (!TransitionBlock::IsStackArgumentOffset(argOffset))
{
- pLoc->m_idxGenReg = TransitionBlock::GetArgumentIndexFromOffset(argOffset);
- pLoc->m_cGenReg = 1;
+#if !defined(UNIX_AMD64_ABI)
+ // On Windows x64, we re-use the location in the transition block for both the integer and floating point registers
+ if ((m_argType == ELEMENT_TYPE_R4) || (m_argType == ELEMENT_TYPE_R8))
+ {
+ pLoc->m_idxFloatReg = TransitionBlock::GetArgumentIndexFromOffset(argOffset);
+ pLoc->m_cFloatReg = 1;
+ }
+ else
+#endif
+ {
+ pLoc->m_idxGenReg = TransitionBlock::GetArgumentIndexFromOffset(argOffset);
+ pLoc->m_cGenReg = 1;
+ }
}
else
{
pLoc->m_idxStack = TransitionBlock::GetStackArgumentIndexFromOffset(argOffset);
- pLoc->m_cStack = (GetArgSize() + STACK_ELEM_SIZE - 1) / STACK_ELEM_SIZE;
+ int argOnStackSize;
+ if (IsArgPassedByRef())
+ argOnStackSize = STACK_ELEM_SIZE;
+ else
+ argOnStackSize = GetArgSize();
+ pLoc->m_cStack = (argOnStackSize + STACK_ELEM_SIZE - 1) / STACK_ELEM_SIZE;
}
}
-#endif // _TARGET_AMD64_ && UNIX_AMD64_ABI
+#endif // _TARGET_AMD64_
protected:
DWORD m_dwFlags; // Cached flags