Skip to content

Commit 449a7ab

Browse files
committed
Merge branch 'master' into sb/test-scope
2 parents cd3f239 + cf4ab83 commit 449a7ab

File tree

770 files changed

+28813
-72242
lines changed

Some content is hidden

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

770 files changed

+28813
-72242
lines changed

.devcontainer/Dockerfile

-3
This file was deleted.

.devcontainer/devcontainer.json

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{
2-
"extensions": [
3-
"julialang.language-julia",
4-
"ms-vscode.cpptools"
5-
],
6-
7-
"dockerFile": "Dockerfile"
2+
"image": "docker.io/library/julia:latest",
3+
"customizations": {
4+
"vscode": {
5+
"extensions": [
6+
"julialang.language-julia",
7+
"ms-vscode.cpptools"
8+
]
9+
}
10+
},
11+
"onCreateCommand": "apt-get update && apt-get install -y build-essential libatomic1 python3 gfortran perl wget m4 cmake pkg-config git"
812
}

.github/workflows/Whitespace.yml

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ jobs:
1818
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
1919
with:
2020
persist-credentials: false
21+
- uses: julia-actions/setup-julia@9b79636afcfb07ab02c256cede01fe2db6ba808c # v2.6.0
22+
with:
23+
version: '1'
2124
- name: Check whitespace
2225
run: |
2326
contrib/check-whitespace.jl

CONTRIBUTING.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ Be sure to change the UUID value back before making the pull request.
278278

279279
The process of [creating a patch release](https://docs.julialang.org/en/v1/devdocs/build/distributing/#Point-releasing-101) is roughly as follows:
280280

281-
1. Create a new branch (e.g. `backports-release-1.6`) against the relevant minor release
282-
branch (e.g. `release-1.6`). Usually a corresponding pull request is created as well.
281+
1. Create a new branch (e.g. `backports-release-1.10`) against the relevant minor release
282+
branch (e.g. `release-1.10`). Usually a corresponding pull request is created as well.
283283

284284
2. Add commits, nominally from `master` (hence "backports"), to that branch.
285285
See below for more information on this process.
@@ -291,8 +291,8 @@ The process of [creating a patch release](https://docs.julialang.org/en/v1/devdo
291291
the pull request associated with the backports branch. Fix any issues.
292292

293293
4. Once all test and benchmark reports look good, merge the backports branch into
294-
the corresponding release branch (e.g. merge `backports-release-1.6` into
295-
`release-1.6`).
294+
the corresponding release branch (e.g. merge `backports-release-1.10` into
295+
`release-1.10`).
296296

297297
5. Open a pull request that bumps the version of the relevant minor release to the
298298
next patch version, e.g. as in [this pull request](https://github.com/JuliaLang/julia/pull/37718).

Compiler/LICENSE.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
MIT License
2+
3+
Copyright (c) 2009-2024: Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors: https://github.com/JuliaLang/julia/contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining
6+
a copy of this software and associated documentation files (the
7+
"Software"), to deal in the Software without restriction, including
8+
without limitation the rights to use, copy, modify, merge, publish,
9+
distribute, sublicense, and/or sell copies of the Software, and to
10+
permit persons to whom the Software is furnished to do so, subject to
11+
the following conditions:
12+
13+
The above copyright notice and this permission notice shall be
14+
included in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23+
24+
end of terms and conditions
25+
26+
Please see [THIRDPARTY.md](../THIRDPARTY.md) for license information for other software used in this project.

Compiler/Project.toml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name = "Compiler"
2+
uuid = "807dbc54-b67e-4c79-8afb-eafe4df6f2e1"
3+
version = "0.0.3"
4+
5+
[compat]
6+
julia = "1.10"
7+
8+
[extras]
9+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
10+
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
11+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
12+
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
13+
14+
[targets]
15+
test = ["Test", "InteractiveUtils", "Random", "Libdl"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file is machine-generated - editing it directly is not advised
2+
3+
julia_version = "1.12.0-DEV"
4+
manifest_format = "2.0"
5+
project_hash = "84f495a1bf065c95f732a48af36dd0cd2cefb9d5"
6+
7+
[[deps.Compiler]]
8+
path = "../.."
9+
uuid = "807dbc54-b67e-4c79-8afb-eafe4df6f2e1"
10+
version = "0.0.2"
11+
12+
[[deps.CompilerDevTools]]
13+
path = "."
14+
uuid = "92b2d91f-d2bd-4c05-9214-4609ac33433f"
15+
version = "0.0.0"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
name = "CompilerDevTools"
2+
uuid = "92b2d91f-d2bd-4c05-9214-4609ac33433f"
3+
4+
[deps]
5+
Compiler = "807dbc54-b67e-4c79-8afb-eafe4df6f2e1"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
module CompilerDevTools
2+
3+
using Compiler
4+
using Core.IR
5+
6+
struct SplitCacheOwner; end
7+
struct SplitCacheInterp <: Compiler.AbstractInterpreter
8+
world::UInt
9+
inf_params::Compiler.InferenceParams
10+
opt_params::Compiler.OptimizationParams
11+
inf_cache::Vector{Compiler.InferenceResult}
12+
function SplitCacheInterp(;
13+
world::UInt = Base.get_world_counter(),
14+
inf_params::Compiler.InferenceParams = Compiler.InferenceParams(),
15+
opt_params::Compiler.OptimizationParams = Compiler.OptimizationParams(),
16+
inf_cache::Vector{Compiler.InferenceResult} = Compiler.InferenceResult[])
17+
new(world, inf_params, opt_params, inf_cache)
18+
end
19+
end
20+
21+
Compiler.InferenceParams(interp::SplitCacheInterp) = interp.inf_params
22+
Compiler.OptimizationParams(interp::SplitCacheInterp) = interp.opt_params
23+
Compiler.get_inference_world(interp::SplitCacheInterp) = interp.world
24+
Compiler.get_inference_cache(interp::SplitCacheInterp) = interp.inf_cache
25+
Compiler.cache_owner(::SplitCacheInterp) = SplitCacheOwner()
26+
27+
import Core.OptimizedGenerics.CompilerPlugins: typeinf, typeinf_edge
28+
@eval @noinline typeinf(::SplitCacheOwner, mi::MethodInstance, source_mode::UInt8) =
29+
Base.invoke_in_world(which(typeinf, Tuple{SplitCacheOwner, MethodInstance, UInt8}).primary_world, Compiler.typeinf_ext, SplitCacheInterp(; world=Base.tls_world_age()), mi, source_mode)
30+
31+
@eval @noinline function typeinf_edge(::SplitCacheOwner, mi::MethodInstance, parent_frame::Compiler.InferenceState, world::UInt, source_mode::UInt8)
32+
# TODO: This isn't quite right, we're just sketching things for now
33+
interp = SplitCacheInterp(; world)
34+
Compiler.typeinf_edge(interp, mi.def, mi.specTypes, Core.svec(), parent_frame, false, false)
35+
end
36+
37+
function with_new_compiler(f, args...)
38+
mi = @ccall jl_method_lookup(Any[f, args...]::Ptr{Any}, (1+length(args))::Csize_t, Base.tls_world_age()::Csize_t)::Ref{Core.MethodInstance}
39+
world = Base.tls_world_age()
40+
new_compiler_ci = Core.OptimizedGenerics.CompilerPlugins.typeinf(
41+
SplitCacheOwner(), mi, Compiler.SOURCE_MODE_ABI
42+
)
43+
invoke(f, new_compiler_ci, args...)
44+
end
45+
46+
export with_new_compiler
47+
48+
end

Compiler/src/Compiler.jl

+210
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
# This file is a part of Julia. License is MIT: https://julialang.org/license
2+
3+
if isdefined(Base, :end_base_include) && !isdefined(Base, :Compiler)
4+
5+
# Define a dummy `Compiler` module to make it installable even on Julia versions where
6+
# Compiler.jl is not available as a standard library.
7+
@eval module Compiler
8+
function __init__()
9+
println("""
10+
The `Compiler` standard library is not available for this version of Julia.
11+
Use Julia version `v"1.12.0-DEV.1581"` or later.
12+
""")
13+
end
14+
end
15+
16+
# When generating an incremental precompile file, we first check whether we
17+
# already have a copy of this *exact* code in the system image. If so, we
18+
# simply generates a pkgimage that has the dependency edges we recorded in
19+
# the system image and simply returns that copy of the compiler. If not,
20+
# we proceed to load/precompile this as an ordinary package.
21+
elseif (isdefined(Base, :generating_output) && Base.generating_output(true) &&
22+
Base.samefile(joinpath(Sys.BINDIR, Base.DATAROOTDIR, Base._compiler_require_dependencies[1][2]), @eval @__FILE__) &&
23+
!Base.any_includes_stale(
24+
map(Base.compiler_chi, Base._compiler_require_dependencies),
25+
"sysimg", nothing))
26+
27+
Base.prepare_compiler_stub_image!()
28+
append!(Base._require_dependencies, map(Base.expand_compiler_path, Base._compiler_require_dependencies))
29+
# There isn't much point in precompiling native code - downstream users will
30+
# specialize their own versions of the compiler code and we don't activate
31+
# the compiler by default anyway, so let's save ourselves some disk space.
32+
ccall(:jl_suppress_precompile, Cvoid, (Cint,), 1)
33+
34+
else
35+
36+
@eval baremodule Compiler
37+
38+
# Needs to match UUID defined in Project.toml
39+
ccall(:jl_set_module_uuid, Cvoid, (Any, NTuple{2, UInt64}), Compiler,
40+
(0x807dbc54_b67e_4c79, 0x8afb_eafe4df6f2e1))
41+
42+
using Core.Intrinsics, Core.IR
43+
44+
using Core: ABIOverride, Builtin, CodeInstance, IntrinsicFunction, MethodInstance, MethodMatch,
45+
MethodTable, PartialOpaque, SimpleVector, TypeofVararg,
46+
_apply_iterate, apply_type, compilerbarrier, donotdelete, memoryref_isassigned,
47+
memoryrefget, memoryrefnew, memoryrefoffset, memoryrefset!, print, println, show, svec,
48+
typename, unsafe_write, write
49+
50+
using Base
51+
using Base: @_foldable_meta, @_gc_preserve_begin, @_gc_preserve_end, @nospecializeinfer,
52+
BINDING_KIND_GLOBAL, BINDING_KIND_UNDEF_CONST, BINDING_KIND_BACKDATED_CONST,
53+
Base, BitVector, Bottom, Callable, DataTypeFieldDesc,
54+
EffectsOverride, Filter, Generator, IteratorSize, JLOptions, NUM_EFFECTS_OVERRIDES,
55+
OneTo, Ordering, RefValue, SizeUnknown, _NAMEDTUPLE_NAME,
56+
_array_for, _bits_findnext, _methods_by_ftype, _uniontypes, all, allocatedinline, any,
57+
argument_datatype, binding_kind, cconvert, copy_exprargs, datatype_arrayelem,
58+
datatype_fieldcount, datatype_fieldtypes, datatype_layoutsize, datatype_nfields,
59+
datatype_pointerfree, decode_effects_override, diff_names, fieldindex,
60+
generating_output, get_nospecializeinfer_sig, get_world_counter, has_free_typevars,
61+
hasgenerator, hasintersect, indexed_iterate, isType, is_file_tracked, is_function_def,
62+
is_meta_expr, is_meta_expr_head, is_nospecialized, is_nospecializeinfer, is_defined_const_binding,
63+
is_some_const_binding, is_some_guard, is_some_imported, is_valid_intrinsic_elptr,
64+
isbitsunion, isconcretedispatch, isdispatchelem, isexpr, isfieldatomic, isidentityfree,
65+
iskindtype, ismutabletypename, ismutationfree, issingletontype, isvarargtype, isvatuple,
66+
kwerr, lookup_binding_partition, may_invoke_generator, methods, midpoint, moduleroot,
67+
partition_restriction, quoted, rename_unionall, rewrap_unionall, specialize_method,
68+
structdiff, tls_world_age, unconstrain_vararg_length, unionlen, uniontype_layout,
69+
uniontypes, unsafe_convert, unwrap_unionall, unwrapva, vect, widen_diagonal,
70+
_uncompressed_ir
71+
using Base.Order
72+
73+
import Base: ==, _topmod, append!, convert, copy, copy!, findall, first, get, get!,
74+
getindex, haskey, in, isempty, isready, iterate, iterate, last, length, max_world,
75+
min_world, popfirst!, push!, resize!, setindex!, size
76+
77+
const getproperty = Core.getfield
78+
const setproperty! = Core.setfield!
79+
const swapproperty! = Core.swapfield!
80+
const modifyproperty! = Core.modifyfield!
81+
const replaceproperty! = Core.replacefield!
82+
const _DOCS_ALIASING_WARNING = ""
83+
84+
ccall(:jl_set_istopmod, Cvoid, (Any, Bool), Compiler, false)
85+
86+
eval(x) = Core.eval(Compiler, x)
87+
eval(m, x) = Core.eval(m, x)
88+
89+
function include(x::String)
90+
if !isdefined(Base, :end_base_include)
91+
# During bootstrap, all includes are relative to `base/`
92+
x = Base.strcat(Base.strcat(Base.DATAROOT, "julia/Compiler/src/"), x)
93+
end
94+
Base.include(Compiler, x)
95+
end
96+
97+
function include(mod::Module, x::String)
98+
if !isdefined(Base, :end_base_include)
99+
x = Base.strcat(Base.strcat(Base.DATAROOT, "julia/Compiler/src/"), x)
100+
end
101+
Base.include(mod, x)
102+
end
103+
104+
macro _boundscheck() Expr(:boundscheck) end
105+
106+
function return_type end
107+
function is_return_type(Core.@nospecialize(f))
108+
f === return_type && return true
109+
if isdefined(Base, :Compiler) && Compiler !== Base.Compiler
110+
# Also model the return_type function of the builtin Compiler the same.
111+
# This isn't completely sound. We don't actually have any idea what the
112+
# base compiler will do at runtime. In the fullness of time, we should
113+
# re-work the semantics to make the cache primary and thus avoid having
114+
# to reason about what the compiler may do at runtime, but we're not
115+
# fully there yet.
116+
return f === Base.Compiler.return_type
117+
end
118+
return false
119+
end
120+
121+
include("sort.jl")
122+
123+
# We don't include some.jl, but this definition is still useful.
124+
something(x::Nothing, y...) = something(y...)
125+
something(x::Any, y...) = x
126+
127+
############
128+
# compiler #
129+
############
130+
131+
baremodule BuildSettings
132+
using Core: ARGS, include
133+
using ..Compiler: >, getindex, length
134+
135+
global MAX_METHODS::Int = 3
136+
137+
if length(ARGS) > 2 && ARGS[2] === "--buildsettings"
138+
include(BuildSettings, ARGS[3])
139+
end
140+
end
141+
142+
if !isdefined(Base, :end_base_include)
143+
macro show(ex...)
144+
blk = Expr(:block)
145+
for s in ex
146+
push!(blk.args, :(println(stdout, $(QuoteNode(s)), " = ",
147+
begin local value = $(esc(s)) end)))
148+
end
149+
isempty(ex) || push!(blk.args, :value)
150+
blk
151+
end
152+
else
153+
using Base: @show
154+
end
155+
156+
include("cicache.jl")
157+
include("methodtable.jl")
158+
include("effects.jl")
159+
include("types.jl")
160+
include("utilities.jl")
161+
include("validation.jl")
162+
163+
include("ssair/basicblock.jl")
164+
include("ssair/domtree.jl")
165+
include("ssair/ir.jl")
166+
include("ssair/tarjan.jl")
167+
168+
include("abstractlattice.jl")
169+
include("stmtinfo.jl")
170+
include("inferenceresult.jl")
171+
include("inferencestate.jl")
172+
173+
include("typeutils.jl")
174+
include("typelimits.jl")
175+
include("typelattice.jl")
176+
include("tfuncs.jl")
177+
178+
include("abstractinterpretation.jl")
179+
include("typeinfer.jl")
180+
include("optimize.jl")
181+
182+
include("bootstrap.jl")
183+
include("reflection_interface.jl")
184+
include("opaque_closure.jl")
185+
186+
macro __SOURCE_FILE__()
187+
__source__.file === nothing && return nothing
188+
return QuoteNode(__source__.file::Symbol)
189+
end
190+
191+
module IRShow end
192+
function load_irshow!()
193+
if isdefined(Base, :end_base_include)
194+
# This code path is exclusively for Revise, which may want to re-run this
195+
# after bootstrap.
196+
include(IRShow, Base.joinpath(Base.dirname(Base.String(@__SOURCE_FILE__)), "ssair/show.jl"))
197+
else
198+
include(IRShow, "ssair/show.jl")
199+
end
200+
end
201+
if !isdefined(Base, :end_base_include)
202+
# During bootstrap, skip including this file and defer it to base/show.jl to include later
203+
else
204+
# When this module is loaded as the standard library, include this file as usual
205+
load_irshow!()
206+
end
207+
208+
end # baremodule Compiler
209+
210+
end # if isdefined(Base, :generating_output) && ...

0 commit comments

Comments
 (0)