Skip to content

Commit 26c5abf

Browse files
authored
Merge pull request #48311 from JuliaLang/backports-release-1.9
Backports for Julia 1.9.0-beta4
2 parents 9ed1555 + d4a4629 commit 26c5abf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1613
-1070
lines changed

Make.inc

+55-6
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,7 @@ JULIA_SYSIMG_release := $(build_private_libdir)/sys.$(SHLIB_EXT)
14791479
JULIA_SYSIMG := $(JULIA_SYSIMG_$(JULIA_BUILD_MODE))
14801480

14811481
define dep_lib_path
1482-
$$($(PYTHON) $(call python_cygpath,$(JULIAHOME)/contrib/relative_path.py) $(1) $(2))
1482+
$(shell $(PYTHON) $(call python_cygpath,$(JULIAHOME)/contrib/relative_path.py) $(1) $(2))
14831483
endef
14841484

14851485
LIBJULIAINTERNAL_BUILD_DEPLIB := $(call dep_lib_path,$(build_libdir),$(build_shlibdir)/libjulia-internal.$(JL_MAJOR_SHLIB_EXT))
@@ -1526,6 +1526,19 @@ LIBGCC_BUILD_DEPLIB := $(call dep_lib_path,$(build_libdir),$(build_shlibdir)/$(L
15261526
endif
15271527
LIBGCC_INSTALL_DEPLIB := $(call dep_lib_path,$(libdir),$(private_shlibdir)/$(LIBGCC_NAME))
15281528

1529+
# We only bother to define this on Linux, as that's the only platform that does libstdc++ probing
1530+
# On all other platforms, the LIBSTDCXX_*_DEPLIB variables will be empty.
1531+
ifeq ($(OS),Linux)
1532+
LIBSTDCXX_NAME := libstdc++.so.6
1533+
ifeq ($(USE_SYSTEM_CSL),1)
1534+
LIBSTDCXX_BUILD_DEPLIB := $(call dep_lib_path,$(build_libdir),$(build_private_shlibdir)/$(LIBSTDCXX_NAME))
1535+
else
1536+
LIBSTDCXX_BUILD_DEPLIB := $(call dep_lib_path,$(build_libdir),$(build_shlibdir)/$(LIBSTDCXX_NAME))
1537+
endif
1538+
LIBSTDCXX_INSTALL_DEPLIB := $(call dep_lib_path,$(libdir),$(private_shlibdir)/$(LIBSTDCXX_NAME))
1539+
endif
1540+
1541+
15291542
# USE_SYSTEM_LIBM and USE_SYSTEM_OPENLIBM causes it to get symlinked into build_private_shlibdir
15301543
ifeq ($(USE_SYSTEM_LIBM),1)
15311544
LIBM_BUILD_DEPLIB := $(call dep_lib_path,$(build_libdir),$(build_private_shlibdir)/$(LIBMNAME).$(SHLIB_EXT))
@@ -1539,6 +1552,8 @@ LIBM_INSTALL_DEPLIB := $(call dep_lib_path,$(libdir),$(private_shlibdir)/$(LIBMN
15391552
# We list:
15401553
# * libgcc_s, because FreeBSD needs to load ours, not the system one.
15411554
# * libopenlibm, because Windows has an untrustworthy libm, and we want to use ours more than theirs
1555+
# * libstdc++, because while performing `libstdc++` probing we need to
1556+
# know the path to the bundled `libstdc++` library.
15421557
# * libjulia-internal, which must always come second-to-last.
15431558
# * libjulia-codegen, which must always come last
15441559
#
@@ -1547,11 +1562,45 @@ LIBM_INSTALL_DEPLIB := $(call dep_lib_path,$(libdir),$(private_shlibdir)/$(LIBMN
15471562
# * install time relative paths are not equal to build time relative paths (../lib vs. ../lib/julia)
15481563
# That second point will no longer be true for most deps once they are placed within Artifacts directories.
15491564
# Note that we prefix `libjulia-codegen` and `libjulia-internal` with `@` to signify to the loader that it
1550-
# should not automatically dlopen() it in its loading loop.
1551-
LOADER_BUILD_DEP_LIBS = $(LIBGCC_BUILD_DEPLIB):$(LIBM_BUILD_DEPLIB):@$(LIBJULIAINTERNAL_BUILD_DEPLIB):@$(LIBJULIACODEGEN_BUILD_DEPLIB):
1552-
LOADER_DEBUG_BUILD_DEP_LIBS = $(LIBGCC_BUILD_DEPLIB):$(LIBM_BUILD_DEPLIB):@$(LIBJULIAINTERNAL_DEBUG_BUILD_DEPLIB):@$(LIBJULIACODEGEN_DEBUG_BUILD_DEPLIB):
1553-
LOADER_INSTALL_DEP_LIBS = $(LIBGCC_INSTALL_DEPLIB):$(LIBM_INSTALL_DEPLIB):@$(LIBJULIAINTERNAL_INSTALL_DEPLIB):@$(LIBJULIACODEGEN_INSTALL_DEPLIB):
1554-
LOADER_DEBUG_INSTALL_DEP_LIBS = $(LIBGCC_INSTALL_DEPLIB):$(LIBM_INSTALL_DEPLIB):@$(LIBJULIAINTERNAL_DEBUG_INSTALL_DEPLIB):@$(LIBJULIACODEGEN_DEBUG_INSTALL_DEPLIB):
1565+
# should not automatically dlopen() it in its loading loop, it is "special" and should happen later.
1566+
# We do the same for `libstdc++`, and explicitly place it _after_ `libgcc_s`, and `libm` since `libstdc++`
1567+
# may depend on those libraries (e.g. when USE_SYSTEM_LIBM=1)
1568+
1569+
# Helper function to join a list with colons, then place an extra at the end.
1570+
define build_deplibs
1571+
$(subst $(SPACE),:,$(strip $(1))):
1572+
endef
1573+
1574+
LOADER_BUILD_DEP_LIBS = $(call build_deplibs, \
1575+
$(LIBGCC_BUILD_DEPLIB) \
1576+
$(LIBM_BUILD_DEPLIB) \
1577+
@$(LIBSTDCXX_BUILD_DEPLIB) \
1578+
@$(LIBJULIAINTERNAL_BUILD_DEPLIB) \
1579+
@$(LIBJULIACODEGEN_BUILD_DEPLIB) \
1580+
)
1581+
1582+
LOADER_DEBUG_BUILD_DEP_LIBS = $(call build_deplibs, \
1583+
$(LIBGCC_BUILD_DEPLIB) \
1584+
$(LIBM_BUILD_DEPLIB) \
1585+
@$(LIBSTDCXX_BUILD_DEPLIB) \
1586+
@$(LIBJULIAINTERNAL_DEBUG_BUILD_DEPLIB) \
1587+
@$(LIBJULIACODEGEN_DEBUG_BUILD_DEPLIB) \
1588+
)
1589+
1590+
LOADER_INSTALL_DEP_LIBS = $(call build_deplibs, \
1591+
$(LIBGCC_INSTALL_DEPLIB) \
1592+
$(LIBM_INSTALL_DEPLIB) \
1593+
@$(LIBSTDCXX_INSTALL_DEPLIB) \
1594+
@$(LIBJULIAINTERNAL_INSTALL_DEPLIB) \
1595+
@$(LIBJULIACODEGEN_INSTALL_DEPLIB) \
1596+
)
1597+
LOADER_DEBUG_INSTALL_DEP_LIBS = $(call build_deplibs, \
1598+
$(LIBGCC_INSTALL_DEPLIB) \
1599+
$(LIBM_INSTALL_DEPLIB) \
1600+
@$(LIBSTDCXX_INSTALL_DEPLIB) \
1601+
@$(LIBJULIAINTERNAL_DEBUG_INSTALL_DEPLIB) \
1602+
@$(LIBJULIACODEGEN_DEBUG_INSTALL_DEPLIB) \
1603+
)
15551604

15561605
# Colors for make
15571606
ifndef VERBOSE

Makefile

-6
Original file line numberDiff line numberDiff line change
@@ -410,12 +410,6 @@ ifeq ($(OS), Linux)
410410
-$(PATCHELF) --set-rpath '$$ORIGIN' $(DESTDIR)$(private_shlibdir)/libLLVM.$(SHLIB_EXT)
411411
endif
412412

413-
# Replace libstdc++ path, which is also moving from `lib` to `../lib/julia`.
414-
ifeq ($(OS),Linux)
415-
$(call stringreplace,$(DESTDIR)$(shlibdir)/libjulia.$(JL_MAJOR_MINOR_SHLIB_EXT),\*libstdc++\.so\.6$$,*$(call dep_lib_path,$(shlibdir),$(private_shlibdir)/libstdc++.so.6))
416-
endif
417-
418-
419413
ifneq ($(LOADER_BUILD_DEP_LIBS),$(LOADER_INSTALL_DEP_LIBS))
420414
# Next, overwrite relative path to libjulia-internal in our loader if $$(LOADER_BUILD_DEP_LIBS) != $$(LOADER_INSTALL_DEP_LIBS)
421415
ifeq ($(JULIA_BUILD_MODE),release)

NEWS.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ New library functions
6868
---------------------
6969

7070
* New function `Iterators.flatmap` ([#44792]).
71-
* New helper `Splat(f)` which acts like `x -> f(x...)`, with pretty printing for
72-
inspecting which function `f` was originally wrapped ([#42717]).
7371
* New `pkgversion(m::Module)` function to get the version of the package that loaded
7472
a given module, similar to `pkgdir(m::Module)` ([#45607]).
7573
* New function `stack(x)` which generalises `reduce(hcat, x::Vector{<:Vector})` to any dimensionality,
@@ -98,6 +96,8 @@ Standard library changes
9896
* `@kwdef` is now exported and added to the public API ([#46273]).
9997
* An issue with order of operations in `fld1` is now fixed ([#28973]).
10098
* Sorting is now always stable by default, as `QuickSort` was stabilized ([#45222]).
99+
* `Base.splat` is now exported. The return value is now a `Base.Splat` instead
100+
of an anonymous function, which allows for pretty printing ([#42717]).
101101

102102
#### Package Manager
103103

@@ -185,7 +185,6 @@ Standard library changes
185185
Deprecated or removed
186186
---------------------
187187

188-
* Unexported `splat` is deprecated in favor of exported `Splat`, which has pretty printing of the wrapped function ([#42717]).
189188

190189
External dependencies
191190
---------------------
@@ -220,6 +219,7 @@ Tooling Improvements
220219
[#44358]: https://github.com/JuliaLang/julia/issues/44358
221220
[#44360]: https://github.com/JuliaLang/julia/issues/44360
222221
[#44512]: https://github.com/JuliaLang/julia/issues/44512
222+
[#44527]: https://github.com/JuliaLang/julia/issues/44527
223223
[#44534]: https://github.com/JuliaLang/julia/issues/44534
224224
[#44571]: https://github.com/JuliaLang/julia/issues/44571
225225
[#44714]: https://github.com/JuliaLang/julia/issues/44714
@@ -249,5 +249,7 @@ Tooling Improvements
249249
[#46609]: https://github.com/JuliaLang/julia/issues/46609
250250
[#46862]: https://github.com/JuliaLang/julia/issues/46862
251251
[#46976]: https://github.com/JuliaLang/julia/issues/46976
252+
[#47117]: https://github.com/JuliaLang/julia/issues/47117
253+
[#47184]: https://github.com/JuliaLang/julia/issues/47184
252254
[#47367]: https://github.com/JuliaLang/julia/issues/47367
253255
[#47392]: https://github.com/JuliaLang/julia/issues/47392

base/Base.jl

+5-4
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,6 @@ end
186186
include(strcat((length(Core.ARGS)>=2 ? Core.ARGS[2] : ""), "build_h.jl")) # include($BUILDROOT/base/build_h.jl)
187187
include(strcat((length(Core.ARGS)>=2 ? Core.ARGS[2] : ""), "version_git.jl")) # include($BUILDROOT/base/version_git.jl)
188188

189-
# These used to be in build_h.jl and are retained for backwards compatibility
190-
const libblas_name = "libblastrampoline"
191-
const liblapack_name = "libblastrampoline"
192-
193189
# numeric operations
194190
include("hashing.jl")
195191
include("rounding.jl")
@@ -290,6 +286,11 @@ include("sysinfo.jl")
290286
include("libc.jl")
291287
using .Libc: getpid, gethostname, time
292288

289+
# These used to be in build_h.jl and are retained for backwards compatibility.
290+
# NOTE: keep in sync with `libblastrampoline_jll.libblastrampoline`.
291+
const libblas_name = "libblastrampoline" * (Sys.iswindows() ? "-5" : "")
292+
const liblapack_name = libblas_name
293+
293294
# Logging
294295
include("logging.jl")
295296
using .CoreLogging

base/binaryplatforms.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ function detect_libstdcxx_version(max_minor_version::Int=30)
872872
end
873873

874874
# Brute-force our way through GLIBCXX_* symbols to discover which version we're linked against
875-
hdl = Libdl.dlopen(first(libstdcxx_paths))
875+
hdl = Libdl.dlopen(first(libstdcxx_paths))::Ptr{Cvoid}
876876
# Try all GLIBCXX versions down to GCC v4.8:
877877
# https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html
878878
for minor_version in max_minor_version:-1:18

base/cmd.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ function cmd_gen(parsed)
462462
(ignorestatus, flags, env, dir) = (cmd.ignorestatus, cmd.flags, cmd.env, cmd.dir)
463463
append!(args, cmd.exec)
464464
for arg in tail(parsed)
465-
append!(args, arg_gen(arg...)::Vector{String})
465+
append!(args, Base.invokelatest(arg_gen, arg...)::Vector{String})
466466
end
467467
return Cmd(Cmd(args), ignorestatus, flags, env, dir)
468468
else

base/compiler/abstractinterpretation.jl

+9-11
Original file line numberDiff line numberDiff line change
@@ -1890,7 +1890,7 @@ function abstract_call_known(interp::AbstractInterpreter, @nospecialize(f),
18901890
fargs = nothing
18911891
end
18921892
argtypes = Any[typeof(<:), argtypes[3], argtypes[2]]
1893-
return CallMeta(abstract_call_known(interp, <:, ArgInfo(fargs, argtypes), si, sv, max_methods).rt, EFFECTS_TOTAL, NoCallInfo())
1893+
return abstract_call_known(interp, <:, ArgInfo(fargs, argtypes), si, sv, max_methods)
18941894
elseif la == 2 &&
18951895
(a2 = argtypes[2]; isa(a2, Const)) && (svecval = a2.val; isa(svecval, SimpleVector)) &&
18961896
istopfunction(f, :length)
@@ -2045,14 +2045,13 @@ function abstract_eval_value_expr(interp::AbstractInterpreter, e::Expr, vtypes::
20452045
end
20462046
elseif head === :boundscheck
20472047
if isa(sv, InferenceState)
2048-
flag = sv.src.ssaflags[sv.currpc]
2049-
# If there is no particular @inbounds for this function, then we only taint `noinbounds`,
2050-
# which will subsequently taint consistency if this function is called from another
2051-
# function that uses `@inbounds`. However, if this :boundscheck is itself within an
2048+
# If there is no particular `@inbounds` for this function, then we only taint `:noinbounds`,
2049+
# which will subsequently taint `:consistent`-cy if this function is called from another
2050+
# function that uses `@inbounds`. However, if this `:boundscheck` is itself within an
20522051
# `@inbounds` region, its value depends on `--check-bounds`, so we need to taint
2053-
# consistency here also.
2052+
# `:consistent`-cy here also.
20542053
merge_effects!(interp, sv, Effects(EFFECTS_TOTAL; noinbounds=false,
2055-
consistent = (flag & IR_FLAG_INBOUNDS) != 0 ? ALWAYS_FALSE : ALWAYS_TRUE))
2054+
consistent = (get_curr_ssaflag(sv) & IR_FLAG_INBOUNDS) != 0 ? ALWAYS_FALSE : ALWAYS_TRUE))
20562055
end
20572056
rt = Bool
20582057
elseif head === :inbounds
@@ -2333,8 +2332,8 @@ function abstract_eval_phi(interp::AbstractInterpreter, phi::PhiNode, vtypes::Un
23332332
end
23342333

23352334
function stmt_taints_inbounds_consistency(sv::InferenceState)
2336-
flag = sv.src.ssaflags[sv.currpc]
2337-
return sv.src.propagate_inbounds || (flag & IR_FLAG_INBOUNDS) != 0
2335+
sv.src.propagate_inbounds && return true
2336+
return (get_curr_ssaflag(sv) & IR_FLAG_INBOUNDS) != 0
23382337
end
23392338

23402339
function abstract_eval_statement(interp::AbstractInterpreter, @nospecialize(e), vtypes::VarTable, sv::InferenceState)
@@ -2346,13 +2345,12 @@ function abstract_eval_statement(interp::AbstractInterpreter, @nospecialize(e),
23462345
end
23472346
(;rt, effects) = abstract_eval_statement_expr(interp, e, vtypes, sv, nothing)
23482347
if !effects.noinbounds
2349-
flag = sv.src.ssaflags[sv.currpc]
23502348
if !sv.src.propagate_inbounds
23512349
# The callee read our inbounds flag, but unless we propagate inbounds,
23522350
# we ourselves don't read our parent's inbounds.
23532351
effects = Effects(effects; noinbounds=true)
23542352
end
2355-
if (flag & IR_FLAG_INBOUNDS) != 0
2353+
if (get_curr_ssaflag(sv) & IR_FLAG_INBOUNDS) != 0
23562354
effects = Effects(effects; consistent=ALWAYS_FALSE)
23572355
end
23582356
end

base/compiler/effects.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ following meanings:
4040
This state corresponds to LLVM's `inaccessiblemem_or_argmemonly` function attribute.
4141
- `nonoverlayed::Bool`: indicates that any methods that may be called within this method
4242
are not defined in an [overlayed method table](@ref OverlayMethodTable).
43-
- `noinbounds::Bool`: If set, indicates that this method does not read the parent's :inbounds
44-
state. In particular, it does not have any reached :boundscheck exprs, not propagates inbounds
43+
- `noinbounds::Bool`: If set, indicates that this method does not read the parent's `:inbounds`
44+
state. In particular, it does not have any reached `:boundscheck` exprs, not propagates inbounds
4545
to any children that do.
4646
4747
Note that the representations above are just internal implementation details and thus likely

base/compiler/inferencestate.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ mutable struct InferenceState
177177

178178
valid_worlds = WorldRange(src.min_world, src.max_world == typemax(UInt) ? get_world_counter() : src.max_world)
179179
bestguess = Bottom
180-
ipo_effects = Effects(EFFECTS_TOTAL)
180+
ipo_effects = EFFECTS_TOTAL
181181

182182
params = InferenceParams(interp)
183183
restrict_abstract_call_sites = isa(linfo.def, Module)

base/compiler/ssair/inlining.jl

+7-7
Original file line numberDiff line numberDiff line change
@@ -1348,14 +1348,13 @@ function compute_inlining_cases(@nospecialize(info::CallInfo), flag::UInt8, sig:
13481348
nunion === nothing && return nothing
13491349
cases = InliningCase[]
13501350
argtypes = sig.argtypes
1351-
local any_fully_covered = false
13521351
local handled_all_cases::Bool = true
13531352
local revisit_idx = nothing
13541353
local only_method = nothing
13551354
local meth::MethodLookupResult
13561355
local all_result_count = 0
13571356
local joint_effects::Effects = EFFECTS_TOTAL
1358-
local nothrow::Bool = true
1357+
local fully_covered::Bool = true
13591358
for i = 1:nunion
13601359
meth = getsplit(info, i)
13611360
if meth.ambig
@@ -1377,12 +1376,12 @@ function compute_inlining_cases(@nospecialize(info::CallInfo), flag::UInt8, sig:
13771376
only_method = false
13781377
end
13791378
end
1379+
local split_fully_covered::Bool = false
13801380
for (j, match) in enumerate(meth)
13811381
all_result_count += 1
13821382
result = getresult(info, all_result_count)
13831383
joint_effects = merge_effects(joint_effects, info_effects(result, match, state))
1384-
nothrow &= match.fully_covers
1385-
any_fully_covered |= match.fully_covers
1384+
split_fully_covered |= match.fully_covers
13861385
if !validate_sparams(match.sparams)
13871386
if !match.fully_covers
13881387
handled_all_cases = false
@@ -1399,9 +1398,10 @@ function compute_inlining_cases(@nospecialize(info::CallInfo), flag::UInt8, sig:
13991398
result, match, argtypes, info, flag, state; allow_abstract=true, allow_typevars=false)
14001399
end
14011400
end
1401+
fully_covered &= split_fully_covered
14021402
end
14031403

1404-
joint_effects = Effects(joint_effects; nothrow)
1404+
joint_effects = Effects(joint_effects; nothrow=fully_covered)
14051405

14061406
if handled_all_cases && revisit_idx !== nothing
14071407
# we handled everything except one match with unmatched sparams,
@@ -1428,13 +1428,13 @@ function compute_inlining_cases(@nospecialize(info::CallInfo), flag::UInt8, sig:
14281428
end
14291429
handle_any_const_result!(cases,
14301430
result, match, argtypes, info, flag, state; allow_abstract=true, allow_typevars=true)
1431-
any_fully_covered = handled_all_cases = match.fully_covers
1431+
fully_covered = handled_all_cases = match.fully_covers
14321432
elseif !handled_all_cases
14331433
# if we've not seen all candidates, union split is valid only for dispatch tuples
14341434
filter!(case::InliningCase->isdispatchtuple(case.sig), cases)
14351435
end
14361436

1437-
return cases, (handled_all_cases & any_fully_covered), joint_effects
1437+
return cases, (handled_all_cases & fully_covered), joint_effects
14381438
end
14391439

14401440
function handle_call!(todo::Vector{Pair{Int,Any}},

base/compiler/tfuncs.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1541,7 +1541,7 @@ function apply_type_tfunc(@nospecialize(headtypetype), @nospecialize args...)
15411541
end
15421542
end
15431543
if largs == 1 # Union{T} --> T
1544-
u1 = typeintersect(widenconst(args[1]), Type)
1544+
u1 = typeintersect(widenconst(args[1]), Union{Type,TypeVar})
15451545
valid_as_lattice(u1) || return Bottom
15461546
return u1
15471547
end

base/docs/Docs.jl

+4-3
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ const modules = Module[]
7373
const META = gensym(:meta)
7474
const METAType = IdDict{Any,Any}
7575

76-
function meta(m::Module)
76+
function meta(m::Module; autoinit::Bool=true)
7777
if !isdefined(m, META) || getfield(m, META) === nothing
78-
initmeta(m)
78+
autoinit ? initmeta(m) : return nothing
7979
end
8080
return getfield(m, META)::METAType
8181
end
@@ -161,7 +161,8 @@ end
161161
function docstr(binding::Binding, typesig = Union{})
162162
@nospecialize typesig
163163
for m in modules
164-
dict = meta(m)
164+
dict = meta(m; autoinit=false)
165+
isnothing(dict) && continue
165166
if haskey(dict, binding)
166167
docs = dict[binding].docs
167168
if haskey(docs, typesig)

0 commit comments

Comments
 (0)