From beaf718cc6e3a0e786191ce322839e66619b5a54 Mon Sep 17 00:00:00 2001 From: SaeHie Park Date: Wed, 15 Feb 2017 14:12:06 +0900 Subject: [x86/Linux] Fix CreateInstantiatingILStub (#9590) The hidden argument should be always passed last for x86 --- src/vm/prestub.cpp | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/vm/prestub.cpp b/src/vm/prestub.cpp index 8e158d2fb9..67a184f4af 100644 --- a/src/vm/prestub.cpp +++ b/src/vm/prestub.cpp @@ -838,39 +838,31 @@ 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++; } #if defined(_TARGET_X86_) - if (numArgs < NUM_ARGUMENT_REGISTERS) + // 2.2 Push the rest of the arguments for x86 + for (unsigned i = 0; i < msig.NumFixedArgs();i++) { -#endif // _TARGET_X86_ - // 2.2 Push the hidden context param - // InstantiatingStub - pCode->EmitLDC((TADDR)pHiddenArg); -#if defined(_TARGET_X86_) + pCode->EmitLDARG(i); } #endif // _TARGET_X86_ - // 2.3 Push the rest of the arguments + // 2.3 Push the hidden context param + // InstantiatingStub + pCode->EmitLDC((TADDR)pHiddenArg); + +#if !defined(_TARGET_X86_) + // 2.4 Push the rest of the arguments for not x86 for (unsigned i = 0; i < msig.NumFixedArgs();i++) { pCode->EmitLDARG(i); } - -#if defined(_TARGET_X86_) - if (numArgs >= NUM_ARGUMENT_REGISTERS) - { - // 2.4 Push the hidden context param - // InstantiatingStub - pCode->EmitLDC((TADDR)pHiddenArg); - } -#endif // _TARGET_X86_ +#endif // !_TARGET_X86_ // 2.5 Push the target address pCode->EmitLDC((TADDR)pTargetMD->GetMultiCallableAddrOfCode(CORINFO_ACCESS_ANY)); -- cgit v1.2.3