diff options
author | Steve MacLean <sdmaclea.qdt@qualcommdatacenter.com> | 2018-04-19 12:22:10 -0400 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2018-04-19 09:22:10 -0700 |
commit | 094a2e8d1d46f373577c0d5a494547e0ed563f40 (patch) | |
tree | 152b74e19ea7873a8712ae4439d453fd1d871881 | |
parent | ae0ce20407606a2fbb825eba2352ab5efd3f3d58 (diff) | |
download | coreclr-094a2e8d1d46f373577c0d5a494547e0ed563f40.tar.gz coreclr-094a2e8d1d46f373577c0d5a494547e0ed563f40.tar.bz2 coreclr-094a2e8d1d46f373577c0d5a494547e0ed563f40.zip |
[Arm64/Linux] Fix GenericPInvokeCalliHelper (#17659)
-rw-r--r-- | src/jit/target.h | 4 | ||||
-rw-r--r-- | src/vm/amd64/PInvokeStubs.asm | 8 | ||||
-rw-r--r-- | src/vm/amd64/pinvokestubs.S | 8 | ||||
-rw-r--r-- | src/vm/arm64/PInvokeStubs.asm | 4 | ||||
-rw-r--r-- | src/vm/arm64/pinvokestubs.S | 5 | ||||
-rw-r--r-- | src/vm/dllimport.cpp | 28 | ||||
-rw-r--r-- | tests/arm64/corefx_test_exclusions.txt | 1 |
7 files changed, 9 insertions, 49 deletions
diff --git a/src/jit/target.h b/src/jit/target.h index 15f4693d05..9c64045a83 100644 --- a/src/jit/target.h +++ b/src/jit/target.h @@ -1746,8 +1746,8 @@ typedef unsigned short regPairNoSmall; // arm: need 12 bits #define RBM_PINVOKE_COOKIE_PARAM RBM_R15 // GenericPInvokeCalliHelper unmanaged target Parameter - #define REG_PINVOKE_TARGET_PARAM REG_R14 - #define RBM_PINVOKE_TARGET_PARAM RBM_R14 + #define REG_PINVOKE_TARGET_PARAM REG_R12 + #define RBM_PINVOKE_TARGET_PARAM RBM_R12 // IL stub's secret MethodDesc parameter (JitFlags::JIT_FLAG_PUBLISH_SECRET_PARAM) #define REG_SECRET_STUB_PARAM REG_R12 diff --git a/src/vm/amd64/PInvokeStubs.asm b/src/vm/amd64/PInvokeStubs.asm index 4801697fee..7255fa2ebf 100644 --- a/src/vm/amd64/PInvokeStubs.asm +++ b/src/vm/amd64/PInvokeStubs.asm @@ -32,14 +32,6 @@ LEAF_ENTRY GenericPInvokeCalliHelper, _TEXT jz GenericPInvokeCalliGenILStub ; - ; We need to distinguish between a MethodDesc* and an unmanaged target in PInvokeStubForHost(). - ; The way we do this is to shift the managed target to the left by one bit and then set the - ; least significant bit to 1. This works because MethodDesc* are always 8-byte aligned. - ; - shl PINVOKE_CALLI_TARGET_REGISTER, 1 - or PINVOKE_CALLI_TARGET_REGISTER, 1 - - ; ; jump to existing IL stub ; jmp rax diff --git a/src/vm/amd64/pinvokestubs.S b/src/vm/amd64/pinvokestubs.S index 49697e1aad..dad668af23 100644 --- a/src/vm/amd64/pinvokestubs.S +++ b/src/vm/amd64/pinvokestubs.S @@ -25,14 +25,6 @@ LEAF_ENTRY GenericPInvokeCalliHelper, _TEXT jz C_FUNC(GenericPInvokeCalliGenILStub) // - // We need to distinguish between a MethodDesc* and an unmanaged target in PInvokeStubForHost(). - // The way we do this is to shift the managed target to the left by one bit and then set the - // least significant bit to 1. This works because MethodDesc* are always 8-byte aligned. - // - shl PINVOKE_CALLI_TARGET_REGISTER, 1 - or PINVOKE_CALLI_TARGET_REGISTER, 1 - - // // jump to existing IL stub // jmp rax diff --git a/src/vm/arm64/PInvokeStubs.asm b/src/vm/arm64/PInvokeStubs.asm index afe2fb4ec8..e21151e179 100644 --- a/src/vm/arm64/PInvokeStubs.asm +++ b/src/vm/arm64/PInvokeStubs.asm @@ -124,9 +124,9 @@ __PInvokeGenStubFuncName SETS "$__PInvokeGenStubFuncName":CC:"_RetBuffArg" ; ; in: ; x15 = VASigCookie* -; x14 = Unmanaged target +; x12 = Unmanaged target ; - PINVOKE_STUB GenericPInvokeCalli, x15, x14, {true} + PINVOKE_STUB GenericPInvokeCalli, x15, x12, {true} ; ------------------------------------------------------------------ ; VarargPInvokeStub_RetBuffArg & VarargPInvokeGenILStub_RetBuffArg diff --git a/src/vm/arm64/pinvokestubs.S b/src/vm/arm64/pinvokestubs.S index 00d64b4ed2..f13d2da72e 100644 --- a/src/vm/arm64/pinvokestubs.S +++ b/src/vm/arm64/pinvokestubs.S @@ -32,7 +32,6 @@ // if null goto stub generation cbz x9, LOCAL_LABEL(\__PInvokeStubFuncName\()_0) - EPILOG_BRANCH_REG x9 LOCAL_LABEL(\__PInvokeStubFuncName\()_0): @@ -96,9 +95,9 @@ PINVOKE_STUB VarargPInvokeStub, VarargPInvokeGenILStub, VarargPInvokeStubWorker, // // in: // x15 = VASigCookie* -// x14 = Unmanaged target +// x12 = Unmanaged target // -PINVOKE_STUB GenericPInvokeCalliHelper, GenericPInvokeCalliGenILStub, GenericPInvokeCalliStubWorker, x15, x14, 1 +PINVOKE_STUB GenericPInvokeCalliHelper, GenericPInvokeCalliGenILStub, GenericPInvokeCalliStubWorker, x15, x12, 1 // ------------------------------------------------------------------ // VarargPInvokeStub_RetBuffArg & VarargPInvokeGenILStub_RetBuffArg diff --git a/src/vm/dllimport.cpp b/src/vm/dllimport.cpp index 5b51ee302a..c0f7d1fa24 100644 --- a/src/vm/dllimport.cpp +++ b/src/vm/dllimport.cpp @@ -2253,31 +2253,9 @@ void NDirectStubLinker::DoNDirect(ILCodeStream *pcsEmit, DWORD dwStubFlags, Meth // if we ever NGEN CALLI stubs, this would have to be done differently _ASSERTE(!SF_IsNGENedStub(dwStubFlags)); -#ifndef CROSSGEN_COMPILE - -#ifdef _TARGET_X86_ - - { - // for managed-to-unmanaged CALLI that requires marshaling, the target is passed - // as the secret argument to the stub by GenericPInvokeCalliHelper (asmhelpers.asm) - EmitLoadStubContext(pcsEmit, dwStubFlags); - } - - -#else // _TARGET_X86_ - - { - // the secret arg has been shifted to left and ORed with 1 (see code:GenericPInvokeCalliHelper) - EmitLoadStubContext(pcsEmit, dwStubFlags); -#ifndef _TARGET_ARM_ - pcsEmit->EmitLDC(1); - pcsEmit->EmitSHR_UN(); -#endif - } - -#endif // _TARGET_X86_ - -#endif // CROSSGEN_COMPILE + // for managed-to-unmanaged CALLI that requires marshaling, the target is passed + // as the secret argument to the stub by GenericPInvokeCalliHelper (asmhelpers.asm) + EmitLoadStubContext(pcsEmit, dwStubFlags); } else #ifdef FEATURE_COMINTEROP diff --git a/tests/arm64/corefx_test_exclusions.txt b/tests/arm64/corefx_test_exclusions.txt index 1d5f55fd33..6b00a58978 100644 --- a/tests/arm64/corefx_test_exclusions.txt +++ b/tests/arm64/corefx_test_exclusions.txt @@ -1,4 +1,3 @@ Invariant.Tests System.Diagnostics.Process.Tests -System.Reflection.Emit.ILGeneration.Tests System.ValueTuple.Tests |