Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/jit/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions src/vm/amd64/PInvokeStubs.asm
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ LEAF_ENTRY GenericPInvokeCalliHelper, _TEXT
test rax, rax
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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have been removed when FEATURE_INCLUDE_ALL_INTERFACES was removed in 1476776

;
; jump to existing IL stub
;
Expand Down
8 changes: 0 additions & 8 deletions src/vm/amd64/pinvokestubs.S
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ LEAF_ENTRY GenericPInvokeCalliHelper, _TEXT
test rax, rax
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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have been removed when FEATURE_INCLUDE_ALL_INTERFACES was removed in 1476776

//
// jump to existing IL stub
//
Expand Down
4 changes: 2 additions & 2 deletions src/vm/arm64/PInvokeStubs.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/vm/arm64/pinvokestubs.S
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
// if null goto stub generation
cbz x9, LOCAL_LABEL(\__PInvokeStubFuncName\()_0)


EPILOG_BRANCH_REG x9

LOCAL_LABEL(\__PInvokeStubFuncName\()_0):
Expand Down Expand Up @@ -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
Expand Down
28 changes: 3 additions & 25 deletions src/vm/dllimport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have been removed when FEATURE_INCLUDE_ALL_INTERFACES was removed in 1476776

#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
Expand Down
1 change: 0 additions & 1 deletion tests/arm64/corefx_test_exclusions.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Invariant.Tests
System.Diagnostics.Process.Tests
System.Reflection.Emit.ILGeneration.Tests
System.ValueTuple.Tests