Skip to content

Follow-up work on shared allocation helpers #116191

Open

Description

@filipnavara

PR #115339 enables sharing of the allocation helpers written in assembly between CoreCLR and NativeAOT runtimes. This is a tracking issue for follow-up work that came up during review of the PR:

  • Change managed signatures of new array helpers to take nint (1)
  • Optimization: Enable the RhpNewObjectArrayFast helper on NativeAOT and teach JIT interface to use it.
  • Cleanup: Extract the 0x40000000 magic constant in RhpNewObjectArrayFast to a named constant like FAST_OBJECT_ARRAY_ALLOCATION_THRESHOLD (1)
  • Correctness: NativeAOT doesn't properly handle multi-dimensional arrays larger than 2 GB (1, 2, 3)
  • Optimization: Investigate and benchmark potential improvements to x86 allocation helpers (1)

Activity

  1. added
    untriaged
    on Jun 1, 2025
  2. dotnet-policy-service commented on Jun 1, 2025

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
    See info in area-owners.md if you want to be subscribed.

  3. added this to the Future milestone on Jun 2, 2025
  4. removed
    untriaged
    on Jun 2, 2025
  5. kant2002 commented on Oct 28, 2025

    @kant2002
    Contributor
    1. According to Fix illumos compile error in coreclr/runtime/amd64/AllocFast.S #117463 the constant 0x40000000 would not appear in source code, but mostly in comments. Is there still need for creation of FAST_OBJECT_ARRAY_ALLOCATION_THRESHOLD if it would be in comments?
    2. RhpNewObjectArrayFast is now RhpNewPtrArrayFast. That's for passerbuys.
  6. am11 commented on Oct 29, 2025

    @am11
    Member
    1. According to Fix illumos compile error in coreclr/runtime/amd64/AllocFast.S #117463 the constant 0x40000000 would not appear in source code, but mostly in comments. Is there still need for creation of FAST_OBJECT_ARRAY_ALLOCATION_THRESHOLD if it would be in comments?

    That's only for amd64, other assemblies have the constant in use:

    src/coreclr/runtime/arm/AllocFast.S:        mov         r2, #1 << 28 // 0x40000000 / sizeof(void*)
    src/coreclr/runtime/arm64/AllocFast.S:        mov         x2, #(0x40000000 / 8) // sizeof(void*)
    src/coreclr/runtime/i386/AllocFast.S:        cmp         edx, (0x40000000 / 4) // sizeof(void*)
    src/coreclr/runtime/loongarch64/AllocFast.S:        li.w  $a2, (0x40000000 / 8) // sizeof(void*)
    src/coreclr/runtime/riscv64/AllocFast.S:        li          t0, (0x40000000 / 8) // sizeof(void*)
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions