Skip to content

Commit e27685f

Browse files
authored
Backports release 1.10 (#52503)
Backported PRs: - [x] #51234 <!-- Fix getfield codegen for tuple inputs and unknown symbol fields. --> - [x] #52170 <!-- fix invalidations related to `ismutable` --> - [x] #52342 <!-- Add single-term multiplication for `AbstractQ` on v1.10 and above --> - [x] #52333 <!-- bugfix for dot of Hermitian{noncommutative} --> - [x] #52407 <!-- channels: fix memory ordering violation in iterate --> - [x] #52405 <!-- Bump LLVM to 15.0.7+10 to fix GC issue --> - [x] #52441 <!-- Remove `Pkg` dependency from `SuiteSparse_jll` --> - [x] #52367 <!-- docs: add notes about scratchspaces in depot --> - [x] #52456 <!-- Make `jl_write_coverage_data` dllexported again --> - [x] #52294 <!-- GC scheduler refinements --> - [x] #52359 <!-- make custom log macros work --> - [x] #52548
2 parents dbb9c46 + 5a0bda4 commit e27685f

File tree

26 files changed

+640
-496
lines changed

26 files changed

+640
-496
lines changed

base/channels.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,12 @@ function close(c::Channel, @nospecialize(excp::Exception))
211211
end
212212
nothing
213213
end
214-
isopen(c::Channel) = ((@atomic :monotonic c.state) === :open)
214+
215+
# Use acquire here to pair with release store in `close`, so that subsequent `isready` calls
216+
# are forced to see `isready == true` if they see `isopen == false`. This means users must
217+
# call `isopen` before `isready` if you are using the race-y APIs (or call `iterate`, which
218+
# does this right for you).
219+
isopen(c::Channel) = ((@atomic :acquire c.state) === :open)
215220

216221
"""
217222
bind(chnl::Channel, task::Task)

base/compiler/abstractinterpretation.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2268,6 +2268,8 @@ end
22682268

22692269
function abstract_eval_special_value(interp::AbstractInterpreter, @nospecialize(e), vtypes::Union{VarTable,Nothing}, sv::AbsIntState)
22702270
if isa(e, QuoteNode)
2271+
merge_effects!(interp, sv, Effects(EFFECTS_TOTAL;
2272+
inaccessiblememonly = is_mutation_free_argtype(typeof(e.value)) ? ALWAYS_TRUE : ALWAYS_FALSE))
22712273
return Const(e.value)
22722274
elseif isa(e, SSAValue)
22732275
return abstract_eval_ssavalue(e, sv)

base/initdefs.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,21 @@ environment variable if set.
7373
Each entry in `DEPOT_PATH` is a path to a directory which contains subdirectories used by Julia for various purposes.
7474
Here is an overview of some of the subdirectories that may exist in a depot:
7575
76+
* `artifacts`: Contains content that packages use for which Pkg manages the installation of.
7677
* `clones`: Contains full clones of package repos. Maintained by `Pkg.jl` and used as a cache.
78+
* `config`: Contains julia-level configuration such as a `startup.jl`
7779
* `compiled`: Contains precompiled `*.ji` files for packages. Maintained by Julia.
7880
* `dev`: Default directory for `Pkg.develop`. Maintained by `Pkg.jl` and the user.
7981
* `environments`: Default package environments. For instance the global environment for a specific julia version. Maintained by `Pkg.jl`.
8082
* `logs`: Contains logs of `Pkg` and `REPL` operations. Maintained by `Pkg.jl` and `Julia`.
8183
* `packages`: Contains packages, some of which were explicitly installed and some which are implicit dependencies. Maintained by `Pkg.jl`.
8284
* `registries`: Contains package registries. By default only `General`. Maintained by `Pkg.jl`.
85+
* `scratchspaces`: Contains content that a package itself installs via the [`Scratch.jl`](https://github.com/JuliaPackaging/Scratch.jl) package. `Pkg.gc()` will delete content that is known to be unused.
86+
87+
!!! note
88+
Packages that want to store content should use the `scratchspaces` subdirectory via
89+
[`Scratch.jl`](https://github.com/JuliaPackaging/Scratch.jl) instead of creating new
90+
subdirectories in the depot root.
8391
8492
See also [`JULIA_DEPOT_PATH`](@ref JULIA_DEPOT_PATH), and
8593
[Code Loading](@ref code-loading).

base/logging.jl

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ Alias for [`LogLevel(2000)`](@ref LogLevel).
159159
const Error = LogLevel( 2000)
160160
const AboveMaxLevel = LogLevel( 1000001)
161161

162+
# Global log limiting mechanism for super fast but inflexible global log limiting.
163+
const _min_enabled_level = Ref{LogLevel}(Debug)
164+
162165
function show(io::IO, level::LogLevel)
163166
if level == BelowMinLevel print(io, "BelowMinLevel")
164167
elseif level == Debug print(io, "Debug")
@@ -319,6 +322,15 @@ function issimplekw(@nospecialize val)
319322
return false
320323
end
321324

325+
# helper function to get the current logger, if enabled for the specified message type
326+
@noinline Base.@constprop :none function current_logger_for_env(std_level::LogLevel, group, _module)
327+
logstate = @inline current_logstate()
328+
if std_level >= logstate.min_enabled_level || env_override_minlevel(group, _module)
329+
return logstate.logger
330+
end
331+
return nothing
332+
end
333+
322334
# Generate code for logging macros
323335
function logmsg_code(_module, file, line, level, message, exs...)
324336
@nospecialize
@@ -370,23 +382,23 @@ function logmsg_code(_module, file, line, level, message, exs...)
370382
let
371383
level = $level
372384
# simplify std_level code emitted, if we know it is one of our global constants
373-
std_level = $(level isa Symbol ? :level : :(level isa LogLevel ? level : convert(LogLevel, level)::LogLevel))
374-
if std_level >= _min_enabled_level[]
385+
std_level = $(level isa Symbol ? :level : :(level isa $LogLevel ? level : convert($LogLevel, level)::$LogLevel))
386+
if std_level >= $(_min_enabled_level)[]
375387
group = $(log_data._group)
376388
_module = $(log_data._module)
377-
logger = current_logger_for_env(std_level, group, _module)
389+
logger = $(current_logger_for_env)(std_level, group, _module)
378390
if !(logger === nothing)
379391
id = $(log_data._id)
380392
# Second chance at an early bail-out (before computing the message),
381393
# based on arbitrary logger-specific logic.
382-
if invokelatest(shouldlog, logger, level, _module, group, id)
394+
if invokelatest($shouldlog, logger, level, _module, group, id)
383395
file = $(log_data._file)
384396
if file isa String
385397
file = Base.fixup_stdlib_path(file)
386398
end
387399
line = $(log_data._line)
388400
local msg, kwargs
389-
$(logrecord) && invokelatest(handle_message,
401+
$(logrecord) && invokelatest($handle_message,
390402
logger, level, msg, _module, group, id, file, line;
391403
kwargs...)
392404
end
@@ -481,9 +493,6 @@ function logmsg_shim(level, message, _module, group, id, file, line, kwargs)
481493
nothing
482494
end
483495

484-
# Global log limiting mechanism for super fast but inflexible global log limiting.
485-
const _min_enabled_level = Ref{LogLevel}(Debug)
486-
487496
# LogState - a cache of data extracted from the logger, plus the logger itself.
488497
struct LogState
489498
min_enabled_level::LogLevel
@@ -497,15 +506,6 @@ function current_logstate()
497506
return (logstate !== nothing ? logstate : _global_logstate)::LogState
498507
end
499508

500-
# helper function to get the current logger, if enabled for the specified message type
501-
@noinline Base.@constprop :none function current_logger_for_env(std_level::LogLevel, group, _module)
502-
logstate = current_logstate()
503-
if std_level >= logstate.min_enabled_level || env_override_minlevel(group, _module)
504-
return logstate.logger
505-
end
506-
return nothing
507-
end
508-
509509
function with_logstate(f::Function, logstate)
510510
@nospecialize
511511
t = current_task()

base/reflection.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,9 @@ true
514514
!!! compat "Julia 1.5"
515515
This function requires at least Julia 1.5.
516516
"""
517-
ismutable(@nospecialize(x)) = (@_total_meta; typeof(x).name.flags & 0x2 == 0x2)
517+
ismutable(@nospecialize(x)) = (@_total_meta; (typeof(x).name::Core.TypeName).flags & 0x2 == 0x2)
518+
# The type assertion above is required to fix some invalidations.
519+
# See also https://github.com/JuliaLang/julia/issues/52134
518520

519521
"""
520522
ismutabletype(T) -> Bool

0 commit comments

Comments
 (0)