Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

PInvoke calli support for CoreRT #18534

Merged
merged 8 commits into from
Jun 19, 2018
Merged

PInvoke calli support for CoreRT #18534

merged 8 commits into from
Jun 19, 2018

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Jun 19, 2018

In CoreCLR, PInvoke calli is implemented via a assembly helper that does a lot of heavy lifting (compares signatures, etc.). This heavy lifting is hard to replicate in CoreRT.

This change introduces an alternative path for calli instruction that is full AOT friendly. When the JIT runs into PInvoke calli, the JIT asks the EE for a regular method to replace it with.

I have also cleaned up a few related things that I have run into along the way (see commit descriptions for details).

Contributes to dotnet/corert#5587

Copy link
Member

@AndyAyersMS AndyAyersMS left a comment

Choose a reason for hiding this comment

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

Looks good, just one small comment.

You almost certainly know this, but when this change gets mirrored over to desktop it will require some additional changes in desktop files. @sandreenko or I can help with this.

@@ -107,6 +107,7 @@ INLINE_OBSERVATION(UNSUPPORTED_OPCODE, bool, "unsupported opcode",
INLINE_OBSERVATION(DEBUG_CODEGEN, bool, "debug codegen", FATAL, CALLER)
INLINE_OBSERVATION(IS_JIT_NOINLINE, bool, "noinline per JitNoInlineRange", FATAL, CALLER)
INLINE_OBSERVATION(NEEDS_SECURITY_CHECK, bool, "needs security check", FATAL, CALLER)
INLINE_OBSERVATION(PINVOKE_EH, bool, "PInvoke from method with EH", FATAL, CALLER)
Copy link
Member

Choose a reason for hiding this comment

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

NIt: seems like this should be a CALLSITE observation ... ?

@jkotas
Copy link
Member Author

jkotas commented Jun 19, 2018

@dotnet-bot test Windows_NT x64 Checked corefx_baseline

@jkotas jkotas merged commit 10111af into dotnet:master Jun 19, 2018
@jkotas jkotas deleted the pinvoke-calli branch June 19, 2018 13:39
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
* Ifdef out NGen-specific PInvoke calli inlining limitation for CoreCLR

This limitation seems to be a left-over from effort to eliminate JITing with fragile NGen.

* Delete dead partial-trust related code

* Allow PInvoke stub inlining

* Add convertCalliToCall JIT/EE interface method

* Update superpmi


Commit migrated from dotnet/coreclr@10111af
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants