Skip to content

[mono] Investigate enabling CanEmitObjectArrayDelegate to respect DynamicCodeSupport feature switch in System.Linq.Expressions library #90092

Open
@ivanpovazan

Description

@ivanpovazan

Based on discussion in: #87924 investigate performance and size impact of enabling

internal static bool CanEmitObjectArrayDelegate => true;
to respect DynamicCodeSupport feature switch setting, ie:

internal static bool CanEmitObjectArrayDelegate => RuntimeFeature.IsDynamicCodeSupported;;

This means that in AOT mode the property becomes: CanEmitObjectArrayDelegate=false and in order to support this setting Mono would have to implement a private CoreLib API which:

  • creates a strongly typed Delegate (e.g. Func<int, int>) that boxes all it's arguments
  • puts the arguments into an array
  • dispatches to a Func<object?[], object?> delegate to do the actual work, and finally
  • unboxes the result

References: comment1 and comment2.

This would also align how System.Linq.Expressions is supported in other AOT compilers - NativeAOT.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions