Skip to content

Commit be8dc69

Browse files
authored
Merge branch 'master' into hr/create_expr_cache
2 parents 4d7f04c + 1afa368 commit be8dc69

File tree

28 files changed

+191
-84
lines changed

28 files changed

+191
-84
lines changed

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,9 @@ endif
459459

460460

461461
exe:
462-
# run Inno Setup to compile installer
463-
$(call spawn,$(JULIAHOME)/dist-extras/inno/iscc.exe /DAppVersion=$(JULIA_VERSION) /DSourceDir="$(call cygpath_w,$(BUILDROOT)/julia-$(JULIA_COMMIT))" /DRepoDir="$(call cygpath_w,$(JULIAHOME))" /F"$(JULIA_BINARYDIST_FILENAME)" /O"$(call cygpath_w,$(BUILDROOT))" $(INNO_ARGS) $(call cygpath_w,$(JULIAHOME)/contrib/windows/build-installer.iss))
462+
# run Inno Setup to compile installer.
463+
# Note that we disable MSYS2 path munging, as it interferes with the `/` options:
464+
MSYS2_ARG_CONV_EXCL='*' $(call spawn,$(JULIAHOME)/dist-extras/inno/iscc.exe /DAppVersion=$(JULIA_VERSION) /DSourceDir="$(call cygpath_w,$(BUILDROOT)/julia-$(JULIA_COMMIT))" /DRepoDir="$(call cygpath_w,$(JULIAHOME))" /F"$(JULIA_BINARYDIST_FILENAME)" /O"$(call cygpath_w,$(BUILDROOT))" $(INNO_ARGS) $(call cygpath_w,$(JULIAHOME)/contrib/windows/build-installer.iss))
464465
chmod a+x "$(BUILDROOT)/$(JULIA_BINARYDIST_FILENAME).exe"
465466

466467
app:
@@ -585,7 +586,7 @@ win-extras:
585586
cd $(JULIAHOME)/dist-extras && \
586587
$(JLDOWNLOAD) https://www.jrsoftware.org/download.php/is.exe && \
587588
chmod a+x is.exe && \
588-
$(call spawn, $(JULIAHOME)/dist-extras/is.exe /DIR="$(call cygpath_w,$(JULIAHOME)/dist-extras/inno)" /PORTABLE=1 /CURRENTUSER /VERYSILENT)
589+
MSYS2_ARG_CONV_EXCL='*' $(call spawn, $(JULIAHOME)/dist-extras/is.exe /DIR="$(call cygpath_w,$(JULIAHOME)/dist-extras/inno)" /PORTABLE=1 /CURRENTUSER /VERYSILENT)
589590

590591
# various statistics about the build that may interest the user
591592
ifeq ($(USE_SYSTEM_LLVM), 1)

base/abstractarray.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3473,8 +3473,9 @@ function circshift!(a::AbstractVector, shift::Integer)
34733473
n == 0 && return
34743474
shift = mod(shift, n)
34753475
shift == 0 && return
3476-
reverse!(a, 1, shift)
3477-
reverse!(a, shift+1, length(a))
3476+
l = lastindex(a)
3477+
reverse!(a, firstindex(a), l-shift)
3478+
reverse!(a, l-shift+1, lastindex(a))
34783479
reverse!(a)
34793480
return a
34803481
end

base/compiler/abstractinterpretation.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2240,7 +2240,9 @@ end
22402240

22412241
function abstract_eval_phi(interp::AbstractInterpreter, phi::PhiNode, vtypes::Union{VarTable, Nothing}, sv::Union{InferenceState, IRCode})
22422242
rt = Union{}
2243-
for val in phi.values
2243+
for i in 1:length(phi.values)
2244+
isassigned(phi.values, i) || continue
2245+
val = phi.values[i]
22442246
rt = tmerge(typeinf_lattice(interp), rt, abstract_eval_special_value(interp, val, vtypes, sv))
22452247
end
22462248
return rt

base/compiler/ssair/inlining.jl

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -699,18 +699,6 @@ function batch_inline!(todo::Vector{Pair{Int, Any}}, ir::IRCode, linetable::Vect
699699
compact.active_result_bb -= 1
700700
refinish = true
701701
end
702-
# It is possible for GlobalRefs and Exprs to be in argument position
703-
# at this point in the IR, though in that case they are required
704-
# to be effect-free. However, we must still move them out of argument
705-
# position, since `Argument` is allowed in PhiNodes, but `GlobalRef`
706-
# and `Expr` are not, so a substitution could anger the verifier.
707-
for aidx in 1:length(argexprs)
708-
aexpr = argexprs[aidx]
709-
if isa(aexpr, Expr) || isa(aexpr, GlobalRef)
710-
ninst = effect_free(NewInstruction(aexpr, argextype(aexpr, compact), compact.result[idx][:line]))
711-
argexprs[aidx] = insert_node_here!(compact, ninst)
712-
end
713-
end
714702
if isa(item, InliningTodo)
715703
compact.ssa_rename[old_idx] = ir_inline_item!(compact, idx, argexprs, linetable, item, boundscheck, state.todo_bbs)
716704
elseif isa(item, UnionSplit)

base/compiler/ssair/irinterp.jl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,16 @@ function concrete_eval_invoke(interp::AbstractInterpreter, ir::IRCode, mi_cache,
134134
return nothing
135135
end
136136

137+
function abstract_eval_phi_stmt(interp::AbstractInterpreter, phi::PhiNode, ir::IRCode, id::Int, dt::LazyDomtree)
138+
return abstract_eval_phi(interp, phi, nothing, ir)
139+
end
140+
137141
function reprocess_instruction!(interp::AbstractInterpreter, ir::IRCode, mi::MethodInstance,
138142
mi_cache,
139143
tpdum::TwoPhaseDefUseMap, idx::Int, bb::Union{Int, Nothing},
140144
@nospecialize(inst), @nospecialize(typ),
141-
phi_revisit::BitSet)
145+
phi_revisit::BitSet,
146+
dt::LazyDomtree)
142147
function update_phi!(from::Int, to::Int)
143148
if length(ir.cfg.blocks[to].preds) == 0
144149
return
@@ -181,7 +186,7 @@ function reprocess_instruction!(interp::AbstractInterpreter, ir::IRCode, mi::Met
181186
if isa(inst, Expr) || isa(inst, PhiNode)
182187
if isa(inst, PhiNode) || inst.head === :call || inst.head === :foreigncall || inst.head === :new
183188
if isa(inst, PhiNode)
184-
rt = abstract_eval_phi(interp, inst, nothing, ir)
189+
rt = abstract_eval_phi_stmt(interp, inst, ir, idx, dt)
185190
else
186191
(;rt, effects) = abstract_eval_statement_expr(interp, inst, nothing, ir, mi)
187192
# All other effects already guaranteed effect free by construction
@@ -243,6 +248,7 @@ function _ir_abstract_constant_propagation(interp::AbstractInterpreter, mi_cache
243248
all_rets = Int[]
244249

245250
tpdum = TwoPhaseDefUseMap(length(ir.stmts))
251+
dt = LazyDomtree(ir)
246252

247253
"""
248254
process_terminator!
@@ -303,7 +309,7 @@ function _ir_abstract_constant_propagation(interp::AbstractInterpreter, mi_cache
303309
delete!(ssa_refined, idx)
304310
end
305311
if any_refined && reprocess_instruction!(interp, ir, mi, mi_cache,
306-
tpdum, idx, bb, inst, typ, ssa_refined)
312+
tpdum, idx, bb, inst, typ, ssa_refined, dt)
307313
push!(ssa_refined, idx)
308314
end
309315
if idx == lstmt && process_terminator!(ip, bb, idx)
@@ -370,7 +376,7 @@ function _ir_abstract_constant_propagation(interp::AbstractInterpreter, mi_cache
370376
inst = ir.stmts[idx][:inst]
371377
typ = ir.stmts[idx][:type]
372378
if reprocess_instruction!(interp, ir, mi, mi_cache,
373-
tpdum, idx, nothing, inst, typ, ssa_refined)
379+
tpdum, idx, nothing, inst, typ, ssa_refined, dt)
374380
append!(stmt_ip, tpdum[idx])
375381
end
376382
end

base/compiler/ssair/verify.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
function maybe_show_ir(ir::IRCode)
44
if isdefined(Core, :Main)
5-
Core.Main.Base.display(ir)
5+
invokelatest(Core.Main.Base.display, ir)
66
end
77
end
88

base/compiler/typelimits.jl

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,8 @@ function tmerge(lattice::ConditionalsLattice, @nospecialize(typea), @nospecializ
433433
end
434434
return Bool
435435
end
436+
typea = widenconditional(typea)
437+
typeb = widenconditional(typeb)
436438
return tmerge(widenlattice(lattice), typea, typeb)
437439
end
438440

@@ -471,8 +473,9 @@ end
471473

472474
function tmerge(lattice::PartialsLattice, @nospecialize(typea), @nospecialize(typeb))
473475
# type-lattice for Const and PartialStruct wrappers
474-
if ((isa(typea, PartialStruct) || isa(typea, Const)) &&
475-
(isa(typeb, PartialStruct) || isa(typeb, Const)))
476+
acp = isa(typea, Const) || isa(typea, PartialStruct)
477+
bcp = isa(typeb, Const) || isa(typeb, PartialStruct)
478+
if acp && bcp
476479
aty = widenconst(typea)
477480
bty = widenconst(typeb)
478481
if aty === bty
@@ -521,22 +524,40 @@ function tmerge(lattice::PartialsLattice, @nospecialize(typea), @nospecialize(ty
521524
return anyrefine ? PartialStruct(aty, fields) : aty
522525
end
523526
end
527+
# Don't widen const here - external AbstractInterpreter might insert lattice
528+
# layers between us and `ConstsLattice`.
529+
isa(typea, PartialStruct) && (typea = widenconst(typea))
530+
isa(typeb, PartialStruct) && (typeb = widenconst(typeb))
524531

525532
# type-lattice for PartialOpaque wrapper
526-
if isa(typea, PartialOpaque) && isa(typeb, PartialOpaque) && widenconst(typea) == widenconst(typeb)
527-
if !(typea.source === typeb.source &&
528-
typea.parent === typeb.parent)
529-
return widenconst(typea)
533+
apo = isa(typea, PartialOpaque)
534+
bpo = isa(typeb, PartialOpaque)
535+
if apo && bpo
536+
aty = widenconst(typea)
537+
bty = widenconst(typeb)
538+
if aty == bty
539+
if !(typea.source === typeb.source &&
540+
typea.parent === typeb.parent)
541+
return widenconst(typea)
542+
end
543+
return PartialOpaque(typea.typ, tmerge(typea.env, typeb.env),
544+
typea.parent, typea.source)
530545
end
531-
return PartialOpaque(typea.typ, tmerge(typea.env, typeb.env),
532-
typea.parent, typea.source)
546+
typea = aty
547+
typeb = bty
548+
elseif apo
549+
typea = widenconst(typea)
550+
elseif bpo
551+
typeb = widenconst(typeb)
533552
end
534553

535-
# no special type-inference lattice, join the types
536-
typea, typeb = widenconst(typea), widenconst(typeb)
537-
@assert isa(typea, Type); @assert isa(typeb, Type)
554+
return tmerge(widenlattice(lattice), typea, typeb)
555+
end
538556

539-
return tmerge(JLTypeLattice(), typea, typeb)
557+
function tmerge(lattice::ConstsLattice, @nospecialize(typea), @nospecialize(typeb))
558+
# the equality of the constants can be checked here, but the equivalent check is usually
559+
# done by `tmerge_fast_path` at earlier lattice stage
560+
return tmerge(widenlattice(lattice), widenconst(typea), widenconst(typeb))
540561
end
541562

542563
function tmerge(::JLTypeLattice, @nospecialize(typea::Type), @nospecialize(typeb::Type))

base/logging.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ function handle_message(logger::SimpleLogger, level::LogLevel, message, _module,
671671
remaining > 0 || return
672672
end
673673
buf = IOBuffer()
674-
stream = logger.stream
674+
stream::IO = logger.stream
675675
if !(isopen(stream)::Bool)
676676
stream = stderr
677677
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
88144ed473b0ca6154ec55a8977c281c
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1c8c27f6b74c60dedecd6dd58de6b4b400bf3b942104e3ba7319a10a111ebbab0be03f98f072c073f43ca454d187674737dd34c1c9acb92adf3c8b76b3c400ac

0 commit comments

Comments
 (0)