julia
db778bda - core: add `unsafe_memoryrefload` and `unsafe_memoryrefstore!`

Commit
25 days ago
core: add `unsafe_memoryrefload` and `unsafe_memoryrefstore!` note: CI is running at the _top_ of the stack in my third attempt at https://github.com/JuliaLang/julia/issues/51658 and https://github.com/JuliaLang/julia/issues/48801, I'm trying to go this route of a new builtin for fast reinterpreted reads from the underlying `Memory`, letting us avoid the `cconvert` + `unsafe_load` to begin with. that was problematic because it required a `GC.@preserve` which blocked vectorization. even though `Memory` already allows `Ptr` access, any `unsafe_load/store`s through it yield very unhelpful aliasinfo since it might touch the array header which means it then can't be hoisted above the loop. thus this builtin could exist to allow: * reading the bits more or less raw from a `Memory` (here phrased as reading an `isbits` type `T`) * preserving the memory from GC while doing so * but also promising that the access remains inside the `Memory`'s data and not its header this is my first time using the stacked-PRs feature but the intention is to show that this one adds the core functionality, and the PRs on top are sample use cases (the `ReinterpretArray` one being the most salient) Assisted-by: Codex (GPT 6.1 Sol) Assisted-by: Claude Code (Claude Opus 5.5)
Author
Committer
Parents
Loading