Skip to content
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

Implement CallConvMemberFunction support for Mono #50440

Open
lambdageek opened this issue Mar 30, 2021 · 2 comments
Open

Implement CallConvMemberFunction support for Mono #50440

lambdageek opened this issue Mar 30, 2021 · 2 comments

Comments

@lambdageek
Copy link
Member

lambdageek commented Mar 30, 2021

That is, implement the Mono part of #46775

CallConvMemberFunction is a new unmanaged calling convention modifier that can be applied in combination with another calling convention on x86 that can be used to modify a cdecl, stdcall or fastcall calling convention to call a member function.

For reference, the CoreCLR support was added in #47828

Note that there are tests that are disabled that reference this issue, see #50461

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Mar 30, 2021
@lambdageek lambdageek added area-Interop-mono and removed untriaged New issue has not been triaged by the area owner labels Mar 30, 2021
@lambdageek lambdageek added this to the Future milestone Mar 30, 2021
@lateralusX
Copy link
Member

lateralusX commented Jan 25, 2022

Windows x64 on Mono needs support for CallConvMemberFunction since win64 ABI handles value types differently for member functions, compared to global/static functions. The following runtime tests have been disabled on Mono Windows in issues.targets depending on this issue:

/JIT/Directed/callconv/PlatformDefaultMemberFunction/PlatformDefaultMemberFunctionTest/*
/JIT/Directed/callconv/CdeclMemberFunction/CdeclMemberFunctionTest/*
/JIT/Directed/callconv/StdCallMemberFunction/StdCallMemberFunctionTest/*
/JIT/Directed/callconv/ThisCall/ThisCallTest/*

Failures are caused by delegates using CallConvMemberFunction and since Mono currently don't detect it, it will handle the pinvoke following win64 ABI defined for global/static functions, but in cases where returned type is a value type and CallConvMemberFunction is used, it should pass allocated return value address in first argument register (regardless of size), or in the case of a C++ member function, in the second argument register (this pointer goes in first argument).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants