Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
7964763b by Julian Ospald at 2026-01-14T11:11:31-05:00
Fix fetch_cabal
* download cabal if the existing one is of an older version
* fix FreeBSD download url
* fix unpacking on FreeBSD
- - - - -
6b0129c1 by Julian Ospald at 2026-01-14T11:11:31-05:00
Bump toolchain in CI
- - - - -
0f53ccc6 by Julian Ospald at 2026-01-14T11:11:31-05:00
Use libffi-clib
Previously, we would build libffi via hadrian
and bundle it manually with the GHC bindist.
This now moves all that logic out of hadrian
and allows us to have a clean Haskell package
to build and link against and ship it without
extra logic.
This patch still retains the ability to link
against a system libffi.
The main reason of bundling libffi was that on
some platforms (e.g. FreeBSD and Mac), system libffi
is not visible to the C toolchain by default,
so users would require settings in e.g. cabal
to be able to compile anything.
This adds the submodule libffi-clib to the repository.
- - - - -
27 changed files:
- .gitlab/ci.sh
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- .gitmodules
- compiler/GHC/Linker/Loader.hs
- compiler/GHC/Linker/Unit.hs
- compiler/GHC/Unit/State.hs
- hadrian/hadrian.cabal
- hadrian/src/Builder.hs
- hadrian/src/Packages.hs
- hadrian/src/Rules.hs
- hadrian/src/Rules/Documentation.hs
- hadrian/src/Rules/Generate.hs
- − hadrian/src/Rules/Libffi.hs
- hadrian/src/Rules/Register.hs
- hadrian/src/Rules/Rts.hs
- hadrian/src/Rules/SourceDist.hs
- hadrian/src/Settings/Builders/Cabal.hs
- hadrian/src/Settings/Builders/Ghc.hs
- hadrian/src/Settings/Default.hs
- hadrian/src/Settings/Packages.hs
- − libffi-tarballs
- + libraries/libffi-clib
- packages
- rts/include/rts/ghc_ffi.h
- rts/rts.buildinfo.in
- rts/rts.cabal
Changes:
=====================================
.gitlab/ci.sh
=====================================
@@ -341,11 +341,27 @@ function fetch_ghc() {
}
function fetch_cabal() {
+ local should_fetch=false
+
if [ ! -e "$CABAL" ]; then
- local v="$CABAL_INSTALL_VERSION"
- if [[ -z "$v" ]]; then
- fail "neither CABAL nor CABAL_INSTALL_VERSION are not set"
+ if [ -z "${CABAL_INSTALL_VERSION:-}" ]; then
+ fail "cabal not found at '$CABAL' and CABAL_INSTALL_VERSION is not set"
+ fi
+ should_fetch=true
+ fi
+
+ if [ -e "$CABAL" ] && [ -n "${CABAL_INSTALL_VERSION:-}" ]; then
+ local current_version
+ if current_version=$($CABAL --numeric-version 2>/dev/null); then
+ if [ "$current_version" != "$CABAL_INSTALL_VERSION" ]; then
+ info "cabal version mismatch: found $current_version, expected $CABAL_INSTALL_VERSION"
+ should_fetch=true
fi
+ fi
+ fi
+
+ if [ "$should_fetch" = true ]; then
+ local v="$CABAL_INSTALL_VERSION"
start_section fetch-cabal "Fetch Cabal"
case "$(uname)" in
@@ -355,7 +371,7 @@ function fetch_cabal() {
CLANG64) cabal_arch="x86_64" ;;
*) fail "unknown MSYSTEM $MSYSTEM" ;;
esac
- url="https://downloads.haskell.org/~cabal/cabal-install-$v/cabal-install-$v-$cab…"
+ local url="https://downloads.haskell.org/~cabal/cabal-install-$v/cabal-install-$v-$cab…"
info "Fetching cabal binary distribution from $url..."
curl "$url" > "$TMP/cabal.zip"
unzip "$TMP/cabal.zip"
@@ -365,19 +381,21 @@ function fetch_cabal() {
local base_url="https://downloads.haskell.org/~cabal/cabal-install-$v/"
case "$(uname)" in
Darwin) cabal_url="$base_url/cabal-install-$v-x86_64-apple-darwin17.7.0.tar.xz" ;;
- FreeBSD) cabal_url="$base_url/cabal-install-$v-x86_64-freebsd14.tar.xz" ;;
+ FreeBSD) cabal_url="https://downloads.haskell.org/ghcup/unofficial-bindists/cabal/$v/cabal-inst…" ;;
*) fail "don't know where to fetch cabal-install for $(uname)"
esac
echo "Fetching cabal-install from $cabal_url"
curl "$cabal_url" > cabal.tar.xz
- tmp="$(tar -tJf cabal.tar.xz | head -n1)"
- $TAR -xJf cabal.tar.xz
+ local path="$(tar -tJf cabal.tar.xz | head -n1)"
+ local tmp_dir=$(mktemp -d XXXX-cabal)
+ $TAR -xJf cabal.tar.xz -C "${tmp_dir}"
# Check if the bindist has directory structure
- if [[ "$tmp" = "cabal" ]]; then
- mv cabal "$toolchain/bin"
+ if [[ "$path" = "cabal" ]]; then
+ mv "${tmp_dir}"/cabal "$toolchain/bin"
else
- mv "$tmp/cabal" "$toolchain/bin"
+ mv "${tmp_dir}/$path/cabal" "$toolchain/bin"
fi
+ rmdir "${tmp_dir}"
;;
esac
end_section fetch-cabal
=====================================
.gitlab/generate-ci/gen_ci.hs
=====================================
@@ -451,7 +451,7 @@ opsysVariables _ FreeBSD14 = mconcat
, "CC" =: "cc"
, "CXX" =: "c++"
, "FETCH_GHC_VERSION" =: "9.10.1"
- , "CABAL_INSTALL_VERSION" =: "3.10.3.0"
+ , "CABAL_INSTALL_VERSION" =: "3.14.2.0"
]
opsysVariables arch (Linux distro) = distroVariables arch distro
opsysVariables AArch64 (Darwin {}) = mconcat
@@ -480,9 +480,9 @@ opsysVariables Amd64 (Darwin {}) = mconcat
opsysVariables _ (Windows {}) = mconcat
[ "MSYSTEM" =: "CLANG64"
, "LANG" =: "en_US.UTF-8"
- , "CABAL_INSTALL_VERSION" =: "3.10.2.0"
+ , "CABAL_INSTALL_VERSION" =: "3.14.2.0"
, "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs"
- , "FETCH_GHC_VERSION" =: "9.10.1"
+ , "FETCH_GHC_VERSION" =: "9.10.3"
]
opsysVariables _ _ = mempty
=====================================
.gitlab/jobs.yaml
=====================================
@@ -1463,7 +1463,7 @@
"BIGNUM_BACKEND": "gmp",
"BIN_DIST_NAME": "ghc-x86_64-freebsd14-validate",
"BUILD_FLAVOUR": "validate",
- "CABAL_INSTALL_VERSION": "3.10.3.0",
+ "CABAL_INSTALL_VERSION": "3.14.2.0",
"CC": "cc",
"CONFIGURE_ARGS": "--with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib --with-system-libffi --with-ffi-includes=/usr/local/include --with-ffi-libraries=/usr/local/lib --with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --enable-strict-ghc-toolchain-check",
"CXX": "c++",
@@ -3691,9 +3691,9 @@
"BIGNUM_BACKEND": "native",
"BIN_DIST_NAME": "ghc-x86_64-windows-int_native-validate",
"BUILD_FLAVOUR": "validate",
- "CABAL_INSTALL_VERSION": "3.10.2.0",
+ "CABAL_INSTALL_VERSION": "3.14.2.0",
"CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
- "FETCH_GHC_VERSION": "9.10.1",
+ "FETCH_GHC_VERSION": "9.10.3",
"HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
"INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
"LANG": "en_US.UTF-8",
@@ -3754,9 +3754,9 @@
"BIGNUM_BACKEND": "gmp",
"BIN_DIST_NAME": "ghc-x86_64-windows-validate",
"BUILD_FLAVOUR": "validate",
- "CABAL_INSTALL_VERSION": "3.10.2.0",
+ "CABAL_INSTALL_VERSION": "3.14.2.0",
"CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
- "FETCH_GHC_VERSION": "9.10.1",
+ "FETCH_GHC_VERSION": "9.10.3",
"HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
"INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
"LANG": "en_US.UTF-8",
@@ -4346,7 +4346,7 @@
"BIGNUM_BACKEND": "gmp",
"BIN_DIST_NAME": "ghc-x86_64-freebsd14-release+no_split_sections",
"BUILD_FLAVOUR": "release+no_split_sections",
- "CABAL_INSTALL_VERSION": "3.10.3.0",
+ "CABAL_INSTALL_VERSION": "3.14.2.0",
"CC": "cc",
"CONFIGURE_ARGS": "--with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib --with-system-libffi --with-ffi-includes=/usr/local/include --with-ffi-libraries=/usr/local/lib --with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --enable-strict-ghc-toolchain-check",
"CXX": "c++",
@@ -5437,9 +5437,9 @@
"BIGNUM_BACKEND": "native",
"BIN_DIST_NAME": "ghc-x86_64-windows-int_native-release",
"BUILD_FLAVOUR": "release",
- "CABAL_INSTALL_VERSION": "3.10.2.0",
+ "CABAL_INSTALL_VERSION": "3.14.2.0",
"CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
- "FETCH_GHC_VERSION": "9.10.1",
+ "FETCH_GHC_VERSION": "9.10.3",
"HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
"IGNORE_PERF_FAILURES": "all",
"INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
@@ -5501,9 +5501,9 @@
"BIGNUM_BACKEND": "gmp",
"BIN_DIST_NAME": "ghc-x86_64-windows-release",
"BUILD_FLAVOUR": "release",
- "CABAL_INSTALL_VERSION": "3.10.2.0",
+ "CABAL_INSTALL_VERSION": "3.14.2.0",
"CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
- "FETCH_GHC_VERSION": "9.10.1",
+ "FETCH_GHC_VERSION": "9.10.3",
"HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
"IGNORE_PERF_FAILURES": "all",
"INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
@@ -5638,7 +5638,7 @@
"BIGNUM_BACKEND": "gmp",
"BIN_DIST_NAME": "ghc-x86_64-freebsd14-validate",
"BUILD_FLAVOUR": "validate",
- "CABAL_INSTALL_VERSION": "3.10.3.0",
+ "CABAL_INSTALL_VERSION": "3.14.2.0",
"CC": "cc",
"CONFIGURE_ARGS": "--with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib --with-system-libffi --with-ffi-includes=/usr/local/include --with-ffi-libraries=/usr/local/lib --with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --enable-strict-ghc-toolchain-check",
"CXX": "c++",
@@ -7835,9 +7835,9 @@
"BIGNUM_BACKEND": "native",
"BIN_DIST_NAME": "ghc-x86_64-windows-int_native-validate",
"BUILD_FLAVOUR": "validate",
- "CABAL_INSTALL_VERSION": "3.10.2.0",
+ "CABAL_INSTALL_VERSION": "3.14.2.0",
"CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
- "FETCH_GHC_VERSION": "9.10.1",
+ "FETCH_GHC_VERSION": "9.10.3",
"HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
"INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
"LANG": "en_US.UTF-8",
@@ -7897,9 +7897,9 @@
"BIGNUM_BACKEND": "gmp",
"BIN_DIST_NAME": "ghc-x86_64-windows-validate",
"BUILD_FLAVOUR": "validate",
- "CABAL_INSTALL_VERSION": "3.10.2.0",
+ "CABAL_INSTALL_VERSION": "3.14.2.0",
"CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
- "FETCH_GHC_VERSION": "9.10.1",
+ "FETCH_GHC_VERSION": "9.10.3",
"HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
"INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
"LANG": "en_US.UTF-8",
=====================================
.gitmodules
=====================================
@@ -99,10 +99,6 @@
path = utils/hsc2hs
url = https://gitlab.haskell.org/ghc/hsc2hs.git
ignore = untracked
-[submodule "libffi-tarballs"]
- path = libffi-tarballs
- url = https://gitlab.haskell.org/ghc/libffi-tarballs.git
- ignore = untracked
[submodule "gmp-tarballs"]
path = libraries/ghc-internal/gmp/gmp-tarballs
url = https://gitlab.haskell.org/ghc/gmp-tarballs.git
@@ -124,3 +120,6 @@
[submodule "libraries/template-haskell-quasiquoter"]
path = libraries/template-haskell-quasiquoter
url = https://gitlab.haskell.org/ghc/template-haskell-quasiquoter.git
+[submodule "libraries/libffi-clib"]
+ path = libraries/libffi-clib
+ url = https://github.com/stable-haskell/libffi-clib.git
=====================================
compiler/GHC/Linker/Loader.hs
=====================================
@@ -1,5 +1,6 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE RecordWildCards #-}
+{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE ViewPatterns #-}
--
@@ -67,6 +68,8 @@ import GHC.ByteCode.Linker
import GHC.ByteCode.Asm
import GHC.ByteCode.Types
+import GHC.Linker.Unit (getUnitDepends)
+
import GHC.Stack.CCS
import GHC.SysTools
@@ -179,10 +182,10 @@ getLoaderState :: Interp -> IO (Maybe LoaderState)
getLoaderState interp = readMVar (loader_state (interpLoader interp))
-emptyLoaderState :: LoaderState
-emptyLoaderState = LoaderState
+emptyLoaderState :: UnitEnv -> LoaderState
+emptyLoaderState unit_env = LoaderState
{ bco_loader_state = emptyBytecodeLoaderState
- , pkgs_loaded = init_pkgs
+ , pkgs_loaded = init_pkgs deps
, bcos_loaded = emptyModuleEnv
, objs_loaded = emptyModuleEnv
, temp_sos = []
@@ -192,7 +195,13 @@ emptyLoaderState = LoaderState
--
-- The linker's symbol table is populated with RTS symbols using an
-- explicit list. See rts/Linker.c for details.
- where init_pkgs = unitUDFM rtsUnitId (LoadedPkgInfo rtsUnitId [] [] [] emptyUniqDSet)
+ where
+ deps = getUnitDepends unit_env rtsUnitId
+ pkg_to_dfm unit_id = (unit_id, (LoadedPkgInfo unit_id [] [] [] emptyUniqDSet))
+ init_pkgs deps = let addToUDFM' (k, v) m = addToUDFM m k v
+ in foldr addToUDFM' emptyUDFM $ [
+ pkg_to_dfm rtsUnitId
+ ] ++ fmap pkg_to_dfm deps
extendLoadedEnv :: Interp -> BytecodeLoaderStateModifier -> [(Name,ForeignHValue)] -> IO ()
extendLoadedEnv interp modify_bytecode_loader_state new_bindings =
@@ -341,7 +350,7 @@ initLoaderState interp hsc_env = do
reallyInitLoaderState :: Interp -> HscEnv -> IO LoaderState
reallyInitLoaderState interp hsc_env = do
-- Initialise the linker state
- let pls0 = emptyLoaderState
+ let pls0 = emptyLoaderState (hsc_unit_env hsc_env)
case platformArch (targetPlatform (hsc_dflags hsc_env)) of
-- FIXME: we don't initialize anything with the JS interpreter.
@@ -1226,12 +1235,6 @@ loadPackage interp hsc_env pkgs pls
bc_dirs = [map ST.unpack $ Packages.unitLibraryBytecodeDirs pkg | pkg <- pkgs]
let hs_libs = [map ST.unpack $ Packages.unitLibraries pkg | pkg <- pkgs]
- -- The FFI GHCi import lib isn't needed as
- -- GHC.Linker.Loader + rts/Linker.c link the
- -- interpreted references to FFI to the compiled FFI.
- -- We therefore filter it out so that we don't get
- -- duplicate symbol errors.
- hs_libs' = filter ("HSffi" /=) <$> hs_libs
-- Because of slight differences between the GHC dynamic linker and
-- the native system linker some packages have to link with a
@@ -1251,7 +1254,7 @@ loadPackage interp hsc_env pkgs pls
dirs_env <- traverse (addEnvPaths "LIBRARY_PATH") dirs
hs_classifieds
- <- sequenceA [mapM (locateLib interp hsc_env True bc_dir_ dirs_env_ gcc_paths) hs_libs'_ | (bc_dir_, dirs_env_, hs_libs'_) <- zip3 bc_dirs dirs_env hs_libs' ]
+ <- sequenceA [mapM (locateLib interp hsc_env True bc_dir_ dirs_env_ gcc_paths) hs_libs'_ | (bc_dir_, dirs_env_, hs_libs'_) <- zip3 bc_dirs dirs_env hs_libs ]
extra_classifieds
<- sequenceA [mapM (locateLib interp hsc_env False [] dirs_env_ gcc_paths) extra_libs_ | (dirs_env_, extra_libs_) <- zip dirs_env extra_libs]
let classifieds = zipWith (++) hs_classifieds extra_classifieds
=====================================
compiler/GHC/Linker/Unit.hs
=====================================
@@ -6,6 +6,7 @@ module GHC.Linker.Unit
, collectArchives
, getUnitLinkOpts
, getLibs
+ , getUnitDepends
)
where
@@ -105,3 +106,9 @@ getLibs namever ways unit_env pkgs = do
, f <- (\n -> "lib" ++ n ++ ".a") <$> unitHsLibs namever ways p ]
filterM (doesFileExist . fst) candidates
+getUnitDepends :: HasDebugCallStack => UnitEnv -> UnitId -> [UnitId]
+getUnitDepends unit_env pkg =
+ let unit_state = ue_homeUnitState unit_env
+ unit_info = unsafeLookupUnitId unit_state pkg
+ in (unitDepends unit_info)
+
=====================================
compiler/GHC/Unit/State.hs
=====================================
@@ -372,7 +372,7 @@ initUnitConfig dflags cached_dbs home_units =
-- Since "base" is not wired in, then the unit-id is discovered
-- from the settings file by default, but can be overriden by power-users
-- by specifying `-base-unit-id` flag.
- | otherwise = filter (hu_id /=) [baseUnitId dflags, ghcInternalUnitId, rtsUnitId]
+ | otherwise = filter (hu_id /=) (baseUnitId dflags:wiredInUnitIds)
-- if the home unit is indefinite, it means we are type-checking it only
-- (not producing any code). Hence we can use virtual units instantiated
=====================================
hadrian/hadrian.cabal
=====================================
@@ -86,7 +86,6 @@ executable hadrian
, Rules.Documentation
, Rules.Generate
, Rules.Gmp
- , Rules.Libffi
, Rules.Library
, Rules.Lint
, Rules.Nofib
=====================================
hadrian/src/Builder.hs
=====================================
@@ -229,25 +229,16 @@ instance H.Builder Builder where
-- changes (#18001).
_bootGhcVersion <- setting GhcVersion
pure []
- Ghc _ st -> do
+ Ghc _ _ -> do
root <- buildRoot
unlitPath <- builderPath Unlit
distro_mingw <- lookupSystemConfig "settings-use-distro-mingw"
- libffi_adjustors <- useLibffiForAdjustors
- use_system_ffi <- flag UseSystemFfi
return $ [ unlitPath ]
++ [ root -/- mingwStamp | windowsHost, distro_mingw == "NO" ]
-- proxy for the entire mingw toolchain that
-- we have in inplace/mingw initially, and then at
-- root -/- mingw.
- -- ffi.h needed by the compiler when using libffi_adjustors (#24864)
- -- It would be nicer to not duplicate this logic between here
- -- and needRtsLibffiTargets and libffiHeaderFiles but this doesn't change
- -- very often.
- ++ [ root -/- buildDir (rtsContext st) -/- "include" -/- header
- | header <- ["ffi.h", "ffitarget.h"]
- , libffi_adjustors && not use_system_ffi ]
Hsc2Hs stage -> (\p -> [p]) <$> templateHscPath stage
Make dir -> return [dir -/- "Makefile"]
=====================================
hadrian/src/Packages.hs
=====================================
@@ -110,7 +110,7 @@ hpc = lib "hpc"
hpcBin = util "hpc-bin" `setPath` "utils/hpc"
integerGmp = lib "integer-gmp"
iservProxy = util "iserv-proxy"
-libffi = top "libffi"
+libffi = lib "libffi-clib"
mtl = lib "mtl"
osString = lib "os-string"
parsec = lib "parsec"
=====================================
hadrian/src/Rules.hs
=====================================
@@ -21,7 +21,6 @@ import qualified Rules.Dependencies
import qualified Rules.Documentation
import qualified Rules.Generate
import qualified Rules.Gmp
-import qualified Rules.Libffi
import qualified Rules.Library
import qualified Rules.Program
import qualified Rules.Register
@@ -80,7 +79,7 @@ packageTargets stage pkg = do
then return [] -- Skip inactive packages.
else if isLibrary pkg
then do -- Collect all targets of a library package.
- let pkgWays = if pkg == rts then getRtsWays else getLibraryWays
+ let pkgWays = if pkg `elem` [rts, libffi] then getRtsWays else getLibraryWays
ways <- interpretInContext context pkgWays
libs <- mapM (\w -> pkgLibraryFile (Context stage pkg w (error "unused"))) (Set.toList ways)
more <- Rules.Library.libraryTargets context
@@ -126,7 +125,6 @@ buildRules = do
Rules.Generate.generateRules
Rules.Generate.templateRules
Rules.Gmp.gmpRules
- Rules.Libffi.libffiRules
Rules.Library.libraryRules
Rules.Rts.rtsRules
packageRules
=====================================
hadrian/src/Rules/Documentation.hs
=====================================
@@ -232,6 +232,9 @@ buildSphinxHtml path = do
------------------------------------ Haddock -----------------------------------
+haddockExclude :: [FilePath]
+haddockExclude = ["rts", "libffi-clib"]
+
-- | Build the haddocks for GHC's libraries.
buildLibraryDocumentation :: Rules ()
buildLibraryDocumentation = do
@@ -241,11 +244,11 @@ buildLibraryDocumentation = do
root -/- htmlRoot -/- "libraries/index.html" %> \file -> do
need [ "libraries/prologue.txt" ]
- -- We want Haddocks for everything except `rts` to be built, but we
+ -- We want Haddocks for everything except `rts` and `libffi-clib` to be built, but we
-- don't want the index to be polluted by stuff from `ghc`-the-library
-- (there will be a separate top-level link to those Haddocks).
haddocks <- allHaddocks
- let neededDocs = filter (\x -> takeFileName x /= "rts.haddock") haddocks
+ let neededDocs = filter (\x -> takeFileName x `notElem` ((<.> "haddock") <$> haddockExclude)) haddocks
libDocs = filter (\x -> takeFileName x /= "ghc.haddock") neededDocs
need neededDocs
@@ -255,7 +258,7 @@ allHaddocks :: Action [FilePath]
allHaddocks = do
pkgs <- stagePackages Stage1
sequence [ pkgHaddockFile $ vanillaContext Stage1 pkg
- | pkg <- pkgs, isLibrary pkg, pkgName pkg /= "rts" ]
+ | pkg <- pkgs, isLibrary pkg, pkgName pkg `notElem` haddockExclude ]
-- Note: this build rule creates plenty of files, not just the .haddock one.
-- All of them go into the 'docRoot' subdirectory. Pedantically tracking all
@@ -427,4 +430,4 @@ haddockDependencies :: Context -> Action [(Package, FilePath)]
haddockDependencies context = do
depNames <- interpretInContext context (getContextData depNames)
sequence [ (,) <$> pure depPkg <*> (pkgHaddockFile $ vanillaContext Stage1 depPkg)
- | Just depPkg <- map findPackageByName depNames, depPkg /= rts ]
+ | Just depPkg <- map findPackageByName depNames, (pkgName depPkg) `notElem` haddockExclude ]
=====================================
hadrian/src/Rules/Generate.hs
=====================================
@@ -18,7 +18,6 @@ import Hadrian.Haskell.Cabal.Type (PackageData(version))
import Hadrian.Haskell.Cabal
import Hadrian.Oracles.Cabal (readPackageData)
import Packages
-import Rules.Libffi
import Settings
import Target
import Utilities
@@ -57,7 +56,6 @@ rtsDependencies = do
stage <- getStage
rtsPath <- expr (rtsBuildPath stage)
jsTarget <- expr isJsTarget
- useSystemFfi <- expr (flag UseSystemFfi)
let -- headers common to native and JS RTS
common_headers =
@@ -69,7 +67,6 @@ rtsDependencies = do
[ "rts" -/- "EventTypes.h"
, "rts" -/- "EventLogConstants.h"
]
- ++ (if useSystemFfi then [] else libffiHeaderFiles)
headers
| jsTarget = common_headers
| otherwise = common_headers ++ native_headers
=====================================
hadrian/src/Rules/Libffi.hs deleted
=====================================
@@ -1,243 +0,0 @@
-{-# LANGUAGE TypeFamilies #-}
-
-module Rules.Libffi (
- LibffiDynLibs(..),
- needLibffi, askLibffilDynLibs, libffiRules, libffiLibrary, libffiHeaderFiles,
- libffiHeaderDir, libffiSystemHeaderDir, libffiName
- ) where
-
-import Hadrian.Utilities
-
-import Packages
-import Settings.Builders.Common
-import Target
-import Utilities
-import GHC.Toolchain (targetPlatformTriple)
-
-{- Note [Libffi indicating inputs]
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-First see https://gitlab.haskell.org/ghc/ghc/wikis/Developing-Hadrian for an
-explanation of "indicating input". Part of the definition is copied here for
-your convenience:
-
- change in the vital output -> change in the indicating inputs
-
-In the case of building libffi `vital output = built libffi library files` and
-we can consider the libffi archive file (i.e. the "libffi-tarballs/libffi*.tar.gz"
-file) to be the only indicating input besides the build tools (e.g. make).
-Note building libffi is split into a few rules, but we also expect that:
-
- no change in the archive file -> no change in the intermediate build artifacts
-
-and so the archive file is still a valid choice of indicating input for
-all libffi rules. Hence we can get away with `need`ing only the archive file and
-don't have to `need` intermediate build artifacts (besides those to trigger
-dependant libffi rules i.e. to generate vital inputs as is noted on the wiki).
-It is then safe to `trackAllow` the libffi build directory as is done in
-`needLibfffiArchive`.
-
-A disadvantage to this approach is that changing the archive file forces a clean
-build of libffi i.e. we cannot incrementally build libffi. This seems like a
-performance issue, but is justified as building libffi is fast and the archive
-file is rarely changed.
-
--}
-
--- | Oracle question type. The oracle returns the list of dynamic
--- libffi library file paths (all but one of which should be symlinks).
-newtype LibffiDynLibs = LibffiDynLibs Stage
- deriving (Eq, Show, Hashable, Binary, NFData)
-type instance RuleResult LibffiDynLibs = [FilePath]
-
-askLibffilDynLibs :: Stage -> Action [FilePath]
-askLibffilDynLibs stage = askOracle (LibffiDynLibs stage)
-
--- | The path to the dynamic library manifest file. The file contains all file
--- paths to libffi dynamic library file paths.
--- The path is calculated but not `need`ed.
-dynLibManifest' :: Monad m => m FilePath -> Stage -> m FilePath
-dynLibManifest' getRoot stage = do
- root <- getRoot
- return $ root -/- stageString stage -/- pkgName libffi -/- ".dynamiclibs"
-
-dynLibManifestRules :: Stage -> Rules FilePath
-dynLibManifestRules = dynLibManifest' buildRootRules
-
-dynLibManifest :: Stage -> Action FilePath
-dynLibManifest = dynLibManifest' buildRoot
-
--- | Need the (locally built) libffi library.
-needLibffi :: Stage -> Action ()
-needLibffi stage = do
- jsTarget <- isJsTarget
- unless jsTarget $ do
- manifest <- dynLibManifest stage
- need [manifest]
-
--- | Context for @libffi@.
-libffiContext :: Stage -> Action Context
-libffiContext stage = do
- ways <- interpretInContext
- (Context stage libffi (error "libffiContext: way not set") (error "libffiContext: iplace not set"))
- getLibraryWays
- return $ (\w -> Context stage libffi w Final) (if any (wayUnit Dynamic) ways
- then dynamic
- else vanilla)
-
--- | The name of the library
-libffiName :: Expr String
-libffiName = do
- useSystemFfi <- expr (flag UseSystemFfi)
- if useSystemFfi
- then pure "ffi"
- else libffiLocalName Nothing
-
--- | The name of the (locally built) library
-libffiLocalName :: Maybe Bool -> Expr String
-libffiLocalName force_dynamic = do
- way <- getWay
- winTarget <- expr isWinTarget
- let dynamic = fromMaybe (Dynamic `wayUnit` way) force_dynamic
- pure $ mconcat
- [ if dynamic then "" else "C"
- , if winTarget then "ffi-6" else "ffi"
- ]
-
-libffiLibrary :: FilePath
-libffiLibrary = "inst/lib/libffi.a"
-
--- | These are the headers that we must package with GHC since foreign export
--- adjustor code produced by GHC depends upon them.
--- See Note [Packaging libffi headers] in GHC.Driver.CodeOutput.
-libffiHeaderFiles :: [FilePath]
-libffiHeaderFiles = ["ffi.h", "ffitarget.h"]
-
-libffiHeaderDir :: Stage -> Action FilePath
-libffiHeaderDir stage = do
- path <- libffiBuildPath stage
- return $ path -/- "inst/include"
-
-libffiSystemHeaderDir :: Action FilePath
-libffiSystemHeaderDir = setting FfiIncludeDir
-
-fixLibffiMakefile :: FilePath -> String -> String
-fixLibffiMakefile top =
- replace "-MD" "-MMD"
- . replace "@toolexeclibdir@" "$(libdir)"
- . replace "@INSTALL@" ("$(subst ../install-sh," ++ top ++ "/install-sh,@INSTALL@)")
-
--- TODO: check code duplication w.r.t. ConfCcArgs
-configureEnvironment :: Stage -> Action [CmdOption]
-configureEnvironment stage = do
- context <- libffiContext stage
- cFlags <- interpretInContext context getStagedCCFlags
- sequence [ builderEnvironment "CC" $ Cc CompileC stage
- , builderEnvironment "CXX" $ Cc CompileC stage
- , builderEnvironment "AR" $ Ar Unpack stage
- , builderEnvironment "NM" Nm
- , builderEnvironment "RANLIB" Ranlib
- , return . AddEnv "CFLAGS" $ unwords cFlags ++ " -w"
- , return . AddEnv "LDFLAGS" $ "-w" ]
-
--- Need the libffi archive and `trackAllow` all files in the build directory.
--- See [Libffi indicating inputs].
-needLibfffiArchive :: FilePath -> Action FilePath
-needLibfffiArchive buildPath = do
- top <- topDirectory
- tarball <- unifyPath
- . fromSingleton "Exactly one LibFFI tarball is expected"
- <$> getDirectoryFiles top ["libffi-tarballs/libffi*.tar.gz"]
- need [top -/- tarball]
- trackAllow [buildPath -/- "**"]
- return tarball
-
-libffiRules :: Rules ()
-libffiRules = do
- _ <- addOracleCache $ \ (LibffiDynLibs stage)
- -> do
- jsTarget <- isJsTarget
- if jsTarget
- then return []
- else readFileLines =<< dynLibManifest stage
- forM_ [Stage1, Stage2, Stage3] $ \stage -> do
- root <- buildRootRules
- let path = root -/- stageString stage
- libffiPath = path -/- pkgName libffi -/- "build"
-
- -- We set a higher priority because this rule overlaps with the build rule
- -- for static libraries 'Rules.Library.libraryRules'.
- dynLibMan <- dynLibManifestRules stage
- let topLevelTargets = [ libffiPath -/- libffiLibrary
- , dynLibMan
- ]
- priority 2 $ topLevelTargets &%> \_ -> do
- _ <- needLibfffiArchive libffiPath
- context <- libffiContext stage
-
- -- Note this build needs the Makefile, triggering the rules bellow.
- build $ target context (Make libffiPath) [] []
- libffiName' <- interpretInContext context (libffiLocalName (Just True))
-
- -- Produces all install files.
- produces =<< (\\ topLevelTargets)
- <$> liftIO (getDirectoryFilesIO "." [libffiPath -/- "inst//*"])
-
- -- Find dynamic libraries.
- osxTarget <- isOsxTarget
- winTarget <- isWinTarget
-
- dynLibFiles <- do
- let libfilesDir = libffiPath -/-
- (if winTarget then "inst" -/- "bin" else "inst" -/- "lib")
- dynlibext
- | winTarget = "dll"
- | osxTarget = "dylib"
- | otherwise = "so"
- filepat = "lib" ++ libffiName' ++ "." ++ dynlibext ++ "*"
- liftIO $ getDirectoryFilesIO "." [libfilesDir -/- filepat]
-
- writeFileLines dynLibMan dynLibFiles
- putSuccess "| Successfully build libffi."
-
- fmap (libffiPath -/-) ( "Makefile.in" :& "configure" :& Nil ) &%>
- \ ( mkIn :& _ ) -> do
- -- Extract libffi tar file
- context <- libffiContext stage
- removeDirectory libffiPath
- tarball <- needLibfffiArchive libffiPath
- -- Go from 'libffi-3.99999+git20171002+77e130c.tar.gz' to 'libffi-3.99999'
- let libname = takeWhile (/= '+') $ fromJust $ stripExtension "tar.gz" $ takeFileName tarball
-
- -- Move extracted directory to libffiPath.
- root <- buildRoot
- removeDirectory (root -/- libname)
- actionFinally (do
- build $ target context (Tar Extract) [tarball] [path]
- moveDirectory (path -/- libname) libffiPath) $
- -- And finally:
- removeFiles (path) [libname -/- "**"]
-
- top <- topDirectory
- fixFile mkIn (fixLibffiMakefile top)
-
- files <- liftIO $ getDirectoryFilesIO "." [libffiPath -/- "**"]
- produces files
-
- fmap (libffiPath -/-) ("Makefile" :& "config.guess" :& "config.sub" :& Nil)
- &%> \( mk :& _ ) -> do
- _ <- needLibfffiArchive libffiPath
- context <- libffiContext stage
-
- -- This need rule extracts the libffi tar file to libffiPath.
- need [mk <.> "in"]
-
- -- Configure.
- forM_ ["config.guess", "config.sub"] $ \file -> do
- copyFile file (libffiPath -/- file)
- env <- configureEnvironment stage
- buildWithCmdOptions env $
- target context (Configure libffiPath) [mk <.> "in"] [mk]
-
- dir <- queryBuildTarget targetPlatformTriple
- files <- liftIO $ getDirectoryFilesIO "." [libffiPath -/- dir -/- "**"]
- produces files
=====================================
hadrian/src/Rules/Register.hs
=====================================
@@ -147,7 +147,7 @@ buildConfFinal :: [(Resource, Int)] -> Context -> FilePath -> Action ()
buildConfFinal rs context@Context {..} _conf = do
depPkgIds <- cabalDependencies context
ensureConfigured context
- ways <- interpretInContext context (getLibraryWays <> if package == rts then getRtsWays else mempty)
+ ways <- interpretInContext context (getLibraryWays <> if package `elem` [rts, libffi] then getRtsWays else mempty)
stamps <- mapM pkgStampFile [ context { way = w } | w <- Set.toList ways ]
confs <- mapM (\pkgId -> packageDbPath (PackageDbLoc stage Final) <&> (-/- pkgId <.> "conf")) depPkgIds
-- Important to need these together to avoid introducing a linearisation. This is not the most critical place
@@ -295,20 +295,10 @@ parseCabalName s = bimap show id (Cabal.runParsecParser parser "<parseCabalName>
where
component = CabalCharParsing.munch1 (\c -> Char.isAlphaNum c || c == '.')
-
-
--- | Return extra library targets.
-extraTargets :: Context -> Action [FilePath]
-extraTargets context
- | package context == rts = needRtsLibffiTargets (Context.stage context)
- | otherwise = return []
-
-- | Given a library 'Package' this action computes all of its targets. Needing
-- all the targets should build the library such that it is ready to be
-- registered into the package database.
libraryTargets :: Context -> Action [FilePath]
libraryTargets context = do
libFile <- pkgLibraryFile context
- extra <- extraTargets context
- return $ [ libFile ]
- ++ extra
+ return [ libFile ]
=====================================
hadrian/src/Rules/Rts.hs
=====================================
@@ -1,14 +1,12 @@
{-# LANGUAGE MultiWayIf #-}
-module Rules.Rts (rtsRules, needRtsLibffiTargets, needRtsSymLinks) where
+module Rules.Rts (rtsRules, needRtsSymLinks) where
import qualified Data.Set as Set
import Packages (rts)
-import Rules.Libffi
import Hadrian.Utilities
import Settings.Builders.Common
-import Context.Type
-- | This rule has priority 3 to override the general rule for generating shared
-- library files (see Rules.Library.libraryRules).
@@ -26,134 +24,6 @@ rtsRules = priority 3 $ do
(addRtsDummyVersion $ takeFileName rtsLibFilePath')
rtsLibFilePath'
- -- Libffi
- forM_ [Stage1, Stage2, Stage3 ] $ \ stage -> do
- let buildPath = root -/- buildDir (rtsContext stage)
-
- -- Header files
- -- See Note [Packaging libffi headers] in GHC.Driver.CodeOutput.
- forM_ libffiHeaderFiles $ \header ->
- buildPath -/- "include" -/- header %> copyLibffiHeader stage
-
- -- Static libraries.
- buildPath -/- "libCffi*.a" %> copyLibffiStatic stage
-
- -- Dynamic libraries
- buildPath -/- "libffi*.dylib*" %> copyLibffiDynamicUnix stage ".dylib"
- buildPath -/- "libffi*.so*" %> copyLibffiDynamicUnix stage ".so"
- buildPath -/- "libffi*.dll*" %> copyLibffiDynamicWin stage
-
-withLibffi :: Stage -> (FilePath -> FilePath -> Action a) -> Action a
-withLibffi stage action = needLibffi stage
- >> (join $ action <$> libffiBuildPath stage
- <*> rtsBuildPath stage)
-
--- | Copy a header files wither from the system libffi or from the libffi
--- build dir to the rts build dir.
---
--- See Note [Packaging libffi headers] in GHC.Driver.CodeOutput.
-copyLibffiHeader :: Stage -> FilePath -> Action ()
-copyLibffiHeader stage header = do
- useSystemFfi <- flag UseSystemFfi
- (fromStr, headerDir) <- if useSystemFfi
- then ("system",) <$> libffiSystemHeaderDir
- else needLibffi stage
- >> ("custom",) <$> libffiHeaderDir stage
- copyFile
- (headerDir -/- takeFileName header)
- header
- putSuccess $ "| Successfully copied " ++ fromStr ++ " FFI library header "
- ++ "files to RTS build directory."
-
--- | Copy a static library file from the libffi build dir to the rts build dir.
-copyLibffiStatic :: Stage -> FilePath -> Action ()
-copyLibffiStatic stage target = withLibffi stage $ \ libffiPath _ -> do
- -- Copy the vanilla library, and symlink the rest to it.
- vanillaLibFile <- rtsLibffiLibrary stage vanilla
- if target == vanillaLibFile
- then copyFile' (libffiPath -/- libffiLibrary) target
- else createFileLink (takeFileName vanillaLibFile) target
-
-
--- | Copy a dynamic library file from the libffi build dir to the rts build dir.
-copyLibffiDynamicUnix :: Stage -> String -> FilePath -> Action ()
-copyLibffiDynamicUnix stage libSuf target = do
- needLibffi stage
- dynLibs <- askLibffilDynLibs stage
-
- -- If no version number suffix, then copy else just symlink.
- let versionlessSourceFilePath = fromMaybe
- (error $ "Needed " ++ show target ++ " which is not any of " ++
- "libffi's built shared libraries: " ++ show dynLibs)
- (find (libSuf `isSuffixOf`) dynLibs)
- let versionlessSourceFileName = takeFileName versionlessSourceFilePath
- if versionlessSourceFileName == takeFileName target
- then do
- copyFile' versionlessSourceFilePath target
-
- -- On OSX the dylib's id must be updated to a relative path.
- when osxHost $ cmd
- [ "install_name_tool"
- , "-id", "@rpath/" ++ takeFileName target
- , target
- ]
- else createFileLink versionlessSourceFileName target
-
--- | Copy a dynamic library file from the libffi build dir to the rts build dir.
-copyLibffiDynamicWin :: Stage -> FilePath -> Action ()
-copyLibffiDynamicWin stage target = do
- needLibffi stage
- dynLibs <- askLibffilDynLibs stage
- let source = fromMaybe
- (error $ "Needed " ++ show target ++ " which is not any of " ++
- "libffi's built shared libraries: " ++ show dynLibs)
- (find (\ lib -> takeFileName target == takeFileName lib) dynLibs)
- copyFile' source target
-
-rtsLibffiLibrary :: Stage -> Way -> Action FilePath
-rtsLibffiLibrary stage way = do
- name <- interpretInContext ((rtsContext stage) { way = way }) libffiName
- suf <- if wayUnit Dynamic way
- then do
- extension <- setting DynamicExtension -- e.g., .dll or .so
- let suffix = waySuffix (removeWayUnit Dynamic way)
- return (suffix ++ extension)
- -- Static suffix
- else return (waySuffix way ++ ".a") -- e.g., _p.a
- rtsPath <- rtsBuildPath stage
- return $ rtsPath -/- "lib" ++ name ++ suf
-
--- | Get the libffi files bundled with the rts (header and library files).
--- Unless using the system libffi, this needs the libffi library. It must be
--- built before the targets can be calculated.
-needRtsLibffiTargets :: Stage -> Action [FilePath]
-needRtsLibffiTargets stage = do
- rtsPath <- rtsBuildPath stage
- useSystemFfi <- flag UseSystemFfi
- jsTarget <- isJsTarget
-
- -- Header files (in the rts build dir).
- let headers = fmap ((rtsPath -/- "include") -/-) libffiHeaderFiles
-
- if | jsTarget -> return []
- | useSystemFfi -> return []
- | otherwise -> do
- -- Need Libffi
- -- This returns the dynamic library files (in the Libffi build dir).
- needLibffi stage
- dynLibffSource <- askLibffilDynLibs stage
-
- -- Dynamic library files (in the rts build dir).
- let dynLibffis = fmap (\ lib -> rtsPath -/- takeFileName lib)
- dynLibffSource
-
- -- Libffi files (in the rts build dir).
- libffis_libs <- do
- ways <- interpretInContext (stageContext stage)
- (getLibraryWays <> getRtsWays)
- mapM (rtsLibffiLibrary stage) (Set.toList ways)
- return $ concat [ headers, dynLibffis, libffis_libs ]
-
-- Need symlinks generated by rtsRules.
needRtsSymLinks :: Stage -> Set.Set Way -> Action ()
needRtsSymLinks stage rtsWays
=====================================
hadrian/src/Rules/SourceDist.hs
=====================================
@@ -155,6 +155,9 @@ prepareTree dest = do
, pkgPath time -/- "lib" -/- "include" -/- "HsTimeConfig.h.in"
, pkgPath unix -/- "configure"
, pkgPath unix -/- "include" -/- "HsUnixConfig.h.in"
+ , pkgPath libffi -/- "configure"
+ , pkgPath libffi -/- "fficonfig.h.in"
+ , pkgPath libffi -/- "include" -/- "ffi.h.in"
, pkgPath terminfo -/- "configure"
, "configure"
, "aclocal.m4"
=====================================
hadrian/src/Settings/Builders/Cabal.hs
=====================================
@@ -184,7 +184,8 @@ configureArgs cFlags' ldFlags' = do
, arg $ top -/- pkgPath pkg
, cFlags'
]
- mconcat
+ useSystemFfi <- getFlag UseSystemFfi
+ mconcat $
[ conf "CFLAGS" cFlags
, conf "LDFLAGS" ldFlags'
, conf "--with-iconv-includes" $ arg =<< getSetting IconvIncludeDir
@@ -198,7 +199,7 @@ configureArgs cFlags' ldFlags' = do
, conf "--host" $ arg =<< getSetting TargetPlatformFull
, conf "--with-cc" $ arg =<< getBuilderPath . (Cc CompileC) =<< getStage
, ghcVersionH
- ]
+ ] ++ if useSystemFfi then [arg "--configure-option=--with-system-libffi"] else []
bootPackageConstraints :: Args
bootPackageConstraints = (stage0InTree ==) <$> getStage ? do
=====================================
hadrian/src/Settings/Builders/Ghc.hs
=====================================
@@ -10,7 +10,6 @@ import Packages
import Settings.Builders.Common
import Settings.Warnings
import qualified Context as Context
-import Rules.Libffi (libffiName)
import qualified Data.Set as Set
import Data.Version.Extra
@@ -106,9 +105,6 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do
context <- getContext
distPath <- expr (Context.distDynDir context)
- useSystemFfi <- expr (flag UseSystemFfi)
- buildPath <- getBuildPath
- libffiName' <- libffiName
debugged <- buildingCompilerStage' . ghcDebugged =<< expr flavour
osxTarget <- expr isOsxTarget
@@ -127,17 +123,6 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do
metaOrigin | osxTarget = "@loader_path"
| otherwise = "$ORIGIN"
- -- TODO: an alternative would be to generalize by linking with extra
- -- bundled libraries, but currently the rts is the only use case. It is
- -- a special case when `useSystemFfi == True`: the ffi library files
- -- are not actually bundled with the rts. Perhaps ffi should be part of
- -- rts's extra libraries instead of extra bundled libraries in that
- -- case. Care should be take as to not break the make build.
- rtsFfiArg = package rts ? not useSystemFfi ? mconcat
- [ arg ("-L" ++ buildPath)
- , arg ("-l" ++ libffiName')
- ]
-
-- This is the -rpath argument that is required for the bindist scenario
-- to work. Indeed, when you install a bindist, the actual executables
-- end up nested somewhere under $libdir, with the wrapper scripts
@@ -166,7 +151,6 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do
, (not (nonHsMainPackage pkg) && not (isLibrary pkg)) ? arg "-rtsopts"
, pure [ "-l" ++ lib | lib <- libs ]
, pure [ "-L" ++ libDir | libDir <- libDirs ]
- , rtsFfiArg
, osxTarget ? pure (concat [ ["-framework", fmwk] | fmwk <- fmwks ])
, debugged ? packageOneOf [ghc, iservProxy, remoteIserv] ?
arg "-debug"
=====================================
hadrian/src/Settings/Default.hs
=====================================
@@ -141,7 +141,9 @@ stage1Packages = do
libraries0 <- filter good_stage0_package <$> stage0Packages
cross <- flag CrossCompiling
winTarget <- isWinTarget
+ jsTarget <- isJsTarget
haveCurses <- any (/= "") <$> traverse setting [ CursesIncludeDir, CursesLibDir ]
+ useSystemFfi <- flag UseSystemFfi
let when c xs = if c then xs else mempty
@@ -194,6 +196,10 @@ stage1Packages = do
[
terminfo
]
+ , when (not jsTarget && not useSystemFfi)
+ [
+ libffi
+ ]
]
-- | Packages built in 'Stage2' by default. You can change this in "UserSettings".
=====================================
hadrian/src/Settings/Packages.hs
=====================================
@@ -215,6 +215,7 @@ packageArgs = do
---------------------------------- rts ---------------------------------
, package rts ? rtsPackageArgs -- RTS deserves a separate function
+ , package libffi ? libffiPackageArgs
-------------------------------- runGhc --------------------------------
, package runGhc ?
@@ -275,6 +276,19 @@ ghcInternalArgs = package ghcInternal ? do
]
+-- libffi and rts have to have the same flavour configuration
+libffiPackageArgs :: Args
+libffiPackageArgs = package libffi ? do
+ rtsWays <- getRtsWays
+ mconcat
+ [ builder (Cabal Flags) ? mconcat
+ [ any (wayUnit Profiling) rtsWays `cabalFlag` "profiling"
+ , any (wayUnit Debug) rtsWays `cabalFlag` "debug"
+ , any (wayUnit Dynamic) rtsWays `cabalFlag` "dynamic"
+ , any (wayUnit Threaded) rtsWays `cabalFlag` "threaded"
+ ]
+ ]
+
-- | RTS-specific command line arguments.
rtsPackageArgs :: Args
rtsPackageArgs = package rts ? do
@@ -285,8 +299,6 @@ rtsPackageArgs = package rts ? do
path <- getBuildPath
top <- expr topDirectory
useSystemFfi <- getFlag UseSystemFfi
- ffiIncludeDir <- getSetting FfiIncludeDir
- ffiLibraryDir <- getSetting FfiLibDir
libdwIncludeDir <- queryTarget (Lib.includePath <=< tgtRTSWithLibdw)
libdwLibraryDir <- queryTarget (Lib.libraryPath <=< tgtRTSWithLibdw)
libnumaIncludeDir <- getSetting LibnumaIncludeDir
@@ -428,7 +440,6 @@ rtsPackageArgs = package rts ? do
[ useLibdw ? cabalExtraDirs (fromMaybe "" libdwIncludeDir) (fromMaybe "" libdwLibraryDir)
, cabalExtraDirs libnumaIncludeDir libnumaLibraryDir
, cabalExtraDirs libzstdIncludeDir libzstdLibraryDir
- , useSystemFfi ? cabalExtraDirs ffiIncludeDir ffiLibraryDir
]
, builder (Cc (FindCDependencies CDep)) ? cArgs
, builder (Cc (FindCDependencies CxxDep)) ? cArgs
=====================================
libffi-tarballs deleted
=====================================
@@ -1 +0,0 @@
-Subproject commit 7c51059557b68d29820a0a87cebfa6fe73c8adf5
=====================================
libraries/libffi-clib
=====================================
@@ -0,0 +1 @@
+Subproject commit 5323bdcc5229191884edb186709b7b91fe5117ee
=====================================
packages
=====================================
@@ -37,7 +37,6 @@
# localpath tag remotepath upstreamurl
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ghc-tarballs windows ghc-tarballs.git -
-libffi-tarballs - - -
utils/hsc2hs - - ssh://git@github.com/haskell/hsc2hs.git
libraries/array - - -
libraries/binary - - https://github.com/kolmodin/binary.git
=====================================
rts/include/rts/ghc_ffi.h
=====================================
@@ -25,4 +25,4 @@
#endif
#endif
-#include "ffi.h"
+#include <ffi.h>
=====================================
rts/rts.buildinfo.in
=====================================
@@ -1,6 +1,5 @@
extra-libraries: @EXTRA_LIBS@
extra-libraries-static: @EXTRA_LIBS@
include-dirs: @FFIIncludeDir@
-library-dirs: @FFILibDir@
-library-dirs-static: @FFILibDir@
-dynamic-library-dirs: @FFILibDir@
+extra-lib-dirs: @FFILibDir@
+extra-lib-dirs-static: @FFILibDir@
=====================================
rts/rts.cabal
=====================================
@@ -163,18 +163,6 @@ library
stg/Types.h
else
- -- If we are using an in-tree libffi then we must declare it as a bundled
- -- library to ensure that Cabal installs it.
- if !flag(use-system-libffi)
- if os(windows)
- extra-bundled-libraries: Cffi-6
- else
- extra-bundled-libraries: Cffi
-
- install-includes: ffi.h ffitarget.h
- -- ^ see Note [Packaging libffi headers] in
- -- GHC.Driver.CodeOutput.
-
-- Here we declare several flavours to be available when passing the
-- suitable (combination of) flag(s) when configuring the RTS from hadrian,
-- using Cabal.
@@ -232,6 +220,8 @@ library
if flag(use-system-libffi)
extra-libraries: ffi
extra-libraries-static: ffi
+ else
+ build-depends: libffi-clib
if os(windows)
extra-libraries:
-- for the linker
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f25e2b12c98290d3136d43e549ac26…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f25e2b12c98290d3136d43e549ac26…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][master] testsuite: remove obsolete --ci option from the testsuite driver
by Marge Bot (@marge-bot) 14 Jan '26
by Marge Bot (@marge-bot) 14 Jan '26
14 Jan '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
f25e2b12 by Cheng Shao at 2026-01-14T11:10:39-05:00
testsuite: remove obsolete --ci option from the testsuite driver
This patch removes the obsolete `--ci` option from the testsuite
driver: neither the CI scripts nor hadrian ever invokes the testsuite
driver with `--ci`, and the perf notes are always fetched to the
`refs/notes/perf` local reference anyway.
- - - - -
1 changed file:
- testsuite/driver/perf_notes.py
Changes:
=====================================
testsuite/driver/perf_notes.py
=====================================
@@ -685,13 +685,10 @@ def main() -> None:
parser.add_argument("--add-note", nargs=3,
help="Development only. --add-note N commit seed \
Adds N fake metrics to the given commit using the random seed.")
- parser.add_argument("--ci", action='store_true',
- help="Use ci results. You must fetch these with:\n " \
- + "$ git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/ci/perf")
group = parser.add_argument_group(title='Filtering', description="Select which subset of performance metrics to dump")
group.add_argument("--test-env",
- help="The given test environment to be compared. Use 'local' for locally run results. If using --ci, see .gitlab-ci file for TEST_ENV settings.")
+ help="The given test environment to be compared. Use 'local' for locally run results.")
group.add_argument("--test-name",
help="Filters for tests matching the given regular expression.")
group.add_argument("--metric",
@@ -721,8 +718,6 @@ def main() -> None:
#
ref = NoteNamespace('perf')
- if args.ci:
- ref = NoteNamespace('ci/perf')
commits = args.commits
if args.commits:
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f25e2b12c98290d3136d43e549ac268…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f25e2b12c98290d3136d43e549ac268…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/26416] DmdAnal: Don't give an absent demand signature to an argument if the argument doesn't
by Zubin (@wz1000) 14 Jan '26
by Zubin (@wz1000) 14 Jan '26
14 Jan '26
Zubin pushed to branch wip/26416 at Glasgow Haskell Compiler / GHC
Commits:
3723f07e by Zubin Duggal at 2026-01-14T19:50:40+05:30
DmdAnal: Don't give an absent demand signature to an argument if the argument doesn't
also have an absent demand signature in its unfolding.
Otherwise, in some cases we might mark an argument as absent and generate a LitRubbish for
it, but then the function might inline and turn out to actually use this argument, resulting
in a run time crash.
Partially addresses #26416.
There may still be cases where an absent argument turns out to be used due to a rule firing.
- - - - -
3 changed files:
- compiler/GHC/Core/Opt/DmdAnal.hs
- + testsuite/tests/dmdanal/should_run/M1.hs
- + testsuite/tests/dmdanal/should_run/T26416.hs
Changes:
=====================================
compiler/GHC/Core/Opt/DmdAnal.hs
=====================================
@@ -1106,8 +1106,17 @@ dmdAnalRhsSig top_lvl rec_flag env let_sd id rhs
WithDmdType rhs_dmd_ty rhs' = dmdAnal env rhs_sd rhs
DmdType rhs_env rhs_dmds = rhs_dmd_ty
+
+ -- See Note [Absence analysis for stable unfoldings and RULES]
+ -- If there's a stable unfolding, we need to combine argument demands
+ -- from the unfolding with those from the RHS, because the unfolding
+ -- might use arguments that the (optimised) RHS doesn't.
+ -- Any argument with a demand absent in one but not the other can
+ -- be problematic, see #26416
+ combined_rhs_dmds = combineUnfoldingDmds env rhs_sd id rhs_dmds
+
(final_rhs_dmds, final_rhs) = finaliseArgBoxities env id ww_arity
- rhs_dmds (de_div rhs_env) rhs'
+ combined_rhs_dmds (de_div rhs_env) rhs'
dmd_sig_arity = ww_arity + strictCallArity body_sd
sig = mkDmdSigForArity dmd_sig_arity (DmdType sig_env final_rhs_dmds)
@@ -1144,6 +1153,28 @@ splitWeakDmds :: DmdEnv -> (DmdEnv, WeakDmds)
splitWeakDmds (DE fvs div) = (DE sig_fvs div, weak_fvs)
where (!weak_fvs, !sig_fvs) = partitionVarEnv isWeakDmd fvs
+-- | If there is a stable unfolding, don't let any demand be absent that
+-- is also not absent in the unfolding
+-- See Note [Absence analysis for stable unfoldings and RULES], Wrinkle (W3).
+combineUnfoldingDmds :: AnalEnv -> SubDemand -> Id -> [Demand] -> [Demand]
+combineUnfoldingDmds env rhs_sd id rhs_dmds
+ | not (isStableUnfolding unf)
+ = rhs_dmds -- No stable unfolding, nothing to do
+
+ | Just unf_body <- maybeUnfoldingTemplate unf
+ , let WithDmdType (DmdType _ unf_dmds) _ = dmdAnal env rhs_sd unf_body
+ , let result = go rhs_dmds unf_dmds
+ = -- pprTrace "lubUnfoldingDmds" (ppr id $$ ppr rhs_dmds $$ ppr unf_dmds $$ ppr result) $
+ result
+ | otherwise = rhs_dmds
+ where
+ unf = realIdUnfolding id
+ go rhs [] = rhs
+ go [] _ = []
+ go (AbsDmd:rhs) (u:unfs) = u : go rhs unfs
+ go (r:rhs) (AbsDmd:unfs) = r : go rhs unfs
+ go (r:rhs) (_:unfs) = r : go rhs unfs
+
-- | The result type after applying 'idArity' many arguments. Returns 'Nothing'
-- when the type doesn't have exactly 'idArity' many arrows.
resultType_maybe :: Id -> Maybe Type
@@ -1523,6 +1554,25 @@ Wrinkles:
for `sg`, failing to unleash the signature and hence observed an absent
error instead of the `really important message`.
+ (W3) The SOLUTION above handles /free variables/ of stable unfoldings, but
+ what about /arguments/? Consider (#25965)
+
+ fromVector :: (Storable a, KnownNat n) => Vector a -> Vector a
+ fromVector v = ... (uses Storable dictionary) ...
+ {-# INLINABLE fromVector #-}
+
+ Suppose that the optimised RHS of `fromVector` somehow discards the use of
+ the Storable dictionary, but the stable unfolding still uses it. Then the
+ demand signature will say that the Storable dictionary argument is absent,
+ and worker/wrapper will replace it with `LitRubbish`. But when the
+ worker's unfolding is inlined, it will use that rubbish value as a real
+ dictionary, leading to a segfault!
+
+ SOLUTION: in `dmdAnalRhsSig`, if the function has a stable unfolding,
+ analyse it and drop any AbsDmds which are not absent in the unfolding.
+ This is done by `combineUnfoldingDmds`. This ensures that if the unfolding
+ uses an argument, it won't be marked as absent.
+
Note [DmdAnal for DataCon wrappers]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We give DataCon wrappers a (necessarily flat) demand signature in
@@ -2046,8 +2096,11 @@ finaliseArgBoxities env fn ww_arity arg_dmds div rhs
arg_triples :: [(Type, StrictnessMark, Demand)]
arg_triples = take ww_arity $
- [ (idType bndr, NotMarkedStrict, get_dmd bndr)
- | bndr <- bndrs, isRuntimeVar bndr ]
+ zipWith mk_triple
+ [ bndr | bndr <- bndrs, isRuntimeVar bndr ]
+ arg_dmds
+ where
+ mk_triple bndr dmd = (idType bndr, NotMarkedStrict, get_dmd dmd)
arg_dmds' = ww_arg_dmds ++ map trimBoxity (drop ww_arity arg_dmds)
-- If ww_arity < length arg_dmds, the leftover ones
@@ -2063,12 +2116,10 @@ finaliseArgBoxities env fn ww_arity arg_dmds div rhs
-- This is the budget initialisation step of
-- Note [Worker argument budget]
- get_dmd :: Id -> Demand
- get_dmd bndr
+ get_dmd :: Demand -> Demand
+ get_dmd dmd
| is_bot_fn = unboxDeeplyDmd dmd -- See Note [Boxity for bottoming functions],
| otherwise = dmd -- case (B)
- where
- dmd = idDemandInfo bndr
-- is_bot_fn: see Note [Boxity for bottoming functions]
is_bot_fn = div == botDiv
=====================================
testsuite/tests/dmdanal/should_run/M1.hs
=====================================
@@ -0,0 +1,17 @@
+-- Short module name is essential, or else f doesn't inline
+module M1 where
+{-# INLINABLE [2] f #-}
+f :: Int -> Int -> Float
+f !dummy x = if times dummy 0 x == 1
+ then 3.0 else 4.0
+
+{-# INLINE [0] times #-}
+times :: Int -> Int -> Int -> Int
+times dummy 0 x = x `seq` ( 0 + big dummy )
+times _ a b = a * b
+
+{-# RULES "times" [1] forall dummy x. times dummy 0 x = 0 + big dummy #-}
+
+big :: Int -> Int
+big x = succ . succ . succ . succ . succ . succ . succ . succ . succ $ x
+{-# INLINE big #-}
=====================================
testsuite/tests/dmdanal/should_run/T26416.hs
=====================================
@@ -0,0 +1,3 @@
+module Main where
+import M1 ( f )
+main = print (f 19 12)
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3723f07e0a325a3efd863022d728cdc…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3723f07e0a325a3efd863022d728cdc…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc] Pushed new branch wip/fix-ghc-experimental
by Matthew Pickering (@mpickering) 14 Jan '26
by Matthew Pickering (@mpickering) 14 Jan '26
14 Jan '26
Matthew Pickering pushed new branch wip/fix-ghc-experimental at Glasgow Haskell Compiler / GHC
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/fix-ghc-experimental
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/romes/hadrian-cross-stage2-rebase_SVEN_FINAL] 23 commits: [#26183] Associated Type Iface Fix
by Sven Tennie (@supersven) 14 Jan '26
by Sven Tennie (@supersven) 14 Jan '26
14 Jan '26
Sven Tennie pushed to branch wip/romes/hadrian-cross-stage2-rebase_SVEN_FINAL at Glasgow Haskell Compiler / GHC
Commits:
8a317b6f by Aaron Allen at 2026-01-01T03:05:15-05:00
[#26183] Associated Type Iface Fix
When determining "extras" for class decl interface entries, axioms for
the associated types need to included so that dependent modules will be
recompiled if those axioms change.
resolves #26183
- - - - -
ae1aeaab by Cheng Shao at 2026-01-01T03:06:32-05:00
testsuite: run numeric tests with optasm when available
This patch adds the `optasm` extra way to nueric tests when NCG is
available. Some numeric bugs only surface with optimization, omitting
this can hide these bugs and even make them slip into release! (e.g. #26711)
- - - - -
6213bb57 by maralorn at 2026-01-02T16:30:32+01:00
GHC.Internal.Exception.Context: Fix comment
on addExceptionAnnotation
- - - - -
b820ff50 by Janis Voigtlaender at 2026-01-05T02:43:18-05:00
GHC.Internal.Control.Monad.replicateM: Fix comment
- - - - -
a8a94aad by Cheng Shao at 2026-01-05T16:24:04-05:00
hadrian: drops unused PE linker script for windows
This patch drops unused PE linker script for windows in the
`MergeObjects` builder of hadrian. The linker script is used for
merging object files into a single `HS*.o` object file and undoing the
effect of split sections, when building the "ghci library" object
file. However, we don't build the ghci library on windows, and this
code path is actually unreachable.
- - - - -
977dd8ae by Matthew Pickering at 2026-01-14T11:30:03+01:00
Add missing req_interp modifier to T18441fail3 and T18441fail19
These tests require the interpreter but they were failing in a different
way with the javascript backend because the interpreter was disabled and
stderr is ignored by the test.
- - - - -
a0a4bf10 by Matthew Pickering at 2026-01-14T11:30:03+01:00
Use explicit syntax rather than pure
- - - - -
24452628 by Matthew Pickering at 2026-01-14T11:30:03+01:00
packaging: correctly propagate build/host/target to bindist configure script
At the moment the host and target which we will produce a compiler for
is fixed at the initial configure time. Therefore we need to persist
the choice made at this time into the installation bindist as well so we
look for the right tools, with the right prefixes at install time.
In the future, we want to provide a bit more control about what kind of
bindist we produce so the logic about what the host/target will have to
be written by hadrian rather than persisted by the configure script. In
particular with cross compilers we want to either build a normal stage 2
cross bindist or a stage 3 bindist, which creates a bindist which has a
native compiler for the target platform.
Fixes #21970
- - - - -
410be291 by Matthew Pickering at 2026-01-14T11:30:03+01:00
hadrian: Fill in more of the default.host toolchain file
When you are building a cross compiler this file will be used to build
stage1 and it's libraries, so we need enough information here to work
accurately. There is still more work to be done (see for example, word
size is still fixed).
- - - - -
2eca860a by Matthew Pickering at 2026-01-14T11:30:03+01:00
hadrian: Disable docs when cross compiling
Before there were a variety of ad-hoc places where doc building was
disabled when cross compiling.
* Some CI jobs sets --docs=none in gen_ci.hs
* Some CI jobs set --docs=none in .gitlab/ci.sh
* There was some logic in hadrian to not need the ["docs"] target when
making a bindist.
Now the situation is simple:
* If you are cross compiling then defaultDocsTargets is empty by
default.
In theory, there is no reason why we can't build documentation for cross
compiler bindists, but this is left to future work to generalise the
documentation building rules to allow this (#24289)
- - - - -
172ecac4 by Matthew Pickering at 2026-01-14T11:30:57+01:00
hadrian: Build stage 2 cross compilers
* Most of hadrian is abstracted over the stage in order to remove the
assumption that the target of all stages is the same platform. This
allows the RTS to be built for two different targets for example.
* Abstracts the bindist creation logic to allow building either normal
or cross bindists. Normal bindists use stage 1 libraries and a stage 2
compiler. Cross bindists use stage 2 libararies and a stage 2
compiler.
* hadrian: Make binary-dist-dir the default build target. This allows us
to have the logic in one place about which libraries/stages to build
with cross compilers. Fixes #24192
New hadrian target:
* `binary-dist-dir-cross`: Build a cross compiler bindist (compiler =
stage 1, libraries = stage 2)
This commit also contains various changes to make stage2 compilers
feasible.
-------------------------
Metric Decrease:
ManyAlternatives
MultiComponentModulesRecomp
MultiLayerModulesRecomp
T10421
T12425
T12707
T13035
T13379
T15703
T16577
T18698a
T18698b
T18923
T1969
T21839c
T3294
T4801
T5030
T5321Fun
T5642
T783
T9198
T9872d
T9961
parsing001
T5321FD
T6048
-------------------------
Co-authored-by: Sven Tennie <sven.tennie(a)gmail.com>
- - - - -
71cfd85c by Sven Tennie at 2026-01-14T11:30:58+01:00
Align CI scripts with master
Fixup
- - - - -
5a73da21 by Matthew Pickering at 2026-01-14T11:30:58+01:00
ci: Test cross bindists
We remove the special logic for testing in-tree cross
compilers and instead test cross compiler bindists, like we do for all
other platforms.
- - - - -
0bc4fe47 by Matthew Pickering at 2026-01-14T11:30:58+01:00
ci: Introduce CROSS_STAGE variable
In preparation for building and testing stage3 bindists we introduce the
CROSS_STAGE variable which is used by a CI job to determine what kind of
bindist the CI job should produce.
At the moment we are only using CROSS_STAGE=2 but in the future we will
have some jobs which set CROSS_STAGE=3 to produce native bindists for a
target, but produced by a cross compiler, which can be tested on by
another CI job on the native platform.
CROSS_STAGE=2: Build a normal cross compiler bindist
CROSS_STAGE=3: Build a stage 3 bindist, one which is a native compiler and library for the target
- - - - -
8990a098 by Matthew Pickering at 2026-01-14T11:30:58+01:00
hadrian: Refactor system-cxx-std-lib rules0
I noticed a few things wrong with the hadrian rules for `system-cxx-std-lib` rules.
* For `text` there is an ad-hoc check to depend on `system-cxx-std-lib` outside of `configurePackage`.
* The `system-cxx-std-lib` dependency is not read from cabal files.
* Recache is not called on the packge database after the `.conf` file is generated, a more natural place for this rule is `registerRules`.
Treating this uniformly like other packages is complicated by it not having any source code or a cabal file. However we can do a bit better by reporting the dependency firstly in `PackageData` and then needing the `.conf` file in the same place as every other package in `configurePackage`.
Fixes #25303
- - - - -
689ae7d8 by Sven Tennie at 2026-01-14T11:30:58+01:00
ci: Increase timeout for emulators
Test runs with emulators naturally take longer than on native machines.
Generate jobs.yml
- - - - -
0384959b by Sven Tennie at 2026-01-14T11:30:58+01:00
ghc: Distinguish between having an interpreter and having an internal one
Otherwise, we fail with warnings when compiling tools. Actually, these
are related but different things:
- ghc can run an interpreter (either internal or external)
- ghc is compiled with an internal interpreter
- - - - -
6e0d2a41 by Matthew Pickering at 2026-01-14T11:30:58+01:00
ci: Javascript don't set CROSS_EMULATOR
There is no CROSS_EMULATOR needed to run javascript binaries, so we
don't set the CROSS_EMULATOR to some dummy value.
- - - - -
61d2c137 by Sven Tennie at 2026-01-14T11:30:58+01:00
Javascript skip T23697
See #22355 about how HSC2HS and the Javascript target don't play well
together.
- - - - -
bbc8f3d0 by Sven Tennie at 2026-01-14T11:30:58+01:00
Mark T24602 as fragile
It was skipped before (due to CROSS_EMULATOR being set, which changed
for JS), so we don't make things worse by marking it as fragile.
- - - - -
7c04c65c by Sven Tennie at 2026-01-14T11:30:58+01:00
WIP: Dirty hack
Let Stage0 build with the default.host.target file and decide for other
stages if default.target cannot be used.
Acutally, I don't like this logic on this level.
- - - - -
51721834 by Sven Tennie at 2026-01-14T11:30:58+01:00
Windows needs NM_STAGE0 as well
The stage0 always needs nm.
- - - - -
86ba1363 by Sven Tennie at 2026-01-14T11:30:58+01:00
T17912 sometimes works for windows-validate
This seems to be timing related. However, just simply increasing the
timeout (sleep) statement of this test didn't help. Maybe, it has been
flaky on CI before.
- - - - -
87 changed files:
- .gitlab/ci.sh
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- compiler/GHC/Iface/Recomp.hs
- configure.ac
- distrib/configure.ac.in
- − driver/utils/merge_sections_pe.ld
- ghc/GHC/Driver/Session/Mode.hs
- ghc/GHCi/UI.hs
- ghc/Main.hs
- ghc/ghc-bin.cabal.in
- hadrian/README.md
- hadrian/bindist/config.mk.in
- hadrian/cfg/default.host.target.in
- + hadrian/cfg/system.config.host.in
- hadrian/cfg/system.config.in
- + hadrian/cfg/system.config.target.in
- hadrian/hadrian.cabal
- hadrian/src/Base.hs
- + hadrian/src/BindistConfig.hs
- hadrian/src/Builder.hs
- hadrian/src/Context.hs
- hadrian/src/Expression.hs
- hadrian/src/Flavour.hs
- hadrian/src/Flavour/Type.hs
- hadrian/src/Hadrian/Builder.hs
- hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
- hadrian/src/Hadrian/Haskell/Cabal/Type.hs
- hadrian/src/Hadrian/Haskell/Hash.hs
- hadrian/src/Hadrian/Oracles/TextFile.hs
- hadrian/src/Oracles/Flag.hs
- hadrian/src/Oracles/Flavour.hs
- hadrian/src/Oracles/Setting.hs
- hadrian/src/Oracles/TestSettings.hs
- hadrian/src/Packages.hs
- hadrian/src/Rules.hs
- hadrian/src/Rules/BinaryDist.hs
- hadrian/src/Rules/CabalReinstall.hs
- hadrian/src/Rules/Compile.hs
- hadrian/src/Rules/Documentation.hs
- hadrian/src/Rules/Generate.hs
- hadrian/src/Rules/Gmp.hs
- hadrian/src/Rules/Libffi.hs
- hadrian/src/Rules/Library.hs
- hadrian/src/Rules/Lint.hs
- hadrian/src/Rules/Program.hs
- hadrian/src/Rules/Register.hs
- hadrian/src/Rules/Rts.hs
- hadrian/src/Rules/Test.hs
- hadrian/src/Settings.hs
- hadrian/src/Settings/Builders/Cabal.hs
- hadrian/src/Settings/Builders/Common.hs
- hadrian/src/Settings/Builders/Configure.hs
- hadrian/src/Settings/Builders/DeriveConstants.hs
- hadrian/src/Settings/Builders/Ghc.hs
- hadrian/src/Settings/Builders/Hsc2Hs.hs
- hadrian/src/Settings/Builders/RunTest.hs
- hadrian/src/Settings/Builders/SplitSections.hs
- hadrian/src/Settings/Default.hs
- hadrian/src/Settings/Flavours/Benchmark.hs
- hadrian/src/Settings/Flavours/Development.hs
- hadrian/src/Settings/Flavours/GhcInGhci.hs
- hadrian/src/Settings/Flavours/Performance.hs
- hadrian/src/Settings/Flavours/Quick.hs
- hadrian/src/Settings/Flavours/QuickCross.hs
- hadrian/src/Settings/Flavours/Quickest.hs
- hadrian/src/Settings/Flavours/Validate.hs
- hadrian/src/Settings/Packages.hs
- hadrian/src/Settings/Program.hs
- hadrian/src/Settings/Warnings.hs
- libraries/base/tests/IO/all.T
- libraries/base/tests/all.T
- libraries/ghc-internal/src/GHC/Internal/Control/Monad.hs
- libraries/ghc-internal/src/GHC/Internal/Exception/Context.hs
- m4/fp_find_nm.m4
- m4/fptools_set_platform_vars.m4
- m4/prep_target_file.m4
- testsuite/ghc-config/ghc-config.hs
- + testsuite/tests/driver/recomp26183/M.hs
- + testsuite/tests/driver/recomp26183/M2A.hs
- + testsuite/tests/driver/recomp26183/M2B.hs
- + testsuite/tests/driver/recomp26183/Makefile
- + testsuite/tests/driver/recomp26183/all.T
- + testsuite/tests/driver/recomp26183/recomp26183.stderr
- testsuite/tests/ghc-e/should_fail/all.T
- testsuite/tests/javascript/closure/all.T
- testsuite/tests/numeric/should_run/all.T
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/28e8c6083ba06e1a24530bd900e4dc…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/28e8c6083ba06e1a24530bd900e4dc…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc] Pushed new branch wip/romes/hadrian-cross-stage2-rebase_SVEN_FINAL_SAVE
by Sven Tennie (@supersven) 14 Jan '26
by Sven Tennie (@supersven) 14 Jan '26
14 Jan '26
Sven Tennie pushed new branch wip/romes/hadrian-cross-stage2-rebase_SVEN_FINAL_SAVE at Glasgow Haskell Compiler / GHC
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/romes/hadrian-cross-stage2-re…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/T26746] 10 commits: Don't re-use stack slots for growing registers
by Simon Peyton Jones (@simonpj) 14 Jan '26
by Simon Peyton Jones (@simonpj) 14 Jan '26
14 Jan '26
Simon Peyton Jones pushed to branch wip/T26746 at Glasgow Haskell Compiler / GHC
Commits:
023c301c by sheaf at 2026-01-13T04:57:30-05:00
Don't re-use stack slots for growing registers
This commit avoids re-using a stack slot for a register that has grown
but already had a stack slot.
For example, suppose we have stack slot assigments
%v1 :: FF64 |-> StackSlot 0
%v2 :: FF64 |-> StackSlot 1
Later, we start using %v1 at a larger format (e.g. F64x2) and we need
to spill it again. Then we **must not** use StackSlot 0, as a spill
at format F64x2 would clobber the data in StackSlot 1.
This can cause some fragmentation of the `StackMap`, but that's probably
OK.
Fixes #26668
- - - - -
d0966e64 by fendor at 2026-01-13T04:58:11-05:00
Remove `traceId` from ghc-pkg executable
- - - - -
20d7efec by Simon Peyton Jones at 2026-01-13T12:41:22-05:00
Make SpecContr rules fire a bit later
See #26615 and Note [SpecConstr rule activation]
- - - - -
8bc4eb8c by Andrew Lelechenko at 2026-01-13T12:42:03-05:00
Upgrade mtl submodule to 2.3.2
Fixes #26656
- - - - -
c94aaacd by Cheng Shao at 2026-01-13T12:42:44-05:00
compiler: remove iserv and only use on-demand external interpreter
This patch removes `iserv` from the tree completely. Hadrian would no
longer build or distribute `iserv`, and the GHC driver would use the
on-demand external interpreter by default when invoked with
`-fexternal-interpreter`, without needing to specify `-pgmi ""`. This
has multiple benefits:
- It allows cleanup of a lot of legacy hacks in the hadrian codebase.
- It paves the way for running cross ghc's iserv via cross emulator
(#25523), fixing TH/ghci support for cross targets other than
wasm/js.
- - - - -
c1fe0097 by Peter Trommler at 2026-01-14T03:54:49-05:00
PPC NCG: Fix shift right MO code
The shift amount in shift right [arithmetic] MOs is machine word
width. Therefore remove unnecessary zero- or sign-extending of
shift amount.
It looks harmless to extend the shift amount argument because the
shift right instruction uses only the seven lowest bits (i. e. mod 128).
But now we have a conversion operation from a smaller type to word width
around a memory load at word width. The types are not matching up but
there is no check done in CodeGen. The necessary conversion from word
width down to the smaller width would be translated into a no-op on
PowerPC anyway. So all seems harmless if it was not for a small
optimisation in getRegister'.
In getRegister' a load instruction with the smaller width of the
conversion operation was generated. This loaded the most significant
bits of the word in memory on a big-endian platform. These bits were
zero and hence shift right was used with shift amount zero and not one
as required in test Sized.
Fixes #26519
- - - - -
2dafc65a by Cheng Shao at 2026-01-14T03:55:31-05:00
Tree-wide cleanup of cygwin logic
GHC has not supported cygwin for quite a few years already, and will
not resume support in the forseeable future. The only supported
windows toolchain is clang64/clangarm64 of the msys2 project. This
patch cleans up the unused cygwin logic in the tree.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
66b96e2a by Teo Camarasu at 2026-01-14T03:56:13-05:00
Set default eventlog-flush-interval to 5s
Resolves #26707
- - - - -
d0254579 by Andrew Lelechenko at 2026-01-14T03:56:53-05:00
Document when -maxN RTS option was added
- - - - -
4a01ec30 by Simon Peyton Jones at 2026-01-14T10:22:12+00:00
Improve newtype unwrapping
Ticket #26746 describes several relatively-minor shortcomings of newtype
unwrapping. This MR addresses them, while also (arguably) simplifying
the code a bit.
See new Note [Solving newtype equalities: overview]
and Note [Decomposing newtype equalities]
and Note [Eager newtype decomposition]
and Note [Even more eager newtype decomposition]
- - - - -
82 changed files:
- CODEOWNERS
- cabal.project-reinstall
- compiler/GHC/CmmToAsm/PPC/CodeGen.hs
- compiler/GHC/CmmToAsm/Reg/Linear.hs
- compiler/GHC/CmmToAsm/Reg/Linear/StackMap.hs
- compiler/GHC/Core/FamInstEnv.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/Opt/Specialise.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/Rules.hs
- compiler/GHC/Core/Unfold/Make.hs
- compiler/GHC/Driver/MakeFile.hs
- compiler/GHC/Runtime/Interpreter/Init.hs
- compiler/GHC/Settings/IO.hs
- compiler/GHC/SysTools/Terminal.hs
- compiler/GHC/Tc/Instance/Family.hs
- compiler/GHC/Tc/Solver/Equality.hs
- compiler/GHC/Tc/Solver/Monad.hs
- configure.ac
- docs/users_guide/9.16.1-notes.rst
- docs/users_guide/ghci.rst
- docs/users_guide/packages.rst
- docs/users_guide/phases.rst
- docs/users_guide/using-concurrent.rst
- docs/users_guide/win32-dlls.rst
- driver/ghci/ghci.c
- driver/utils/cwrapper.c
- driver/utils/isMinTTY.c
- hadrian/bindist/cwrappers/cwrapper.c
- hadrian/doc/user-settings.md
- hadrian/src/Packages.hs
- hadrian/src/Rules/BinaryDist.hs
- hadrian/src/Rules/CabalReinstall.hs
- hadrian/src/Rules/Generate.hs
- hadrian/src/Rules/Program.hs
- hadrian/src/Rules/Test.hs
- hadrian/src/Settings/Builders/Ghc.hs
- hadrian/src/Settings/Default.hs
- hadrian/src/Settings/Packages.hs
- hadrian/src/Settings/Program.hs
- libraries/base/tests/IO/T12010/cbits/initWinSock.c
- libraries/ghc-internal/cbits/consUtils.c
- libraries/ghc-internal/configure.ac
- libraries/ghc-internal/src/GHC/Internal/ConsoleHandler.hsc
- libraries/ghc-internal/src/GHC/Internal/IO/Handle.hs
- libraries/mtl
- m4/ghc_select_file_extensions.m4
- rts/RtsFlags.c
- testsuite/driver/runtests.py
- testsuite/driver/testglobals.py
- testsuite/driver/testlib.py
- testsuite/mk/test.mk
- testsuite/tests/deriving/should_fail/T8984.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail4.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail5.stderr
- − testsuite/tests/driver/T24731.hs
- testsuite/tests/driver/all.T
- testsuite/tests/rts/linker/rdynamic.hs
- testsuite/tests/simplCore/should_compile/T14003.stderr
- testsuite/tests/simplCore/should_compile/T19672.stderr
- testsuite/tests/simplCore/should_compile/T21763.stderr
- testsuite/tests/simplCore/should_compile/T21763a.stderr
- + testsuite/tests/simplCore/should_compile/T26615.hs
- + testsuite/tests/simplCore/should_compile/T26615.stderr
- + testsuite/tests/simplCore/should_compile/T26615a.hs
- testsuite/tests/simplCore/should_compile/T4908.stderr
- testsuite/tests/simplCore/should_compile/all.T
- testsuite/tests/simplCore/should_compile/spec-inline.stderr
- + testsuite/tests/typecheck/should_compile/T26746.hs
- testsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_fail/T15801.stderr
- testsuite/tests/typecheck/should_fail/T22924b.stderr
- testsuite/tests/typecheck/should_fail/TcCoercibleFail.hs
- testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr
- testsuite/tests/typecheck/should_fail/all.T
- utils/ghc-pkg/Main.hs
- − utils/iserv/iserv.cabal.in
- − utils/iserv/src/Main.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a505c4e1468274b59b744ec3053137…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a505c4e1468274b59b744ec3053137…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 9 commits: PPC NCG: Fix shift right MO code
by Marge Bot (@marge-bot) 14 Jan '26
by Marge Bot (@marge-bot) 14 Jan '26
14 Jan '26
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
c1fe0097 by Peter Trommler at 2026-01-14T03:54:49-05:00
PPC NCG: Fix shift right MO code
The shift amount in shift right [arithmetic] MOs is machine word
width. Therefore remove unnecessary zero- or sign-extending of
shift amount.
It looks harmless to extend the shift amount argument because the
shift right instruction uses only the seven lowest bits (i. e. mod 128).
But now we have a conversion operation from a smaller type to word width
around a memory load at word width. The types are not matching up but
there is no check done in CodeGen. The necessary conversion from word
width down to the smaller width would be translated into a no-op on
PowerPC anyway. So all seems harmless if it was not for a small
optimisation in getRegister'.
In getRegister' a load instruction with the smaller width of the
conversion operation was generated. This loaded the most significant
bits of the word in memory on a big-endian platform. These bits were
zero and hence shift right was used with shift amount zero and not one
as required in test Sized.
Fixes #26519
- - - - -
2dafc65a by Cheng Shao at 2026-01-14T03:55:31-05:00
Tree-wide cleanup of cygwin logic
GHC has not supported cygwin for quite a few years already, and will
not resume support in the forseeable future. The only supported
windows toolchain is clang64/clangarm64 of the msys2 project. This
patch cleans up the unused cygwin logic in the tree.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
66b96e2a by Teo Camarasu at 2026-01-14T03:56:13-05:00
Set default eventlog-flush-interval to 5s
Resolves #26707
- - - - -
d0254579 by Andrew Lelechenko at 2026-01-14T03:56:53-05:00
Document when -maxN RTS option was added
- - - - -
9c8c8e37 by Cheng Shao at 2026-01-14T04:29:45-05:00
testsuite: remove obsolete --ci option from the testsuite driver
This patch removes the obsolete `--ci` option from the testsuite
driver: neither the CI scripts nor hadrian ever invokes the testsuite
driver with `--ci`, and the perf notes are always fetched to the
`refs/notes/perf` local reference anyway.
- - - - -
440647e0 by Julian Ospald at 2026-01-14T04:29:57-05:00
Fix fetch_cabal
* download cabal if the existing one is of an older version
* fix FreeBSD download url
* fix unpacking on FreeBSD
- - - - -
96f4fb6c by Julian Ospald at 2026-01-14T04:29:57-05:00
Bump toolchain in CI
- - - - -
59f56b35 by Julian Ospald at 2026-01-14T04:29:57-05:00
Use libffi-clib
Previously, we would build libffi via hadrian
and bundle it manually with the GHC bindist.
This now moves all that logic out of hadrian
and allows us to have a clean Haskell package
to build and link against and ship it without
extra logic.
This patch still retains the ability to link
against a system libffi.
The main reason of bundling libffi was that on
some platforms (e.g. FreeBSD and Mac), system libffi
is not visible to the C toolchain by default,
so users would require settings in e.g. cabal
to be able to compile anything.
This adds the submodule libffi-clib to the repository.
- - - - -
e1320756 by Peng Fan at 2026-01-14T04:30:11-05:00
NCG/LA64: add support for la664 micro architecture
Add '-mla664' flag to LA664, which has some new features:
atomic instructions, dbar hints, etc.
'LA464' is the default so that unrecognized instructions are not
generated.
- - - - -
58 changed files:
- .gitlab/ci.sh
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- .gitmodules
- compiler/GHC/CmmToAsm/Config.hs
- compiler/GHC/CmmToAsm/PPC/CodeGen.hs
- compiler/GHC/Driver/Config/CmmToAsm.hs
- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Driver/MakeFile.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Linker/Loader.hs
- compiler/GHC/Linker/Unit.hs
- compiler/GHC/SysTools/Terminal.hs
- compiler/GHC/Unit/State.hs
- configure.ac
- docs/users_guide/9.16.1-notes.rst
- docs/users_guide/packages.rst
- docs/users_guide/using-concurrent.rst
- docs/users_guide/using.rst
- docs/users_guide/win32-dlls.rst
- driver/ghci/ghci.c
- driver/utils/cwrapper.c
- driver/utils/isMinTTY.c
- hadrian/bindist/cwrappers/cwrapper.c
- hadrian/hadrian.cabal
- hadrian/src/Builder.hs
- hadrian/src/Packages.hs
- hadrian/src/Rules.hs
- hadrian/src/Rules/Documentation.hs
- hadrian/src/Rules/Generate.hs
- − hadrian/src/Rules/Libffi.hs
- hadrian/src/Rules/Register.hs
- hadrian/src/Rules/Rts.hs
- hadrian/src/Rules/SourceDist.hs
- hadrian/src/Settings/Builders/Cabal.hs
- hadrian/src/Settings/Builders/Ghc.hs
- hadrian/src/Settings/Default.hs
- hadrian/src/Settings/Packages.hs
- hadrian/src/Settings/Program.hs
- − libffi-tarballs
- libraries/base/tests/IO/T12010/cbits/initWinSock.c
- libraries/ghc-internal/cbits/consUtils.c
- libraries/ghc-internal/configure.ac
- libraries/ghc-internal/src/GHC/Internal/ConsoleHandler.hsc
- libraries/ghc-internal/src/GHC/Internal/IO/Handle.hs
- + libraries/libffi-clib
- m4/ghc_select_file_extensions.m4
- packages
- rts/RtsFlags.c
- rts/include/rts/ghc_ffi.h
- rts/rts.buildinfo.in
- rts/rts.cabal
- testsuite/driver/perf_notes.py
- testsuite/driver/runtests.py
- testsuite/driver/testglobals.py
- testsuite/driver/testlib.py
- testsuite/mk/test.mk
- testsuite/tests/rts/linker/rdynamic.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6ef0ac0c8c1582a1991a6cae9a7cee…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6ef0ac0c8c1582a1991a6cae9a7cee…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/spj-try-opt-coercion] Fuse optCoRefl and substCo
by Simon Peyton Jones (@simonpj) 14 Jan '26
by Simon Peyton Jones (@simonpj) 14 Jan '26
14 Jan '26
Simon Peyton Jones pushed to branch wip/spj-try-opt-coercion at Glasgow Haskell Compiler / GHC
Commits:
e180c6dc by Simon Peyton Jones at 2026-01-14T09:07:38+00:00
Fuse optCoRefl and substCo
Maybe this will be better than either
- - - - -
4 changed files:
- compiler/GHC/Core/Coercion/Opt.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/TyCo/Subst.hs
- compiler/GHC/Utils/Misc.hs
Changes:
=====================================
compiler/GHC/Core/Coercion/Opt.hs
=====================================
@@ -257,12 +257,17 @@ optCoAlt is (Alt k bs e)
left-to-right, and won't spot (co1 ; co2 ; sym co2)
-}
-optCoRefl :: Coercion -> Coercion
+optCoRefl :: Subst -> Coercion -> Coercion
-- See Note [optCoRefl]
-optCoRefl in_co
-#ifdef DEBUG
+optCoRefl subst in_co
+ | isEmptyTCvSubst subst = in_co
+
+ | otherwise
+#ifndef DEBUG
+ = opt_co_refl subst in_co
+#else
-- Debug check that optCoRefl doesn't change the type
- = let out_co = go in_co
+ = let out_co = opt_co_refl subst in_co
(Pair in_l in_r) = coercionKind in_co
(Pair out_l out_r) = coercionKind out_co
in if (in_l `eqType` out_l) && (in_r `eqType` out_r)
@@ -274,9 +279,11 @@ optCoRefl in_co
, text "in_co:" <+> ppr in_co
, text "out_co:" <+> ppr out_co ]) $
out_co
-#else
- = go in_co
#endif
+
+
+opt_co_refl :: Subst -> Coercion -> Coercion
+opt_co_refl subst co = go co
where
go_m MRefl = MRefl
go_m (MCo co) = MCo (go co)
@@ -294,12 +301,17 @@ optCoRefl in_co
go (LRCo n co) = mkLRCo n (go co)
go (AppCo co1 co2) = mkAppCo (go co1) (go co2)
go (InstCo co1 co2) = mkInstCo (go co1) (go co2)
- go (ForAllCo v vl vr mco co) = mkForAllCo v vl vr (go_m mco) (go co)
go (FunCo r afl afr com coa cor) = mkFunCo2 r afl afr (go com) (go coa) (go cor)
go (TyConAppCo r tc cos) = mkTyConAppCo r tc (go_s cos)
go (UnivCo p r lt rt cos) = mkUnivCo p (go_s cos) r lt rt
go (AxiomCo ax cos) = mkAxiomCo ax (go_s cos)
+ go (ForAllCo v vl vr mco co) = mkForAllCo v' vl vr
+ $!! go_m mco
+ $!! opt_co_refl subst' co
+ where
+ !(subst', v') = substVarBndr subst v
+
-- This is the main payload
go (TransCo co1 co2) = gobble gs0 co1 [co2]
where
=====================================
compiler/GHC/Core/Opt/Simplify/Iteration.hs
=====================================
@@ -1390,7 +1390,7 @@ simplCoercionF env co cont
simplCoercion :: SimplEnv -> InCoercion -> SimplM OutCoercion
simplCoercion env co
- = do { let out_co = optCoRefl (substCo env co)
+ = do { let out_co = optCoRefl (getTCvSubst env) co
; seqCo out_co `seq` return out_co }
-----------------------------------
=====================================
compiler/GHC/Core/TyCo/Subst.hs
=====================================
@@ -860,33 +860,33 @@ subst_co subst co
go_mco (MCo co) = MCo (go co)
go :: Coercion -> Coercion
- go (Refl ty) = mkNomReflCo $! (go_ty ty)
- go (GRefl r ty mco) = (mkGReflCo r $! (go_ty ty)) $! (go_mco mco)
- go (TyConAppCo r tc args)= mkTyConAppCo r tc $! go_cos args
- go (AxiomCo con cos) = mkAxiomCo con $! go_cos cos
- go (AppCo co arg) = (mkAppCo $! go co) $! go arg
+ go (Refl ty) = mkNomReflCo $!! go_ty ty
+ go (GRefl r ty mco) = mkGReflCo r $!! go_ty ty $!! go_mco mco
+ go (TyConAppCo r tc args)= mkTyConAppCo r tc $!! go_cos args
+ go (AxiomCo con cos) = mkAxiomCo con $!! go_cos cos
+ go (AppCo co arg) = mkAppCo $!! go co $!! go arg
go (ForAllCo { fco_tcv = tcv, fco_visL = visL, fco_visR = visR
, fco_kind = kind_co, fco_body = co })
- = ((mkForAllCo $! tcv') visL visR
- $! go_mco kind_co)
- $! subst_co subst' co
+ = (mkForAllCo $!! tcv') visL visR
+ $!! go_mco kind_co
+ $!! subst_co subst' co
where
!(subst', tcv') = substVarBndrUnchecked subst tcv
-- Unchecked because used from substTyUnchecked
- go (FunCo r afl afr w co1 co2) = ((mkFunCo2 r afl afr $! go w) $! go co1) $! go co2
+ go (FunCo r afl afr w co1 co2) = mkFunCo2 r afl afr $!! go w $!! go co1 $!! go co2
go (CoVarCo cv) = substCoVar subst cv
go (UnivCo { uco_prov = p, uco_role = r
, uco_lty = t1, uco_rty = t2, uco_deps = deps })
- = ((((mkUnivCo $! p) $! go_cos deps) $! r) $!
- (go_ty t1)) $! (go_ty t2)
- go (SymCo co) = mkSymCo $! (go co)
- go (TransCo co1 co2) = (mkTransCo $! (go co1)) $! (go co2)
- go (SelCo d co) = mkSelCo d $! (go co)
- go (LRCo lr co) = mkLRCo lr $! (go co)
- go (InstCo co arg) = (mkInstCo $! (go co)) $! go arg
- go (KindCo co) = mkKindCo $! (go co)
- go (SubCo co) = mkSubCo $! (go co)
- go (HoleCo h) = HoleCo $! go_hole h
+ = mkUnivCo p $!! go_cos deps $!! r
+ $!! go_ty t1 $!! go_ty t2
+ go (SymCo co) = mkSymCo $!! go co
+ go (TransCo co1 co2) = mkTransCo $!! go co1 $!! go co2
+ go (SelCo d co) = mkSelCo d $!! go co
+ go (LRCo lr co) = mkLRCo lr $!! go co
+ go (InstCo co arg) = mkInstCo $!! go co $!! go arg
+ go (KindCo co) = mkKindCo $!! go co
+ go (SubCo co) = mkSubCo $!! go co
+ go (HoleCo h) = HoleCo $!! go_hole h
go_cos cos = let cos' = map go cos
in cos' `seqList` cos'
=====================================
compiler/GHC/Utils/Misc.hs
=====================================
@@ -8,7 +8,7 @@
--
module GHC.Utils.Misc (
-- * Miscellaneous higher-order functions
- applyWhen, nTimes, const2,
+ applyWhen, nTimes, const2, ($!!),
-- * General list processing
zipEqual, zipWithEqual, zipWith3Equal, zipWith4Equal,
@@ -44,8 +44,7 @@ module GHC.Utils.Misc (
mergeListsBy,
isSortedBy,
- -- Foldable generalised functions,
-
+ -- * Foldable generalised functions,
mapMaybe',
-- * Tuples
@@ -153,6 +152,8 @@ import qualified Data.Set as Set
import Data.Time
+infixl 0 $!! -- LEFT associative
+
{-
************************************************************************
* *
@@ -199,6 +200,14 @@ third3 f (a, b, c) = (a, b, f c)
uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d
uncurry3 f (a, b, c) = f a b c
+($!!) :: forall r a (b :: TYPE r). (a -> b) -> a -> b
+-- | ^ ($!!) is left-associative so you can write
+-- (f $!! e1 $!! e2) for a multi-argument strict application
+-- In contrast ($) and ($!) are right associative
+{-# INLINE ($!!) #-}
+f $!! x = let !vx = x in f vx -- see #2273
+
+
{-
************************************************************************
* *
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e180c6dc8f8141c31771b50d30c17c4…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e180c6dc8f8141c31771b50d30c17c4…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][master] Document when -maxN RTS option was added
by Marge Bot (@marge-bot) 14 Jan '26
by Marge Bot (@marge-bot) 14 Jan '26
14 Jan '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
d0254579 by Andrew Lelechenko at 2026-01-14T03:56:53-05:00
Document when -maxN RTS option was added
- - - - -
1 changed file:
- docs/users_guide/using-concurrent.rst
Changes:
=====================================
docs/users_guide/using-concurrent.rst
=====================================
@@ -112,7 +112,7 @@ use the RTS :rts-flag:`-N ⟨x⟩` options.
.. rts-flag:: -N ⟨x⟩
-N
- -maxN ⟨x⟩
+ -maxN ⟨x⟩ :since: 8.0
Use ⟨x⟩ simultaneous threads when running the program.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d0254579799c8cc3885179c58b8d204…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d0254579799c8cc3885179c58b8d204…
You're receiving this email because of your account on gitlab.haskell.org.
1
0