Skip to content
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

[mono] Don't truncate the high bits when ldelema index is nint #73799

Closed
wants to merge 4 commits into from

Conversation

BrzVlad
Copy link
Member

@BrzVlad BrzVlad commented Aug 11, 2022

Fixes #71656

We previously assumend index is i32, but it can be either i32 or native int. In order to avoid code bloat by adding native int versions to all opcodes (LDELEM, STELEM and LDELEMA) for negligible perf gain, just add one additional data to these instructions which indicates whether to fetch the index var as a i32 or native int.

On interp we don't zero extend by default to 8 byte when storing into locals (we should probably do this at some point), so we need to special handle nint argument.
Remove MONO_ARCH_EMIT_BOUNDS_CHECK on amd64 since it was doing a I4 comparison, while the index reg is i8. Use MONO_EMIT_DEFAULT_BOUNDS_CHECK instead also on amd64.
@BrzVlad
Copy link
Member Author

BrzVlad commented Nov 15, 2022

I'll consider a better way to fix this

@BrzVlad BrzVlad closed this Nov 15, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Dec 16, 2022
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.

Mono fails new test src/tests/JIT/Directed/Arrays/nintindexoutofrange.csproj
2 participants