Skip to content

Change IL Emit invoke path to use function pointers and OpCodes.Calli #75357

@steveharter

Description

@steveharter

Currently, the invoke fast-path generates IL using either call or callvirt. If this is changed to use calli and function pointers, it is possible to cache the generated dynamic method and use it for all such calls to the same signature. This reduces the memory footprint and makes calling subsequent but different methods faster since there would essentially be a hashtable look upon the signature instead of generating a new method.

In addition, it will be used to support invoke against a function pointer via #75347.

Items to consider:

  • Sharing of instance methods across different reference Types.
  • Virtual functions (see ldvirtftn).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions