Skip to content

remove zero length memory boundscheck for memoryrefget/set#62070

Open
oscardssmith wants to merge 3 commits into
JuliaLang:masterfrom
oscardssmith:os/empty-memory-guard-page
Open

remove zero length memory boundscheck for memoryrefget/set#62070
oscardssmith wants to merge 3 commits into
JuliaLang:masterfrom
oscardssmith:os/empty-memory-guard-page

Conversation

@oscardssmith

@oscardssmith oscardssmith commented Jun 11, 2026

Copy link
Copy Markdown
Member

Rather than emitting code for a length check on memoryref, we can ensure that all zero length memories have their ptr field point to a guard page so that reads of the page will fault.

This lets us do the boundschecking for Vector/Memory operations purely on the codegen side rather than on the julia side which reduces the amount of Julia IR for functions that do lots of array manipulation. It also may give slightly better codegen as we are doing a slightly simpler boundscheck.

Coauthored by Fable 5

@oscardssmith oscardssmith added arrays [a, r, r, a, y, s] error handling Handling of exceptions by Julia or the user compiler:codegen Generation of LLVM IR and native code labels Jun 11, 2026
@oscardssmith
oscardssmith requested review from gbaraldi and vtjnash June 11, 2026 16:29
@oscardssmith
oscardssmith marked this pull request as ready for review June 11, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrays [a, r, r, a, y, s] compiler:codegen Generation of LLVM IR and native code error handling Handling of exceptions by Julia or the user

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant