Skip to content

Allow to inline methods with delegate invocation (at least methods marked with AggressiveInlining) #10048

Closed
@dmitriyse

Description

@dmitriyse

Method with delegate invocation problem:

using System;
using System.Runtime.CompilerServices;

public class C {
    private MyStruct[] _s = new MyStruct[1];
    
    public void M() {
        // Currently this method is not inlined :(
        _s[0].TryInvoke();
    }
}

public struct MyStruct
{
    public Action A;

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public void TryInvoke()
    {
        A();
        A();
    }
}

https://sharplab.io/#v2:C4LghgzgtgPgAgBgARwIwG4CwAoRLUB0ASgK4B2wAllAKYEDCA9lAA6UA2NATgMrcBulAMY0IWbDjgBmFACYk9JAG8cSNUhZdK/MMBpIAsgE8ewLiSHAA2gF0kAfQhIAvEjI0A7oZNmL11Dbi6kiq6tIoACyGABQAlMqhwWoA9MkKJFxcNBTsRkjAABaUTrSFjAAmSMVujMBVZOyU7pUg0YlJjlYINgQAKlxGAJJk/IwA1jRxQeoAvjhzErgyEL6W3qbmljgq2MHhaPIAguLtVgY0ZeWDrOzR55fXLOwA8ixUjGQQBIcA5j9ZEAg2how0aZCaP1iNna+yi/SGI3Gk1i7R2SXUhym7WCmNi0zUCwWQA==

category:cq
theme:inlining
skill-level:expert
cost:small

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIoptimization

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions