From bb247cfef7e4fd920c04398262684790d9de17da Mon Sep 17 00:00:00 2001 From: Yichao Yu Date: Mon, 5 Oct 2015 18:50:39 -0400 Subject: [PATCH] Avoid introducing local variable (and GC frame store) when the inliner is confused about the return point. --- base/array.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/base/array.jl b/base/array.jl index a1a17d57e24d2..f67a2185fbb06 100644 --- a/base/array.jl +++ b/base/array.jl @@ -303,7 +303,10 @@ end setindex!{T}(A::Array{T}, x, i1::Real) = arrayset(A, convert(T,x)::T, to_index(i1)) setindex!{T}(A::Array{T}, x, i1::Real, i2::Real, I::Real...) = arrayset(A, convert(T,x)::T, to_index(i1), to_index(i2), to_indexes(I...)...) -unsafe_setindex!{T}(A::Array{T}, x, i1::Real, I::Real...) = @inbounds return arrayset(A, convert(T,x)::T, to_index(i1), to_indexes(I...)...) +# Type inference is confused by `@inbounds return ...` and introduces a +# !ispointerfree local variable and a GC frame +unsafe_setindex!{T}(A::Array{T}, x, i1::Real, I::Real...) = + (@inbounds arrayset(A, convert(T,x)::T, to_index(i1), to_indexes(I...)...); A) # These are redundant with the abstract fallbacks but needed for bootstrap function setindex!(A::Array, x, I::AbstractVector{Int})