diff options
author | Evgeny Pavlov <lucenticus@gmail.com> | 2017-03-16 07:30:37 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2017-03-15 21:30:37 -0700 |
commit | 6f3aa999a842cfa4bf83415e88ea7fb1650ab5bf (patch) | |
tree | 13430a26dbea19627595798af073d5638184713b | |
parent | debcfa9e83bb9d5896f922fd8682241dec79d5e7 (diff) | |
download | coreclr-6f3aa999a842cfa4bf83415e88ea7fb1650ab5bf.tar.gz coreclr-6f3aa999a842cfa4bf83415e88ea7fb1650ab5bf.tar.bz2 coreclr-6f3aa999a842cfa4bf83415e88ea7fb1650ab5bf.zip |
[x86/Linux] Fix NativeCallableTest (#10060)
* [x86/Linux] Fix NativeCallableTest
* Move m_cbActualArgSize adjustment outside if statement
* [x86/Linux] Adjust m_cbActualArgSize in case pStubMD == NULL
* [x86/Linux] Move m_cbActualArgSize calculation to #else part of '#ifdef _TARGET_X86_'
* [x86/Linux] Remove redundant computations, add comments for m_cbActualArgSize meaning
-rw-r--r-- | src/vm/dllimportcallback.cpp | 16 | ||||
-rw-r--r-- | src/vm/dllimportcallback.h | 1 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/vm/dllimportcallback.cpp b/src/vm/dllimportcallback.cpp index fb968751ca..b72bc16058 100644 --- a/src/vm/dllimportcallback.cpp +++ b/src/vm/dllimportcallback.cpp @@ -1375,15 +1375,9 @@ VOID UMThunkMarshInfo::RunTimeInit() } } - // - // m_cbActualArgSize gets the number of arg bytes for the NATIVE signature - // - m_cbActualArgSize = - (pStubMD != NULL) ? pStubMD->AsDynamicMethodDesc()->GetNativeStackArgSize() : pMD->SizeOfArgStack(); #if defined(_TARGET_X86_) MetaSig sig(pMD); - ArgIterator argit(&sig); int numRegistersUsed = 0; // @@ -1407,11 +1401,14 @@ VOID UMThunkMarshInfo::RunTimeInit() m_cbStackArgSize += StackElemSize(cbSize); } } + m_cbActualArgSize = (pStubMD != NULL) ? pStubMD->AsDynamicMethodDesc()->GetNativeStackArgSize() : offs; + PInvokeStaticSigInfo sigInfo; if (pMD != NULL) new (&sigInfo) PInvokeStaticSigInfo(pMD); else new (&sigInfo) PInvokeStaticSigInfo(GetSignature(), GetModule()); + if (sigInfo.GetCallConv() == pmCallConvCdecl) { // caller pop @@ -1422,6 +1419,13 @@ VOID UMThunkMarshInfo::RunTimeInit() // callee pop m_cbRetPop = static_cast<UINT16>(m_cbActualArgSize); } +#else // _TARGET_X86_ + // + // m_cbActualArgSize gets the number of arg bytes for the NATIVE signature + // + m_cbActualArgSize = + (pStubMD != NULL) ? pStubMD->AsDynamicMethodDesc()->GetNativeStackArgSize() : pMD->SizeOfArgStack(); + #endif // _TARGET_X86_ #endif // _TARGET_X86_ && !FEATURE_STUBS_AS_IL diff --git a/src/vm/dllimportcallback.h b/src/vm/dllimportcallback.h index b50b917337..af2a0b1d92 100644 --- a/src/vm/dllimportcallback.h +++ b/src/vm/dllimportcallback.h @@ -220,6 +220,7 @@ private: // On x86, NULL for no-marshal signatures // On non-x86, the managed entrypoint for no-delegate no-marshal signatures UINT32 m_cbActualArgSize; // caches m_pSig.SizeOfFrameArgumentArray() + // On x86/Linux we have to augment with numRegistersUsed * STACK_ELEM_SIZE #if defined(_TARGET_X86_) UINT16 m_cbRetPop; // stack bytes popped by callee (for UpdateRegDisplay) #if defined(FEATURE_STUBS_AS_IL) |