Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backports for julia 1.9.1 #49680

Merged
merged 38 commits into from
May 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
177f6ef
Update parallel.md (#49308)
Azzaare Apr 10, 2023
cd960d9
Nospecialize close(c::Channel, excp::Exception) on excp. (#49508)
NHDaly Apr 26, 2023
c613d9c
remove debug print from loading test (#49534)
KristofferC Apr 27, 2023
0ef50aa
add two more explicit precompile statements (#49537)
KristofferC Apr 27, 2023
fdff436
Preserve LLVM function attributes during address space removal pass. …
maleadt Apr 28, 2023
f7b39e7
Ensure length(ipiv)==n before calling LAPACK.getrs! to avoid segfault…
aravindh-krishnamoorthy May 3, 2023
c9f59c9
shield `Base.require` from invalidations when loading Symbolics.jl (#…
KristofferC May 3, 2023
441a84e
fix some SCC cycle mistakes (#49654)
vtjnash May 6, 2023
78f2f87
Update LBT source checksums (#49523)
staticfloat May 8, 2023
e8fa82b
Improve performance of global code by emitting fewer atomic barriers.
maleadt Nov 19, 2022
7a3fb0a
Also emit a barrier at the end of the function prologue.
maleadt Dec 21, 2022
2895e43
Demote another world-age load to monotonic.
maleadt Dec 21, 2022
0eabff2
Undo change in atomic ordering.
maleadt Apr 18, 2023
2a5ede1
Initialize hoisted object allocations (#49584)
pchintalapudi May 4, 2023
a98b387
Bump LBT to v5.8.0 (#49658)
staticfloat May 8, 2023
be67a40
Allow showing of StepRangLen{T} with generic T (#49516)
SamuelBadr May 5, 2023
f81bada
Initialize hoisted object allocations (#49584)
pchintalapudi May 4, 2023
c3d84e4
Export offsets necessary for external codegen (#49548)
vchuravy Apr 29, 2023
b15d8a9
minimal changes to avoid Artifacts to get invalidated by some common …
KristofferC May 3, 2023
9ce1976
Ensure LLVM function attributes are preserved by always calling Clone…
maleadt May 2, 2023
1602dc1
Don't explicitly remap the personality function.
maleadt May 2, 2023
16579c4
Clarify Cxx.jl. Update calling-c-and-fortran-code.md (#49379)
PallHaraldsson Apr 17, 2023
7ab56f4
Add `@eval using REPL` to the `atreplinit` do block in REPL documenta…
kdheepak May 10, 2023
efa269e
add note about references in `Out` (#49729)
MasonProtter May 11, 2023
42d4b97
Artifacts: pull out a recursive function from a closure to a stand al…
KristofferC May 12, 2023
d175b27
allow loading extensions when a trigger is loaded from below the pare…
KristofferC May 12, 2023
303ea52
🤖 [backports-release-1.9] Bump the Pkg stdlib from 3ca88658d to 7276c…
DilumAluthgeBot May 18, 2023
1dd49c9
Fix subtyping freeze in 1.9.0 (#49875)
kpamnany May 19, 2023
f07ed54
[Profile] fix overhead counts in format=:flat (#49824)
vtjnash May 16, 2023
ca5ee23
[cli] Ensure that probed `libstdc++` path is NULL-terminated
staticfloat May 17, 2023
4ce8bf8
improve inferrability of loading.jl
aviatesk May 13, 2023
c3458d0
follow up #49812, fix the wrong type declaration (#49854)
aviatesk May 17, 2023
23c0d24
Fix thread safety in `atexit(f)`: Lock access to atexit_hooks (#49774)
NHDaly May 15, 2023
9e94f66
Merge pull request #49842 from JuliaLang/sf/dont_eagerly_load_libgomp
staticfloat May 17, 2023
83263ee
Fix MemorySSA bug, broken julia-licm test (#49900)
pchintalapudi May 20, 2023
d40e71a
[MPFR] Fix printing of `BigFloat` (#49909)
giordano May 21, 2023
4a46ccb
🤖 [backports-release-1.9] Bump the Pkg stdlib from 7276c7514 to 3fa06…
DilumAluthgeBot May 22, 2023
295b503
Improve type stability of array_subpadding slightly (#48136)
jakobnissen Jan 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions base/binaryplatforms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1015,19 +1015,19 @@ function platforms_match(a::AbstractPlatform, b::AbstractPlatform)

# Throw an error if `a` and `b` have both set non-default comparison strategies for `k`
# and they're not the same strategy.
if a_comp != compare_default && b_comp != compare_default && a_comp != b_comp
if a_comp !== compare_default && b_comp !== compare_default && a_comp !== b_comp
throw(ArgumentError("Cannot compare Platform objects with two different non-default comparison strategies for the same key \"$(k)\""))
end

# Select the custom comparator, if we have one.
comparator = a_comp
if b_comp != compare_default
if b_comp !== compare_default
comparator = b_comp
end

# Call the comparator, passing in which objects requested this comparison (one, the other, or both)
# For some comparators this doesn't matter, but for non-symmetrical comparisons, it does.
if !(comparator(ak, bk, a_comp == comparator, b_comp == comparator)::Bool)
if !(comparator(ak, bk, a_comp === comparator, b_comp === comparator)::Bool)
return false
end
end
Expand Down Expand Up @@ -1073,7 +1073,9 @@ function select_platform(download_info::Dict, platform::AbstractPlatform = HostP
# of generally choosing the latest release (e.g. a `libgfortran5` tarball
# rather than a `libgfortran3` tarball)
p = last(sort(ps, by = p -> triplet(p)))
return download_info[p]

# @invokelatest here to not get invalidated by new defs of `==(::Function, ::Function)`
return @invokelatest getindex(download_info, p)
end

# precompiles to reduce latency (see https://github.com/JuliaLang/julia/pull/43990#issuecomment-1025692379)
Expand Down
3 changes: 2 additions & 1 deletion base/channels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ Close a channel. An exception (optionally given by `excp`), is thrown by:
* [`put!`](@ref) on a closed channel.
* [`take!`](@ref) and [`fetch`](@ref) on an empty, closed channel.
"""
function close(c::Channel, excp::Exception=closed_exception())
close(c::Channel) = close(c, closed_exception()) # nospecialize on default arg seems to confuse makedocs
function close(c::Channel, @nospecialize(excp::Exception))
lock(c)
try
c.excp = excp
Expand Down
3 changes: 2 additions & 1 deletion base/initdefs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ end
const atexit_hooks = Callable[
() -> Filesystem.temp_cleanup_purge(force=true)
]
const _atexit_hooks_lock = ReentrantLock()

"""
atexit(f)
Expand All @@ -374,7 +375,7 @@ calls `exit(n)`, then Julia will exit with the exit code corresponding to the
last called exit hook that calls `exit(n)`. (Because exit hooks are called in
LIFO order, "last called" is equivalent to "first registered".)
"""
atexit(f::Function) = (pushfirst!(atexit_hooks, f); nothing)
atexit(f::Function) = Base.@lock _atexit_hooks_lock (pushfirst!(atexit_hooks, f); nothing)

function _atexit(exitcode::Cint)
while !isempty(atexit_hooks)
Expand Down
104 changes: 70 additions & 34 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,9 @@ function locate_package_env(pkg::PkgId, stopenv::Union{String, Nothing}=nothing)
@goto done
end
end
stopenv == env && @goto done
if !(loading_extension || precompiling_extension)
stopenv == env && @goto done
end
end
else
for env in load_path()
Expand All @@ -428,7 +430,9 @@ function locate_package_env(pkg::PkgId, stopenv::Union{String, Nothing}=nothing)
path = entry_path(path, pkg.name)
@goto done
end
stopenv == env && break
if !(loading_extension || precompiling_extension)
stopenv == env && break
end
end
# Allow loading of stdlibs if the name/uuid are given
# e.g. if they have been explicitly added to the project/manifest
Expand Down Expand Up @@ -619,6 +623,24 @@ function manifest_deps_get(env::String, where::PkgId, name::String)::Union{Nothi
pkg_uuid = explicit_project_deps_get(project_file, name)
return PkgId(pkg_uuid, name)
end
d = parsed_toml(project_file)
exts = get(d, "extensions", nothing)::Union{Dict{String, Any}, Nothing}
if exts !== nothing
# Check if `where` is an extension of the project
if where.name in keys(exts) && where.uuid == uuid5(proj.uuid::UUID, where.name)
# Extensions can load weak deps...
weakdeps = get(d, "weakdeps", nothing)::Union{Dict{String, Any}, Nothing}
if weakdeps !== nothing
wuuid = get(weakdeps, name, nothing)::Union{String, Nothing}
if wuuid !== nothing
return PkgId(UUID(wuuid), name)
end
end
# ... and they can load same deps as the project itself
mby_uuid = explicit_project_deps_get(project_file, name)
mby_uuid === nothing || return PkgId(mby_uuid, name)
end
end
# look for manifest file and `where` stanza
return explicit_manifest_deps_get(project_file, where, name)
elseif project_file
Expand All @@ -636,6 +658,8 @@ function manifest_uuid_path(env::String, pkg::PkgId)::Union{Nothing,String,Missi
# if `pkg` matches the project, return the project itself
return project_file_path(project_file)
end
mby_ext = project_file_ext_path(project_file, pkg.name)
mby_ext === nothing || return mby_ext
# look for manifest file and `where` stanza
return explicit_manifest_uuid_path(project_file, pkg)
elseif project_file
Expand All @@ -645,6 +669,25 @@ function manifest_uuid_path(env::String, pkg::PkgId)::Union{Nothing,String,Missi
return nothing
end


function find_ext_path(project_path::String, extname::String)
extfiledir = joinpath(project_path, "ext", extname, extname * ".jl")
isfile(extfiledir) && return extfiledir
return joinpath(project_path, "ext", extname * ".jl")
end

function project_file_ext_path(project_file::String, name::String)
d = parsed_toml(project_file)
p = project_file_path(project_file)
exts = get(d, "extensions", nothing)::Union{Dict{String, Any}, Nothing}
if exts !== nothing
if name in keys(exts)
return find_ext_path(p, name)
end
end
return nothing
end

# find project file's top-level UUID entry (or nothing)
function project_file_name_uuid(project_file::String, name::String)::PkgId
d = parsed_toml(project_file)
Expand Down Expand Up @@ -747,10 +790,10 @@ function explicit_project_deps_get(project_file::String, name::String)::Union{No
return nothing
end

function is_v1_format_manifest(raw_manifest::Dict)
function is_v1_format_manifest(raw_manifest::Dict{String})
if haskey(raw_manifest, "manifest_format")
mf = raw_manifest["manifest_format"]
if mf isa Dict && haskey(mf, "uuid")
if mf isa Dict{String} && haskey(mf, "uuid")
# the off-chance where an old format manifest has a dep called "manifest_format"
return true
end
Expand Down Expand Up @@ -876,9 +919,7 @@ function explicit_manifest_uuid_path(project_file::String, pkg::PkgId)::Union{No
error("failed to find source of parent package: \"$name\"")
end
p = normpath(dirname(parent_path), "..")
extfiledir = joinpath(p, "ext", pkg.name, pkg.name * ".jl")
isfile(extfiledir) && return extfiledir
return joinpath(p, "ext", pkg.name * ".jl")
return find_ext_path(p, pkg.name)
end
end
end
Expand Down Expand Up @@ -1126,6 +1167,20 @@ end
function insert_extension_triggers(env::String, pkg::PkgId)::Union{Nothing,Missing}
project_file = env_project_file(env)
if project_file isa String
# Look in project for extensions to insert
proj_pkg = project_file_name_uuid(project_file, pkg.name)
if pkg == proj_pkg
d_proj = parsed_toml(project_file)
weakdeps = get(d_proj, "weakdeps", nothing)::Union{Nothing, Vector{String}, Dict{String,Any}}
extensions = get(d_proj, "extensions", nothing)::Union{Nothing, Dict{String, Any}}
extensions === nothing && return
weakdeps === nothing && return
if weakdeps isa Dict{String, Any}
return _insert_extension_triggers(pkg, extensions, weakdeps)
end
end

# Now look in manifest
manifest_file = project_file_manifest_path(project_file)
manifest_file === nothing && return
d = get_deps(parsed_toml(manifest_file))
Expand All @@ -1144,7 +1199,7 @@ function insert_extension_triggers(env::String, pkg::PkgId)::Union{Nothing,Missi
return _insert_extension_triggers(pkg, extensions, weakdeps)
end

d_weakdeps = Dict{String, String}()
d_weakdeps = Dict{String, Any}()
for (dep_name, entries) in d
dep_name in weakdeps || continue
entries::Vector{Any}
Expand All @@ -1164,8 +1219,9 @@ function insert_extension_triggers(env::String, pkg::PkgId)::Union{Nothing,Missi
return nothing
end

function _insert_extension_triggers(parent::PkgId, extensions::Dict{String, <:Any}, weakdeps::Dict{String, <:Any})
for (ext::String, triggers::Union{String, Vector{String}}) in extensions
function _insert_extension_triggers(parent::PkgId, extensions::Dict{String, Any}, weakdeps::Dict{String, Any})
for (ext, triggers) in extensions
triggers = triggers::Union{String, Vector{String}}
triggers isa String && (triggers = [triggers])
id = PkgId(uuid5(parent.uuid, ext), ext)
if id in keys(EXT_PRIMED) || haskey(Base.loaded_modules, id)
Expand All @@ -1190,6 +1246,7 @@ function _insert_extension_triggers(parent::PkgId, extensions::Dict{String, <:An
end

loading_extension::Bool = false
precompiling_extension::Bool = false
function run_extension_callbacks(extid::ExtensionId)
assert_havelock(require_lock)
succeeded = try
Expand Down Expand Up @@ -1217,30 +1274,8 @@ function run_extension_callbacks(pkgid::PkgId)
extids === nothing && return
for extid in extids
if extid.ntriggers > 0
# It is possible that pkgid was loaded in an environment
# below the one of the parent. This will cause a load failure when the
# pkg ext tries to load the triggers. Therefore, check this first
# before loading the pkg ext.
pkgenv = identify_package_env(extid.id, pkgid.name)
ext_not_allowed_load = false
if pkgenv === nothing
ext_not_allowed_load = true
else
pkg, env = pkgenv
path = locate_package(pkg, env)
if path === nothing
ext_not_allowed_load = true
end
end
if ext_not_allowed_load
@debug "Extension $(extid.id.name) of $(extid.parentid.name) will not be loaded \
since $(pkgid.name) loaded in environment lower in load path"
# indicate extid is expected to fail
extid.ntriggers *= -1
else
# indicate pkgid is loaded
extid.ntriggers -= 1
end
# indicate pkgid is loaded
extid.ntriggers -= 1
end
if extid.ntriggers < 0
# indicate pkgid is loaded
Expand Down Expand Up @@ -2066,6 +2101,7 @@ function create_expr_cache(pkg::PkgId, input::String, output::String, output_o::
# write data over stdin to avoid the (unlikely) case of exceeding max command line size
write(io.in, """
empty!(Base.EXT_DORMITORY) # If we have a custom sysimage with `EXT_DORMITORY` prepopulated
Base.precompiling_extension = $(loading_extension)
Base.include_package_for_output($(pkg_str(pkg)), $(repr(abspath(input))), $(repr(depot_path)), $(repr(dl_load_path)),
$(repr(load_path)), $deps, $(repr(source_path(nothing))))
""")
Expand Down
2 changes: 1 addition & 1 deletion base/mpfr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ function _string(x::BigFloat, fmt::String)::String
isfinite(x) || return string(Float64(x))
_prettify_bigfloat(string_mpfr(x, fmt))
end
_string(x::BigFloat) = _string(x, "%.Re")
_string(x::BigFloat) = _string(x, "%Re")
_string(x::BigFloat, k::Integer) = _string(x, "%.$(k)Re")

string(b::BigFloat) = _string(b)
Expand Down
2 changes: 1 addition & 1 deletion base/range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ show(io::IO, r::AbstractRange) = print(io, repr(first(r)), ':', repr(step(r)), '
show(io::IO, r::UnitRange) = print(io, repr(first(r)), ':', repr(last(r)))
show(io::IO, r::OneTo) = print(io, "Base.OneTo(", r.stop, ")")
function show(io::IO, r::StepRangeLen)
if step(r) != 0
if !iszero(step(r))
print(io, repr(first(r)), ':', repr(step(r)), ':', repr(last(r)))
else
# ugly temporary printing, to avoid 0:0:0 etc.
Expand Down
15 changes: 11 additions & 4 deletions base/reinterpretarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -725,11 +725,18 @@ end
@assume_effects :total function array_subpadding(S, T)
lcm_size = lcm(sizeof(S), sizeof(T))
s, t = CyclePadding(S), CyclePadding(T)
isempty(t) && return true
isempty(s) && return false
checked_size = 0
ps, sstate = iterate(s) # use of Stateful harms inference and makes this vulnerable to invalidation
pad, tstate = iterate(t)
# use of Stateful harms inference and makes this vulnerable to invalidation
(pad, tstate) = let
it = iterate(t)
it === nothing && return true
it
end
(ps, sstate) = let
it = iterate(s)
it === nothing && return false
it
end
while checked_size < lcm_size
while true
# See if there's corresponding padding in S
Expand Down
2 changes: 2 additions & 0 deletions cli/loader_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ static char *libstdcxxprobe(void)
free(path);
return NULL;
}
// Ensure that `path` is zero-terminated.
path[pathlen] = '\0';
return path;
}
}
Expand Down
2 changes: 2 additions & 0 deletions contrib/generate_precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ precompile(Tuple{typeof(push!), Vector{Function}, Function})
# miscellaneous
precompile(Tuple{typeof(Base.require), Base.PkgId})
precompile(Tuple{typeof(Base.recursive_prefs_merge), Base.Dict{String, Any}})
precompile(Tuple{typeof(Base.hashindex), Tuple{Base.PkgId, Nothing}, Int64})
precompile(Tuple{typeof(Base.hashindex), Tuple{Base.PkgId, String}, Int64})
precompile(Tuple{typeof(isassigned), Core.SimpleVector, Int})
precompile(Tuple{typeof(getindex), Core.SimpleVector, Int})
precompile(Tuple{typeof(Base.Experimental.register_error_hint), Any, Type})
Expand Down
6 changes: 3 additions & 3 deletions deps/blastrampoline.version
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
BLASTRAMPOLINE_JLL_NAME := libblastrampoline

## source build
BLASTRAMPOLINE_VER := 5.7.0
BLASTRAMPOLINE_BRANCH=v5.7.0
BLASTRAMPOLINE_SHA1=2272604bfb10b9e8a3ae5f1a4569899b99251a65
BLASTRAMPOLINE_VER := 5.8.0
BLASTRAMPOLINE_BRANCH=v5.8.0
BLASTRAMPOLINE_SHA1=81316155d4838392e8462a92bcac3eebe9acd0c7

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
203b01484d8550eeb8e08d18099b56e0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e0818e7542a360668119cc7bc9f57a136f5fdcb0d0786bb02a98eceaf7d993790bd81c60915857baff84a3ec97a39eadb735d666bf12666e24fcad28035eddc0
Loading