Skip to content

Mono: correctly handle new 0x09 ("unmanaged") calling convention in metadata #38480

Closed

Description

@lambdageek

In #38357, a new calling convention value is added to function signatures. Mono should not crash when we see this value in assemblies.

The runtime should basically treat it the same as cdecl on non-Windows platforms (and on Windows for .net 5, too).

When the execution engine sees the calli fsig IL instruction, we will need to look for unmanaged in fsig and do a GC transition around the call.

Next, a modopt on the return type of the signature will encode details of the calling convention #34805

Finally, if the unmanaged calling convention modopts have CallConvSuppressGCTransition as one of the options, we can drop the GC transition around the indirect call.

Tasks:

Activity

  1. added this to the 5.0.0 milestone on Jun 26, 2020
  2. added
    untriaged
    on Jun 26, 2020
  3. removed
    untriaged
    on Jun 26, 2020
  4. self-assigned this
    on Jun 26, 2020
  5. lambdageek commented on Jul 8, 2020

    @lambdageek
    MemberAuthor

    An initial attempt is at lambdageek/mono@8684def
    need to chase down all the places that look at the calling convention and add a case for this one.

  6. lambdageek commented on Jul 11, 2020

    @lambdageek
    MemberAuthor

    Related CoreCLR PR #39030

    Need to handle, in particular the case where unmanaged+modopt is different from an existing unmanaged xyz cconv https://github.com/dotnet/runtime/pull/39030/files#r452569548

  7. vargaz commented on Jul 15, 2020

    @vargaz
    Contributor

    ikvm changes:
    mono/mono#20119

  8. vargaz commented on Jul 15, 2020

    @vargaz
    Contributor

    monodis prints:
    calli signature-0x11000006
    for all calli signatures.

  9. marek-safar commented on Aug 3, 2020

    @marek-safar
    Contributor

    @lambdageek is there anything else to be done?

  10. CoffeeFlux commented on Aug 10, 2020

    @CoffeeFlux
    Contributor

    I guess the initial work was covered by #38728? So if we're updated in ikdasm and monodis, I guess we're good?

  11. CoffeeFlux commented on Aug 10, 2020

    @CoffeeFlux
    Contributor

    I'm closing this unless anyone knows of remaining work. The issue's topics seem to be covered. cc: @vargaz

  12. 7 remaining items

  13. added
    tracking
    on Jan 4, 2021
  14. SamMonoRT commented on Jul 22, 2021

    @SamMonoRT
    Member

    @BrzVlad - is the last tracking item above " interp - ditto - emit GC transitions around calli instructions with the pinvoke bit set." necessary for 6.0 ?

  15. SamMonoRT commented on Aug 6, 2021

    @SamMonoRT
    Member

    Assigning to @BrzVlad for the last item

  16. ghost locked as resolved and limited conversation to collaborators on Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-VM-meta-monotracking

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions