-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Mono] Implement support for CallConvSuppressGCTransition #46451
Labels
Milestone
Comments
Dotnet-GitSync-Bot
added
the
untriaged
New issue has not been triaged by the area owner
label
Dec 29, 2020
I'm not actually sure that mono today emits a GC transition for something like: int n;
unsafe {
delegate* unmanaged[Cdecl]<int*, int> fptr
= (delegate* unmanaged[Cdecl]<int*, int>)GetNextUIntFunctionPointer();
fptr(&n);
} We need to complete #38480 - the |
7 tasks
lambdageek
added a commit
to lambdageek/runtime
that referenced
this issue
Jan 14, 2021
ghost
added
the
in-pr
There is an active PR which will close this issue when it is merged
label
Jan 14, 2021
monojenkins
pushed a commit
to monojenkins/mono
that referenced
this issue
Jan 14, 2021
* Parse modopt encoded calling conventions Add `suppress_gc_transition` bit to `MonoMethodSignature` to add support for the `SuppressGCTransition` unmanaged calling convention modifier. * Don't emit a wrapper on `calli` if `suppress_gc_transition` is set This adds support for `delegate* unmanaged[Cdecl, SuppressGCTransition] <TRet, TArgs...>` function pointers. (And other base calling conventions other than Cdecl). * Allow blittable types in `mono_marshal_get_native_func_wrapper_indirect` This was already used by C++/CLI, so the C# function pointers spec allows blittable types in unmanaged function pointer types. * Remove SuppressGCTransitionTest from exclude list Fixes dotnet/runtime#46451
lambdageek
added a commit
to mono/mono
that referenced
this issue
Jan 15, 2021
* Parse modopt encoded calling conventions Add `suppress_gc_transition` bit to `MonoMethodSignature` to add support for the `SuppressGCTransition` unmanaged calling convention modifier. * Don't emit a wrapper on `calli` if `suppress_gc_transition` is set This adds support for `delegate* unmanaged[Cdecl, SuppressGCTransition] <TRet, TArgs...>` function pointers. (And other base calling conventions other than Cdecl). * Allow blittable types in `mono_marshal_get_native_func_wrapper_indirect` This was already used by C++/CLI, so the C# function pointers spec allows blittable types in unmanaged function pointer types. * Remove SuppressGCTransitionTest from exclude list Fixes dotnet/runtime#46451 Co-authored-by: lambdageek <[email protected]>
lambdageek
added a commit
that referenced
this issue
Jan 15, 2021
* [metadata] Parse modopt encoded calling conventions Add suppress_gc_transition bit to MonoMethodSignature to add support for the SuppressGCTransition unmanaged calling convention modifier. * [mini] Don't emit a wrapper on calli if suppress_gc_transition is set This adds support for `delegate* unmanaged[Cdecl, SuppressGCTransition] <TRet, TArgs...>` function pointers. (And other base calling conventions other than Cdecl). * [marshal] Allow blittable types in mono_marshal_get_native_func_wrapper_indirect This was already used by C++/CLI, so the C# function pointers spec allows blittable types in unmanaged function pointer types. * [tests] Remove SuppressGCTransitionTest from exclude list Fixes #46451
ghost
removed
the
in-pr
There is an active PR which will close this issue when it is merged
label
Jan 15, 2021
ghost
locked as resolved and limited conversation to collaborators
Feb 14, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
See #38134. The CoreCLR implementation is in #46343
This gives the ability to declare a function pointer that can be called without a GC transition.
For example:
The call to
GetNextUintFunctionPointer
returns a pointer to some unmanaged function. By declaring its calling convention as[Cdecl, SuppressGCTransition]
(as opposed to[Cdecl]
) the caller code does not need to do a managed-to-native transition when calling throughfptr
. All the rules ofSuppressGCTransitionAttribute
still apply: the native function can't block, throw exceptions, call back into the runtime, manipulate locks or other concurrency primitives, etc.Re-enable
Interop/PInvoke/Attributes/SuppressGCTransition/SuppressGCTransitionTest/
insrc/tests/issues.targets
once this is fixed.The text was updated successfully, but these errors were encountered: