Skip to content

Commit 4f6ee4e

Browse files
authored
Merge branch 'master' into reimplement_cosc_for_Float32_Float64
2 parents af0fbff + 1a1270d commit 4f6ee4e

File tree

112 files changed

+2665
-996
lines changed

Some content is hidden

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

112 files changed

+2665
-996
lines changed

AGENTS.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,19 @@ will not be reflected, unless you use `Revise`.
1919

2020
## For all changes
2121

22-
1. Run `make check-whitespace` before creating the PR to make sure you're not committing any whitespace errors.
22+
1. Run `make fix-whitespace` before creating the PR to make sure you're not committing any whitespace errors.
2323

2424
## Building Julia
2525

2626
If you made changes to the runtime (any files in `src/`), you will need to rebuild
2727
julia. Run `make -j` to rebuild julia. This process may take up to 10 minutes
2828
depending on your changes.
2929

30+
After `make` run these static analysis checks:
31+
- `make -C src clang-sa-<filename>` (replace `<filename>` with the basename of the file you modified)
32+
- `make -C src clang-sagc-<filename>` which may require adding JL_GC_PUSH arguments, or JL_GC_PROMISE_ROOTED statements., or require fixing locks. Remember arguments are assumed rooted, so check the callers to make sure that is handled. If the value is being temporarily moved around in a struct or arraylist, `JL_GC_PROMISE_ROOTED(struct->field)` may be needed as a statement (it return void) immediately after reloading the struct before any use of struct. Put the promise as early in the code as is legal.
33+
- `make -C src clang-tidy-<filename>`
34+
3035
## Using Revise
3136

3237
If you have made changes to files included in the system image (base/ or stdlib/),
@@ -76,6 +81,13 @@ When modifying external dependencies (patches in `deps/patches/` or version upda
7681
- Prefer using the full upstream commit in `git am` format (e.g., `git format-patch`) which includes proper commit metadata
7782
3. When updating dependency versions, ensure all associated patches still apply
7883

84+
### External JLLs
85+
86+
To update a JLL to the latest version:
87+
- Update the version number in the appropriate jll folder
88+
- If the dependencies in the upstream jll changed, update the Project.toml
89+
- Run `make -f contrib/refresh_checksums.mk <jll>` to update the checksums. This may take a few minutes.
90+
7991
### Writing code
8092
After writing code, look up the docstring for each function you used. If there
8193
are recommendations or additional considerations that apply to these functions,

Compiler/src/abstractinterpretation.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ function find_union_split_method_matches(interp::AbstractInterpreter, argtypes::
369369
end
370370
valid_worlds = intersect(valid_worlds, thismatches.valid_worlds)
371371
thisfullmatch = any(match::MethodMatch->match.fully_covers, thismatches)
372-
mt = Core.GlobalMethods
372+
mt = Core.methodtable
373373
thisinfo = MethodMatchInfo(thismatches, mt, sig_n, thisfullmatch)
374374
push!(infos, thisinfo)
375375
for idx = 1:length(thismatches)
@@ -390,7 +390,7 @@ function find_simple_method_matches(interp::AbstractInterpreter, @nospecialize(a
390390
return FailedMethodMatch("Too many methods matched")
391391
end
392392
fullmatch = any(match::MethodMatch->match.fully_covers, matches)
393-
mt = Core.GlobalMethods
393+
mt = Core.methodtable
394394
info = MethodMatchInfo(matches, mt, atype, fullmatch)
395395
applicable = MethodMatchTarget[MethodMatchTarget(matches[idx], info.edges, idx) for idx = 1:length(matches)]
396396
return MethodMatches(applicable, info, matches.valid_worlds)
@@ -3255,7 +3255,7 @@ function abstract_eval_copyast(interp::AbstractInterpreter, e::Expr, sstate::Sta
32553255
return RTEffects(rt, Any, effects)
32563256
end
32573257

3258-
function abstract_eval_isdefined_expr(interp::AbstractInterpreter, e::Expr, sstate::StatementState,
3258+
function abstract_eval_isdefined_expr(::AbstractInterpreter, e::Expr, sstate::StatementState,
32593259
sv::AbsIntState)
32603260
sym = e.args[1]
32613261
if isa(sym, SlotNumber) && sstate.vtypes !== nothing

Compiler/src/stmtinfo.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ function _add_edges_impl(edges::Vector{Any}, info::MethodMatchInfo, mi_edge::Boo
4949
if !fully_covering(info)
5050
exists = false
5151
for i in 2:length(edges)
52-
if edges[i] === Core.GlobalMethods && edges[i-1] == info.atype
52+
if edges[i] === Core.methodtable && edges[i-1] == info.atype
5353
exists = true
5454
break
5555
end
5656
end
5757
if !exists
5858
push!(edges, info.atype)
59-
push!(edges, Core.GlobalMethods)
59+
push!(edges, Core.methodtable)
6060
end
6161
end
6262
nmatches = length(info.results)

Compiler/src/tfuncs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3208,7 +3208,7 @@ function _hasmethod_tfunc(interp::AbstractInterpreter, argtypes::Vector{Any}, sv
32083208
if match === nothing
32093209
rt = Const(false)
32103210
vresults = MethodLookupResult(Any[], valid_worlds, true)
3211-
mt = Core.GlobalMethods
3211+
mt = Core.methodtable
32123212
vinfo = MethodMatchInfo(vresults, mt, types, false) # XXX: this should actually be an info with invoke-type edge
32133213
else
32143214
rt = Const(true)

Compiler/src/typelattice.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@
88
# inside the global code cache.
99
import Core: Const, InterConditional, PartialStruct
1010

11+
function may_form_limited_typ(@nospecialize(aty), @nospecialize(bty), @nospecialize(xty))
12+
if aty isa LimitedAccuracy
13+
if bty isa LimitedAccuracy
14+
return LimitedAccuracy(xty, union!(copy(aty.causes), bty.causes))
15+
else
16+
return LimitedAccuracy(xty, copy(aty.causes))
17+
end
18+
elseif bty isa LimitedAccuracy
19+
return LimitedAccuracy(xty, copy(bty.causes))
20+
end
21+
return nothing
22+
end
23+
1124
"""
1225
cnd::Conditional
1326
@@ -40,6 +53,8 @@ struct Conditional
4053
isdefined::Bool=false)
4154
assert_nested_slotwrapper(thentype)
4255
assert_nested_slotwrapper(elsetype)
56+
limited = may_form_limited_typ(thentype, elsetype, Bool)
57+
limited !== nothing && return limited
4358
return new(slot, thentype, elsetype, isdefined)
4459
end
4560
end
@@ -83,6 +98,8 @@ struct MustAlias
8398
assert_nested_slotwrapper(fldtyp)
8499
# @assert !isalreadyconst(vartyp) "vartyp is already const"
85100
# @assert !isalreadyconst(fldtyp) "fldtyp is already const"
101+
limited = may_form_limited_typ(vartyp, fldtyp, fldtyp)
102+
limited !== nothing && return limited
86103
return new(slot, vartyp, fldidx, fldtyp)
87104
end
88105
end
@@ -104,6 +121,8 @@ struct InterMustAlias
104121
assert_nested_slotwrapper(fldtyp)
105122
# @assert !isalreadyconst(vartyp) "vartyp is already const"
106123
# @assert !isalreadyconst(fldtyp) "fldtyp is already const"
124+
limited = may_form_limited_typ(vartyp, fldtyp, fldtyp)
125+
limited !== nothing && return limited
107126
return new(slot, vartyp, fldidx, fldtyp)
108127
end
109128
end

Compiler/test/inference.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3549,8 +3549,14 @@ f31974(n::Int) = f31974(1:n)
35493549
# call cycles.
35503550
@test code_typed(f31974, Tuple{Int}) !== nothing
35513551

3552-
f_overly_abstract_complex() = Complex(Ref{Number}(1)[])
3553-
@test Base.return_types(f_overly_abstract_complex, Tuple{}) == [Complex]
3552+
# Issue #33472
3553+
struct WrapperWithUnionall33472{T<:Real}
3554+
x::T
3555+
end
3556+
3557+
f_overly_abstract33472() = WrapperWithUnionall33472(Base.inferencebarrier(1)::Number)
3558+
# Check that this doesn't infer as `WrapperWithUnionall33472{T<:Number}`.
3559+
@test Base.return_types(f_overly_abstract33472, Tuple{}) == [WrapperWithUnionall33472]
35543560

35553561
# Issue 26724
35563562
const IntRange = AbstractUnitRange{<:Integer}

Make.inc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,8 @@ ifneq ($(OS), Darwin)
798798
endif
799799
endif
800800

801+
bootstrap_julia_flags :=
802+
801803
ifeq ($(SANITIZE),1)
802804
SANITIZE_OPTS :=
803805
SANITIZE_LDFLAGS :=
@@ -815,6 +817,9 @@ endif
815817
ifeq ($(SANITIZE_THREAD),1)
816818
SANITIZE_OPTS += -fsanitize=thread
817819
SANITIZE_LDFLAGS += -fsanitize=thread
820+
ifneq ($(CROSS_BOOTSTRAP_JULIA),)
821+
bootstrap_julia_flags += --target-sanitize=thread
822+
endif
818823
endif
819824
ifeq ($(SANITIZE_OPTS),)
820825
$(error SANITIZE=1, but no sanitizer selected, set either SANITIZE_MEMORY, SANITIZE_THREAD, or SANITIZE_ADDRESS)
@@ -1761,9 +1766,15 @@ JULIA_BUILD_MODE := debug
17611766
endif
17621767
endif
17631768

1769+
ifneq ($(CROSS_BOOTSTRAP_JULIA),)
1770+
JULIA_EXECUTABLE_debug := $(CROSS_BOOTSTRAP_JULIA)
1771+
JULIA_EXECUTABLE_release := $(CROSS_BOOTSTRAP_JULIA)
1772+
JULIA_EXECUTABLE := $(CROSS_BOOTSTRAP_JULIA)
1773+
else
17641774
JULIA_EXECUTABLE_debug := $(build_bindir)/julia-debug$(EXE)
17651775
JULIA_EXECUTABLE_release := $(build_bindir)/julia$(EXE)
17661776
JULIA_EXECUTABLE := $(JULIA_EXECUTABLE_$(JULIA_BUILD_MODE))
1777+
endif
17671778

17681779
JULIA_SYSIMG_debug := $(build_private_libdir)/sys-debug.$(SHLIB_EXT)
17691780
JULIA_SYSIMG_release := $(build_private_libdir)/sys.$(SHLIB_EXT)

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ julia-cli-release julia-cli-debug: julia-cli-% : julia-deps
113113
julia-sysimg-release julia-sysimg-debug : julia-sysimg-% : julia-src-% $(TOP_LEVEL_PKG_LINK_TARGETS) julia-stdlib julia-base julia-cli-% | $(build_private_libdir)
114114
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) -f sysimage.mk sysimg-$*
115115

116+
# Useful for cross-bootstrapping
117+
julia-sysbase-release julia-sysbase-debug : julia-sysbase-% : julia-src-% $(TOP_LEVEL_PKG_LINK_TARGETS) julia-stdlib julia-base julia-cli-% | $(build_private_libdir)
118+
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) -f sysimage.mk sysbase-$*
119+
116120
julia-debug julia-release : julia-% : julia-sysimg-% julia-src-% julia-symlink julia-libccalltest \
117121
julia-libccalllazyfoo julia-libccalllazybar julia-libllvmcalltest julia-base-cache
118122

@@ -136,6 +140,15 @@ else
136140
$(warn "Skipping whitespace check because git is unavailable")
137141
endif
138142

143+
fix-whitespace:
144+
ifneq ($(NO_GIT), 1)
145+
@# Append the directory containing the julia we just built to the end of `PATH`,
146+
@# to give us the best chance of being able to run this check.
147+
@PATH="$(PATH):$(dir $(JULIA_EXECUTABLE))" julia $(call cygpath_w,$(JULIAHOME)/contrib/check-whitespace.jl) --fix
148+
else
149+
$(warn "Skipping whitespace fix because git is unavailable")
150+
endif
151+
139152
release-candidate: release testall
140153
@$(JULIA_EXECUTABLE) $(JULIAHOME)/contrib/add_license_to_files.jl #add license headers
141154
@#Check documentation
@@ -686,7 +699,7 @@ distcleanall: cleanall
686699
@-$(MAKE) -C $(BUILDROOT)/doc cleanall
687700

688701
.FORCE:
689-
.PHONY: .FORCE default debug release check-whitespace release-candidate \
702+
.PHONY: .FORCE default debug release check-whitespace fix-whitespace release-candidate \
690703
julia-debug julia-release julia-stdlib julia-deps julia-deps-libs \
691704
julia-cli-release julia-cli-debug julia-src-release julia-src-debug \
692705
julia-symlink julia-base julia-sysimg julia-sysimg-ji julia-sysimg-release julia-sysimg-debug \

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,13 @@ Standard library changes
7575
#### REPL
7676

7777
* The display of `AbstractChar`s in the main REPL mode now includes LaTeX input information like what is shown in help mode ([#58181]).
78+
* Display of repeated frames and cycles in stack traces has been improved by bracketing them in the trace and treating them consistently ([#55841]).
7879

7980
#### Test
8081

8182
* Test failures when using the `@test` macro now show evaluated arguments for all function calls ([#57825], [#57839]).
8283
* Transparent test sets (`@testset let`) now show context when tests error ([#58727]).
84+
* `@test_throws` now supports a three-argument form `@test_throws ExceptionType pattern expr` to test both exception type and message pattern in one call ([#59117]).
8385

8486
#### InteractiveUtils
8587

base/array.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ function fill!(dest::Array{T}, x) where T
336336
end
337337
function _fill!(dest::Array{T}, x::T) where T
338338
for i in eachindex(dest)
339-
@inbounds dest[i] = x
339+
dest[i] = x
340340
end
341341
return dest
342342
end

0 commit comments

Comments
 (0)