Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 .github/workflows/Typos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
timeout-minutes: 5
steps:
- name: Checkout the JuliaLang/julia repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Check spelling with typos
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Whitespace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
timeout-minutes: 2
steps:
- name: Checkout the JuliaLang/julia repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: julia-actions/setup-julia@5c9647d97b78a5debe5164e9eec09d653d29bd71 # v2.6.1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cffconvert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out a copy of the repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion Compiler/src/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function can_propagate_conditional(@nospecialize(rt), argtypes::Vector{Any})
return false
end
return isa(argtypes[rt.slot], Conditional) &&
is_const_bool_or_bottom(rt.thentype) && is_const_bool_or_bottom(rt.thentype)
is_const_bool_or_bottom(rt.thentype) && is_const_bool_or_bottom(rt.elsetype)
end

function propagate_conditional(rt::InterConditional, cond::Conditional)
Expand Down
14 changes: 14 additions & 0 deletions Compiler/test/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6531,4 +6531,18 @@ function haskey_inference_test()
end
@inferred haskey_inference_test()

# issue #60883: conditional propagation through wrapper functions
mutable struct A60883
a::Int
end
inner60883(a, b) = iszero(a.a) && !b
outer60883(a, b) = inner60883(a, b)
function issue60883()
a = A60883(0)
b = iszero(a.a)
if outer60883(a, b) else end
return b # should not be narrowed to Const(false)
end
@test issue60883() === true

end # module inference
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ Deprecated or removed

* The method `merge(combine::Callable, d::AbstractDict...)` is now deprecated to favor `mergewith` instead ([#59775]).

Deprecated or removed
---------------------

* The method `merge(combine::Callable, d::AbstractDict...)` is now deprecated to favor `mergewith` instead ([#59775]).

<!--- generated by NEWS-update.jl: -->
[#47102]: https://github.com/JuliaLang/julia/issues/47102
[#48507]: https://github.com/JuliaLang/julia/issues/48507
Expand Down
2 changes: 1 addition & 1 deletion base/docs/Docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ function metadata(__source__, __module__, expr, ismodule)
if isa(eachex, Symbol) || isexpr(eachex, :(::))
# a field declaration
if last_docstr !== nothing
push!(fields, P(namify(eachex), last_docstr))
push!(fields, P(namify(eachex)::Symbol, last_docstr))
last_docstr = nothing
end
elseif isexpr(eachex, :function) || isexpr(eachex, :(=))
Expand Down
11 changes: 10 additions & 1 deletion base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,16 @@ struct LoadingCache
located::Dict{Tuple{PkgId, Union{String, Nothing}}, Union{Tuple{String, String}, Nothing}}
end
const LOADING_CACHE = Ref{Union{LoadingCache, Nothing}}(nothing) # n.b.: all access to and through this are protected by require_lock
LoadingCache() = LoadingCache(load_path(), Dict(), Dict(), Dict(), Set(), Dict(), Dict(), Dict())
LoadingCache() = LoadingCache(
load_path(),
Dict{String, UUID}(),
Dict{String, Union{Bool, String}}(),
Dict{String, Union{Nothing, String}}(),
Set{String}(),
Dict{Tuple{PkgId, String}, Union{Nothing, Tuple{PkgId, String}}}(),
Dict{String, Union{Nothing, Tuple{PkgId, String}}}(),
Dict{Tuple{PkgId, Union{String, Nothing}}, Union{Tuple{String, String}, Nothing}}()
)


struct TOMLCache{Dates}
Expand Down
7 changes: 6 additions & 1 deletion base/precompilation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,11 @@ function _color_string(cstr::String, col::Union{Int64, Symbol}, hascolor)
end

# Can be merged with `maybe_cachefile_lock` in loading?
# Wraps the precompilation function `f` with cachefile lock handling.
# Returns the result from `f()`, which can be:
# - `nothing`: cache already existed
# - `Tuple{String, Union{Nothing, String}}`: this process just compiled
# - `Exception`: compilation failed
function precompile_pkgs_maybe_cachefile_lock(f, io::IO, print_lock::ReentrantLock, fancyprint::Bool, pkg_config, pkgspidlocked, hascolor, parallel_limiter::Base.Semaphore)
if !(isdefined(Base, :mkpidlock_hook) && isdefined(Base, :trymkpidlock_hook) && Base.isdefined(Base, :parse_pidfile_hook))
return f()
Expand All @@ -1284,7 +1289,7 @@ function precompile_pkgs_maybe_cachefile_lock(f, io::IO, print_lock::ReentrantLo
Base.release(parallel_limiter) # release so other work can be done while waiting
try
# wait until the lock is available
@invokelatest Base.mkpidlock_hook(() -> begin
cachefile = @invokelatest Base.mkpidlock_hook(() -> begin
delete!(pkgspidlocked, pkg_config)
Base.acquire(f, parallel_limiter)
end,
Expand Down
2 changes: 1 addition & 1 deletion base/shell.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function shell_split(s::AbstractString)
parsed = shell_parse(s, false)[1]
args = String[]
for arg in parsed
push!(args, string(arg...))
push!(args, string(arg...)::String)
end
args
end
Expand Down
42 changes: 27 additions & 15 deletions base/strings/annotated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ function annotatedstring(xs...)
size = filesize(s.io)
if x isa AnnotatedString
for annot in x.annotations
push!(annotations, setindex(annot, annot.region .+ size, :region))
push!(annotations, @inline(setindex(annot, annot.region .+ size, :region)))
end
print(s, x.string)
elseif x isa SubString{<:AnnotatedString}
Expand All @@ -259,7 +259,7 @@ function annotatedstring(xs...)
if start <= x.offset + x.ncodeunits && stop > x.offset
rstart = size + max(0, start - x.offset - 1) + 1
rstop = size + min(stop, x.offset + x.ncodeunits) - x.offset
push!(annotations, setindex(annot, rstart:rstop, :region))
push!(annotations, @inline(setindex(annot, rstart:rstop, :region)))
end
end
print(s, SubString(x.string.string, x.offset, x.ncodeunits, Val(:noshift)))
Expand Down Expand Up @@ -293,12 +293,12 @@ function repeat(str::AnnotatedString, r::Integer)
elseif allequal(a -> a.region, str.annotations) && first(str.annotations).region == fullregion
newfullregion = firstindex(unannot):lastindex(unannot)
for annot in str.annotations
push!(annotations, setindex(annot, newfullregion, :region))
push!(annotations, @inline(setindex(annot, newfullregion, :region)))
end
else
for offset in 0:len:(r-1)*len
for annot in str.annotations
push!(annotations, setindex(annot, annot.region .+ offset, :region))
push!(annotations, @inline(setindex(annot, annot.region .+ offset, :region)))
end
end
end
Expand All @@ -318,10 +318,10 @@ function reverse(s::AnnotatedString)
lastind = lastindex(s)
AnnotatedString(
reverse(s.string),
[setindex(annot,
[@inline(setindex(annot,
UnitRange(1 + lastind - last(annot.region),
1 + lastind - first(annot.region)),
:region)
:region))
for annot in s.annotations])
end

Expand Down Expand Up @@ -389,16 +389,28 @@ See also: [`annotate!`](@ref).
annotations(s::AnnotatedString) = s.annotations

function annotations(s::SubString{<:AnnotatedString})
RegionAnnotation[
setindex(ann, first(ann.region)-s.offset:last(ann.region)-s.offset, :region)
for ann in annotations(s.string, s.offset+1:s.offset+s.ncodeunits)]
substr_range = s.offset+1:s.offset+s.ncodeunits
result = RegionAnnotation[]
for ann in annotations(s.string, substr_range)
# Shift the region to be relative to the substring start
shifted_region = first(ann.region)-s.offset:last(ann.region)-s.offset
# @inline setindex makes :region const knowable (#60365)
push!(result, @inline(setindex(ann, shifted_region, :region)))
end
return result
end

function annotations(s::AnnotatedString, pos::UnitRange{<:Integer})
# TODO optimise
RegionAnnotation[
setindex(ann, max(first(pos), first(ann.region)):min(last(pos), last(ann.region)), :region)
for ann in s.annotations if !isempty(intersect(pos, ann.region))]
result = RegionAnnotation[]
for ann in s.annotations
if !isempty(intersect(pos, ann.region))
clamped_region = max(first(pos), first(ann.region)):min(last(pos), last(ann.region))
# @inline setindex makes :region const knowable (#60365)
push!(result, @inline(setindex(ann, clamped_region, :region)))
end
end
return result
end

annotations(s::AnnotatedString, pos::Integer) = annotations(s, pos:pos)
Expand Down Expand Up @@ -455,7 +467,7 @@ function annotated_chartransform(f::Function, str::AnnotatedString, state=nothin
start, stop = first(annot.region), last(annot.region)
start_offset = last(offsets[findlast(<=(start) ∘ first, offsets)::Int])
stop_offset = last(offsets[findlast(<=(stop) ∘ first, offsets)::Int])
push!(annots, setindex(annot, (start + start_offset):(stop + stop_offset), :region))
push!(annots, @inline(setindex(annot, (start + start_offset):(stop + stop_offset), :region)))
end
AnnotatedString(takestring!(outstr), annots)
end
Expand Down Expand Up @@ -509,7 +521,7 @@ function eachregion(s::AnnotatedString, subregion::UnitRange{Int}=firstindex(s):
pos = first(events).pos
if pos > first(subregion)
push!(regions, thisind(s, first(subregion)):prevind(s, pos))
push!(annots, [])
push!(annots, Annotation[])
end
activelist = Int[]
for event in events
Expand All @@ -526,7 +538,7 @@ function eachregion(s::AnnotatedString, subregion::UnitRange{Int}=firstindex(s):
end
if last(events).pos < nextind(s, last(subregion))
push!(regions, last(events).pos:thisind(s, last(subregion)))
push!(annots, [])
push!(annots, Annotation[])
end
RegionIterator(s.string, regions, annots)
end
Expand Down
15 changes: 8 additions & 7 deletions base/strings/annotated_io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function write(dest::AnnotatedIOBuffer, src::AnnotatedIOBuffer)
srcpos = position(src)
nb = write(dest.io, src.io)
isappending || _clear_annotations_in_region!(dest.annotations, destpos:destpos+nb)
srcannots = [setindex(annot, max(1 + srcpos, first(annot.region)):last(annot.region), :region)
srcannots = [@inline(setindex(annot, max(1 + srcpos, first(annot.region)):last(annot.region), :region))
for annot in src.annotations if first(annot.region) >= srcpos]
_insert_annotations!(dest, srcannots, destpos - srcpos)
nb
Expand All @@ -78,10 +78,11 @@ function write(io::AbstractPipe, c::AnnotatedChar)
end

function read(io::AnnotatedIOBuffer, ::Type{AnnotatedString{T}}) where {T <: AbstractString}
if (start = position(io)) == 0
start = position(io)
if start == 0
AnnotatedString(read(io.io, T), copy(io.annotations))
else
annots = [setindex(annot, UnitRange{Int}(max(1, first(annot.region) - start), last(annot.region)-start), :region)
annots = [@inline(setindex(annot, UnitRange{Int}(max(1, first(annot.region) - start), last(annot.region)-start), :region))
for annot in io.annotations if last(annot.region) > start]
AnnotatedString(read(io.io, T), annots)
end
Expand All @@ -101,7 +102,7 @@ read(io::AnnotatedIOBuffer, ::Type{AnnotatedChar}) = read(io, AnnotatedChar{Char
function truncate(io::AnnotatedIOBuffer, size::Integer)
truncate(io.io, size)
filter!(ann -> first(ann.region) <= size, io.annotations)
map!(ann -> setindex(ann, first(ann.region):min(size, last(ann.region)), :region),
map!(ann -> @inline(setindex(ann, first(ann.region):min(size, last(ann.region)), :region)),
io.annotations, io.annotations)
io
end
Expand All @@ -125,17 +126,17 @@ function _clear_annotations_in_region!(annotations::Vector{RegionAnnotation}, sp
# Test for partial overlap
if first(region) <= first(span) <= last(region) || first(region) <= last(span) <= last(region)
annotations[i] =
setindex(annot,
@inline(setindex(annot,
if first(region) < first(span)
first(region):first(span)-1
else
last(span)+1:last(region)
end,
:region)
:region))
# If `span` fits exactly within `region`, then we've only copied over
# the beginning overhang, but also need to conserve the end overhang.
if first(region) < first(span) && last(span) < last(region)
push!(extras, (i, setindex(annot, last(span)+1:last(region), :region)))
push!(extras, (i, @inline(setindex(annot, last(span)+1:last(region), :region))))
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion base/terminfo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct TermInfo
aliases::Dict{Symbol, Symbol}
end

TermInfo() = TermInfo([], Dict(), Dict(), Dict(), nothing, Dict())
TermInfo() = TermInfo(String[], Dict{Symbol, Bool}(), Dict{Symbol, Int}(), Dict{Symbol, String}(), nothing, Dict{Symbol, Symbol}())

function read(data::IO, ::Type{TermInfoRaw})
# Parse according to `term(5)`
Expand Down
4 changes: 2 additions & 2 deletions deps/JuliaSyntax.version
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
JULIASYNTAX_BRANCH = main
JULIASYNTAX_SHA1 = 99e975a726a82994de3f8e961e6fa8d39aed0d37
JULIASYNTAX_BRANCH = release-1.13
JULIASYNTAX_SHA1 = c02bc7a9151f36e46daea509827545d44132df2e
JULIASYNTAX_GIT_URL := https://github.com/JuliaLang/JuliaSyntax.jl.git
JULIASYNTAX_TAR_URL = https://api.github.com/repos/JuliaLang/JuliaSyntax.jl/tarball/$1

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8fccef621fc59fd982a64d2a570f4e2d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8deefdfa0e2eaf1a269e90ad0e779a3fc9c2a4b7d87d0d70afd35857b22c8b1b9f91304b2b7ebc70595ab77bf1399a2dafb3ba7fd990515c5f87c4a4fe0a23dc

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1fa5749ed9d73b565fe689a5bd53476c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
de0d6283143a8bc20c122b4960371a15e8c24f222252b1e6f2455aaefbcb659b6620e32de0897257935e28cb188e76443e4e715ba1c1731515a31e70c7dcd22a
9 changes: 6 additions & 3 deletions src/aotcompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -816,9 +816,12 @@ void *jl_emit_native_impl(jl_array_t *codeinfos, LLVMOrcThreadSafeModuleRef llvm
continue; // skip any duplicates that accidentally made there way in here (or make this an error?)
if (jl_ir_inlining_cost((jl_value_t*)src) < UINT16_MAX)
params.safepoint_on_entry = false; // ensure we don't block ExpandAtomicModifyPass from inlining this code if applicable
orc::ThreadSafeModule result_m = jl_create_ts_module(name_from_method_instance(jl_get_ci_mi(codeinst)),
params.tsctx, clone.getModuleUnlocked()->getDataLayout(),
Triple(clone.getModuleUnlocked()->getTargetTriple()));
orc::ThreadSafeModule result_m =
jl_create_ts_module(name_from_method_instance(jl_get_ci_mi(codeinst)),
params.tsctx,
clone.getModuleUnlocked()->getDataLayout(),
Triple(clone.getModuleUnlocked()->getTargetTriple()),
clone.getModuleUnlocked());
jl_llvm_functions_t decls;
if (!(params.params->force_emit_all) && jl_atomic_load_relaxed(&codeinst->invoke) == jl_fptr_const_return_addr)
decls.functionObject = "jl_fptr_const_return";
Expand Down
Loading