-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mono] Add support for UnmanagedCallersOnlyAttribute (#38728)
* [marshal] Add mono_method_has_unmanaged_callers_only_attribute * [marshal] Allow calls to mono_marshal_get_managed_wrapped without a delegate class In that case, create a wrapper based on the signature of the method itself. * [aot] Allow decode_method_ref to decode NATIVE_TO_MANAGED wrappers without a delegate class Bump the AOT file format * [interp] ldftn will return a native-to-managed wrapper to UnmanagedCallersOnly methods * aot: emit byte when we don't expect a class * jit: create wrapper creation for ldftn in method-to-ir Do it at IR generation of the caller, not every time the ldftn is executed * jit: don't create a jump trampoline for ldftn of a native-to-managed wrapper The wrapper might be called from a thread that's not attached to the runtime, and the jump trampoline will look at TLS vars that are not initialized * interp: transform LDFTN into LDC of a create_method_pointer for UnmanagedCallersOnly method * marshal: throw invalid program exception for instance and generic methods * Emit IPE throw instead of aborting JIT or interp compilation for bad UnmanagedCallersOnly methods Instead of throwing while JITing (or transforming), throw when the LDFTN is executed. * disallow delegate constructor calls on UnmanagedCallersOnly methods * throw IPE if UnmanagedCallersOnly method has non-blittable args * disallow DllImport and UnmanagedCallersOnly together throw NotSupportedException Co-authored-by: Ryan Lucia <[email protected]>
- Loading branch information
1 parent
838fcff
commit 1e3c959
Showing
11 changed files
with
312 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.