Skip to content

Commit 62f8cff

Browse files
authored
make: define basecompiler.ji target (JuliaLang#56498)
For easier experimentation with just the bootstrap process. Additionally, as a follow-up to JuliaLang#56409, this commit also includes some minor cosmetic changes.
1 parent d0af9c5 commit 62f8cff

File tree

7 files changed

+18
-22
lines changed

7 files changed

+18
-22
lines changed

Compiler/src/Compiler.jl

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,8 @@ function include(mod::Module, x::String)
8686
Base.include(mod, x)
8787
end
8888

89-
9089
macro _boundscheck() Expr(:boundscheck) end
9190

92-
# These types are used by reflection.jl and expr.jl too, so declare them here.
93-
# Note that `@assume_effects` is available only after loading namedtuple.jl.
94-
abstract type MethodTableView end
95-
abstract type AbstractInterpreter end
96-
9791
function return_type end
9892
function is_return_type(Core.@nospecialize(f))
9993
f === return_type && return true
@@ -189,6 +183,6 @@ if isdefined(Base, :IRShow)
189183
end
190184
end
191185

192-
end
186+
end # baremodule Compiler
193187

194-
end
188+
end # if isdefined(Base, :generating_output) && ...

Compiler/src/cicache.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,3 @@ function setindex!(wvc::WorldView{InternalCodeCache}, ci::CodeInstance, mi::Meth
7777
setindex!(wvc.cache, ci, mi)
7878
return wvc
7979
end
80-
81-
function code_cache(interp::AbstractInterpreter)
82-
cache = InternalCodeCache(cache_owner(interp))
83-
worlds = WorldRange(get_inference_world(interp))
84-
return WorldView(cache, worlds)
85-
end

Compiler/src/methodtable.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ function iterate(result::MethodLookupResult, args...)
1616
end
1717
getindex(result::MethodLookupResult, idx::Int) = getindex(result.matches, idx)::MethodMatch
1818

19+
abstract type MethodTableView end
20+
1921
"""
2022
struct InternalMethodTable <: MethodTableView
2123

Compiler/src/types.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ the following methods to satisfy the `AbstractInterpreter` API requirement:
2424
- `get_inference_cache(interp::NewInterpreter)` - return the local inference cache
2525
- `cache_owner(interp::NewInterpreter)` - return the owner of any new cache entries
2626
"""
27-
:(AbstractInterpreter)
27+
abstract type AbstractInterpreter end
2828

2929
abstract type AbstractLattice end
3030

@@ -465,6 +465,12 @@ typeinf_lattice(::AbstractInterpreter) = InferenceLattice(BaseInferenceLattice.i
465465
ipo_lattice(::AbstractInterpreter) = InferenceLattice(IPOResultLattice.instance)
466466
optimizer_lattice(::AbstractInterpreter) = SimpleInferenceLattice.instance
467467

468+
function code_cache(interp::AbstractInterpreter)
469+
cache = InternalCodeCache(cache_owner(interp))
470+
worlds = WorldRange(get_inference_world(interp))
471+
return WorldView(cache, worlds)
472+
end
473+
468474
get_escape_cache(interp::AbstractInterpreter) = GetNativeEscapeCache(interp)
469475

470476
abstract type CallInfo end

base/Base_compiler.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

33
baremodule Base
4+
45
using Core.Intrinsics, Core.IR
56

67
# to start, we're going to use a very simple definition of `include`
@@ -128,7 +129,6 @@ function setpropertyonce!(x::Module, f::Symbol, desired, success_order::Symbol=:
128129
return Core.setglobalonce!(x, f, val, success_order, fail_order)
129130
end
130131

131-
132132
convert(::Type{Any}, Core.@nospecialize x) = x
133133
convert(::Type{T}, x::T) where {T} = x
134134
include("coreio.jl")
@@ -254,7 +254,6 @@ using .Order
254254

255255
include("coreir.jl")
256256

257-
258257
# For OS specific stuff
259258
# We need to strcat things here, before strings are really defined
260259
function strcat(x::String, y::String)
@@ -267,10 +266,9 @@ function strcat(x::String, y::String)
267266
return out
268267
end
269268

270-
BUILDROOT::String = ""
269+
global BUILDROOT::String = ""
271270

272-
baremodule BuildSettings
273-
end
271+
baremodule BuildSettings end
274272

275273
function process_sysimg_args!()
276274
let i = 1
@@ -299,4 +297,5 @@ include("flparse.jl")
299297
Core._setparser!(fl_parse)
300298

301299
# Further definition of Base will happen in Base.jl if loaded.
302-
end
300+
301+
end # baremodule Base

sysimage.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ include $(JULIAHOME)/stdlib/stdlib.mk
66

77
default: sysimg-$(JULIA_BUILD_MODE) # contains either "debug" or "release"
88
all: sysimg-release sysimg-debug
9+
basecompiler-ji: $(build_private_libdir)/basecompiler.ji
910
sysimg-ji: $(build_private_libdir)/sys.ji
1011
sysimg-bc: $(build_private_libdir)/sys-bc.a
1112
sysimg-release: $(build_private_libdir)/sys.$(SHLIB_EXT)

test/compiler/contextual.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module MiniCassette
1111
# fancy features, but sufficient to exercise this code path in the compiler.
1212

1313
using Core.IR
14-
using Core.Compiler: retrieve_code_info, quoted, signature_type, anymap
14+
using Core.Compiler: retrieve_code_info, quoted, anymap
1515
using Base.Meta: isexpr
1616

1717
export Ctx, overdub

0 commit comments

Comments
 (0)