Skip to content

Conversation

@kant2002
Copy link
Contributor

Third item from #116191

@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 Oct 29, 2025
// ESI == element count
LEAF_ENTRY RhpNewPtrArrayFast, _TEXT

// Delegate overflow handling to the generic helper conservatively
Copy link
Member

@jkotas jkotas Oct 29, 2025

Choose a reason for hiding this comment

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

Instead of the ceremony with FAST_OBJECT_ARRAY_ALLOCATION_THRESHOLD and delegating the call conservatively, it would be easier to just do the right thing here:

        // we want to limit the element count to the non-negative 32-bit int range
        cmp         rsi, 0x07fffffff
        ja          LOCAL_LABEL(ArraySizeOverflow)

Copy link
Member

@am11 am11 left a comment

Choose a reason for hiding this comment

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

We can bring others to the same plan.

@am11 am11 added area-VM-coreclr community-contribution Indicates that the PR has been added by a community member and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Oct 30, 2025
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

kant2002 and others added 11 commits October 30, 2025 16:58
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
;; RDX == element count
LEAF_ENTRY RhpNewPtrArrayFast, _TEXT

; Delegate overflow handling to the generic helper conservatively
Copy link
Member

Choose a reason for hiding this comment

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

This can be on the 0x07FFFFFFF plan

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did try that, but it does not have LOCAL_LABEL machinery, and for some reasons label was not found. After writing this I probably should look for typo somewhere.

LEAF_ENTRY RhpNewPtrArrayFast, _TEXT
NEW_ARRAY_FAST_PROLOG

// Delegate overflow handling to the generic helper conservatively
Copy link
Member

@jkotas jkotas Oct 31, 2025

Choose a reason for hiding this comment

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

This needs to be on the conservative 0x40000000 plan, like any other 32-bit platform.

This check needs to ensure that add r2, r2, r1, lsl #2 below won't overflow silently.

@am11
Copy link
Member

am11 commented Oct 31, 2025

Nit: PR title could now be Replace conservative overflow check with int limit.

@kant2002 kant2002 changed the title Introduce FAST_OBJECT_ARRAY_ALLOCATION_THRESHOLD constant Replace conservative overflow check with int limit Oct 31, 2025
@jkotas
Copy link
Member

jkotas commented Nov 1, 2025

Failing tests:

Assert failure(PID 552 [0x00000228], Thread: 4156 [0x103c]): m_alignpad == 0

// $a1 == element count
LEAF_ENTRY RhpNewPtrArrayFast, _Text

// Delegate overflow handling to the generic helper conservatively
Copy link
Member

Choose a reason for hiding this comment

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

"Delegate overflow handling to the generic helper conservatively" should be deleted here and on other 64-bit platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-VM-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.

3 participants