Skip to content

Commit a0fe172

Browse files
authored
Merge branch 'master' into jishnub/reshape_integer
2 parents 62852f1 + 58d5263 commit a0fe172

Some content is hidden

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

69 files changed

+1713
-719
lines changed

Make.inc

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,20 +1095,13 @@ LIBUNWIND:=
10951095
else ifneq ($(DISABLE_LIBUNWIND), 0)
10961096
LIBUNWIND:=
10971097
else
1098-
ifeq ($(USE_SYSTEM_LIBUNWIND), 1)
1099-
ifneq ($(OS),Darwin)
11001098
LIBUNWIND:=-lunwind
1101-
# Only for linux since we want to use not yet released libunwind features
1102-
JCFLAGS+=-DSYSTEM_LIBUNWIND
1103-
JCPPFLAGS+=-DSYSTEM_LIBUNWIND
1104-
endif
1105-
else
11061099
ifneq ($(findstring $(OS),Darwin OpenBSD),)
1107-
LIBUNWIND:=-lunwind
11081100
JCPPFLAGS+=-DLLVMLIBUNWIND
1109-
else
1110-
LIBUNWIND:=-lunwind
1111-
endif
1101+
else ifeq ($(USE_SYSTEM_LIBUNWIND), 1)
1102+
# Only for linux and freebsd since we want to use not yet released gnu libunwind features
1103+
JCFLAGS+=-DSYSTEM_LIBUNWIND
1104+
JCPPFLAGS+=-DSYSTEM_LIBUNWIND
11121105
endif
11131106
endif
11141107

base/client.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,12 @@ function exec_options(opts)
292292
invokelatest(show, Core.eval(Main, parse_input_line(arg)))
293293
println()
294294
elseif cmd == 'm'
295-
@eval Main import $(Symbol(arg)).main
295+
entrypoint = push!(split(arg, "."), "main")
296+
Base.eval(Main, Expr(:import, Expr(:., Symbol.(entrypoint)...)))
296297
if !should_use_main_entrypoint()
297298
error("`main` in `$arg` not declared as entry point (use `@main` to do so)")
298299
end
299300
return false
300-
301301
elseif cmd == 'L'
302302
# load file immediately on all processors
303303
if !distributed_mode
@@ -417,7 +417,7 @@ function load_REPL()
417417
return nothing
418418
end
419419

420-
global active_repl
420+
global active_repl::Any
421421
global active_repl_backend = nothing
422422

423423
function run_fallback_repl(interactive::Bool)

base/compiler/typeinfer.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ function typeinf_edge(interp::AbstractInterpreter, method::Method, @nospecialize
864864
end
865865
end
866866
if ccall(:jl_get_module_infer, Cint, (Any,), method.module) == 0 && !generating_output(#=incremental=#false)
867-
add_remark!(interp, caller, "Inference is disabled for the target module")
867+
add_remark!(interp, caller, "[typeinf_edge] Inference is disabled for the target module")
868868
return EdgeCallResult(Any, Any, nothing, Effects())
869869
end
870870
if !is_cached(caller) && frame_parent(caller) === nothing
@@ -897,7 +897,7 @@ function typeinf_edge(interp::AbstractInterpreter, method::Method, @nospecialize
897897
end
898898
frame = InferenceState(result, cache_mode, interp) # always use the cache for edge targets
899899
if frame === nothing
900-
add_remark!(interp, caller, "Failed to retrieve source")
900+
add_remark!(interp, caller, "[typeinf_edge] Failed to retrieve source")
901901
# can't get the source for this, so we know nothing
902902
if cache_mode == CACHE_MODE_GLOBAL
903903
engine_reject(interp, ci)
@@ -918,6 +918,7 @@ function typeinf_edge(interp::AbstractInterpreter, method::Method, @nospecialize
918918
return EdgeCallResult(frame.bestguess, exc_bestguess, edge, effects, volatile_inf_result)
919919
elseif frame === true
920920
# unresolvable cycle
921+
add_remark!(interp, caller, "[typeinf_edge] Unresolvable cycle")
921922
return EdgeCallResult(Any, Any, nothing, Effects())
922923
end
923924
# return the current knowledge about this cycle

base/condition.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ struct GenericCondition{L<:AbstractLock}
6969
GenericCondition(l::AbstractLock) = new{typeof(l)}(IntrusiveLinkedList{Task}(), l)
7070
end
7171

72+
show(io::IO, c::GenericCondition) = print(io, GenericCondition, "(", c.lock, ")")
73+
7274
assert_havelock(c::GenericCondition) = assert_havelock(c.lock)
7375
lock(c::GenericCondition) = lock(c.lock)
7476
unlock(c::GenericCondition) = unlock(c.lock)
@@ -194,6 +196,8 @@ This object is NOT thread-safe. See [`Threads.Condition`](@ref) for a thread-saf
194196
"""
195197
const Condition = GenericCondition{AlwaysLockedST}
196198

199+
show(io::IO, ::Condition) = print(io, Condition, "()")
200+
197201
lock(c::GenericCondition{AlwaysLockedST}) =
198202
throw(ArgumentError("`Condition` is not thread-safe. Please use `Threads.Condition` instead for multi-threaded code."))
199203
unlock(c::GenericCondition{AlwaysLockedST}) =

base/file.jl

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,15 +1183,24 @@ function unlink(p::AbstractString)
11831183
end
11841184

11851185
"""
1186-
rename(oldpath::AbstractString, newpath::AbstractString)
1186+
Base.rename(oldpath::AbstractString, newpath::AbstractString)
11871187
1188-
Change the name of a file from `oldpath` to `newpath`. If `newpath` is an existing file it may be replaced.
1189-
Equivalent to [rename(2)](https://man7.org/linux/man-pages/man2/rename.2.html).
1190-
Throws an `IOError` on failure.
1188+
Change the name of a file or directory from `oldpath` to `newpath`.
1189+
If `newpath` is an existing file or empty directory it may be replaced.
1190+
Equivalent to [rename(2)](https://man7.org/linux/man-pages/man2/rename.2.html) on Unix.
1191+
If a path contains a "\\0" throw an `ArgumentError`.
1192+
On other failures throw an `IOError`.
11911193
Return `newpath`.
11921194
11931195
OS-specific restrictions may apply when `oldpath` and `newpath` are in different directories.
11941196
1197+
Currently there are a few differences in behavior on Windows which may be resolved in a future release.
1198+
Specifically, currently on Windows:
1199+
1. `rename` will fail if `oldpath` or `newpath` are opened files.
1200+
2. `rename` will fail if `newpath` is an existing directory.
1201+
3. `rename` may work if `newpath` is a file and `oldpath` is a directory.
1202+
4. `rename` may remove `oldpath` if it is a hardlink to `newpath`.
1203+
11951204
See also: [`mv`](@ref).
11961205
"""
11971206
function rename(oldpath::AbstractString, newpath::AbstractString)

base/lock.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ end
5151

5252
assert_havelock(l::ReentrantLock) = assert_havelock(l, l.locked_by)
5353

54+
show(io::IO, ::ReentrantLock) = print(io, ReentrantLock, "()")
55+
56+
function show(io::IO, ::MIME"text/plain", l::ReentrantLock)
57+
show(io, l)
58+
if !(get(io, :compact, false)::Bool)
59+
locked_by = l.locked_by
60+
if locked_by isa Task
61+
print(io, " (locked by ", locked_by === current_task() ? "current " : "", locked_by, ")")
62+
else
63+
print(io, " (unlocked)")
64+
end
65+
end
66+
end
67+
5468
"""
5569
islocked(lock) -> Status (Boolean)
5670

base/opaque_closure.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ the argument type may be fixed length even if the function is variadic.
1818
This interface is experimental and subject to change or removal without notice.
1919
"""
2020
macro opaque(ex)
21-
esc(Expr(:opaque_closure, nothing, nothing, nothing, ex))
21+
esc(Expr(:opaque_closure, nothing, nothing, nothing, #= allow_partial =# true, ex))
2222
end
2323

2424
macro opaque(ty, ex)
@@ -34,7 +34,7 @@ macro opaque(ty, ex)
3434
end
3535
AT = (AT !== :_) ? AT : nothing
3636
RT = (RT !== :_) ? RT : nothing
37-
return esc(Expr(:opaque_closure, AT, RT, RT, ex))
37+
return esc(Expr(:opaque_closure, AT, RT, RT, #= allow_partial =# true, ex))
3838
end
3939

4040
# OpaqueClosure construction from pre-inferred CodeInfo/IRCode

base/precompilation.jl

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ function show_progress(io::IO, p::MiniProgressBar; termwidth=nothing, carriagere
285285
return
286286
end
287287
t = time()
288-
if p.has_shown && (t - p.time_shown) < PROGRESS_BAR_TIME_GRANULARITY[]
288+
if !p.always_reprint && p.has_shown && (t - p.time_shown) < PROGRESS_BAR_TIME_GRANULARITY[]
289289
return
290290
end
291291
p.time_shown = t
@@ -301,9 +301,11 @@ function show_progress(io::IO, p::MiniProgressBar; termwidth=nothing, carriagere
301301
max_progress_width = max(0, min(termwidth - textwidth(p.header) - textwidth(progress_text) - 10 , p.width))
302302
n_filled = ceil(Int, max_progress_width * perc / 100)
303303
n_left = max_progress_width - n_filled
304+
headers = split(p.header, ' ')
304305
to_print = sprint(; context=io) do io
305306
print(io, " "^p.indent)
306-
printstyled(io, p.header, color=p.color, bold=true)
307+
printstyled(io, headers[1], " "; color=:green, bold=true)
308+
printstyled(io, join(headers[2:end], ' '))
307309
print(io, " ")
308310
printstyled(io, ""^n_filled; color=p.color)
309311
printstyled(io, perc >= 95 ? "" : ""; color=p.color)
@@ -343,7 +345,7 @@ import Base: StaleCacheKey
343345

344346
can_fancyprint(io::IO) = io isa Base.TTY && (get(ENV, "CI", nothing) != "true")
345347

346-
function printpkgstyle(io, header, msg; color=:light_green)
348+
function printpkgstyle(io, header, msg; color=:green)
347349
printstyled(io, header; color, bold=true)
348350
println(io, " ", msg)
349351
end
@@ -564,9 +566,6 @@ function precompilepkgs(pkgs::Vector{String}=String[];
564566
if !manifest
565567
if isempty(pkgs)
566568
pkgs = [pkg.name for pkg in direct_deps]
567-
target = "all packages"
568-
else
569-
target = join(pkgs, ", ")
570569
end
571570
# restrict to dependencies of given packages
572571
function collect_all_deps(depsmap, dep, alldeps=Set{Base.PkgId}())
@@ -602,18 +601,16 @@ function precompilepkgs(pkgs::Vector{String}=String[];
602601
return
603602
end
604603
end
605-
else
606-
target = "manifest"
607604
end
608605

609606
nconfigs = length(configs)
607+
target = nothing
610608
if nconfigs == 1
611609
if !isempty(only(configs)[1])
612-
target *= " for configuration $(join(only(configs)[1], " "))"
610+
target = "for configuration $(join(only(configs)[1], " "))"
613611
end
614-
target *= "..."
615612
else
616-
target *= " for $nconfigs compilation configurations..."
613+
target = "for $nconfigs compilation configurations..."
617614
end
618615
@debug "precompile: packages filtered"
619616

@@ -695,15 +692,19 @@ function precompilepkgs(pkgs::Vector{String}=String[];
695692
try
696693
wait(first_started)
697694
(isempty(pkg_queue) || interrupted_or_done.set) && return
698-
fancyprint && lock(print_lock) do
699-
printpkgstyle(io, :Precompiling, target)
700-
print(io, ansi_disablecursor)
695+
lock(print_lock) do
696+
if target !== nothing
697+
printpkgstyle(io, :Precompiling, target)
698+
end
699+
if fancyprint
700+
print(io, ansi_disablecursor)
701+
end
701702
end
702703
t = Timer(0; interval=1/10)
703704
anim_chars = ["","","",""]
704705
i = 1
705706
last_length = 0
706-
bar = MiniProgressBar(; indent=2, header = "Progress", color = Base.info_color(), percentage=false, always_reprint=true)
707+
bar = MiniProgressBar(; indent=0, header = "Precompiling packages ", color = :green, percentage=false, always_reprint=true)
707708
n_total = length(depsmap) * length(configs)
708709
bar.max = n_total - n_already_precomp
709710
final_loop = false
@@ -832,8 +833,10 @@ function precompilepkgs(pkgs::Vector{String}=String[];
832833
config_str = "$(join(flags, " "))"
833834
name *= color_string(" $(config_str)", :light_black)
834835
end
835-
!fancyprint && lock(print_lock) do
836-
isempty(pkg_queue) && printpkgstyle(io, :Precompiling, target)
836+
lock(print_lock) do
837+
if !fancyprint && target === nothing && isempty(pkg_queue)
838+
printpkgstyle(io, :Precompiling, "packages...")
839+
end
837840
end
838841
push!(pkg_queue, pkg_config)
839842
started[pkg_config] = true

base/reflection.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,27 @@ function _fieldnames(@nospecialize t)
207207
return t.name.names
208208
end
209209

210+
const BINDING_KIND_GLOBAL = 0x0
211+
const BINDING_KIND_CONST = 0x1
212+
const BINDING_KIND_CONST_IMPORT = 0x2
213+
const BINDING_KIND_IMPLICIT = 0x3
214+
const BINDING_KIND_EXPLICIT = 0x4
215+
const BINDING_KIND_IMPORTED = 0x5
216+
const BINDING_KIND_FAILED = 0x6
217+
const BINDING_KIND_DECLARED = 0x7
218+
const BINDING_KIND_GUARD = 0x8
219+
220+
function lookup_binding_partition(world::UInt, b::Core.Binding)
221+
ccall(:jl_get_binding_partition, Ref{Core.BindingPartition}, (Any, UInt), b, world)
222+
end
223+
224+
function lookup_binding_partition(world::UInt, gr::Core.GlobalRef)
225+
ccall(:jl_get_globalref_partition, Ref{Core.BindingPartition}, (Any, UInt), gr, world)
226+
end
227+
228+
binding_kind(bpart::Core.BindingPartition) = ccall(:jl_bpart_get_kind, UInt8, (Any,), bpart)
229+
binding_kind(m::Module, s::Symbol) = binding_kind(lookup_binding_partition(tls_world_age(), GlobalRef(m, s)))
230+
210231
"""
211232
fieldname(x::DataType, i::Integer)
212233

base/strings/string.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ end
208208
i = i′
209209
@inbounds l = codeunit(s, i)
210210
(l < 0x80) | (0xf8 l) && return i+1
211-
@assert l >= 0xc0
211+
@assert l >= 0xc0 "invalid codeunit"
212212
end
213213
# first continuation byte
214214
(i += 1) > n && return i

0 commit comments

Comments
 (0)