diff options
author | Fadi Hanna <fadim@microsoft.com> | 2019-04-01 12:07:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-01 12:07:47 -0700 |
commit | bc9248cad132fa01dd2b641b6b22849bc7a05457 (patch) | |
tree | 5d1ee71059353a66004fc7a4d2501a7452db849f /src/vm/method.cpp | |
parent | ff43a803a814eaaa5eba02cafa4a91def3e4c7be (diff) | |
download | coreclr-bc9248cad132fa01dd2b641b6b22849bc7a05457.tar.gz coreclr-bc9248cad132fa01dd2b641b6b22849bc7a05457.tar.bz2 coreclr-bc9248cad132fa01dd2b641b6b22849bc7a05457.zip |
Enable R2R compilation/inlining of PInvoke stubs where no marshalling is required (#22560)
* These changes enable the inlining of some PInvokes that do not require any marshalling. With inlined pinvokes, R2R performance should become slightly better, since we'll avoid jitting some of the pinvoke IL stubs that we jit today for S.P.CoreLib. Performance gains not yet measured.
* Added JIT_PInvokeBegin/End helpers for all architectures. Linux stubs not yet implemented
* Add INLINE_GETTHREAD for arm/arm64
* Set CORJIT_FLAG_USE_PINVOKE_HELPERS jit flag for ReadyToRun compilations
* Updating R2RDump tool to handle pinvokes
Diffstat (limited to 'src/vm/method.cpp')
-rw-r--r-- | src/vm/method.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/vm/method.cpp b/src/vm/method.cpp index 70d79ca515..d180014a3a 100644 --- a/src/vm/method.cpp +++ b/src/vm/method.cpp @@ -5127,6 +5127,13 @@ FARPROC NDirectMethodDesc::FindEntryPointWithMangling(HINSTANCE hMod, PTR_CUTF8 if (IsStdCall()) { + if (GetModule()->IsReadyToRun()) + { + // Computing if marshalling is required also computes the required stack size. We need the stack size to correctly form the + // name of the import pinvoke function on x86 + ((NDirectMethodDesc*)this)->MarshalingRequired(); + } + DWORD probedEntrypointNameLength = (DWORD)(strlen(entryPointName) + 1); // 1 for null terminator int dstbufsize = (int)(sizeof(char) * (probedEntrypointNameLength + 10)); // 10 for stdcall mangling LPSTR szProbedEntrypointName = ((LPSTR)_alloca(dstbufsize + 1)); |