Skip to content

Commit 7796df8

Browse files
authored
Use mapany to avoid some broadcasting invalidations (#420)
These were triggered by loading FillArrays
1 parent e42045c commit 7796df8

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/interpret.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ function evaluate_call_recurse!(@nospecialize(recurse), frame::Frame, call_expr:
215215
if fargs[1] === Core.invoke # invoke needs special handling
216216
f_invoked = which(fargs[2], fargs[3])
217217
fargs_pruned = [fargs[2]; fargs[4:end]]
218-
sig = Tuple{_Typeof.(fargs_pruned)...}
218+
sig = Tuple{mapany(_Typeof, fargs_pruned)...}
219219
ret = prepare_framecode(f_invoked, sig; enter_generated=enter_generated)
220220
isa(ret, Compiled) && invoke(fargs[2:end]...)
221221
framecode, lenv = ret

src/packagedef.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ else
3131
append_any(@nospecialize x...) = append!([], Core.svec((x...)...))
3232
end
3333

34+
if isdefined(Base, :mapany)
35+
const mapany = Base.mapany
36+
else
37+
mapany(f, itr) = map!(f, Vector{Any}(undef, length(itr)::Int), itr) # convenient for Expr.args
38+
end
39+
3440
include("types.jl")
3541
include("utils.jl")
3642
include("construct.jl")

src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ function Base.StackTraces.StackFrame(frame::Frame)
625625
if scopeof(frame) isa Method
626626
method = frame.framecode.scope
627627
method_args = something.(frame.framedata.locals[1:method.nargs])
628-
atypes = Tuple{typeof.(method_args)...}
628+
atypes = Tuple{mapany(_Typeof, method_args)...}
629629
sig = method.sig
630630
sparams = Core.svec(frame.framedata.sparams...)
631631
mi = specialize_method(method, atypes, sparams)

0 commit comments

Comments
 (0)