Skip to content

Conversation

clamp03
Copy link
Member

@clamp03 clamp03 commented Sep 26, 2025

I am working interpreter on arm32 based on arm64 iterpreter.
I found a bug in callstubgenerator when there are multiple pending ranges.
It occurs on arm32. However, I think it can be a problem in other archs.
(If I misunderstood, please let me know.)

Test case on arm32

public static void Main()
{
        try
        {
            var input = new LargeStruct { Value1 = 10, Value2 = 20, Value3 = 30 };
            var result = ProcessLargeStruct(3, input);
            Console.WriteLine($"Processed struct: Value1 = {result.Value1}, Value2 = {result.Value2}, Value3 = {result.Value3}");
            if (result.Value1 == 30 && result.Value2 == 60 && result.Value3 == 90)
                Console.WriteLine("✓ Process struct test PASSED");
            else
                Console.WriteLine("✗ Process struct test FAILED");
        }
        catch (Exception e)
        {
            Console.WriteLine($"✗ Process struct test FAILED with exception: {e.Message}");
        } 
}

[StructLayout(LayoutKind.Sequential)]
public struct LargeStruct // 12 bytes - should definitely use return buffer
{
    public int Value1;
    public int Value2;
    public int Value3;
}

[MethodImpl(MethodImplOptions.NoInlining)]
public static LargeStruct ProcessLargeStruct(int multiplier, LargeStruct input)
{
    return new LargeStruct
    {
        Value1 = input.Value1 * multiplier,
        Value2 = input.Value2 * multiplier,
        Value3 = input.Value3 * multiplier
    };
} 

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Sep 26, 2025
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Sep 26, 2025
@clamp03 clamp03 self-assigned this Sep 26, 2025
@clamp03 clamp03 added area-CodeGen-Interpreter-coreclr and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Sep 26, 2025
@clamp03 clamp03 requested a review from janvorli September 26, 2025 09:14
Copy link
Contributor

Tagging subscribers to this area: @BrzVlad, @janvorli, @kg
See info in area-owners.md if you want to be subscribed.

@clamp03
Copy link
Member Author

clamp03 commented Sep 26, 2025

@janvorli Are you planning to support the ARM32 interpreter in the future? If it's possible, I'd like to contribute to the ARM32 support. (I am working on https://github.com/clamp03/runtime/tree/intrp_arm branch now.)

@jkotas
Copy link
Member

jkotas commented Sep 26, 2025

Are you planning to support the ARM32 interpreter in the future?

For foreseeable future, we are planning to support and ship the interpreter on Apple devices and Wasm only. We do not have plans beyond that. I think we will be happy to accept fixes to make interpreter work on Arm32, but the interpreter support won't be included in Microsoft official builds.

Why are you interested in the interpreter for Arm32?

@clamp03
Copy link
Member Author

clamp03 commented Sep 29, 2025

Why are you interested in the interpreter for Arm32?

I think the interpreter is good for improving launch time and memory usage in some cases.

For launch time, I tried to remove JIT compilation during app launch time by using Crossgen2 as much as possible.
However some methods are not compiled by crossgen2 and are still needed to be compiled by JIT during launching time.
(ex. generics and stubs, ...)
I think the interpreter is useful for the cases.

For memory, some methods like clinit and others are used only once in applications. I think we don't need to compile these all methods. I think executing some of them by interpreter is better than JITC and Crossgen2. Actually, we found huge clinit methods in our applications, so it takes very long time (to compile and run) and consumes much memory. We gave some guides for that, but it is still very large even though they fixed.

In javascript engine, I got better launch time (around 10%) in the real applications (not benchmark) with the interpreter. So I want to check coreclr interpreter. (*. I expect the gain is less than javascript because they have different language features such as type. However, I think it is worth researching it.)

I am going to contribute arm32 interpreter after long holiday in Korea.
Thank you!!!

@clamp03
Copy link
Member Author

clamp03 commented Sep 29, 2025

cc @dotnet/samsung

@clamp03
Copy link
Member Author

clamp03 commented Oct 14, 2025

Pushed a new PR as a draft in #120688 including this PR.
Close this PR.
Thank you.

@clamp03 clamp03 closed this Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-Interpreter-coreclr community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants