dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.95k stars 4.65k forks source link

[API Proposal]: IL Emit support for FunctionPointer #75348

Open steveharter opened 2 years ago

steveharter commented 2 years ago

[primarily a placeholder for now for planning]

This adds invoke capability to function pointers, layering on See also https://github.com/dotnet/runtime/issues/69273 and https://github.com/dotnet/runtime/issues/75347.

Overloads will be added to ILGenerator.EmitCalli() to support new calling conventions that are modifier-based instead of enum-based. The enum-based calling conventions through System.Runtime.InteropServices.CallingConvention have not scaled well thus specifying "CallConv" types from the System.Runtime.InteropServices is assumed. Currently these include:

The new APIs may likely take a proposed MethodSignature class from https://github.com/dotnet/runtime/issues/75347.

ghost commented 2 years ago

Tagging subscribers to this area: @dotnet/area-system-reflection See info in area-owners.md if you want to be subscribed.

Issue Details
[primarily a placeholder for now for planning] This adds invoke capability to function pointers, layering on See also https://github.com/dotnet/runtime/issues/69273 and https://github.com/dotnet/runtime/issues/75347. Overloads will be added to `ILGenerator.EmitCalli()` to support new calling conventions that are modifier-based instead of enum-based. The enum-based calling conventions through `System.Runtime.InteropServices.CallingConvention` have not scaled well thus specifying "CallConv" types from the `System.Runtime.InteropServices` is assumed. Currently these include: - [CallConvCdecl](https://docs.microsoft.com/dotnet/api/system.runtime.compilerservices.callconvcdecl) - [CallConvStdCall](https://docs.microsoft.com/dotnet/api/system.runtime.compilerservices.callconvstdcall) - [CallConvThiscall](https://docs.microsoft.com/dotnet/api/system.runtime.compilerservices.callconvthiscall) - [CallConvFastcall](https://docs.microsoft.com/dotnet/api/system.runtime.compilerservices.callconvfastcall) - [CallConvSuppressGCTransition](https://docs.microsoft.com/dotnet/api/system.runtime.compilerservices.callconvsuppressgctransition) - [CallConvMemberFunction](https://docs.microsoft.com/dotnet/api/system.runtime.compilerservices.callconvmemberfunction) The new APIs may likely take a proposed `MethodSignature` class from https://github.com/dotnet/runtime/issues/75347.
Author: steveharter
Assignees: steveharter
Labels: `api-needs-work`, `area-System.Reflection`
Milestone: 8.0.0
ghost commented 2 years ago

Tagging subscribers to this area: @dotnet/area-system-reflection-emit See info in area-owners.md if you want to be subscribed.

Issue Details
[primarily a placeholder for now for planning] This adds invoke capability to function pointers, layering on See also https://github.com/dotnet/runtime/issues/69273 and https://github.com/dotnet/runtime/issues/75347. Overloads will be added to `ILGenerator.EmitCalli()` to support new calling conventions that are modifier-based instead of enum-based. The enum-based calling conventions through `System.Runtime.InteropServices.CallingConvention` have not scaled well thus specifying "CallConv" types from the `System.Runtime.InteropServices` is assumed. Currently these include: - [CallConvCdecl](https://docs.microsoft.com/dotnet/api/system.runtime.compilerservices.callconvcdecl) - [CallConvStdCall](https://docs.microsoft.com/dotnet/api/system.runtime.compilerservices.callconvstdcall) - [CallConvThiscall](https://docs.microsoft.com/dotnet/api/system.runtime.compilerservices.callconvthiscall) - [CallConvFastcall](https://docs.microsoft.com/dotnet/api/system.runtime.compilerservices.callconvfastcall) - [CallConvSuppressGCTransition](https://docs.microsoft.com/dotnet/api/system.runtime.compilerservices.callconvsuppressgctransition) - [CallConvMemberFunction](https://docs.microsoft.com/dotnet/api/system.runtime.compilerservices.callconvmemberfunction) The new APIs may likely take a proposed `MethodSignature` class from https://github.com/dotnet/runtime/issues/75347.
Author: steveharter
Assignees: steveharter
Labels: `api-needs-work`, `area-System.Reflection`, `area-System.Reflection.Emit`
Milestone: 8.0.0