Skip to content

Commit

Permalink
Backports release 1.10 (#52503)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
KristofferC committed Dec 17, 2023
2 parents dbb9c46 + 5a0bda4 commit e27685f
Show file tree
Hide file tree
Showing 26 changed files with 640 additions and 496 deletions.
7 changes: 6 additions & 1 deletion base/channels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,12 @@ function close(c::Channel, @nospecialize(excp::Exception))
end
nothing
end
isopen(c::Channel) = ((@atomic :monotonic c.state) === :open)

# Use acquire here to pair with release store in `close`, so that subsequent `isready` calls
# are forced to see `isready == true` if they see `isopen == false`. This means users must
# call `isopen` before `isready` if you are using the race-y APIs (or call `iterate`, which
# does this right for you).
isopen(c::Channel) = ((@atomic :acquire c.state) === :open)

"""
bind(chnl::Channel, task::Task)
Expand Down
2 changes: 2 additions & 0 deletions base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2268,6 +2268,8 @@ end

function abstract_eval_special_value(interp::AbstractInterpreter, @nospecialize(e), vtypes::Union{VarTable,Nothing}, sv::AbsIntState)
if isa(e, QuoteNode)
merge_effects!(interp, sv, Effects(EFFECTS_TOTAL;
inaccessiblememonly = is_mutation_free_argtype(typeof(e.value)) ? ALWAYS_TRUE : ALWAYS_FALSE))
return Const(e.value)
elseif isa(e, SSAValue)
return abstract_eval_ssavalue(e, sv)
Expand Down
8 changes: 8 additions & 0 deletions base/initdefs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,21 @@ environment variable if set.
Each entry in `DEPOT_PATH` is a path to a directory which contains subdirectories used by Julia for various purposes.
Here is an overview of some of the subdirectories that may exist in a depot:
* `artifacts`: Contains content that packages use for which Pkg manages the installation of.
* `clones`: Contains full clones of package repos. Maintained by `Pkg.jl` and used as a cache.
* `config`: Contains julia-level configuration such as a `startup.jl`
* `compiled`: Contains precompiled `*.ji` files for packages. Maintained by Julia.
* `dev`: Default directory for `Pkg.develop`. Maintained by `Pkg.jl` and the user.
* `environments`: Default package environments. For instance the global environment for a specific julia version. Maintained by `Pkg.jl`.
* `logs`: Contains logs of `Pkg` and `REPL` operations. Maintained by `Pkg.jl` and `Julia`.
* `packages`: Contains packages, some of which were explicitly installed and some which are implicit dependencies. Maintained by `Pkg.jl`.
* `registries`: Contains package registries. By default only `General`. Maintained by `Pkg.jl`.
* `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.
!!! note
Packages that want to store content should use the `scratchspaces` subdirectory via
[`Scratch.jl`](https://github.com/JuliaPackaging/Scratch.jl) instead of creating new
subdirectories in the depot root.
See also [`JULIA_DEPOT_PATH`](@ref JULIA_DEPOT_PATH), and
[Code Loading](@ref code-loading).
Expand Down
34 changes: 17 additions & 17 deletions base/logging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ Alias for [`LogLevel(2000)`](@ref LogLevel).
const Error = LogLevel( 2000)
const AboveMaxLevel = LogLevel( 1000001)

# Global log limiting mechanism for super fast but inflexible global log limiting.
const _min_enabled_level = Ref{LogLevel}(Debug)

function show(io::IO, level::LogLevel)
if level == BelowMinLevel print(io, "BelowMinLevel")
elseif level == Debug print(io, "Debug")
Expand Down Expand Up @@ -319,6 +322,15 @@ function issimplekw(@nospecialize val)
return false
end

# helper function to get the current logger, if enabled for the specified message type
@noinline Base.@constprop :none function current_logger_for_env(std_level::LogLevel, group, _module)
logstate = @inline current_logstate()
if std_level >= logstate.min_enabled_level || env_override_minlevel(group, _module)
return logstate.logger
end
return nothing
end

# Generate code for logging macros
function logmsg_code(_module, file, line, level, message, exs...)
@nospecialize
Expand Down Expand Up @@ -370,23 +382,23 @@ function logmsg_code(_module, file, line, level, message, exs...)
let
level = $level
# simplify std_level code emitted, if we know it is one of our global constants
std_level = $(level isa Symbol ? :level : :(level isa LogLevel ? level : convert(LogLevel, level)::LogLevel))
if std_level >= _min_enabled_level[]
std_level = $(level isa Symbol ? :level : :(level isa $LogLevel ? level : convert($LogLevel, level)::$LogLevel))
if std_level >= $(_min_enabled_level)[]
group = $(log_data._group)
_module = $(log_data._module)
logger = current_logger_for_env(std_level, group, _module)
logger = $(current_logger_for_env)(std_level, group, _module)
if !(logger === nothing)
id = $(log_data._id)
# Second chance at an early bail-out (before computing the message),
# based on arbitrary logger-specific logic.
if invokelatest(shouldlog, logger, level, _module, group, id)
if invokelatest($shouldlog, logger, level, _module, group, id)
file = $(log_data._file)
if file isa String
file = Base.fixup_stdlib_path(file)
end
line = $(log_data._line)
local msg, kwargs
$(logrecord) && invokelatest(handle_message,
$(logrecord) && invokelatest($handle_message,
logger, level, msg, _module, group, id, file, line;
kwargs...)
end
Expand Down Expand Up @@ -481,9 +493,6 @@ function logmsg_shim(level, message, _module, group, id, file, line, kwargs)
nothing
end

# Global log limiting mechanism for super fast but inflexible global log limiting.
const _min_enabled_level = Ref{LogLevel}(Debug)

# LogState - a cache of data extracted from the logger, plus the logger itself.
struct LogState
min_enabled_level::LogLevel
Expand All @@ -497,15 +506,6 @@ function current_logstate()
return (logstate !== nothing ? logstate : _global_logstate)::LogState
end

# helper function to get the current logger, if enabled for the specified message type
@noinline Base.@constprop :none function current_logger_for_env(std_level::LogLevel, group, _module)
logstate = current_logstate()
if std_level >= logstate.min_enabled_level || env_override_minlevel(group, _module)
return logstate.logger
end
return nothing
end

function with_logstate(f::Function, logstate)
@nospecialize
t = current_task()
Expand Down
4 changes: 3 additions & 1 deletion base/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,9 @@ true
!!! compat "Julia 1.5"
This function requires at least Julia 1.5.
"""
ismutable(@nospecialize(x)) = (@_total_meta; typeof(x).name.flags & 0x2 == 0x2)
ismutable(@nospecialize(x)) = (@_total_meta; (typeof(x).name::Core.TypeName).flags & 0x2 == 0x2)
# The type assertion above is required to fix some invalidations.
# See also https://github.com/JuliaLang/julia/issues/52134

"""
ismutabletype(T) -> Bool
Expand Down

0 comments on commit e27685f

Please sign in to comment.