-
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: support CallConvSuppressGCTransition #47006
Mono: support CallConvSuppressGCTransition #47006
Conversation
Add suppress_gc_transition bit to MonoMethodSignature to add support for the SuppressGCTransition unmanaged calling convention modifier.
This adds support for `delegate* unmanaged[Cdecl, SuppressGCTransition] <TRet, TArgs...>` function pointers. (And other base calling conventions other than Cdecl).
…er_indirect This was already used by C++/CLI, so the C# function pointers spec allows blittable types in unmanaged function pointer types.
Don't forget to re-enable the SuppressGCTransition runtime test test. It's disabled in issues.targets. |
Done. It's the last commit in the PR 😁 |
@@ -3688,13 +3688,19 @@ mono_marshal_get_native_func_wrapper_indirect (MonoClass *caller_class, MonoMeth | |||
g_assert (!sig->hasthis && ! sig->explicit_this); | |||
g_assert (!sig->is_inflated && !sig->has_type_parameters); | |||
|
|||
#if 0 | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can non-blittable types be passed to unmanaged code, how are they marshalled ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I'm going by what I see in #46402 (comment))
It works the same way as a normal pinvoke: the wrapper does marshalling based on the managed signature. we don't know the exact callee, but we know the types.
Parse modopt encoded calling conventions
Add
suppress_gc_transition
bit toMonoMethodSignature
to add support for theSuppressGCTransition
unmanaged calling convention modifier.Don't emit a wrapper on
calli
ifsuppress_gc_transition
is setThis 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 #46451, Contributes to #38480