Commit 33792bb0 authored by John Ericson's avatar John Ericson

Merge remote-tracking branch 'origin/master' into decl-invisible-params

parents 350b705d a1a75aa9
......@@ -307,16 +307,20 @@ hadrian-ghc-in-ghci:
- .gitlab/ci.sh setup
- cabal update
- cd hadrian; cabal new-build -j`../mk/detect-cpu-count.sh` --with-compiler=$GHC --project-file=ci.project; cd ..
after_script:
- cp -Rf $HOME/.cabal cabal-cache
variables:
GHC_FLAGS: -Werror
cache:
key: lint
paths:
- cabal-cache
lint-base:
extends: .lint-params
script:
- hadrian/build -c -j stage1:lib:base
- hadrian/build -j lint:base
cache:
key: lint
############################################################
# Validation via Pipelines (make)
......@@ -524,6 +528,14 @@ validate-x86_64-darwin:
tags:
- aarch64-linux
.build-aarch64-linux-deb10-llvm:
extends: .build-aarch64-linux-deb10
stage: full-build
variables:
BUILD_FLAVOUR: perf-llvm
tags:
- aarch64-linux
validate-aarch64-linux-deb10:
extends: .build-aarch64-linux-deb10
artifacts:
......@@ -647,22 +659,6 @@ validate-x86_64-linux-deb9-debug:
when: always
expire_in: 2 week
# Disabled to alleviate CI load
.validate-x86_64-linux-deb9-llvm:
extends: .build-x86_64-linux-deb9
stage: full-build
variables:
BUILD_FLAVOUR: perf-llvm
TEST_ENV: "x86_64-linux-deb9-llvm"
nightly-x86_64-linux-deb9-llvm:
<<: *nightly
extends: .build-x86_64-linux-deb9
stage: full-build
variables:
BUILD_FLAVOUR: perf-llvm
TEST_ENV: "x86_64-linux-deb9-llvm"
validate-x86_64-linux-deb9-integer-simple:
extends: .build-x86_64-linux-deb9
stage: full-build
......@@ -681,6 +677,25 @@ nightly-x86_64-linux-deb9-integer-simple:
TEST_ENV: "x86_64-linux-deb9-integer-simple"
TEST_TYPE: slowtest
.build-x86_64-linux-deb9-tsan:
extends: .validate-linux-hadrian
stage: full-build
variables:
TEST_ENV: "x86_64-linux-deb9-tsan"
BUILD_FLAVOUR: "thread-sanitizer"
TSAN_OPTIONS: "suppressions=$CI_PROJECT_DIR/rts/.tsan-suppressions"
# Haddock is large enough to make TSAN choke without massive quantities of
# memory.
HADRIAN_ARGS: "--docs=none"
nightly-x86_64-linux-deb9-tsan:
<<: *nightly
extends: .build-x86_64-linux-deb9-tsan
validate-x86_64-linux-deb9-tsan:
extends: .build-x86_64-linux-deb9-tsan
when: manual
validate-x86_64-linux-deb9-dwarf:
extends: .build-x86_64-linux-deb9
stage: full-build
......@@ -719,6 +734,32 @@ release-x86_64-linux-deb10:
<<: *release
extends: .build-x86_64-linux-deb10
release-x86_64-linux-deb10-dwarf:
<<: *release
extends: .build-x86_64-linux-deb10
variables:
CONFIGURE_ARGS: "--enable-dwarf-unwind"
BUILD_FLAVOUR: dwarf
TEST_ENV: "x86_64-linux-deb10-dwarf"
BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-deb10-linux-dwarf.tar.xz"
validate-x86_64-linux-deb10-llvm:
extends: .build-x86_64-linux-deb10
stage: full-build
rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*LLVM backend.*/'
variables:
BUILD_FLAVOUR: perf-llvm
TEST_ENV: "x86_64-linux-deb10-llvm"
nightly-x86_64-linux-deb10-llvm:
<<: *nightly
extends: .build-x86_64-linux-deb10
stage: full-build
variables:
BUILD_FLAVOUR: perf-llvm
TEST_ENV: "x86_64-linux-deb10-llvm"
#################################
# x86_64-linux-ubuntu 20.04
#################################
......@@ -834,7 +875,7 @@ release-x86_64-linux-centos7:
# x86_64-linux-fedora27
#################################
validate-x86_64-linux-fedora27:
.build-x86_64-linux-fedora27:
extends: .validate-linux
stage: full-build
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-fedora27:$DOCKER_REV"
......@@ -843,7 +884,6 @@ validate-x86_64-linux-fedora27:
LLC: /bin/false
OPT: /bin/false
TEST_ENV: "x86_64-linux-fedora27"
BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-fedora27-linux.tar.xz"
cache:
key: linux-x86_64-fedora27
artifacts:
......@@ -852,6 +892,20 @@ validate-x86_64-linux-fedora27:
# longer.
expire_in: 8 week
validate-x86_64-linux-fedora27:
extends: .build-x86_64-linux-fedora27
variables:
BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-fedora27-linux.tar.xz"
release-x86_64-linux-fedora27-dwarf:
<<: *release
extends: .build-x86_64-linux-fedora27
variables:
CONFIGURE_ARGS: "--enable-dwarf-unwind"
BUILD_FLAVOUR: dwarf
BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-fedora27-linux-dwarf.tar.xz"
TEST_ENV: "x86_64-linux-fedora27-dwarf"
############################################################
# Validation via Pipelines (Windows)
############################################################
......
......@@ -2,6 +2,8 @@
# shellcheck disable=SC2230
# This is the primary driver of the GitLab CI infrastructure.
# Run `ci.sh usage` for usage information.
set -e -o pipefail
......@@ -17,6 +19,62 @@ fi
source $TOP/.gitlab/common.sh
function usage() {
cat <<EOF
$0 - GHC continuous integration driver
Common Modes:
usage Show this usage message.
setup Prepare environment for a build.
configure Run ./configure.
clean Clean the tree
shell Run an interactive shell with a configured build environment.
Make build system:
build_make Build GHC via the make build system
test_make Test GHC via the make build system
Hadrian build system
build_hadrian Build GHC via the Hadrian build system
test_hadrian Test GHC via the Hadrian build system
Environment variables affecting both build systems:
VERBOSE Set to non-empty for verbose build output
MSYSTEM (Windows-only) Which platform to build form (MINGW64 or MINGW32).
Environment variables determining build configuration of Make system:
BUILD_FLAVOUR Which flavour to build.
BUILD_SPHINX_HTML Whether to build Sphinx HTML documentation.
BUILD_SPHINX_PDF Whether to build Sphinx PDF documentation.
INTEGER_LIBRARY Which integer library to use (integer-simple or integer-gmp).
HADDOCK_HYPERLINKED_SOURCES
Whether to build hyperlinked Haddock sources.
TEST_TYPE Which test rule to run.
Environment variables determining build configuration of Hadrian system:
BUILD_FLAVOUR Which flavour to build.
Environment variables determining bootstrap toolchain (Linux):
GHC Path of GHC executable to use for bootstrapping.
CABAL Path of cabal-install executable to use for bootstrapping.
ALEX Path of alex executable to use for bootstrapping.
HAPPY Path of alex executable to use for bootstrapping.
Environment variables determining bootstrap toolchain (non-Linux):
GHC_VERSION Which GHC version to fetch for bootstrapping.
CABAL_INSTALL_VERSION
Cabal-install version to fetch for bootstrapping.
EOF
}
function setup_locale() {
# Musl doesn't provide locale support at all...
if ! which locale > /dev/null; then
......@@ -341,6 +399,11 @@ function build_make() {
if [[ -z "$BIN_DIST_PREP_TAR_COMP" ]]; then
fail "BIN_DIST_PREP_TAR_COMP is not set"
fi
if [[ -n "$VERBOSE" ]]; then
MAKE_ARGS="$MAKE_ARGS V=1"
else
MAKE_ARGS="$MAKE_ARGS V=0"
fi
echo "include mk/flavours/${BUILD_FLAVOUR}.mk" > mk/build.mk
echo 'GhcLibHcOpts+=-haddock' >> mk/build.mk
......@@ -434,6 +497,7 @@ function clean() {
function run_hadrian() {
if [ -z "$BIGNUM_BACKEND" ]; then BIGNUM_BACKEND="gmp"; fi
if [ -n "$VERBOSE" ]; then HADRIAN_ARGS="$HADRIAN_ARGS -V"; fi
run hadrian/build-cabal \
--flavour="$BUILD_FLAVOUR" \
-j"$cores" \
......@@ -476,6 +540,7 @@ esac
set_toolchain_paths
case $1 in
usage) usage ;;
setup) setup && cleanup_submodules ;;
configure) configure ;;
build_make) build_make ;;
......
......@@ -118,7 +118,7 @@ AC_DEFUN([FPTOOLS_SET_PLATFORM_VARS],
GHC_CONVERT_OS([$target_os], [$TargetArch], [TargetOS])
fi
GHC_LLVM_TARGET([$target_cpu],[$target_vendor],[$target_os],[LlvmTarget])
GHC_LLVM_TARGET([$target],[$target_cpu],[$target_vendor],[$target_os],[LlvmTarget])
GHC_SELECT_FILE_EXTENSIONS([$host], [exeext_host], [soext_host])
GHC_SELECT_FILE_EXTENSIONS([$target], [exeext_target], [soext_target])
......@@ -218,7 +218,7 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS],
test -z "[$]2" || eval "[$]2=\"ArchARM \$ARM_ISA \$ARM_ISA_EXT \$ARM_ABI\""
;;
aarch64)
test -z "[$]2" || eval "[$]2=ArchARM64"
test -z "[$]2" || eval "[$]2=ArchAArch64"
;;
alpha)
test -z "[$]2" || eval "[$]2=ArchAlpha"
......@@ -327,9 +327,14 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS],
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([], [__asm__ (".subsections_via_symbols");])],
[AC_MSG_RESULT(yes)
TargetHasSubsectionsViaSymbols=YES
AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1],
if test x"$TargetArch" = xaarch64; then
dnl subsections via symbols is busted on arm64
TargetHasSubsectionsViaSymbols=NO
else
TargetHasSubsectionsViaSymbols=YES
AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1],
[Define to 1 if Apple-style dead-stripping is supported.])
fi
],
[TargetHasSubsectionsViaSymbols=NO
AC_MSG_RESULT(no)])
......@@ -1976,7 +1981,7 @@ AC_MSG_CHECKING(for path to top of build tree)
# `libraries/base/System/Info.hs`'s documentation.
AC_DEFUN([GHC_CONVERT_CPU],[
case "$1" in
aarch64*)
aarch64*|arm64*)
$2="aarch64"
;;
alpha*)
......@@ -2058,18 +2063,19 @@ case "$1" in
esac
])
# GHC_LLVM_TARGET(target_cpu, target_vendor, target_os, llvm_target_var)
# GHC_LLVM_TARGET(target, target_cpu, target_vendor, target_os, llvm_target_var)
# --------------------------------
# converts the canonicalized target into something llvm can understand
AC_DEFUN([GHC_LLVM_TARGET], [
case "$2-$3" in
llvm_target_cpu=$2
case "$1" in
*-freebsd*-gnueabihf)
llvm_target_vendor="unknown"
llvm_target_os="freebsd-gnueabihf"
;;
hardfloat-*eabi)
*-hardfloat-*eabi)
llvm_target_vendor="unknown"
llvm_target_os="$3""hf"
llvm_target_os="$4""hf"
;;
*-mingw32|*-mingw64|*-msys)
llvm_target_vendor="unknown"
......@@ -2080,15 +2086,25 @@ AC_DEFUN([GHC_LLVM_TARGET], [
# turned into just `-linux` and fail to be found
# in the `llvm-targets` file.
*-android*|*-gnueabi*|*-musleabi*)
GHC_CONVERT_VENDOR([$2],[llvm_target_vendor])
llvm_target_os="$3"
GHC_CONVERT_VENDOR([$3],[llvm_target_vendor])
llvm_target_os="$4"
;;
# apple is a bit about their naming scheme for
# aarch64; and clang on macOS doesn't know that
# aarch64 would be arm64. So for LLVM we'll need
# to call it arm64; while we'll refer to it internally
# as aarch64 for consistency and sanity.
aarch64-apple-*|arm64-apple-*)
llvm_target_cpu="arm64"
GHC_CONVERT_VENDOR([$3],[llvm_target_vendor])
GHC_CONVERT_OS([$4],[$2],[llvm_target_os])
;;
*)
GHC_CONVERT_VENDOR([$2],[llvm_target_vendor])
GHC_CONVERT_OS([$3],[$1],[llvm_target_os])
GHC_CONVERT_VENDOR([$3],[llvm_target_vendor])
GHC_CONVERT_OS([$4],[$2],[llvm_target_os])
;;
esac
$4="$1-$llvm_target_vendor-$llvm_target_os"
$5="$llvm_target_cpu-$llvm_target_vendor-$llvm_target_os"
])
......
......@@ -215,7 +215,7 @@ module GHC (
FamInst,
-- ** Types and Kinds
Type, splitForAllTys, funResultTy,
Type, splitForAllTyCoVars, funResultTy,
pprParendType, pprTypeApp,
Kind,
PredType,
......@@ -313,6 +313,7 @@ import GHC.Driver.Monad
import GHC.Driver.Ppr
import GHC.ByteCode.Types
import GHC.Runtime.Loader
import GHC.Runtime.Eval
import GHC.Runtime.Eval.Types
import GHC.Runtime.Interpreter
......@@ -729,6 +730,8 @@ getProgramDynFlags :: GhcMonad m => m DynFlags
getProgramDynFlags = getSessionDynFlags
-- | Set the 'DynFlags' used to evaluate interactive expressions.
-- Also initialise (load) plugins.
--
-- Note: this cannot be used for changes to packages. Use
-- 'setSessionDynFlags', or 'setProgramDynFlags' and then copy the
-- 'unitState' into the interactive @DynFlags@.
......@@ -736,7 +739,22 @@ setInteractiveDynFlags :: GhcMonad m => DynFlags -> m ()
setInteractiveDynFlags dflags = do
dflags' <- checkNewDynFlags dflags
dflags'' <- checkNewInteractiveDynFlags dflags'
modifySession $ \h -> h{ hsc_IC = (hsc_IC h) { ic_dflags = dflags'' }}
modifySessionM $ \hsc_env0 -> do
let ic0 = hsc_IC hsc_env0
-- Initialise (load) plugins in the interactive environment with the new
-- DynFlags
plugin_env <- liftIO $ initializePlugins $ mkInteractiveHscEnv $
hsc_env0 { hsc_IC = ic0 { ic_dflags = dflags'' }}
-- Update both plugins cache and DynFlags in the interactive context.
return $ hsc_env0
{ hsc_IC = ic0
{ ic_plugins = hsc_plugins plugin_env
, ic_dflags = hsc_dflags plugin_env
}
}
-- | Get the 'DynFlags' used to evaluate interactive expressions.
getInteractiveDynFlags :: GhcMonad m => m DynFlags
......
......@@ -336,7 +336,7 @@ basicKnownKeyNames
-- FFI primitive types that are not wired-in.
stablePtrTyConName, ptrTyConName, funPtrTyConName,
int8TyConName, int16TyConName, int32TyConName, int64TyConName,
word16TyConName, word32TyConName, word64TyConName,
word8TyConName, word16TyConName, word32TyConName, word64TyConName,
-- Others
otherwiseIdName, inlineIdName,
......@@ -1463,7 +1463,8 @@ int32TyConName = tcQual gHC_INT (fsLit "Int32") int32TyConKey
int64TyConName = tcQual gHC_INT (fsLit "Int64") int64TyConKey
-- Word module
word16TyConName, word32TyConName, word64TyConName :: Name
word8TyConName, word16TyConName, word32TyConName, word64TyConName :: Name
word8TyConName = tcQual gHC_WORD (fsLit "Word8") word8TyConKey
word16TyConName = tcQual gHC_WORD (fsLit "Word16") word16TyConKey
word32TyConName = tcQual gHC_WORD (fsLit "Word32") word32TyConKey
word64TyConName = tcQual gHC_WORD (fsLit "Word64") word64TyConKey
......
......@@ -55,7 +55,7 @@ module GHC.Builtin.Types (
wordTyCon, wordDataCon, wordTyConName, wordTy,
-- * Word8
word8TyCon, word8DataCon, word8TyConName, word8Ty,
word8TyCon, word8DataCon, word8Ty,
-- * List
listTyCon, listTyCon_RDR, listTyConName, listTyConKey,
......@@ -251,7 +251,6 @@ wiredInTyCons = [ -- Units are not treated like other tuples, because they
, floatTyCon
, intTyCon
, wordTyCon
, word8TyCon
, listTyCon
, orderingTyCon
, maybeTyCon
......@@ -354,10 +353,9 @@ nothingDataConName = mkWiredInDataConName UserSyntax gHC_MAYBE (fsLit "Nothing")
justDataConName = mkWiredInDataConName UserSyntax gHC_MAYBE (fsLit "Just")
justDataConKey justDataCon
wordTyConName, wordDataConName, word8TyConName, word8DataConName :: Name
wordTyConName, wordDataConName, word8DataConName :: Name
wordTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Word") wordTyConKey wordTyCon
wordDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "W#") wordDataConKey wordDataCon
word8TyConName = mkWiredInTyConName UserSyntax gHC_WORD (fsLit "Word8") word8TyConKey word8TyCon
word8DataConName = mkWiredInDataConName UserSyntax gHC_WORD (fsLit "W8#") word8DataConKey word8DataCon
floatTyConName, floatDataConName, doubleTyConName, doubleDataConName :: Name
......@@ -1641,7 +1639,7 @@ word8TyCon = pcTyCon word8TyConName
(NoSourceText, fsLit "HsWord8"))) []
[word8DataCon]
word8DataCon :: DataCon
word8DataCon = pcDataCon word8DataConName [] [wordPrimTy] word8TyCon
word8DataCon = pcDataCon word8DataConName [] [word8PrimTy] word8TyCon
floatTy :: Type
floatTy = mkTyConTy floatTyCon
......
......@@ -291,8 +291,8 @@ section "Int8#"
primtype Int8#
primop Int8Extend "extendInt8#" GenPrimOp Int8# -> Int#
primop Int8Narrow "narrowInt8#" GenPrimOp Int# -> Int8#
primop Int8ExtendOp "extendInt8#" GenPrimOp Int8# -> Int#
primop Int8NarrowOp "narrowInt8#" GenPrimOp Int# -> Int8#
primop Int8NegOp "negateInt8#" GenPrimOp Int8# -> Int8#
......@@ -332,8 +332,8 @@ section "Word8#"