[Git][ghc/ghc][wip/reinstallable-th] 3 commits: Revert "Drop ghc-boot-th-next logic"
Teo Camarasu (@teo)
gitlab at gitlab.haskell.org
Thu May 9 12:16:19 UTC 2024
Teo Camarasu pushed to branch wip/reinstallable-th at Glasgow Haskell Compiler / GHC
Commits:
aa244ef7 by Teo Camarasu at 2024-05-09T12:38:34+01:00
Revert "Drop ghc-boot-th-next logic"
This reverts commit 635bdd20ea0ce61c143695894364891d80f150f2.
- - - - -
b19831b5 by Teo Camarasu at 2024-05-09T12:39:19+01:00
Remove reference to template-haskell-next in .gitignore
- - - - -
ad1418c4 by Teo Camarasu at 2024-05-09T13:16:03+01:00
Update bootstrapping TH note
- - - - -
9 changed files:
- .gitignore
- compiler/GHC/Tc/Gen/Splice.hs
- compiler/ghc.cabal.in
- hadrian/src/Packages.hs
- hadrian/src/Rules/ToolArgs.hs
- hadrian/src/Settings/Default.hs
- hadrian/src/Settings/Packages.hs
- libraries/ghc-boot/ghc-boot.cabal.in
- libraries/ghci/ghci.cabal.in
Changes:
=====================================
.gitignore
=====================================
@@ -166,6 +166,7 @@ _darcs/
/libraries/ghc-boot/ghc-boot.cabal
/libraries/ghc-boot-th/GNUmakefile
/libraries/ghc-boot-th/ghc-boot-th.cabal
+/libraries/ghc-boot-th-next/ghc-boot-th-next.cabal
/libraries/ghc-boot-th/ghc.mk
/libraries/ghc-heap/ghc-heap.cabal
/libraries/ghci/GNUmakefile
=====================================
compiler/GHC/Tc/Gen/Splice.hs
=====================================
@@ -2921,7 +2921,9 @@ tcGetInterp = do
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Staged Metaprogramming as implemented in Template Haskell introduces a whole
-- new dimension of staging to the already staged bootstrapping process.
--- The `template-haskell` library plays a crucial role in this process.
+-- While users depend on the user-facing `template-haskell` library, the TH
+-- interface (all wired-in identifiers) is defined in `ghc-internal` and for
+-- bootstrapping purposes, re-exported from `ghc-boot-th`.
--
-- Nomenclature:
--
@@ -2939,26 +2941,16 @@ tcGetInterp = do
-- the stage1 compiler; thus the "boot" in boot library does not refer to a
-- stage.
--
--- Here is how we bootstrap `template-haskell` in tandem with GHC:
+-- Here is how we bootstrap TH in tandem with GHC:
--
--- 1. Link the stage1 compiler against the boot TH library.
+-- 1. Link the stage1 compiler against the boot `template-haskell`/`ghc-boot-th` library.
-- 2. When building the stage1 compiler, build a CPP'd version of the in-tree
--- TH using the boot compiler under a different package-id,
--- `template-haskell-next`, and build stage1 GHC against that.
--- 3. Build the in-tree TH with the stage1 compiler.
+-- TH (defined in `ghc-internal`) using the boot compiler under a different
+-- package-id, `ghc-boot-th-next`, and build stage1 GHC against that.
+-- 3. Build the in-tree TH with the stage1 compiler. From here on `ghc-boot-th`
+-- re-exposes the TH modules from `ghc-internal`.
-- 4. Build and link the stage2 compiler against the in-tree TH.
--
--- Observations:
---
--- A. The vendoring in (2) means that the fully qualified name of the in-tree TH
--- AST will be, e.g., `template-haskell-next:...VarE`, not `template-haskell:...VarE`.
--- That is OK, because we need it just for the `Binary` instance and to
--- convert TH ASTs returned by splices into the Hs AST, both of which do not
--- depend on the fully qualified name of the type to serialise! Importantly,
--- Note [Hard-wiring in-tree template-haskell for desugaring quotes] is
--- unaffected, because the desugaring refers to names in the in-tree TH
--- library, which is built in the next stage, stage1, and later.
---
-- (Rejected) alternative designs:
--
-- 1b. Build the in-tree TH with the stage0 compiler and link the stage1 compiler
=====================================
compiler/ghc.cabal.in
=====================================
@@ -82,6 +82,15 @@ Flag hadrian-stage0
Default: False
Manual: True
+Flag bootstrap
+ Description:
+ Enabled when building the stage1 compiler in order to vendor the in-tree
+ `template-haskell` library (including its dependency `ghc-boot-th`), while
+ allowing dependencies to depend on the boot `template-haskell` library.
+ See Note [Bootstrapping Template Haskell]
+ Default: False
+ Manual: True
+
Library
Default-Language: GHC2021
Exposed: False
@@ -121,10 +130,16 @@ Library
semaphore-compat,
stm,
ghc-boot == @ProjectVersionMunged@,
- ghc-boot-th == @ProjectVersionMunged@,
ghc-heap == @ProjectVersionMunged@,
ghci == @ProjectVersionMunged@
+ if flag(bootstrap)
+ Build-Depends:
+ ghc-boot-th-next == @ProjectVersionMunged@
+ else
+ Build-Depends:
+ ghc-boot-th == @ProjectVersionMunged@
+
if os(windows)
Build-Depends: Win32 >= 2.3 && < 2.15
else
=====================================
hadrian/src/Packages.hs
=====================================
@@ -4,7 +4,7 @@ module Packages (
array, base, binary, bytestring, cabal, cabalSyntax, checkPpr,
checkExact, countDeps,
compareSizes, compiler, containers, deepseq, deriveConstants, directory, dumpDecls,
- exceptions, filepath, genapply, genprimopcode, ghc, ghcBignum, ghcBoot, ghcBootTh, ghcPlatform,
+ exceptions, filepath, genapply, genprimopcode, ghc, ghcBignum, ghcBoot, ghcBootTh, ghcBootThNext, ghcPlatform,
ghcCompact, ghcConfig, ghcExperimental, ghcHeap, ghcInternal, ghci, ghciWrapper, ghcPkg, ghcPrim,
ghcToolchain, ghcToolchainBin, haddock, haskeline,
hsc2hs, hp2ps, hpc, hpcBin, integerGmp, integerSimple, iserv, iservProxy,
@@ -37,7 +37,7 @@ ghcPackages :: [Package]
ghcPackages =
[ array, base, binary, bytestring, cabalSyntax, cabal, checkPpr, checkExact, countDeps
, compareSizes, compiler, containers, deepseq, deriveConstants, directory, dumpDecls
- , exceptions, filepath, genapply, genprimopcode, ghc, ghcBignum, ghcBoot, ghcBootTh, ghcPlatform
+ , exceptions, filepath, genapply, genprimopcode, ghc, ghcBignum, ghcBoot, ghcBootTh, ghcBootThNext, ghcPlatform
, ghcCompact, ghcConfig, ghcExperimental, ghcHeap, ghcInternal, ghci, ghciWrapper, ghcPkg, ghcPrim
, ghcToolchain, ghcToolchainBin, haddock, haskeline, hsc2hs
, hp2ps, hpc, hpcBin, integerGmp, integerSimple, iserv, libffi, mtl, osString
@@ -54,7 +54,7 @@ isGhcPackage = (`elem` ghcPackages)
-- | Package definitions, see 'Package'.
array, base, binary, bytestring, cabalSyntax, cabal, checkPpr, checkExact, countDeps,
compareSizes, compiler, containers, deepseq, deriveConstants, directory, dumpDecls,
- exceptions, filepath, genapply, genprimopcode, ghc, ghcBignum, ghcBoot, ghcBootTh, ghcPlatform,
+ exceptions, filepath, genapply, genprimopcode, ghc, ghcBignum, ghcBoot, ghcBootTh, ghcBootThNext, ghcPlatform,
ghcCompact, ghcConfig, ghcExperimental, ghcHeap, ghci, ghcInternal, ghciWrapper, ghcPkg, ghcPrim,
ghcToolchain, ghcToolchainBin, haddock, haskeline, hsc2hs,
hp2ps, hpc, hpcBin, integerGmp, integerSimple, iserv, iservProxy, remoteIserv, libffi, mtl,
@@ -87,6 +87,7 @@ ghc = prg "ghc-bin" `setPath` "ghc"
ghcBignum = lib "ghc-bignum"
ghcBoot = lib "ghc-boot"
ghcBootTh = lib "ghc-boot-th"
+ghcBootThNext = lib "ghc-boot-th-next"
ghcPlatform = lib "ghc-platform"
ghcCompact = lib "ghc-compact"
ghcConfig = prg "ghc-config" `setPath` "testsuite/ghc-config"
=====================================
hadrian/src/Rules/ToolArgs.hs
=====================================
@@ -142,7 +142,7 @@ toolTargets = [ cabalSyntax
-- , ghc -- # depends on ghc library
-- , runGhc -- # depends on ghc library
, ghcBoot
- , ghcBootTh
+ , ghcBootThNext
, ghcPlatform
, ghcToolchain
, ghcToolchainBin
=====================================
hadrian/src/Settings/Default.hs
=====================================
@@ -87,7 +87,7 @@ stage0Packages = do
, filepath -- depends on os-string
, ghc
, ghcBoot
- , ghcBootTh
+ , ghcBootThNext
, ghcHeap
, ghcPkg
, ghcPlatform
@@ -126,6 +126,7 @@ stage1Packages = do
| p == unix = False
-- These packages are only needed for bootstrapping.
-- See Note [Bootstrapping Template Haskell]
+ | p == ghcBootThNext = False
| otherwise = True
libraries0 <- filter good_stage0_package <$> stage0Packages
=====================================
hadrian/src/Settings/Packages.hs
=====================================
@@ -87,6 +87,7 @@ packageArgs = do
-- We do it through a cabal flag in ghc.cabal
, stageVersion < makeVersion [9,8,1] ? arg "+hadrian-stage0"
, flag StaticLibzstd `cabalFlag` "static-libzstd"
+ , stage0 `cabalFlag` "bootstrap"
]
, builder (Haddock BuildPackage) ? arg ("--optghc=-I" ++ path) ]
@@ -121,8 +122,8 @@ packageArgs = do
, builder (Cc CompileC) ? (not <$> flag CcLlvmBackend) ?
input "**/cbits/atomic.c" ? arg "-Wno-sync-nand" ]
- -------------------------------- ghcBootTh ------------------------------
- , package ghcBootTh ?
+ -------------------------------- ghcBoot ------------------------------
+ , package ghcBoot ?
builder (Cabal Flags) ? (stage0 `cabalFlag` "bootstrap")
--------------------------------- ghci ---------------------------------
@@ -159,6 +160,7 @@ packageArgs = do
[ ifM stage0
(andM [cross, bootCross] `cabalFlag` "internal-interpreter")
(arg "internal-interpreter")
+ , stage0 `cabalFlag` "bootstrap"
]
]
@@ -184,6 +186,10 @@ packageArgs = do
, package haddock ?
builder (Cabal Flags) ? arg "in-ghc-tree"
+ ---------------------------- ghc-boot-th-next --------------------------
+ , package ghcBootThNext ?
+ builder (Cabal Flags) ? stage0 `cabalFlag` "bootstrap"
+
---------------------------------- text --------------------------------
, package text ? mconcat
-- Disable SIMDUTF by default due to packaging difficulties
=====================================
libraries/ghc-boot/ghc-boot.cabal.in
=====================================
@@ -35,6 +35,15 @@ source-repository head
location: https://gitlab.haskell.org/ghc/ghc.git
subdir: libraries/ghc-boot
+Flag bootstrap
+ Description:
+ Enabled when building the stage1 compiler in order to vendor the in-tree
+ `template-haskell` library (including its dependency `ghc-boot-th`), while
+ allowing dependencies to depend on the boot `template-haskell` library.
+ See Note [Bootstrapping Template Haskell]
+ Default: False
+ Manual: True
+
Library
default-language: Haskell2010
other-extensions: DeriveGeneric, RankNTypes, ScopedTypeVariables
@@ -74,7 +83,6 @@ Library
filepath >= 1.3 && < 1.6,
deepseq >= 1.4 && < 1.6,
ghc-platform >= 0.1,
- ghc-boot-th == @ProjectVersionMunged@
-- reexport modules from ghc-boot-th so that packages
-- don't have to import all of ghc-boot and ghc-boot-th.
@@ -84,6 +92,13 @@ Library
, GHC.ForeignSrcLang.Type
, GHC.Lexeme
+ if flag(bootstrap)
+ build-depends:
+ ghc-boot-th-next == @ProjectVersionMunged@
+ else
+ build-depends:
+ ghc-boot-th == @ProjectVersionMunged@
+
if !os(windows)
build-depends:
unix >= 2.7 && < 2.9
=====================================
libraries/ghci/ghci.cabal.in
=====================================
@@ -22,6 +22,15 @@ Flag internal-interpreter
Default: False
Manual: True
+Flag bootstrap
+ Description:
+ Enabled when building the stage1 compiler in order to vendor the in-tree
+ `template-haskell` library (including its dependency `ghc-boot-th`), while
+ allowing dependencies to depend on the boot `template-haskell` library.
+ See Note [Bootstrapping Template Haskell]
+ Default: False
+ Manual: True
+
source-repository head
type: git
location: https://gitlab.haskell.org/ghc/ghc.git
@@ -83,9 +92,15 @@ library
deepseq >= 1.4 && < 1.6,
filepath >= 1.4 && < 1.6,
ghc-boot == @ProjectVersionMunged@,
- ghc-boot-th == @ProjectVersionMunged@,
ghc-heap == @ProjectVersionMunged@,
transformers >= 0.5 && < 0.7
+ if flag(bootstrap)
+ build-depends:
+ ghc-boot-th-next == @ProjectVersionMunged@
+ else
+ build-depends:
+ ghc-boot-th == @ProjectVersionMunged@
+
if !os(windows)
Build-Depends: unix >= 2.7 && < 2.9
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0feca2967aaecf2f11736d8a173ff5cb68a0f44f...ad1418c4ea15a4ea25866d7940fbd3f04446f269
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0feca2967aaecf2f11736d8a173ff5cb68a0f44f...ad1418c4ea15a4ea25866d7940fbd3f04446f269
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240509/1e8ea9c2/attachment-0001.html>
More information about the ghc-commits
mailing list