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

Test whether llvm and Cranelift allow usize::MAX array lengths #251

Closed
rtfeldman opened this issue Mar 15, 2020 · 1 comment
Closed

Test whether llvm and Cranelift allow usize::MAX array lengths #251

rtfeldman opened this issue Mar 15, 2020 · 1 comment

Comments

@rtfeldman
Copy link
Contributor

rtfeldman commented Mar 15, 2020

According to rust-lang/rust#67186 LLVM only permits generating arrays (or perhaps indexing into them) of isize::MAX as opposed to the theoretical maximum of usize::MAX imposed by the size of a pointer. (Apparently the reason for the restriction is related to doing pointer arithmetic potentially involving negative numbers, which a language like C would permit in userspace.)

Is this still true? Inkwell's API doesn't suggest or mention it, so it seems worth verifying empirically. What about for Cranelift? (If it's not true, it seems better to go with usize::MAX since Roc doesn't support arbitrary pointer arithmetic.) Probably the easiest way to verify it is through a List.range test.

If it is true, how should we enforce this? Error if attempting to create a list that's over isize::MAX elements?

@rtfeldman rtfeldman changed the title Test whether llvm allows usize::MAX array lengths Test whether llvm and Cranelift allow usize::MAX array lengths Mar 15, 2020
@rtfeldman
Copy link
Contributor Author

Error if attempting to create a list that's over isize::MAX elements?

Yes! Closing in favor of #3299

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant