Skip to content

Conversation

@AaronRobinsonMSFT
Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT commented Jan 2, 2025

Convert JIT_GetFieldAddr and JIT_GetStaticFieldAddr to C#.

  • These JIT helpers are only used in EnC scenarios so their
    performance is secondary.

Convert JIT_NewMDArr to C#.

Contributes to #95695

These JIT helpers are only used in EnC scenarios so their
performance is secondary.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 15 changed files in this pull request and generated no comments.

Files not reviewed (13)
  • src/coreclr/classlibnative/bcltype/arraynative.cpp: Language not supported
  • src/coreclr/classlibnative/bcltype/arraynative.h: Language not supported
  • src/coreclr/inc/jithelpers.h: Language not supported
  • src/coreclr/jit/utils.cpp: Language not supported
  • src/coreclr/vm/corelib.h: Language not supported
  • src/coreclr/vm/ecalllist.h: Language not supported
  • src/coreclr/vm/field.cpp: Language not supported
  • src/coreclr/vm/field.h: Language not supported
  • src/coreclr/vm/jithelpers.cpp: Language not supported
  • src/coreclr/vm/metasig.h: Language not supported
  • src/coreclr/vm/qcallentrypoints.cpp: Language not supported
  • src/coreclr/vm/reflectioninvocation.cpp: Language not supported
  • src/coreclr/vm/runtimehandles.h: Language not supported
Comments suppressed due to low confidence (3)

src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs:1670

  • [nitpick] The error message is too generic. Consider providing a more descriptive error message indicating the failure to get the field address.
throw new NullReferenceException();

src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs:1679

  • [nitpick] The error message is too generic. Consider providing a more descriptive error message indicating the failure to get the static field address.
throw new NullReferenceException();

src/coreclr/System.Private.CoreLib/src/System/Array.CoreCLR.cs:42

  • Ensure that the new method CreateInstanceMDArray is covered by tests.
internal static unsafe object CreateInstanceMDArray(nint typeHandle, uint dwNumArgs, void* pArgList)

@AaronRobinsonMSFT
Copy link
Member Author

@EgorBot -amd -arm

using System;
using System.Runtime.CompilerServices;
using BenchmarkDotNet.Attributes;

public class Bench
{
    [MethodImpl(MethodImplOptions.NoInlining)]
    static object Alloc<T>(int a, int b, int c)
    {
        return new T[a, b, c];
    }

    [Benchmark]
    public object MDInt() => Alloc<int>(1,2,3);

    [Benchmark]
    public object MDObject() => Alloc<object>(1,2,3);

    [Benchmark]
    public object MDGuid() => Alloc<Guid>(1,2,3);
}

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@AaronRobinsonMSFT AaronRobinsonMSFT merged commit a4674c3 into dotnet:main Jan 3, 2025
104 of 108 checks passed
@AaronRobinsonMSFT AaronRobinsonMSFT deleted the hmf_jithelpers01 branch January 3, 2025 18:44
@github-actions github-actions bot locked and limited conversation to collaborators Feb 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants