Skip to content

Commit 9a16c08

Browse files
authored
Merge pull request #43735 from JuliaLang/backports-release-1.6
release-1.6: Backports for 1.6.6
2 parents 7be0dcd + 3c8241c commit 9a16c08

Some content is hidden

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

62 files changed

+412
-149
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ $(BUILDROOT)/doc/_build/html/en/index.html: $(shell find $(BUILDROOT)/base $(BUI
4848

4949
julia-symlink: julia-cli-$(JULIA_BUILD_MODE)
5050
ifeq ($(OS),WINNT)
51-
@echo '@"%~dp0\'"$$(echo $(call rel_path,$(BUILDROOT),$(JULIA_EXECUTABLE)) | tr / '\\')"\" '%*' > $(BUILDROOT)/julia.bat
51+
echo '@"%~dp0/'"$$(echo '$(call rel_path,$(BUILDROOT),$(JULIA_EXECUTABLE))')"'" %*' | tr / '\\' > $(BUILDROOT)/julia.bat
5252
chmod a+x $(BUILDROOT)/julia.bat
5353
else
5454
ifndef JULIA_VAGRANT_BUILD

base/Base.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,6 @@ include("weakkeydict.jl")
244244
include("logging.jl")
245245
using .CoreLogging
246246

247-
# BinaryPlatforms, used by Artifacts
248-
include("binaryplatforms.jl")
249-
250247
# functions defined in Random
251248
function rand end
252249
function randn end
@@ -298,6 +295,9 @@ using .Order
298295
include("sort.jl")
299296
using .Sort
300297

298+
# BinaryPlatforms, used by Artifacts. Needs `Sort`.
299+
include("binaryplatforms.jl")
300+
301301
# Fast math
302302
include("fastmath.jl")
303303
using .FastMath

base/abstractdict.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,10 @@ empty(a::AbstractDict) = empty(a, keytype(a), valtype(a))
155155
empty(a::AbstractDict, ::Type{V}) where {V} = empty(a, keytype(a), V) # Note: this is the form which makes sense for `Vector`.
156156

157157
copy(a::AbstractDict) = merge!(empty(a), a)
158-
copy!(dst::AbstractDict, src::AbstractDict) = merge!(empty!(dst), src)
158+
function copy!(dst::AbstractDict, src::AbstractDict)
159+
dst === src && return dst
160+
merge!(empty!(dst), src)
161+
end
159162

160163
"""
161164
merge!(d::AbstractDict, others::AbstractDict...)

base/abstractset.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
eltype(::Type{<:AbstractSet{T}}) where {T} = @isdefined(T) ? T : Any
44
sizehint!(s::AbstractSet, n) = nothing
55

6-
copy!(dst::AbstractSet, src::AbstractSet) = union!(empty!(dst), src)
6+
function copy!(dst::AbstractSet, src::AbstractSet)
7+
dst === src && return dst
8+
union!(empty!(dst), src)
9+
end
710

811
## set operations (union, intersection, symmetric difference)
912

base/asyncmap.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ up to 100 tasks will be used for concurrent mapping.
1515
1616
`ntasks` can also be specified as a zero-arg function. In this case, the
1717
number of tasks to run in parallel is checked before processing every element and a new
18-
task started if the value of `ntasks_func` is less than the current number
18+
task started if the value of `ntasks_func` is greater than the current number
1919
of tasks.
2020
2121
If `batch_size` is specified, the collection is processed in batch mode. `f` must

base/binaryplatforms.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,8 @@ const arch_march_isa_mapping = let
608608
"armv8_0" => get_set("aarch64", "armv8.0-a"),
609609
"armv8_1" => get_set("aarch64", "armv8.1-a"),
610610
"armv8_2_crypto" => get_set("aarch64", "armv8.2-a+crypto"),
611-
"armv8_4_crypto_sve" => get_set("aarch64", "armv8.4-a+crypto+sve"),
611+
"a64fx" => get_set("aarch64", "a64fx"),
612+
"apple_m1" => get_set("aarch64", "apple_m1"),
612613
],
613614
"powerpc64le" => [
614615
"power8" => get_set("powerpc64le", "power8"),

base/cmd.jl

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ byteenv(env::Union{AbstractVector{Pair{T,V}}, Tuple{Vararg{Pair{T,V}}}}) where {
230230
String[cstr(k*"="*string(v)) for (k,v) in env]
231231

232232
"""
233-
setenv(command::Cmd, env; dir="")
233+
setenv(command::Cmd, env; dir)
234234
235235
Set environment variables to use when running the given `command`. `env` is either a
236236
dictionary mapping strings to strings, an array of strings of the form `"var=val"`, or
@@ -239,11 +239,22 @@ existing environment, create `env` through `copy(ENV)` and then setting `env["va
239239
as desired, or use `addenv`.
240240
241241
The `dir` keyword argument can be used to specify a working directory for the command.
242+
`dir` defaults to the currently set `dir` for `command` (which is the current working
243+
directory if not specified already).
242244
"""
243-
setenv(cmd::Cmd, env; dir="") = Cmd(cmd; env=byteenv(env), dir=dir)
244-
setenv(cmd::Cmd, env::Pair{<:AbstractString}...; dir="") =
245+
setenv(cmd::Cmd, env; dir=cmd.dir) = Cmd(cmd; env=byteenv(env), dir=dir)
246+
setenv(cmd::Cmd, env::Pair{<:AbstractString}...; dir=cmd.dir) =
245247
setenv(cmd, env; dir=dir)
246-
setenv(cmd::Cmd; dir="") = Cmd(cmd; dir=dir)
248+
setenv(cmd::Cmd; dir=cmd.dir) = Cmd(cmd; dir=dir)
249+
250+
# split environment entry string into before and after first `=` (key and value)
251+
function splitenv(e::String)
252+
i = findnext('=', e, 2)
253+
if i === nothing
254+
throw(ArgumentError("malformed environment entry"))
255+
end
256+
e[1:prevind(e, i)], e[nextind(e, i):end]
257+
end
247258

248259
"""
249260
addenv(command::Cmd, env...; inherit::Bool = true)
@@ -262,7 +273,7 @@ function addenv(cmd::Cmd, env::Dict; inherit::Bool = true)
262273
merge!(new_env, ENV)
263274
end
264275
else
265-
for (k, v) in split.(cmd.env, "=")
276+
for (k, v) in splitenv.(cmd.env)
266277
new_env[string(k)::String] = string(v)::String
267278
end
268279
end
@@ -277,7 +288,7 @@ function addenv(cmd::Cmd, pairs::Pair{<:AbstractString}...; inherit::Bool = true
277288
end
278289

279290
function addenv(cmd::Cmd, env::Vector{<:AbstractString}; inherit::Bool = true)
280-
return addenv(cmd, Dict(k => v for (k, v) in split.(env, "=")); inherit)
291+
return addenv(cmd, Dict(k => v for (k, v) in splitenv.(env)); inherit)
281292
end
282293

283294
(&)(left::AbstractCmd, right::AbstractCmd) = AndCmds(left, right)

base/cpuid.jl

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ const ISAs_by_family = Dict(
5656
"aarch64" => [
5757
# Implicit in all sets, because always required: fp, asimd
5858
"armv8.0-a" => ISA(Set{UInt32}()),
59-
"armv8.1-a" => ISA(Set((JL_AArch64_lse, JL_AArch64_crc, JL_AArch64_rdm))),
60-
"armv8.2-a+crypto" => ISA(Set((JL_AArch64_lse, JL_AArch64_crc, JL_AArch64_rdm, JL_AArch64_aes, JL_AArch64_sha2))),
61-
"armv8.4-a+crypto+sve" => ISA(Set((JL_AArch64_lse, JL_AArch64_crc, JL_AArch64_rdm, JL_AArch64_fp16fml, JL_AArch64_aes, JL_AArch64_sha2, JL_AArch64_dotprod, JL_AArch64_sve))),
59+
"armv8.1-a" => ISA(Set((JL_AArch64_v8_1a, JL_AArch64_lse, JL_AArch64_crc, JL_AArch64_rdm))),
60+
"armv8.2-a+crypto" => ISA(Set((JL_AArch64_v8_2a, JL_AArch64_lse, JL_AArch64_crc, JL_AArch64_rdm, JL_AArch64_aes, JL_AArch64_sha2))),
61+
"a64fx" => ISA(Set((JL_AArch64_v8_2a, JL_AArch64_lse, JL_AArch64_crc, JL_AArch64_rdm, JL_AArch64_sha2, JL_AArch64_ccpp, JL_AArch64_complxnum, JL_AArch64_fullfp16, JL_AArch64_sve))),
62+
"apple_m1" => ISA(Set((JL_AArch64_v8_5a, JL_AArch64_lse, JL_AArch64_crc, JL_AArch64_rdm, JL_AArch64_aes, JL_AArch64_sha2, JL_AArch64_sha3, JL_AArch64_ccpp, JL_AArch64_complxnum, JL_AArch64_fp16fml, JL_AArch64_fullfp16, JL_AArch64_dotprod, JL_AArch64_rcpc, JL_AArch64_altnzcv))),
6263
],
6364
"powerpc64le" => [
6465
# We have no way to test powerpc64le features yet, so we're only going to declare the lowest ISA:
@@ -88,14 +89,27 @@ function normalize_arch(arch::String)
8889
return arch
8990
end
9091

92+
let
93+
# Collect all relevant features for the current architecture, if any.
94+
FEATURES = UInt32[]
95+
arch = normalize_arch(String(Sys.ARCH))
96+
if arch in keys(ISAs_by_family)
97+
for isa in ISAs_by_family[arch]
98+
unique!(append!(FEATURES, last(isa).features))
99+
end
100+
end
101+
102+
# Use `@eval` to inline the list of features.
103+
@eval function cpu_isa()
104+
return ISA(Set{UInt32}(feat for feat in $(FEATURES) if test_cpu_feature(feat)))
105+
end
106+
end
107+
91108
"""
92109
cpu_isa()
93110
94111
Return the [`ISA`](@ref) (instruction set architecture) of the current CPU.
95112
"""
96-
function cpu_isa()
97-
all_features = last(last(get(ISAs_by_family, normalize_arch(String(Sys.ARCH)), "" => [ISA(Set{UInt32}())]))).features
98-
return ISA(Set{UInt32}(feat for feat in all_features if test_cpu_feature(feat)))
99-
end
113+
cpu_isa
100114

101115
end # module CPUID

base/expr.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,15 +422,16 @@ macro generated(f)
422422
if isa(f, Expr) && (f.head === :function || is_short_function_def(f))
423423
body = f.args[2]
424424
lno = body.args[1]
425+
tmp = gensym("tmp")
425426
return Expr(:escape,
426427
Expr(f.head, f.args[1],
427428
Expr(:block,
428429
lno,
429430
Expr(:if, Expr(:generated),
430431
# https://github.com/JuliaLang/julia/issues/25678
431432
Expr(:block,
432-
:(local tmp = $body),
433-
:(if tmp isa Core.CodeInfo; return tmp; else tmp; end)),
433+
:(local $tmp = $body),
434+
:(if $tmp isa $(GlobalRef(Core, :CodeInfo)); return $tmp; else $tmp; end)),
434435
Expr(:block,
435436
Expr(:meta, :generated_only),
436437
Expr(:return, nothing))))))

base/io.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct SystemError <: Exception
2020
extrainfo
2121
SystemError(p::AbstractString, e::Integer, extrainfo) = new(p, e, extrainfo)
2222
SystemError(p::AbstractString, e::Integer) = new(p, e, nothing)
23-
SystemError(p::AbstractString) = new(p, Libc.errno())
23+
SystemError(p::AbstractString) = new(p, Libc.errno(), nothing)
2424
end
2525

2626
lock(::IO) = nothing

0 commit comments

Comments
 (0)