Skip to content

release-1.9: Backports for julia 1.9.0-alpha2 / 1.9.0-beta1 #47602

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

Merged
merged 57 commits into from
Dec 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
05c8f3b
Limit initial OpenBLAS thread count (#46844)
staticfloat Nov 15, 2022
9606388
fix #46778, precompile() for abstract but compileable signatures (#47…
JeffBezanson Nov 16, 2022
0e17295
fix #47410, syntax error with anonfn inside `elseif` and short-circui…
JeffBezanson Nov 16, 2022
9dfd76b
ensure bindings handle write barriers for ty and globalref (#47580)
vtjnash Nov 16, 2022
d85e9ac
Turn on Intel jitevents by default on Linux (#47586)
vchuravy Nov 20, 2022
b5d6b03
Doc: The default sorting alg. is stable from 1.9 (#47579)
petvana Nov 21, 2022
3bc94a9
update MPFR (#47659)
simonbyrne Nov 21, 2022
f8f0c63
Add compat note for `sortperm(x; dims)` (#47657)
mcabbott Nov 22, 2022
382661c
build: add get-lld target (#47589)
petvana Nov 23, 2022
0f271d7
Print the detailed type on heap snapshot (#47503)
gbaraldi Nov 23, 2022
c615a49
Remove typeinfer lock altogether (#46825)
pchintalapudi Nov 23, 2022
3b414c6
Fix regression in generic_bitcast with Union{} arguments. (#47605)
maleadt Nov 24, 2022
aba112c
Filesystem: `rm(; recursive=true)` should ignore `UV_EACCES` (#47668)
staticfloat Nov 24, 2022
24505fc
Fix overflow in pow5 (#47511)
LilithHafner Nov 26, 2022
6fb45be
Fix GCExt test (#47699)
vchuravy Nov 27, 2022
0865ae0
Fix REPL keybinding CTRL-Q for stdlib methods (#47637)
rashidrafeek Nov 28, 2022
cfbb86a
fix 5-arg `mul!` for vectors of vectors (#47665)
ranocha Nov 28, 2022
93587d7
Add support for "package extensions" to code loading (#47695)
KristofferC Dec 7, 2022
dc1369e
🤖 Bump the Pkg stdlib from ed6a5497e to 5d8b9ddb8 (#47828)
DilumAluthgeBot Dec 7, 2022
9b9a703
Fix and simplify inference timing logic (#47711)
pchintalapudi Nov 26, 2022
1b85c1f
Fix nth_methtable tparam of -1 when n==0 (#47666)
apaz-cli Nov 28, 2022
81f8582
Fix generator-invocation legality check for varargs generators (#47739)
Keno Nov 29, 2022
9da50d2
Bump libuv. (#47707)
maleadt Nov 30, 2022
fcf02e8
Provider cycleclock() for 32bit ARM targets (#47358)
fingolfin Nov 30, 2022
628c953
strengthen setglobal to default to release-consume ordering (#47742)
vtjnash Nov 30, 2022
dfec160
fix unescaping in `global` expressions (#47719)
simeonschaub Dec 1, 2022
d8cbffd
Refactor and document sorting dispatch (#47383)
LilithHafner Dec 3, 2022
930314e
Comment out test in subtype that causes hang due to StackOverflow(#47…
vchuravy Dec 3, 2022
01ae8b7
Prioritize build_dir for generated headers (#47783)
vchuravy Dec 4, 2022
dba443d
Set `OPENBLAS_NUM_THREADS=1` on local Distributed workers (#47803)
staticfloat Dec 5, 2022
ce7a372
Add native julia fmod (#47501)
gbaraldi Dec 6, 2022
712a123
Fix libjulia install name and libjulia-internal rpath on OS X (#47220)
jonathan-conder-sm Dec 7, 2022
d561447
Replace the `.ji` serialization with sysimage format
timholy Feb 7, 2022
f8a5cd6
Allow re-initialization and caching of foreign types (#47407)
vchuravy Nov 27, 2022
12a4863
Fix physical_memory exports. (#47859)
maleadt Dec 10, 2022
2866e26
Fix missing GC root in Symbol construction (#47865)
Keno Dec 11, 2022
0b845b1
TOML: print: handle mixed vector of dicts and non-dicts (#47876)
fonsp Dec 12, 2022
3d80653
Fixups for #47383 (fixes `runbenchmarks("sort")`) (#47822)
LilithHafner Dec 13, 2022
a548ee3
fixes for jl_rewrap_unionall
vtjnash Nov 30, 2022
31df7c8
call specialized method instance when encountering unspecialized sparams
vtjnash Nov 19, 2022
9827f1d
ensure sparams are cached correctly for widened methods
vtjnash Nov 21, 2022
a506f43
ensure types are UnionAll wrapped are cached correctly for widened Va…
vtjnash Nov 22, 2022
3e1373e
add back wordaround for `Slot objects should not occur in an AST` in …
KristofferC Dec 14, 2022
5848e99
Reduce invalidations when loading JuliaData packages (#47889)
timholy Dec 15, 2022
86e8ef9
intersect: fix a minor soundness issue with supertypes (#47813)
vtjnash Dec 16, 2022
8432d4f
make Ctrl-C during sleeping work better (#47901)
JeffBezanson Dec 16, 2022
eba98e5
revert promotions of abstract arrays inside other arrays (#47893)
KristofferC Dec 19, 2022
a16ffd6
Revert "Emit safepoints at function entry (#41616)"
Dec 20, 2022
5a684f0
Revert "improve performance issue of `@nospecialize`-d keyword func c…
Dec 20, 2022
327e081
only load extensions once dependencies have finished loading (#47927)
KristofferC Dec 19, 2022
95cb3a8
Precompile cache: always add worklist CIs (#47924)
timholy Dec 20, 2022
f17d1df
put back the old QuickSort, PartialQuickSort, and MergeSort algorithm…
LilithHafner Dec 20, 2022
3ea7f6c
add bounds check to Slices indexing (#47622)
mcabbott Dec 20, 2022
22789c0
Reduce codegen lock scope (#46836)
pchintalapudi Dec 13, 2022
9a592dd
Implement support for object caching through pkgimages (#47184)
vchuravy Dec 27, 2022
7880930
Apply `InitialOptimizations` more consistently in sorting & fix dispa…
LilithHafner Dec 22, 2022
6adc428
Restore libgcc_s symlinkin in !macOS (#47986)
antonio-rojas Dec 24, 2022
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
.DS_Store
.idea/*
.vscode/*

*.heapsnapshot
# Buildkite: Ignore the entire .buildkite directory
/.buildkite

Expand Down
4 changes: 3 additions & 1 deletion Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ JULIA_THREADS := 1
# Set to 1 to enable profiling with OProfile
USE_OPROFILE_JITEVENTS ?= 0

# USE_PERF_JITEVENTS defined below since default is OS specific
# USE_PERF_JITEVENTS, and USE_INTEL_JITEVENTS defined below since default is OS specific

# assume we don't have LIBSSP support in our compiler, will enable later if likely true
HAVE_SSP := 0
Expand Down Expand Up @@ -442,8 +442,10 @@ endif
# Set to 1 to enable profiling with perf
ifeq ("$(OS)", "Linux")
USE_PERF_JITEVENTS ?= 1
USE_INTEL_JITEVENTS ?= 1
else
USE_PERF_JITEVENTS ?= 0
USE_INTEL_JITEVENTS ?= 0
endif

JULIACODEGEN := LLVM
Expand Down
29 changes: 26 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ all: debug release
# sort is used to remove potential duplicates
DIRS := $(sort $(build_bindir) $(build_depsbindir) $(build_libdir) $(build_private_libdir) $(build_libexecdir) $(build_includedir) $(build_includedir)/julia $(build_sysconfdir)/julia $(build_datarootdir)/julia $(build_datarootdir)/julia/stdlib $(build_man1dir))
ifneq ($(BUILDROOT),$(JULIAHOME))
BUILDDIRS := $(BUILDROOT) $(addprefix $(BUILDROOT)/,base src src/flisp src/support src/clangsa cli doc deps stdlib test test/clangsa test/embedding test/llvmpasses)
BUILDDIRS := $(BUILDROOT) $(addprefix $(BUILDROOT)/,base src src/flisp src/support src/clangsa cli doc deps stdlib test test/clangsa test/embedding test/gcext test/llvmpasses)
BUILDDIRMAKE := $(addsuffix /Makefile,$(BUILDDIRS)) $(BUILDROOT)/sysimage.mk
DIRS := $(DIRS) $(BUILDDIRS)
$(BUILDDIRMAKE): | $(BUILDDIRS)
Expand Down Expand Up @@ -247,13 +247,21 @@ ifeq ($(OS),WINNT)
-$(INSTALL_M) $(wildcard $(build_bindir)/*.dll) $(DESTDIR)$(bindir)/
ifeq ($(JULIA_BUILD_MODE),release)
-$(INSTALL_M) $(build_libdir)/libjulia.dll.a $(DESTDIR)$(libdir)/
-$(INSTALL_M) $(build_libdir)/libjulia-internal.dll.a $(DESTDIR)$(libdir)/
else ifeq ($(JULIA_BUILD_MODE),debug)
-$(INSTALL_M) $(build_libdir)/libjulia-debug.dll.a $(DESTDIR)$(libdir)/
-$(INSTALL_M) $(build_libdir)/libjulia-internal-debug.dll.a $(DESTDIR)$(libdir)/
endif

# We have a single exception; we want 7z.dll to live in libexec, not bin, so that 7z.exe can find it.
-mv $(DESTDIR)$(bindir)/7z.dll $(DESTDIR)$(libexecdir)/
-$(INSTALL_M) $(build_bindir)/libopenlibm.dll.a $(DESTDIR)$(libdir)/
-$(INSTALL_M) $(build_libdir)/libssp.dll.a $(DESTDIR)$(libdir)/
# The rest are compiler dependencies, as an example memcpy is exported by msvcrt
# These are files from mingw32 and required for creating shared libraries like our caches.
-$(INSTALL_M) $(build_libdir)/libgcc_s.a $(DESTDIR)$(libdir)/
-$(INSTALL_M) $(build_libdir)/libgcc.a $(DESTDIR)$(libdir)/
-$(INSTALL_M) $(build_libdir)/libmsvcrt.a $(DESTDIR)$(libdir)/
else

# Copy over .dSYM directories directly for Darwin
Expand Down Expand Up @@ -318,6 +326,11 @@ else ifeq ($(JULIA_BUILD_MODE),debug)
$(INSTALL_M) $(build_private_libdir)/sys-debug.$(SHLIB_EXT) $(DESTDIR)$(private_libdir)
endif

# Cache stdlibs
@$(call PRINT_JULIA, $(call spawn,$(JULIA_EXECUTABLE)) --startup-file=no $(JULIAHOME)/contrib/cache_stdlibs.jl)
# CI uses `--check-bounds=yes` which impacts the cache flags
@$(call PRINT_JULIA, $(call spawn,$(JULIA_EXECUTABLE)) --startup-file=no --check-bounds=yes $(JULIAHOME)/contrib/cache_stdlibs.jl)

# Copy in all .jl sources as well
mkdir -p $(DESTDIR)$(datarootdir)/julia/base $(DESTDIR)$(datarootdir)/julia/test
cp -R -L $(JULIAHOME)/base/* $(DESTDIR)$(datarootdir)/julia/base
Expand Down Expand Up @@ -371,8 +384,18 @@ endif
fi;
endif

# Set rpath for libjulia-internal, which is moving from `../lib` to `../lib/julia`. We only need to do this for Linux/FreeBSD
ifneq (,$(findstring $(OS),Linux FreeBSD))
# Set rpath for libjulia-internal, which is moving from `../lib` to `../lib/julia`.
ifeq ($(OS), Darwin)
ifneq ($(DARWIN_FRAMEWORK),1)
ifeq ($(JULIA_BUILD_MODE),release)
install_name_tool -add_rpath @loader_path/$(reverse_private_libdir_rel)/ $(DESTDIR)$(private_libdir)/libjulia-internal.$(SHLIB_EXT)
install_name_tool -add_rpath @loader_path/$(reverse_private_libdir_rel)/ $(DESTDIR)$(private_libdir)/libjulia-codegen.$(SHLIB_EXT)
else ifeq ($(JULIA_BUILD_MODE),debug)
install_name_tool -add_rpath @loader_path/$(reverse_private_libdir_rel)/ $(DESTDIR)$(private_libdir)/libjulia-internal-debug.$(SHLIB_EXT)
install_name_tool -add_rpath @loader_path/$(reverse_private_libdir_rel)/ $(DESTDIR)$(private_libdir)/libjulia-codegen-debug.$(SHLIB_EXT)
endif
endif
else ifneq (,$(findstring $(OS),Linux FreeBSD))
ifeq ($(JULIA_BUILD_MODE),release)
$(PATCHELF) --set-rpath '$$ORIGIN:$$ORIGIN/$(reverse_private_libdir_rel)' $(DESTDIR)$(private_libdir)/libjulia-internal.$(SHLIB_EXT)
$(PATCHELF) --set-rpath '$$ORIGIN:$$ORIGIN/$(reverse_private_libdir_rel)' $(DESTDIR)$(private_libdir)/libjulia-codegen.$(SHLIB_EXT)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ Standard library changes

#### Package Manager

- "Package Extensions": support for loading a piece of code based on other
packages being loaded in the Julia session.
This has similar applications as the Requires.jl package but also
supports precompilation and setting compatibility.
#### LinearAlgebra

* The methods `a / b` and `b \ a` with `a` a scalar and `b` a vector, which were equivalent to `a * pinv(b)`,
Expand Down
2 changes: 2 additions & 0 deletions base/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ include("idset.jl")
include("iterators.jl")
using .Iterators: zip, enumerate, only
using .Iterators: Flatten, Filter, product # for generators
using .Iterators: Stateful # compat (was formerly used in reinterpretarray.jl)

include("namedtuple.jl")

Expand Down Expand Up @@ -417,6 +418,7 @@ include("threadcall.jl")
include("uuid.jl")
include("pkgid.jl")
include("toml_parser.jl")
include("linking.jl")
include("loading.jl")

# misc useful functions & macros
Expand Down
6 changes: 6 additions & 0 deletions base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ ifeq ($(DARWIN_FRAMEWORK), 1)
@echo "const DARWIN_FRAMEWORK_NAME = \"$(FRAMEWORK_NAME)\"" >> $@
else
@echo "const DARWIN_FRAMEWORK = false" >> $@
endif
ifeq ($(OS), Darwin)
@echo "const MACOS_PRODUCT_VERSION = \"$(shell sw_vers -productVersion)\"" >> $@
@echo "const MACOS_PLATFORM_VERSION = \"$(shell xcrun --show-sdk-version)\"" >> $@
endif
@echo "const BUILD_TRIPLET = \"$(BB_TRIPLET_LIBGFORTRAN_CXXABI)\"" >> $@

Expand Down Expand Up @@ -227,6 +231,8 @@ else
$(eval $(call symlink_system_library,CSL,libgcc_s,1))
endif
endif
else
$(eval $(call symlink_system_library,CSL,libgcc_s,1))
endif
ifneq (,$(LIBGFORTRAN_VERSION))
$(eval $(call symlink_system_library,CSL,libgfortran,$(LIBGFORTRAN_VERSION)))
Expand Down
7 changes: 4 additions & 3 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2730,7 +2730,8 @@ keepat!(a::Vector, m::AbstractVector{Bool}) = _keepat!(a, m)
# set-like operators for vectors
# These are moderately efficient, preserve order, and remove dupes.

_unique_filter!(pred, update!, state) = function (x)
_unique_filter!(pred::P, update!::U, state) where {P,U} = function (x)
# P, U force specialization
if pred(x, state)
update!(state, x)
true
Expand All @@ -2756,7 +2757,7 @@ union!(v::AbstractVector{T}, itrs...) where {T} =
symdiff!(v::AbstractVector{T}, itrs...) where {T} =
_grow!(_shrink_filter!(symdiff!(Set{T}(), v, itrs...)), v, itrs)

function _shrink!(shrinker!, v::AbstractVector, itrs)
function _shrink!(shrinker!::F, v::AbstractVector, itrs) where F
seen = Set{eltype(v)}()
filter!(_grow_filter!(seen), v)
shrinker!(seen, itrs...)
Expand All @@ -2768,7 +2769,7 @@ setdiff!( v::AbstractVector, itrs...) = _shrink!(setdiff!, v, itrs)

vectorfilter(T::Type, f, v) = T[x for x in v if f(x)]

function _shrink(shrinker!, itr, itrs)
function _shrink(shrinker!::F, itr, itrs) where F
T = promote_eltype(itr, itrs...)
keep = shrinker!(Set{T}(itr), itrs...)
vectorfilter(T, _shrink_filter!(keep), itr)
Expand Down
18 changes: 10 additions & 8 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -503,16 +503,19 @@ Array{T}(A::AbstractArray{S,N}) where {T,N,S} = Array{T,N}(A)
AbstractArray{T}(A::AbstractArray{S,N}) where {T,S,N} = AbstractArray{T,N}(A)

# primitive Symbol constructors

## Helper for proper GC rooting without unsafe_convert
eval(Core, quote
_Symbol(ptr::Ptr{UInt8}, sz::Int, root::Any) = $(Expr(:foreigncall, QuoteNode(:jl_symbol_n),
Ref{Symbol}, svec(Ptr{UInt8}, Int), 0, QuoteNode(:ccall), :ptr, :sz, :root))
end)

function Symbol(s::String)
@_foldable_meta
return ccall(:jl_symbol_n, Ref{Symbol}, (Ptr{UInt8}, Int),
ccall(:jl_string_ptr, Ptr{UInt8}, (Any,), s),
sizeof(s))
return _Symbol(ccall(:jl_string_ptr, Ptr{UInt8}, (Any,), s), sizeof(s), s)
end
function Symbol(a::Array{UInt8,1})
return ccall(:jl_symbol_n, Ref{Symbol}, (Ptr{UInt8}, Int),
ccall(:jl_array_ptr, Ptr{UInt8}, (Any,), a),
Intrinsics.arraylen(a))
return _Symbol(ccall(:jl_array_ptr, Ptr{UInt8}, (Any,), a), Intrinsics.arraylen(a), a)
end
Symbol(s::Symbol) = s

Expand Down Expand Up @@ -617,8 +620,7 @@ end

NamedTuple() = NamedTuple{(),Tuple{}}(())

eval(Core, :(NamedTuple{names}(args::Tuple) where {names} =
$(Expr(:splatnew, :(NamedTuple{names,typeof(args)}), :args))))
NamedTuple{names}(args::Tuple) where {names} = NamedTuple{names,typeof(args)}(args)

using .Intrinsics: sle_int, add_int

Expand Down
12 changes: 6 additions & 6 deletions base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2180,16 +2180,16 @@ function abstract_eval_statement_expr(interp::AbstractInterpreter, e::Expr, vtyp
elseif ehead === :splatnew
t, isexact = instanceof_tfunc(abstract_eval_value(interp, e.args[1], vtypes, sv))
nothrow = false # TODO: More precision
if length(e.args) == 2 && isconcretedispatch(t) && !ismutabletype(t)
if length(e.args) == 2 && isconcretetype(t) && !ismutabletype(t)
at = abstract_eval_value(interp, e.args[2], vtypes, sv)
n = fieldcount(t)
if isa(at, Const) && isa(at.val, Tuple) && n == length(at.val::Tuple) &&
let t = t, at = at; all(i::Int->getfield(at.val::Tuple, i) isa fieldtype(t, i), 1:n); end
nothrow = isexact
let t = t, at = at; _all(i->getfield(at.val::Tuple, i) isa fieldtype(t, i), 1:n); end
nothrow = isexact && isconcretedispatch(t)
t = Const(ccall(:jl_new_structt, Any, (Any, Any), t, at.val))
elseif isa(at, PartialStruct) && at ⊑ Tuple && n == length(at.fields::Vector{Any}) &&
let t = t, at = at; all(i::Int->(at.fields::Vector{Any})[i] ⊑ fieldtype(t, i), 1:n); end
nothrow = isexact
elseif isa(at, PartialStruct) && at ⊑ Tuple && n == length(at.fields::Vector{Any}) &&
let t = t, at = at; _all(i->(at.fields::Vector{Any})[i] ⊑ fieldtype(t, i), 1:n); end
nothrow = isexact && isconcretedispatch(t)
t = PartialStruct(t, at.fields::Vector{Any})
end
end
Expand Down
12 changes: 1 addition & 11 deletions base/compiler/ssair/passes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -401,16 +401,6 @@ function lift_leaves(compact::IncrementalCompact,
end
lift_arg!(compact, leaf, cache_key, def, 1+field, lifted_leaves)
continue
# NOTE we can enable this, but most `:splatnew` expressions are transformed into
# `:new` expressions by the inlinear
# elseif isexpr(def, :splatnew) && length(def.args) == 2 && isa(def.args[2], AnySSAValue)
# tplssa = def.args[2]::AnySSAValue
# tplexpr = compact[tplssa][:inst]
# if is_known_call(tplexpr, tuple, compact) && 1 ≤ field < length(tplexpr.args)
# lift_arg!(compact, tplssa, cache_key, tplexpr, 1+field, lifted_leaves)
# continue
# end
# return nothing
elseif is_getfield_captures(def, compact)
# Walk to new_opaque_closure
ocleaf = def.args[2]
Expand Down Expand Up @@ -479,7 +469,7 @@ function lift_arg!(
end
end
lifted_leaves[cache_key] = LiftedValue(lifted)
return nothing
nothing
end

function walk_to_def(compact::IncrementalCompact, @nospecialize(leaf))
Expand Down
20 changes: 3 additions & 17 deletions base/compiler/tfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -407,19 +407,11 @@ add_tfunc(Core.sizeof, 1, 1, sizeof_tfunc, 1)
function nfields_tfunc(@nospecialize(x))
isa(x, Const) && return Const(nfields(x.val))
isa(x, Conditional) && return Const(0)
xt = widenconst(x)
x = unwrap_unionall(xt)
x = unwrap_unionall(widenconst(x))
isconstType(x) && return Const(nfields(x.parameters[1]))
if isa(x, DataType) && !isabstracttype(x)
if x.name === Tuple.name
isvatuple(x) && return Int
return Const(length(x.types))
elseif x.name === _NAMEDTUPLE_NAME
length(x.parameters) == 2 || return Int
names = x.parameters[1]
isa(names, Tuple{Vararg{Symbol}}) || return nfields_tfunc(rewrap_unionall(x.parameters[2], xt))
return Const(length(names))
else
if !(x.name === Tuple.name && isvatuple(x)) &&
!(x.name === _NAMEDTUPLE_NAME && !isconcretetype(x))
return Const(isdefined(x, :types) ? length(x.types) : length(x.name.names))
end
end
Expand Down Expand Up @@ -1660,12 +1652,6 @@ function apply_type_tfunc(@nospecialize(headtypetype), @nospecialize args...)
end
if istuple
return Type{<:appl}
elseif isa(appl, DataType) && appl.name === _NAMEDTUPLE_NAME && length(appl.parameters) == 2 &&
(appl.parameters[1] === () || appl.parameters[2] === Tuple{})
# if the first/second parameter of `NamedTuple` is known to be empty,
# the second/first argument should also be empty tuple type,
# so refine it here
return Const(NamedTuple{(),Tuple{}})
end
ans = Type{appl}
for i = length(outervars):-1:1
Expand Down
12 changes: 5 additions & 7 deletions base/compiler/typeinfer.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

# Tracking of newly-inferred MethodInstances during precompilation
# Tracking of newly-inferred CodeInstances during precompilation
const track_newly_inferred = RefValue{Bool}(false)
const newly_inferred = MethodInstance[]
const newly_inferred = CodeInstance[]

# build (and start inferring) the inference frame for the top-level MethodInstance
function typeinf(interp::AbstractInterpreter, result::InferenceResult, cache::Symbol)
Expand Down Expand Up @@ -344,7 +344,7 @@ function maybe_compress_codeinfo(interp::AbstractInterpreter, linfo::MethodInsta
return ci
end
if may_discard_trees(interp)
cache_the_tree = ci.inferred && (is_inlineable(ci) || isa_compileable_sig(linfo.specTypes, def))
cache_the_tree = ci.inferred && (is_inlineable(ci) || isa_compileable_sig(linfo.specTypes, linfo.sparam_vals, def))
else
cache_the_tree = true
end
Expand Down Expand Up @@ -400,13 +400,11 @@ function cache_result!(interp::AbstractInterpreter, result::InferenceResult)
# TODO: also don't store inferred code if we've previously decided to interpret this function
if !already_inferred
inferred_result = transform_result_for_cache(interp, linfo, valid_worlds, result)
code_cache(interp)[linfo] = CodeInstance(result, inferred_result, valid_worlds)
code_cache(interp)[linfo] = ci = CodeInstance(result, inferred_result, valid_worlds)
if track_newly_inferred[]
m = linfo.def
if isa(m, Method) && m.module != Core
ccall(:jl_typeinf_lock_begin, Cvoid, ())
push!(newly_inferred, linfo)
ccall(:jl_typeinf_lock_end, Cvoid, ())
ccall(:jl_push_newly_inferred, Cvoid, (Any,), ci)
end
end
end
Expand Down
11 changes: 8 additions & 3 deletions base/compiler/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ function get_compileable_sig(method::Method, @nospecialize(atype), sparams::Simp
mt, atype, sparams, method)
end

isa_compileable_sig(@nospecialize(atype), method::Method) =
!iszero(ccall(:jl_isa_compileable_sig, Int32, (Any, Any), atype, method))
isa_compileable_sig(@nospecialize(atype), sparams::SimpleVector, method::Method) =
!iszero(ccall(:jl_isa_compileable_sig, Int32, (Any, Any, Any), atype, sparams, method))

# eliminate UnionAll vars that might be degenerate due to having identical bounds,
# or a concrete upper bound and appearing covariantly.
Expand Down Expand Up @@ -200,7 +200,12 @@ function specialize_method(method::Method, @nospecialize(atype), sparams::Simple
if compilesig
new_atype = get_compileable_sig(method, atype, sparams)
new_atype === nothing && return nothing
atype = new_atype
if atype !== new_atype
sp_ = ccall(:jl_type_intersection_with_env, Any, (Any, Any), new_atype, method.sig)::SimpleVector
if sparams === sp_[2]::SimpleVector
atype = new_atype
end
end
end
if preexisting
# check cached specializations
Expand Down
2 changes: 1 addition & 1 deletion base/file.jl
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ function rm(path::AbstractString; force::Bool=false, recursive::Bool=false)
rm(joinpath(path, p), force=force, recursive=true)
end
catch err
if !(force && isa(err, IOError) && err.code==Base.UV_EACCES)
if !(isa(err, IOError) && err.code==Base.UV_EACCES)
rethrow(err)
end
end
Expand Down
Loading