-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On x64 platform, "stelem.ref" ignores high bits of "native int" index #52817
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Judging from the disassembly, the |
|
Repathed to VM area, because that really seems like the closest thing to the true area owners. |
That's correct. It looks like we just import a call to the helper, and it is the helper's responsibility to check out of range conditions, which it does. I am wondering what would be needed here beyond changing the helper's signature to take |
That's why I pathed it under VM. Not sure if we require JIT changes to ensure 32-bit int indices (the 99.9999% case) are properly native word size extended before invoking the helper method. The VM area owners would know for sure. |
I also noticed that the native-sized index is first |
I suspect changes will be needed, heh (looks like we don't sign extend right now), or an alternative version of the helper. Another note: seems like |
When I am running the The previous implementation of the helper in x64 assembly truncated the index to 32bit as well - https://github.com/dotnet/runtime/pull/32722/files#r633023865 |
It does not throw from |
I've looked into this. We can't just extend the helper to take a nint, we'll need to have a parallel helper, or force the index to be sign extended to nint. The abi of several of our platforms doesn't reliably set the high bits to 0 when passing 32bit values. |
…of a native int index Fix dotnet#52817
…of a native int index (#71571) Add support for native int indices in stelem.ref and ldelema helper functions. This required changing the abi of these functions, which required bumping the major R2R version number. As we have already done that for .NET 7, this is a minor cost. Note that this is still broken on Mono, and that bug is #71656 Fixes #52817
IndexOutOfRangeException
not thrown when index=0x100000000.sharplab test
The text was updated successfully, but these errors were encountered: