diff options
author | SaeHie Park <saehie.park@gmail.com> | 2017-01-11 08:43:23 +0900 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2017-01-11 00:43:23 +0100 |
commit | b1586fb32ae6bbb37966952c10308b328021db43 (patch) | |
tree | 7e2ad355a0050ef318e717c45cba558f9b1c5f18 /src | |
parent | 7bb52294ab9d555d773eb5f64e2fbd876d1a5dff (diff) | |
download | coreclr-b1586fb32ae6bbb37966952c10308b328021db43.tar.gz coreclr-b1586fb32ae6bbb37966952c10308b328021db43.tar.bz2 coreclr-b1586fb32ae6bbb37966952c10308b328021db43.zip |
[x86/Linux] Fix generic context(hidden arg) position (#8848)
This fixes how to handle generic context position in x86 by num of arguments
Diffstat (limited to 'src')
-rw-r--r-- | src/vm/prestub.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/vm/prestub.cpp b/src/vm/prestub.cpp index e0d4096347..9fd7c52446 100644 --- a/src/vm/prestub.cpp +++ b/src/vm/prestub.cpp @@ -829,15 +829,24 @@ Stub * CreateInstantiatingILStub(MethodDesc* pTargetMD, void* pHiddenArg) CreateInstantiatingILStubTargetSig(pTargetMD, typeContext, &stubSigBuilder); // 2. Emit the method body + unsigned int numArgs = msig.NumFixedArgs(); if (msig.HasThis()) { // 2.1 Push the thisptr pCode->EmitLoadThis(); + numArgs++; } - // 2.2 Push the hidden context param - // InstantiatingStub - pCode->EmitLDC((TADDR)pHiddenArg); +#if defined(_TARGET_X86_) + if (numArgs < NUM_ARGUMENT_REGISTERS) + { +#endif // _TARGET_X86_ + // 2.2 Push the hidden context param + // InstantiatingStub + pCode->EmitLDC((TADDR)pHiddenArg); +#if defined(_TARGET_X86_) + } +#endif // _TARGET_X86_ // 2.3 Push the rest of the arguments for (unsigned i = 0; i < msig.NumFixedArgs();i++) @@ -845,10 +854,19 @@ Stub * CreateInstantiatingILStub(MethodDesc* pTargetMD, void* pHiddenArg) pCode->EmitLDARG(i); } - // 2.4 Push the target address +#if defined(_TARGET_X86_) + if (numArgs >= NUM_ARGUMENT_REGISTERS) + { + // 2.4 Push the hidden context param + // InstantiatingStub + pCode->EmitLDC((TADDR)pHiddenArg); + } +#endif // _TARGET_X86_ + + // 2.5 Push the target address pCode->EmitLDC((TADDR)pTargetMD->GetMultiCallableAddrOfCode(CORINFO_ACCESS_ANY)); - // 2.5 Do the calli + // 2.6 Do the calli pCode->EmitCALLI(TOKEN_ILSTUB_TARGET_SIG, msig.NumFixedArgs() + 1, msig.IsReturnTypeVoid() ? 0 : 1); pCode->EmitRET(); |