Skip to content

Mono work necessary to support IL-based invoke #68928

Description

@steveharter

Per this issue and comment here's the Mono work necessary to support the IL Emit fast-path. This effort will also be used to support the planned new Invoke() APIs to support byref-like types.

Native changes

In RuntimeMethodInfo.InternalInvoke, apply the same changes as made to CoreClr's RuntimeMethodHandle::Invoke including:

  • Pass parameters byref instead of by System.Object. This primarily means value types are no longer required to be boxed; this will be leveraged more when we support byref-like types later. Also, when we do that the return value and obj parameter will also need to be changed to be byref or use TypedReference pending design.
  • All conversions removed such as from Int to Long (moved to managed).
  • No exception handling for TargetInvocationException (moved to managed). Also see the breaking change issue.
    • A null byref for a byref-like parameter should just throw now instead of passing default().
    • Invalid ctor parameters for size should just throw wrapped in TIE instead of outside the TIE.
    • See Update runtime Invoke exception handling #67457
  • Nullable<T> is now passed as a true Nullable<T>, not as a boxed T or null.

Managed changes

  • Change the various Invoker and shared invoke code to remove Mono special casing.
    • Search for // Temporary until Mono is updated and remove the corresponding #ifs.
    • In the Method and Constructor invoker classes, Mono should use the same exception handling as Core which is basically try\catch(Exception) without any one-off catches for misc exception types.
  • Update RuntimeType.CheckValue() (see the Core implementation)
    • Perform validation and conversions that were probably handled in native code before; Core added InvokeUtils.ConvertOrWiden which should be able to be re-used.
    • Add special Nullable<T> calls to create true nullables (see the Core implementation)

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions