Skip to content

Commit ebb9407

Browse files
authored
Merge branch 'master' into kp/add-gc-ttsp
2 parents e3e0cfa + eb2e968 commit ebb9407

File tree

46 files changed

+699
-370
lines changed

Some content is hidden

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

46 files changed

+699
-370
lines changed

Make.inc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ private_libdir := $(libdir)/julia
286286
endif
287287
build_private_libdir := $(build_libdir)/julia
288288

289+
private_libexecdir := $(libexecdir)/julia
290+
build_private_libexecdir := $(build_libexecdir)/julia
291+
289292
# A helper functions for dealing with lazily-evaluated, expensive operations.. Spinning
290293
# up a python process to, for exaxmple, parse a TOML file is expensive, and we must wait
291294
# until the TOML files are on-disk before we can parse them. This means that we cannot
@@ -310,7 +313,7 @@ define cache_rel_path
310313
$(1)_rel_eval = $(call rel_path,$(2),$($(1)))
311314
$(1)_rel = $$(call hit_cache,$(1)_rel_eval)
312315
endef
313-
$(foreach D,libdir private_libdir datarootdir libexecdir docdir sysconfdir includedir,$(eval $(call cache_rel_path,$(D),$(bindir))))
316+
$(foreach D,libdir private_libdir datarootdir libexecdir private_libexecdir docdir sysconfdir includedir,$(eval $(call cache_rel_path,$(D),$(bindir))))
314317
$(foreach D,build_libdir build_private_libdir,$(eval $(call cache_rel_path,$(D),$(build_bindir))))
315318

316319
# Save a special one: reverse_private_libdir_rel: usually just `../`, but good to be general:

Makefile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ release-candidate: release testall
152152
@echo 10. Follow packaging instructions in doc/build/distributing.md to create binary packages for all platforms
153153
@echo 11. Upload to AWS, update https://julialang.org/downloads and http://status.julialang.org/stable links
154154
@echo 12. Update checksums on AWS for tarball and packaged binaries
155-
@echo 13. Update versions.json
155+
@echo 13. Update versions.json. Wait at least 60 minutes before proceeding to step 14.
156156
@echo 14. Push to Juliaup (https://github.com/JuliaLang/juliaup/wiki/Adding-a-Julia-version)
157157
@echo 15. Announce on mailing lists
158158
@echo 16. Change master to release-0.X in base/version.jl and base/version_git.sh as in 4cb1e20
@@ -253,7 +253,7 @@ endef
253253

254254
install: $(build_depsbindir)/stringreplace docs
255255
@$(MAKE) $(QUIET_MAKE) $(JULIA_BUILD_MODE)
256-
@for subdir in $(bindir) $(datarootdir)/julia/stdlib/$(VERSDIR) $(docdir) $(man1dir) $(includedir)/julia $(libdir) $(private_libdir) $(sysconfdir) $(libexecdir); do \
256+
@for subdir in $(bindir) $(datarootdir)/julia/stdlib/$(VERSDIR) $(docdir) $(man1dir) $(includedir)/julia $(libdir) $(private_libdir) $(sysconfdir) $(private_libexecdir); do \
257257
mkdir -p $(DESTDIR)$$subdir; \
258258
done
259259

@@ -268,8 +268,8 @@ else ifeq ($(JULIA_BUILD_MODE),debug)
268268
-$(INSTALL_M) $(build_libdir)/libjulia-internal-debug.dll.a $(DESTDIR)$(libdir)/
269269
endif
270270

271-
# We have a single exception; we want 7z.dll to live in libexec, not bin, so that 7z.exe can find it.
272-
-mv $(DESTDIR)$(bindir)/7z.dll $(DESTDIR)$(libexecdir)/
271+
# We have a single exception; we want 7z.dll to live in private_libexecdir, not bindir, so that 7z.exe can find it.
272+
-mv $(DESTDIR)$(bindir)/7z.dll $(DESTDIR)$(private_libexecdir)/
273273
-$(INSTALL_M) $(build_bindir)/libopenlibm.dll.a $(DESTDIR)$(libdir)/
274274
-$(INSTALL_M) $(build_libdir)/libssp.dll.a $(DESTDIR)$(libdir)/
275275
# The rest are compiler dependencies, as an example memcpy is exported by msvcrt
@@ -331,14 +331,14 @@ endif
331331
done \
332332
done
333333
endif
334-
# Install `7z` into libexec/
335-
$(INSTALL_M) $(build_bindir)/7z$(EXE) $(DESTDIR)$(libexecdir)/
334+
# Install `7z` into private_libexecdir
335+
$(INSTALL_M) $(build_bindir)/7z$(EXE) $(DESTDIR)$(private_libexecdir)/
336336

337-
# Install `lld` into libexec/
338-
$(INSTALL_M) $(build_depsbindir)/lld$(EXE) $(DESTDIR)$(libexecdir)/
337+
# Install `lld` into private_libexecdir
338+
$(INSTALL_M) $(build_depsbindir)/lld$(EXE) $(DESTDIR)$(private_libexecdir)/
339339

340-
# Install `dsymutil` into libexec/
341-
$(INSTALL_M) $(build_depsbindir)/dsymutil$(EXE) $(DESTDIR)$(libexecdir)/
340+
# Install `dsymutil` into private_libexecdir/
341+
$(INSTALL_M) $(build_depsbindir)/dsymutil$(EXE) $(DESTDIR)$(private_libexecdir)/
342342

343343
# Copy public headers
344344
cp -R -L $(build_includedir)/julia/* $(DESTDIR)$(includedir)/julia

base/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ ifeq ($(OS),WINNT)
6666
@printf 'const LIBDIR = "%s"\n' '$(subst /,\\,$(libdir_rel))' >> $@
6767
@printf 'const LIBEXECDIR = "%s"\n' '$(subst /,\\,$(libexecdir_rel))' >> $@
6868
@printf 'const PRIVATE_LIBDIR = "%s"\n' '$(subst /,\\,$(private_libdir_rel))' >> $@
69+
@printf 'const PRIVATE_LIBEXECDIR = "%s"\n' '$(subst /,\\,$(private_libexecdir_rel))' >> $@
6970
@printf 'const INCLUDEDIR = "%s"\n' '$(subst /,\\,$(includedir_rel))' >> $@
7071
else
7172
@echo "const SYSCONFDIR = \"$(sysconfdir_rel)\"" >> $@
@@ -74,6 +75,7 @@ else
7475
@echo "const LIBDIR = \"$(libdir_rel)\"" >> $@
7576
@echo "const LIBEXECDIR = \"$(libexecdir_rel)\"" >> $@
7677
@echo "const PRIVATE_LIBDIR = \"$(private_libdir_rel)\"" >> $@
78+
@echo "const PRIVATE_LIBEXECDIR = \"$(private_libexecdir_rel)\"" >> $@
7779
@echo "const INCLUDEDIR = \"$(includedir_rel)\"" >> $@
7880
endif
7981
ifeq ($(DARWIN_FRAMEWORK), 1)

base/c.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,9 +565,9 @@ end
565565
"""
566566
ccall_macro_parse(expression)
567567
568-
`ccall_macro_parse` is an implementation detail of `@ccall
568+
`ccall_macro_parse` is an implementation detail of `@ccall`.
569569
570-
it takes an expression like `:(printf("%d"::Cstring, value::Cuint)::Cvoid)`
570+
It takes an expression like `:(printf("%d"::Cstring, value::Cuint)::Cvoid)`
571571
returns: a tuple of `(function_name, return_type, arg_types, args)`
572572
573573
The above input outputs this:

base/compiler/abstractinterpretation.jl

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function should_infer_this_call(interp::AbstractInterpreter, sv::InferenceState)
4444
end
4545

4646
function should_infer_for_effects(sv::InferenceState)
47-
effects = Effects(sv)
47+
effects = sv.ipo_effects
4848
return is_terminates(effects) && is_effect_free(effects)
4949
end
5050

@@ -255,7 +255,7 @@ struct MethodMatches
255255
applicable::Vector{Any}
256256
info::MethodMatchInfo
257257
valid_worlds::WorldRange
258-
mt::Core.MethodTable
258+
mt::MethodTable
259259
fullmatch::Bool
260260
nonoverlayed::Bool
261261
end
@@ -267,7 +267,7 @@ struct UnionSplitMethodMatches
267267
applicable_argtypes::Vector{Vector{Any}}
268268
info::UnionSplitInfo
269269
valid_worlds::WorldRange
270-
mts::Vector{Core.MethodTable}
270+
mts::Vector{MethodTable}
271271
fullmatches::Vector{Bool}
272272
nonoverlayed::Bool
273273
end
@@ -282,15 +282,15 @@ function find_matching_methods(argtypes::Vector{Any}, @nospecialize(atype), meth
282282
applicable = Any[]
283283
applicable_argtypes = Vector{Any}[] # arrays like `argtypes`, including constants, for each match
284284
valid_worlds = WorldRange()
285-
mts = Core.MethodTable[]
285+
mts = MethodTable[]
286286
fullmatches = Bool[]
287287
nonoverlayed = true
288288
for i in 1:length(split_argtypes)
289289
arg_n = split_argtypes[i]::Vector{Any}
290290
sig_n = argtypes_to_type(arg_n)
291291
mt = ccall(:jl_method_table_for, Any, (Any,), sig_n)
292292
mt === nothing && return FailedMethodMatch("Could not identify method table for call")
293-
mt = mt::Core.MethodTable
293+
mt = mt::MethodTable
294294
result = findall(sig_n, method_table; limit = max_methods)
295295
if result === nothing
296296
return FailedMethodMatch("For one of the union split cases, too many methods matched")
@@ -329,7 +329,7 @@ function find_matching_methods(argtypes::Vector{Any}, @nospecialize(atype), meth
329329
if mt === nothing
330330
return FailedMethodMatch("Could not identify method table for call")
331331
end
332-
mt = mt::Core.MethodTable
332+
mt = mt::MethodTable
333333
result = findall(atype, method_table; limit = max_methods)
334334
if result === nothing
335335
# this means too many methods matched
@@ -502,22 +502,24 @@ function conditional_argtype(@nospecialize(rt), @nospecialize(sig), argtypes::Ve
502502
end
503503
end
504504

505-
function add_call_backedges!(interp::AbstractInterpreter,
506-
@nospecialize(rettype), all_effects::Effects,
505+
function add_call_backedges!(interp::AbstractInterpreter, @nospecialize(rettype), all_effects::Effects,
507506
edges::Vector{MethodInstance}, matches::Union{MethodMatches,UnionSplitMethodMatches}, @nospecialize(atype),
508507
sv::InferenceState)
509-
# we don't need to add backedges when:
510-
# - a new method couldn't refine (widen) this type and
511-
# - the effects are known to not provide any useful IPO information
508+
# don't bother to add backedges when both type and effects information are already
509+
# maximized to the top since a new method couldn't refine or widen them anyway
512510
if rettype === Any
511+
# ignore the `:nonoverlayed` property if `interp` doesn't use overlayed method table
512+
# since it will never be tainted anyway
513513
if !isoverlayed(method_table(interp))
514-
# we can ignore the `nonoverlayed` property if `interp` doesn't use
515-
# overlayed method table at all since it will never be tainted anyway
516514
all_effects = Effects(all_effects; nonoverlayed=false)
517515
end
518-
if all_effects === Effects()
519-
return
516+
if (# ignore the `:noinbounds` property if `:consistent`-cy is tainted already
517+
sv.ipo_effects.consistent === ALWAYS_FALSE || all_effects.consistent === ALWAYS_FALSE ||
518+
# or this `:noinbounds` doesn't taint it
519+
!stmt_taints_inbounds_consistency(sv))
520+
all_effects = Effects(all_effects; noinbounds=false)
520521
end
522+
all_effects === Effects() && return nothing
521523
end
522524
for edge in edges
523525
add_backedge!(sv, edge)
@@ -531,6 +533,7 @@ function add_call_backedges!(interp::AbstractInterpreter,
531533
thisfullmatch || add_mt_backedge!(sv, mt, atype)
532534
end
533535
end
536+
return nothing
534537
end
535538

536539
const RECURSION_UNUSED_MSG = "Bounded recursion detected with unused result. Annotated return type may be wider than true result."
@@ -688,7 +691,7 @@ function edge_matches_sv(frame::InferenceState, method::Method, @nospecialize(si
688691
if callee_method2 !== inf_method2
689692
return false
690693
end
691-
if !hardlimit
694+
if !hardlimit || InferenceParams(sv.interp).ignore_recursion_hardlimit
692695
# if this is a soft limit,
693696
# also inspect the parent of this edge,
694697
# to see if they are the same Method as sv
@@ -1018,9 +1021,9 @@ function abstract_call_method_with_const_args(interp::AbstractInterpreter,
10181021
add_remark!(interp, sv, "[constprop] Fresh constant inference hit a cycle")
10191022
return nothing
10201023
end
1021-
@assert !isa(inf_result.result, InferenceState)
1024+
@assert inf_result.result !== nothing
10221025
else
1023-
if isa(inf_result.result, InferenceState)
1026+
if inf_result.result === nothing
10241027
add_remark!(interp, sv, "[constprop] Found cached constant inference in a cycle")
10251028
return nothing
10261029
end
@@ -2475,7 +2478,8 @@ function abstract_eval_foreigncall(interp::AbstractInterpreter, e::Expr, vtypes:
24752478
override.terminates_globally ? true : effects.terminates,
24762479
override.notaskstate ? true : effects.notaskstate,
24772480
override.inaccessiblememonly ? ALWAYS_TRUE : effects.inaccessiblememonly,
2478-
effects.nonoverlayed)
2481+
effects.nonoverlayed,
2482+
effects.noinbounds)
24792483
end
24802484
return RTEffects(t, effects)
24812485
end
@@ -2820,7 +2824,7 @@ end
28202824

28212825
# make as much progress on `frame` as possible (without handling cycles)
28222826
function typeinf_local(interp::AbstractInterpreter, frame::InferenceState)
2823-
@assert !frame.inferred
2827+
@assert !is_inferred(frame)
28242828
frame.dont_work_on_me = true # mark that this function is currently on the stack
28252829
W = frame.ip
28262830
nargs = narguments(frame, #=include_va=#false)
@@ -3081,7 +3085,7 @@ function typeinf_nocycle(interp::AbstractInterpreter, frame::InferenceState)
30813085
typeinf_local(interp, caller)
30823086
no_active_ips_in_callers = false
30833087
end
3084-
caller.valid_worlds = intersect(caller.valid_worlds, frame.valid_worlds)
3088+
update_valid_age!(caller, frame.valid_worlds)
30853089
end
30863090
end
30873091
return true

base/compiler/cicache.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ Internally, each `MethodInstance` keep a unique global cache of code instances
77
that have been created for the given method instance, stratified by world age
88
ranges. This struct abstracts over access to this cache.
99
"""
10-
struct InternalCodeCache
11-
end
10+
struct InternalCodeCache end
1211

1312
function setindex!(cache::InternalCodeCache, ci::CodeInstance, mi::MethodInstance)
1413
ccall(:jl_mi_cache_insert, Cvoid, (Any, Any), mi, ci)
14+
return cache
1515
end
1616

1717
const GLOBAL_CI_CACHE = InternalCodeCache()
@@ -49,11 +49,11 @@ WorldView(wvc::WorldView, wr::WorldRange) = WorldView(wvc.cache, wr)
4949
WorldView(wvc::WorldView, args...) = WorldView(wvc.cache, args...)
5050

5151
function haskey(wvc::WorldView{InternalCodeCache}, mi::MethodInstance)
52-
ccall(:jl_rettype_inferred, Any, (Any, UInt, UInt), mi, first(wvc.worlds), last(wvc.worlds))::Union{Nothing, CodeInstance} !== nothing
52+
return ccall(:jl_rettype_inferred, Any, (Any, UInt, UInt), mi, first(wvc.worlds), last(wvc.worlds)) !== nothing
5353
end
5454

5555
function get(wvc::WorldView{InternalCodeCache}, mi::MethodInstance, default)
56-
r = ccall(:jl_rettype_inferred, Any, (Any, UInt, UInt), mi, first(wvc.worlds), last(wvc.worlds))::Union{Nothing, CodeInstance}
56+
r = ccall(:jl_rettype_inferred, Any, (Any, UInt, UInt), mi, first(wvc.worlds), last(wvc.worlds))
5757
if r === nothing
5858
return default
5959
end
@@ -66,5 +66,7 @@ function getindex(wvc::WorldView{InternalCodeCache}, mi::MethodInstance)
6666
return r::CodeInstance
6767
end
6868

69-
setindex!(wvc::WorldView{InternalCodeCache}, ci::CodeInstance, mi::MethodInstance) =
69+
function setindex!(wvc::WorldView{InternalCodeCache}, ci::CodeInstance, mi::MethodInstance)
7070
setindex!(wvc.cache, ci, mi)
71+
return wvc
72+
end

base/compiler/compiler.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ using Core.Intrinsics, Core.IR
66

77
import Core: print, println, show, write, unsafe_write, stdout, stderr,
88
_apply_iterate, svec, apply_type, Builtin, IntrinsicFunction,
9-
MethodInstance, CodeInstance, MethodMatch, PartialOpaque,
9+
MethodInstance, CodeInstance, MethodTable, MethodMatch, PartialOpaque,
1010
TypeofVararg
1111

1212
const getproperty = Core.getfield

base/compiler/effects.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ struct Effects
7272
notaskstate::Bool,
7373
inaccessiblememonly::UInt8,
7474
nonoverlayed::Bool,
75-
noinbounds::Bool = true)
75+
noinbounds::Bool)
7676
return new(
7777
consistent,
7878
effect_free,

0 commit comments

Comments
 (0)