Skip to content

Commit

Permalink
make: define basecompiler.ji target
Browse files Browse the repository at this point in the history
For easier experimentation with just the bootstrap process.

Additionally, as a follow-up to #56409, this commit also
includes some minor cosmetic changes.
  • Loading branch information
aviatesk committed Nov 8, 2024
1 parent 683da41 commit 2908e82
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 22 deletions.
10 changes: 2 additions & 8 deletions Compiler/src/Compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,8 @@ function include(mod::Module, x::String)
Base.include(mod, x)
end


macro _boundscheck() Expr(:boundscheck) end

# These types are used by reflection.jl and expr.jl too, so declare them here.
# Note that `@assume_effects` is available only after loading namedtuple.jl.
abstract type MethodTableView end
abstract type AbstractInterpreter end

function return_type end
function is_return_type(Core.@nospecialize(f))
f === return_type && return true
Expand Down Expand Up @@ -189,6 +183,6 @@ if isdefined(Base, :IRShow)
end
end

end
end # baremodule Compiler

end
end # if isdefined(Base, :generating_output) && ...
6 changes: 0 additions & 6 deletions Compiler/src/cicache.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,3 @@ function setindex!(wvc::WorldView{InternalCodeCache}, ci::CodeInstance, mi::Meth
setindex!(wvc.cache, ci, mi)
return wvc
end

function code_cache(interp::AbstractInterpreter)
cache = InternalCodeCache(cache_owner(interp))
worlds = WorldRange(get_inference_world(interp))
return WorldView(cache, worlds)
end
2 changes: 2 additions & 0 deletions Compiler/src/methodtable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ function iterate(result::MethodLookupResult, args...)
end
getindex(result::MethodLookupResult, idx::Int) = getindex(result.matches, idx)::MethodMatch

abstract type MethodTableView end

"""
struct InternalMethodTable <: MethodTableView
Expand Down
8 changes: 7 additions & 1 deletion Compiler/src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ the following methods to satisfy the `AbstractInterpreter` API requirement:
- `get_inference_cache(interp::NewInterpreter)` - return the local inference cache
- `cache_owner(interp::NewInterpreter)` - return the owner of any new cache entries
"""
:(AbstractInterpreter)
abstract type AbstractInterpreter end

abstract type AbstractLattice end

Expand Down Expand Up @@ -465,6 +465,12 @@ typeinf_lattice(::AbstractInterpreter) = InferenceLattice(BaseInferenceLattice.i
ipo_lattice(::AbstractInterpreter) = InferenceLattice(IPOResultLattice.instance)
optimizer_lattice(::AbstractInterpreter) = SimpleInferenceLattice.instance

function code_cache(interp::AbstractInterpreter)
cache = InternalCodeCache(cache_owner(interp))
worlds = WorldRange(get_inference_world(interp))
return WorldView(cache, worlds)
end

get_escape_cache(interp::AbstractInterpreter) = GetNativeEscapeCache(interp)

abstract type CallInfo end
Expand Down
11 changes: 5 additions & 6 deletions base/Base_compiler.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

baremodule Base

using Core.Intrinsics, Core.IR

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


convert(::Type{Any}, Core.@nospecialize x) = x
convert(::Type{T}, x::T) where {T} = x
include("coreio.jl")
Expand Down Expand Up @@ -254,7 +254,6 @@ using .Order

include("coreir.jl")


# For OS specific stuff
# We need to strcat things here, before strings are really defined
function strcat(x::String, y::String)
Expand All @@ -267,10 +266,9 @@ function strcat(x::String, y::String)
return out
end

BUILDROOT::String = ""
global BUILDROOT::String = ""

baremodule BuildSettings
end
baremodule BuildSettings end

function process_sysimg_args!()
let i = 1
Expand Down Expand Up @@ -299,4 +297,5 @@ include("flparse.jl")
Core._setparser!(fl_parse)

# Further definition of Base will happen in Base.jl if loaded.
end

end # baremodule Base
1 change: 1 addition & 0 deletions sysimage.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ include $(JULIAHOME)/stdlib/stdlib.mk

default: sysimg-$(JULIA_BUILD_MODE) # contains either "debug" or "release"
all: sysimg-release sysimg-debug
basecompiler-ji: $(build_private_libdir)/basecompiler.ji
sysimg-ji: $(build_private_libdir)/sys.ji
sysimg-bc: $(build_private_libdir)/sys-bc.a
sysimg-release: $(build_private_libdir)/sys.$(SHLIB_EXT)
Expand Down
2 changes: 1 addition & 1 deletion test/compiler/contextual.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module MiniCassette
# fancy features, but sufficient to exercise this code path in the compiler.

using Core.IR
using Core.Compiler: retrieve_code_info, quoted, signature_type, anymap
using Core.Compiler: retrieve_code_info, quoted, anymap
using Base.Meta: isexpr

export Ctx, overdub
Expand Down

0 comments on commit 2908e82

Please sign in to comment.