Skip to content

In precompiled operator interceptors, access closure fields via unsafe accessor when possible #33418

@roji

Description

@roji

In precompiled queries, we generate interceptors for LINQ query operators that need to extract evaluatable fragments of the query tree as parameters; this is currently done via the LINQ expression tree interpreter, which has an overhead. We have to do that for complex evaluatable fragments (e.g. binary expression composed on top of a captured variable), but when the fragment is a simple captured variable (nothing composed on top) the overhead of the interpretor can be done away with.

In the short term, we can generate code that does reflection to read the field from the closure type (i.e. the DisplayClass). But in the future, we should even be able to generate an unsafe accessor that allows us to efficiently access that field without reflection as well.

See dotnet/runtime#90081 (comment) for more context.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions