In a debug session.
Note that D3_
becomes instantly a Core.Box()
but the precedent line, which is virtually equal, gets assigned as expected.
Nowhere even close to enough information here to say for sure, but I assume this is because youβre rebinding D3_
in a closure somewhere else.
Observe:
julia> function foo_maker()
x = 3 # <---- This will be boxed
y = 4 # <---- This won't
function ()
x = x + y
end
end
foo_maker (generic function with 1 method)
julia> @code_typed foo_maker()
CodeInfo(
1 β %1 = Core.Box::Type{Core.Box}
β %2 = %new(%1)::Core.Box
β Core.setfield!(%2, :contents, 3)::Int64
β %4 = Ο (4, Int64)
β %5 = %new(var"#13#14"{Int64}, %4, %2)::var"#13#14"{Int64}
βββ return %5
) => var"#13#14"{Int64}
1 Like
Thanks for looking. I thought in something like that might be happening and renamed that variable such that itβs only used in that function. And @code_typed
has no references to Core.Box
@code_typed boxplot(vvv, separator=true, show=1)
CodeInfo(
1 β goto #3 if not false
2 β nothing::Nothing
3 β %3 = $(Expr(:foreigncall, :(:jl_alloc_array_1d), Vector{Real}, svec(Any, Int64), 0, :(:ccall), Vector{Real}, 0, 0))::Vector{Real}
βββ goto #5 if not false
4 β nothing::Nothing
5 β %6 = Ο (true, Bool)
βββ goto #7 if not false
6 β nothing::Nothing
7 β %9 = Ο (0.75, Float64)
βββ goto #9 if not false
8 β nothing::Nothing
9 β %12 = Ο (false, Bool)
β %13 = Base.getfield(@_2, 1)::Bool
β %14 = Base.getfield(@_2, 2)::Int64
β %15 = %new(NamedTuple{(:separator, :show), Tuple{Bool, Int64}}, %13, %14)::NamedTuple{(:separator, :show), Tuple{Bool, Int64}}
β %16 = %new(Base.Pairs{Symbol, Integer, Tuple{Symbol, Symbol}, NamedTuple{(:separator, :show), Tuple{Bool, Int64}}}, %15, (:separator, :show))::Base.Pairs{Symbol, Integer, Tuple{Symbol, Symbol}, NamedTuple{(:separator, :show), Tuple{Bool, Int64}}}
β %17 = invoke GMT.:(var"#boxplot#817")(%3::Vector{Real}, %6::Bool, %9::Float64, %12::Bool, %16::Base.Pairs{Symbol, Integer, Tuple{Symbol, Symbol}, NamedTuple{(:separator, :show), Tuple{Bool, Int64}}}, @_3::typeof(boxplot), data::Vector{Vector{Vector{Float64}}})::Any
βββ return %17
) => Any