Skip to content

Commit c6fb8dc

Browse files
committed
expand comment
1 parent 044ec3c commit c6fb8dc

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

stdlib/Random/src/misc.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,17 @@ ltm52(n::Int, mask::Int=nextpow(2, n)-1) = LessThan(n-1, Masked(mask, UInt52Raw(
184184
## shuffle & shuffle!
185185

186186
function shuffle(rng::AbstractRNG, tup::NTuple{N}) where {N}
187-
@inline let # `@inline` and `@inbounds` are here to help escape analysis
187+
# `@inline` and `@inbounds` are here to help escape analysis eliminate the `Memory` allocation
188+
#
189+
# * `@inline` might be necessary because escape analysis relies on everything
190+
# touching the `Memory` being inlined because there's no interprocedural escape
191+
# analysis yet, relevant WIP PR: https://github.com/JuliaLang/julia/pull/56849
192+
#
193+
# * `@inbounds` might be necessary because escape analysis requires any throws of
194+
# `BoundsError` to be eliminated as dead code, because `BoundsError` stores the
195+
# array itself, making the throw escape the array from the function, relevant
196+
# WIP PR: https://github.com/JuliaLang/julia/pull/56167
197+
@inline let
188198
# use a narrow integer type to save stack space and prevent heap allocation
189199
Ind = if N typemax(UInt8)
190200
UInt8

0 commit comments

Comments
 (0)