Skip to content

Commit 1d93878

Browse files
authored
Merge pull request #44324 from JuliaLang/backports-release-1.8
Backports for julia 1.8.0-beta2
2 parents 7b711ce + e1e02f6 commit 1d93878

File tree

113 files changed

+2333
-1089
lines changed

Some content is hidden

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

113 files changed

+2333
-1089
lines changed

.buildkite/pipelines/main/misc/sanitizers.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ steps:
2121
timeout_in_minutes: 120
2222
if: | # We only run the `asan` job on Julia 1.8 and later.
2323
(pipeline.slug != "julia-release-1-dot-6") && (pipeline.slug != "julia-release-1-dot-7")
24-
soft_fail: true # TODO: delete this line (and thus disallow failures) once JuliaLang/julia#42540 is fixed
2524
commands: |
2625
echo "--- Build julia-debug with ASAN"
2726
contrib/asan/build.sh ./tmp/test-asan -j$${JULIA_CPU_THREADS:?} debug

Make.inc

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# -*- mode: makefile-gmake -*-
1+
# -*- mode: makefile -*-
22
# vi:syntax=make
33

44
## Note:
@@ -483,9 +483,6 @@ endif
483483
endif
484484

485485
ifeq ($(USEGCC),1)
486-
ifeq ($(SANITIZE),1)
487-
$(error Sanitizers are only supported with clang. Try setting SANITIZE=0)
488-
endif
489486
CC := $(CROSS_COMPILE)gcc
490487
CXX := $(CROSS_COMPILE)g++
491488
JCFLAGS := -std=gnu99 -pipe $(fPIC) -fno-strict-aliasing -D_FILE_OFFSET_BITS=64
@@ -519,6 +516,8 @@ JCPPFLAGS += -D_LARGEFILE_SOURCE -D_DARWIN_USE_64_BIT_INODE=1
519516
endif
520517
endif
521518

519+
JLDFLAGS :=
520+
522521
ifeq ($(USECCACHE), 1)
523522
# Expand CC, CXX and FC here already because we want the original definition and not the ccache version.
524523
CC_ARG := $(CC)
@@ -1237,15 +1236,11 @@ IFUNC_DETECT_SRC := 'void (*f0(void))(void) { return (void(*)(void))0L; }; void
12371236
ifeq (supported, $(shell echo $(IFUNC_DETECT_SRC) | $(CC) -Werror -x c - -S -o /dev/null > /dev/null 2>&1 && echo supported))
12381237
JCPPFLAGS += -DJULIA_HAS_IFUNC_SUPPORT=1
12391238
endif
1240-
JLDFLAGS := -Wl,-Bdynamic
1241-
ifneq ($(SANITIZE),1)
1242-
ifneq ($(SANITIZE_MEMORY),1)
1243-
ifneq ($(LLVM_SANITIZE),1)
1239+
JLDFLAGS += -Wl,-Bdynamic
12441240
OSLIBS += -Wl,--version-script=$(JULIAHOME)/src/julia.expmap
1241+
ifneq ($(SANITIZE),1)
12451242
JLDFLAGS += -Wl,-no-undefined
12461243
endif
1247-
endif
1248-
endif
12491244
ifeq (-Bsymbolic-functions, $(shell $(LD) --help | grep -o -e "-Bsymbolic-functions"))
12501245
JLIBLDFLAGS := -Wl,-Bsymbolic-functions
12511246
else
@@ -1256,7 +1251,7 @@ JLIBLDFLAGS :=
12561251
endif
12571252

12581253
ifeq ($(OS), FreeBSD)
1259-
JLDFLAGS := -Wl,-Bdynamic
1254+
JLDFLAGS += -Wl,-Bdynamic
12601255
OSLIBS += -lelf -lkvm -lrt -lpthread -latomic
12611256

12621257
# Tweak order of libgcc_s in DT_NEEDED,
@@ -1274,7 +1269,6 @@ SHLIB_EXT := dylib
12741269
OSLIBS += -framework CoreFoundation
12751270
WHOLE_ARCHIVE := -Xlinker -all_load
12761271
NO_WHOLE_ARCHIVE :=
1277-
JLDFLAGS :=
12781272
HAVE_SSP := 1
12791273
JLIBLDFLAGS := -Wl,-compatibility_version,$(SOMAJOR) -Wl,-current_version,$(JULIA_MAJOR_VERSION).$(JULIA_MINOR_VERSION).$(JULIA_PATCH_VERSION)
12801274
endif
@@ -1283,7 +1277,7 @@ ifeq ($(OS), WINNT)
12831277
HAVE_SSP := 1
12841278
OSLIBS += -Wl,--export-all-symbols -Wl,--version-script=$(JULIAHOME)/src/julia.expmap \
12851279
$(NO_WHOLE_ARCHIVE) -lpsapi -lkernel32 -lws2_32 -liphlpapi -lwinmm -ldbghelp -luserenv -lsecur32 -latomic
1286-
JLDFLAGS := -Wl,--stack,8388608
1280+
JLDFLAGS += -Wl,--stack,8388608
12871281
ifeq ($(ARCH),i686)
12881282
JLDFLAGS += -Wl,--large-address-aware
12891283
endif
@@ -1478,7 +1472,7 @@ endif
14781472
endif
14791473
ifeq ($(OS),Darwin)
14801474
ifeq ($(ARCH),aarch64)
1481-
LIBGCC_NAME := libgcc_s.2.$(SHLIB_EXT)
1475+
LIBGCC_NAME := libgcc_s.1.1.$(SHLIB_EXT)
14821476
else
14831477
LIBGCC_NAME := libgcc_s.1.$(SHLIB_EXT)
14841478
endif

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,21 @@ ifeq ($(OS), Linux)
427427
endif
428428
ifeq ($(OS), WINNT)
429429
cd $(BUILDROOT)/julia-$(JULIA_COMMIT)/bin && rm -f llvm* llc.exe lli.exe opt.exe LTO.dll bugpoint.exe macho-dump.exe
430+
endif
431+
# If we're on macOS, and we have a codesigning identity, then codesign the binary-dist tarball!
432+
ifeq ($(OS),Darwin)
433+
ifneq ($(MACOS_CODESIGN_IDENTITY),)
434+
echo "Codesigning with identity $(MACOS_CODESIGN_IDENTITY)"; \
435+
MACHO_FILES=$$(find "$(BUILDROOT)/julia-$(JULIA_COMMIT)" -type f -perm -0111 | cut -d: -f1); \
436+
for f in $${MACHO_FILES}; do \
437+
echo "Codesigning $${f}..."; \
438+
codesign -s "$(MACOS_CODESIGN_IDENTITY)" --option=runtime --entitlements $(JULIAHOME)/contrib/mac/app/Entitlements.plist -vvv --timestamp --deep --force "$${f}"; \
439+
done
440+
endif
430441
endif
431442
cd $(BUILDROOT) && $(TAR) zcvf $(JULIA_BINARYDIST_FILENAME).tar.gz julia-$(JULIA_COMMIT)
432443

444+
433445
exe:
434446
# run Inno Setup to compile installer
435447
$(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))

NEWS.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ New language features
1313
no errors were thrown ([#42211]).
1414
* `@inline` and `@noinline` annotations can now be placed within a function body ([#41312]).
1515
* `@inline` and `@noinline` annotations can now be applied to a function call site or block
16-
to enforce the involved function calls to be (or not to be) inlined ([#41312]).
16+
to enforce the involved function calls to be (or not to be) inlined ([#41328]).
1717
* ``, ``, and `` are now allowed as identifier characters ([#42314]).
1818
* Support for Unicode 14.0.0 ([#43443]).
1919
* `Module(:name, false, false)` can be used to create a `module` that contains no names
20-
(it does not import `Base` or `Core` and does not contain a reference to itself) ([#40110, #42154]).
20+
(it does not import `Base` or `Core` and does not contain a reference to itself) ([#40110], [#42154]).
2121

2222
Language changes
2323
----------------
@@ -54,6 +54,12 @@ Compiler/Runtime improvements
5454
Code heavily dependent on constant propagation should see significant compile-time performance improvements and
5555
certain cases (e.g. calls to uninlinable functions that are nevertheless effect free) should see runtime performance
5656
improvements. Effects may be overwritten manually with the `@Base.assume_effects` macro ([#43852]).
57+
* Precompilation (with explicit `precompile` directives or representative workloads) now saves more type-inferred code,
58+
resulting in reduced time-to-first task for packages that use precompilation. This change also eliminates the
59+
runtime performance degradation occasionally triggered by precompilation on older Julia versions. More specifically,
60+
any newly-inferred method/type combinations needed by your package--regardless of where those methods were
61+
defined--can now be cached in the precompile file, as long as they are inferrably called by a method owned by
62+
your package ([#43990]).
5763

5864
Command-line option changes
5965
---------------------------
@@ -111,6 +117,26 @@ Standard library changes
111117
* Intersect returns a result with the eltype of the type-promoted eltypes of the two inputs ([#41769]).
112118
* Iterating an `Iterators.Reverse` now falls back on reversing the eachindex iterator, if possible ([#43110]).
113119

120+
#### Package Manager
121+
122+
* New `` and `` indicators beside packages in `pkg> status` that have new versions available.
123+
`` indicates when new versions cannot be installed ([Pkg#2906]).
124+
* New `outdated::Bool` kwarg to `Pkg.status` (`--outdated` or `-o` in the REPL mode) to show
125+
information about packages not at the latest version ([Pkg#2284]).
126+
* New `compat::Bool` kwarg to `Pkg.status` (`--compat` or `-c` in the REPL mode) to show any [compat]
127+
entries in the Project.toml ([Pkg#2702]).
128+
* New `pkg> compat` (and `Pkg.compat`) mode for setting Project compat entries. Provides an interactive editor
129+
via `pkg> compat`, or direct entry manipulation via `pkg> Foo 0.4,0.5` which can load current entries via tab-completion.
130+
i.e. `pkg> compat Fo<TAB>` autocompletes to `pkg> Foo 0.4,0.5` so that the existing entry can be edited ([Pkg#2702]).
131+
* Pkg now only tries to download packages from the package server in case the server tracks a registry that contains
132+
the package ([Pkg#2689]).
133+
* `Pkg.instantiate` will now warn when a Project.toml is out of sync with a Manifest.toml. It does this by storing a hash
134+
of the project deps and compat entries (other fields are ignored) in the manifest when it is resolved, so that any change
135+
to the Project.toml deps or compat entries without a re-resolve can be detected ([Pkg#2815]).
136+
* If `pkg> add` cannot find a package with the provided name it will now suggest similarly named packages that can be added ([Pkg#2985]).
137+
* The julia version stored in the manifest no longer includes the build number i.e. master will now record as `1.9.0-DEV` ([Pkg#2995]).
138+
* Interrupting a `pkg> test` will now be caught more reliably and exit back to the REPL gracefully ([Pkg#2933]).
139+
114140
#### InteractiveUtils
115141

116142
* New macro `@time_imports` for reporting any time spent importing packages and their dependencies ([#41612]).
@@ -212,6 +238,16 @@ Tooling Improvements
212238
* `GC.enable_logging(true)` can be used to log each garbage collection, with the
213239
time it took and the amount of memory that was collected ([#43511]).
214240

241+
<!-- manually added -->
242+
[Pkg#2284]: https://github.com/JuliaLang/Pkg.jl/issues/2284
243+
[Pkg#2689]: https://github.com/JuliaLang/Pkg.jl/issues/2689
244+
[Pkg#2702]: https://github.com/JuliaLang/Pkg.jl/issues/2702
245+
[Pkg#2815]: https://github.com/JuliaLang/Pkg.jl/issues/2815
246+
[Pkg#2906]: https://github.com/JuliaLang/Pkg.jl/issues/2906
247+
[Pkg#2933]: https://github.com/JuliaLang/Pkg.jl/issues/2933
248+
[Pkg#2985]: https://github.com/JuliaLang/Pkg.jl/issues/2985
249+
[Pkg#2995]: https://github.com/JuliaLang/Pkg.jl/issues/2995
250+
215251
<!--- generated by NEWS-update.jl: -->
216252
[#33711]: https://github.com/JuliaLang/julia/issues/33711
217253
[#36265]: https://github.com/JuliaLang/julia/issues/36265
@@ -220,12 +256,14 @@ Tooling Improvements
220256
[#38791]: https://github.com/JuliaLang/julia/issues/38791
221257
[#39241]: https://github.com/JuliaLang/julia/issues/39241
222258
[#39245]: https://github.com/JuliaLang/julia/issues/39245
259+
[#40110]: https://github.com/JuliaLang/julia/issues/40110
223260
[#40382]: https://github.com/JuliaLang/julia/issues/40382
224261
[#40642]: https://github.com/JuliaLang/julia/issues/40642
225262
[#40783]: https://github.com/JuliaLang/julia/issues/40783
226263
[#40980]: https://github.com/JuliaLang/julia/issues/40980
227264
[#41085]: https://github.com/JuliaLang/julia/issues/41085
228265
[#41312]: https://github.com/JuliaLang/julia/issues/41312
266+
[#41328]: https://github.com/JuliaLang/julia/issues/41328
229267
[#41449]: https://github.com/JuliaLang/julia/issues/41449
230268
[#41551]: https://github.com/JuliaLang/julia/issues/41551
231269
[#41576]: https://github.com/JuliaLang/julia/issues/41576
@@ -238,6 +276,7 @@ Tooling Improvements
238276
[#41794]: https://github.com/JuliaLang/julia/issues/41794
239277
[#41888]: https://github.com/JuliaLang/julia/issues/41888
240278
[#41936]: https://github.com/JuliaLang/julia/issues/41936
279+
[#42154]: https://github.com/JuliaLang/julia/issues/42154
241280
[#42211]: https://github.com/JuliaLang/julia/issues/42211
242281
[#42225]: https://github.com/JuliaLang/julia/issues/42225
243282
[#42248]: https://github.com/JuliaLang/julia/issues/42248
@@ -274,5 +313,6 @@ Tooling Improvements
274313
[#43852]: https://github.com/JuliaLang/julia/issues/43852
275314
[#43865]: https://github.com/JuliaLang/julia/issues/43865
276315
[#43919]: https://github.com/JuliaLang/julia/issues/43919
316+
[#43990]: https://github.com/JuliaLang/julia/issues/43990
277317
[#44080]: https://github.com/JuliaLang/julia/issues/44080
278318
[#44136]: https://github.com/JuliaLang/julia/issues/44136

base/Base.jl

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ end_base_include = time_ns()
427427
const _sysimage_modules = PkgId[]
428428
in_sysimage(pkgid::PkgId) = pkgid in _sysimage_modules
429429

430-
# Precompiles for Revise
430+
# Precompiles for Revise and other packages
431431
# TODO: move these to contrib/generate_precompile.jl
432432
# The problem is they don't work there
433433
for match = _methods(+, (Int, Int), -1, get_world_counter())
@@ -461,6 +461,23 @@ for match = _methods(+, (Int, Int), -1, get_world_counter())
461461

462462
# Code loading uses this
463463
sortperm(mtime.(readdir(".")), rev=true)
464+
# JLLWrappers uses these
465+
Dict{UUID,Set{String}}()[UUID("692b3bcd-3c85-4b1f-b108-f13ce0eb3210")] = Set{String}()
466+
get!(Set{String}, Dict{UUID,Set{String}}(), UUID("692b3bcd-3c85-4b1f-b108-f13ce0eb3210"))
467+
eachindex(IndexLinear(), Expr[])
468+
push!(Expr[], Expr(:return, false))
469+
vcat(String[], String[])
470+
k, v = (:hello => nothing)
471+
precompile(indexed_iterate, (Pair{Symbol, Union{Nothing, String}}, Int))
472+
precompile(indexed_iterate, (Pair{Symbol, Union{Nothing, String}}, Int, Int))
473+
# Preferences uses these
474+
precompile(get_preferences, (UUID,))
475+
precompile(record_compiletime_preference, (UUID, String))
476+
get(Dict{String,Any}(), "missing", nothing)
477+
delete!(Dict{String,Any}(), "missing")
478+
for (k, v) in Dict{String,Any}()
479+
println(k)
480+
end
464481

465482
break # only actually need to do this once
466483
end

base/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,11 @@ else ifneq ($(USE_SYSTEM_OPENLIBM),0)
206206
$(eval $(call symlink_system_library,OPENLIBM,$(LIBMNAME)))
207207
endif
208208

209+
ifeq ($(APPLE_ARCH),arm64)
210+
$(eval $(call symlink_system_library,CSL,libgcc_s,1.1))
211+
else
209212
$(eval $(call symlink_system_library,CSL,libgcc_s,1))
213+
endif
210214
ifneq (,$(LIBGFORTRAN_VERSION))
211215
$(eval $(call symlink_system_library,CSL,libgfortran,$(LIBGFORTRAN_VERSION)))
212216
endif

base/binaryplatforms.jl

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ struct Platform <: AbstractPlatform
4040
# The "compare strategy" allows selective overriding on how a tag is compared
4141
compare_strategies::Dict{String,Function}
4242

43-
function Platform(arch::String, os::String;
43+
# Passing `tags` as a `Dict` avoids the need to infer different NamedTuple specializations
44+
function Platform(arch::String, os::String, _tags::Dict{String};
4445
validate_strict::Bool = false,
45-
compare_strategies::Dict{String,<:Function} = Dict{String,Function}(),
46-
kwargs...)
46+
compare_strategies::Dict{String,<:Function} = Dict{String,Function}())
4747
# A wee bit of normalization
4848
os = lowercase(os)
4949
arch = CPUID.normalize_arch(arch)
@@ -52,8 +52,9 @@ struct Platform <: AbstractPlatform
5252
"arch" => arch,
5353
"os" => os,
5454
)
55-
for (tag, value) in kwargs
56-
tag = lowercase(string(tag::Symbol))
55+
for (tag, value) in _tags
56+
value = value::Union{String,VersionNumber,Nothing}
57+
tag = lowercase(tag)
5758
if tag ("arch", "os")
5859
throw(ArgumentError("Cannot double-pass key $(tag)"))
5960
end
@@ -70,8 +71,8 @@ struct Platform <: AbstractPlatform
7071
if tag ("libgfortran_version", "libstdcxx_version", "os_version")
7172
if isa(value, VersionNumber)
7273
value = string(value)
73-
elseif isa(value, AbstractString)
74-
v = tryparse(VersionNumber, String(value)::String)
74+
elseif isa(value, String)
75+
v = tryparse(VersionNumber, value)
7576
if isa(v, VersionNumber)
7677
value = string(v)
7778
end
@@ -110,6 +111,19 @@ struct Platform <: AbstractPlatform
110111
end
111112
end
112113

114+
# Keyword interface (to avoid inference of specialized NamedTuple methods, use the Dict interface for `tags`)
115+
function Platform(arch::String, os::String;
116+
validate_strict::Bool = false,
117+
compare_strategies::Dict{String,<:Function} = Dict{String,Function}(),
118+
kwargs...)
119+
tags = Dict{String,Any}(String(tag)::String=>tagvalue(value) for (tag, value) in kwargs)
120+
return Platform(arch, os, tags; validate_strict, compare_strategies)
121+
end
122+
123+
tagvalue(v::Union{String,VersionNumber,Nothing}) = v
124+
tagvalue(v::Symbol) = String(v)
125+
tagvalue(v::AbstractString) = convert(String, v)::String
126+
113127
# Simple tag insertion that performs a little bit of validation
114128
function add_tag!(tags::Dict{String,String}, tag::String, value::String)
115129
# I know we said only alphanumeric and dots, but let's be generous so that we can expand
@@ -699,21 +713,22 @@ function Base.parse(::Type{Platform}, triplet::AbstractString; validate_strict::
699713
end
700714

701715
# Extract the information we're interested in:
716+
tags = Dict{String,Any}()
702717
arch = get_field(m, arch_mapping)
703718
os = get_field(m, os_mapping)
704-
libc = get_field(m, libc_mapping)
705-
call_abi = get_field(m, call_abi_mapping)
706-
libgfortran_version = get_field(m, libgfortran_version_mapping)
707-
libstdcxx_version = get_field(m, libstdcxx_version_mapping)
708-
cxxstring_abi = get_field(m, cxxstring_abi_mapping)
719+
tags["libc"] = get_field(m, libc_mapping)
720+
tags["call_abi"] = get_field(m, call_abi_mapping)
721+
tags["libgfortran_version"] = get_field(m, libgfortran_version_mapping)
722+
tags["libstdcxx_version"] = get_field(m, libstdcxx_version_mapping)
723+
tags["cxxstring_abi"] = get_field(m, cxxstring_abi_mapping)
709724
function split_tags(tagstr)
710725
tag_fields = split(tagstr, "-"; keepempty=false)
711726
if isempty(tag_fields)
712727
return Pair{String,String}[]
713728
end
714-
return map(v -> Symbol(v[1]) => v[2], split.(tag_fields, "+"))
729+
return map(v -> String(v[1]) => String(v[2]), split.(tag_fields, "+"))
715730
end
716-
tags = split_tags(m["tags"])
731+
merge!(tags, Dict(split_tags(m["tags"])))
717732

718733
# Special parsing of os version number, if any exists
719734
function extract_os_version(os_name, pattern)
@@ -730,18 +745,9 @@ function Base.parse(::Type{Platform}, triplet::AbstractString; validate_strict::
730745
if os == "freebsd"
731746
os_version = extract_os_version("freebsd", r".*freebsd([\d.]+)")
732747
end
748+
tags["os_version"] = os_version
733749

734-
return Platform(
735-
arch, os;
736-
validate_strict,
737-
libc,
738-
call_abi,
739-
libgfortran_version,
740-
cxxstring_abi,
741-
libstdcxx_version,
742-
os_version,
743-
tags...,
744-
)
750+
return Platform(arch, os, tags; validate_strict)
745751
end
746752
throw(ArgumentError("Platform `$(triplet)` is not an officially supported platform"))
747753
end
@@ -1068,4 +1074,9 @@ function select_platform(download_info::Dict, platform::AbstractPlatform = HostP
10681074
return download_info[p]
10691075
end
10701076

1077+
# precompiles to reduce latency (see https://github.com/JuliaLang/julia/pull/43990#issuecomment-1025692379)
1078+
Dict{Platform,String}()[HostPlatform()] = ""
1079+
Platform("x86_64", "linux", Dict{String,Any}(); validate_strict=true)
1080+
Platform("x86_64", "linux", Dict{String,String}(); validate_strict=false) # called this way from Artifacts.unpack_platform
1081+
10711082
end # module

0 commit comments

Comments
 (0)