...
 
Commits (239)
--command ./hadrian/ghci.sh
--command sh ./hadrian/ghci.sh
--reload compiler
--reload ghc
--reload includes
......
......@@ -31,6 +31,7 @@ Thumbs.db
*.dyn_o
*.dyn_hi
__pycache__
.mypy_cache
*.SYMDEF*
log
......@@ -50,6 +51,9 @@ stage0
stage1
stage2
_build
*/generated/
*/ghc-stage1
.shake.*
.hadrian_ghci
# -----------------------------------------------------------------------------
......@@ -142,7 +146,6 @@ _darcs/
/libraries/frames.html
/libraries/ghc-boot/GNUmakefile
/libraries/ghc-boot/ghc-boot.cabal
/libraries/ghc-boot/ghc.mk
/libraries/ghc-boot-th/GNUmakefile
/libraries/ghc-boot-th/ghc-boot-th.cabal
/libraries/ghc-boot-th/ghc.mk
......@@ -221,5 +224,12 @@ GIT_COMMIT_ID
# ghc.nix
ghc.nix/
# gdb
.gdb_history
.gdbinit
# Tooling - direnv
.envrc
# Tooling - vscode
.vscode
......@@ -2,7 +2,7 @@ variables:
GIT_SSL_NO_VERIFY: "1"
# Commit of ghc/ci-images repository from which to pull Docker images
DOCKER_REV: 88e952f165f48cfb956ac9a2486a9263aa4f777c
DOCKER_REV: e517150438cd9df9564fb91adc4b42e2667b2bc1
# Sequential version number capturing the versions of all tools fetched by
# .gitlab/win32-init.sh.
......@@ -12,7 +12,6 @@ variables:
GIT_DEPTH: 0
before_script:
- python3 .gitlab/fix-submodules.py
- git submodule sync --recursive
- git submodule update --init --recursive
- git checkout .gitmodules
......@@ -24,7 +23,7 @@ stages:
- full-build # Build all the things
- cleanup # See Note [Cleanup after the shell executor]
- packaging # Source distribution, etc.
- hackage # head.hackage testing
- testing # head.hackage correctness and compiler performance testing
- deploy # push documentation
# N.B.Don't run on wip/ branches, instead on run on merge requests.
......@@ -71,6 +70,7 @@ ghc-linters:
refs:
- merge_requests
# Run mypy Python typechecker on linter scripts.
lint-linters:
<<: *only-default
stage: lint
......@@ -81,6 +81,7 @@ lint-linters:
tags:
- lint
# Check that .T files all parse by listing broken tests.
lint-testsuite:
<<: *only-default
stage: lint
......@@ -91,6 +92,17 @@ lint-testsuite:
tags:
- lint
# Run mypy Python typechecker on testsuite driver
typecheck-testsuite:
<<: *only-default
stage: lint
image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
script:
- mypy testsuite/driver/runtests.py
dependencies: []
tags:
- lint
# We allow the submodule checker to fail when run on merge requests (to
# accomodate, e.g., haddock changes not yet upstream) but not on `master` or
# Marge jobs.
......@@ -103,7 +115,8 @@ lint-testsuite:
- base="$(git merge-base FETCH_HEAD $CI_COMMIT_SHA)"
- "echo Linting submodule changes between $base..$CI_COMMIT_SHA"
- git submodule foreach git remote update
- submodchecker .git $(git rev-list $base..$CI_COMMIT_SHA)
# TODO: Fix submodule linter
- submodchecker .git $(git rev-list $base..$CI_COMMIT_SHA) || true
dependencies: []
tags:
- lint
......@@ -114,7 +127,7 @@ lint-submods-marge:
refs:
- merge_requests
variables:
- $CI_MERGE_REQUEST_LABELS =~ /.*wip/marge_bot_batch_merge_job.*/
- "$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/"
lint-submods-mr:
extends: .lint-submods
......@@ -126,7 +139,7 @@ lint-submods-mr:
- merge_requests
except:
variables:
- $CI_MERGE_REQUEST_LABELS =~ /.*wip/marge_bot_batch_merge_job.*/
- "$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/"
lint-submods-branch:
extends: .lint-submods
......@@ -203,7 +216,6 @@ validate-x86_64-linux-deb9-hadrian:
before_script:
# workaround for docker permissions
- sudo chown ghc:ghc -R .
- python3 .gitlab/fix-submodules.py
- git submodule sync --recursive
- git submodule update --init --recursive
- git checkout .gitmodules
......@@ -218,7 +230,6 @@ hadrian-ghc-in-ghci:
before_script:
# workaround for docker permissions
- sudo chown ghc:ghc -R .
- python3 .gitlab/fix-submodules.py
- git submodule sync --recursive
- git submodule update --init --recursive
- git checkout .gitmodules
......@@ -299,7 +310,6 @@ validate-x86_64-darwin:
TEST_ENV: "x86_64-darwin"
before_script:
- git clean -xdf && git submodule foreach git clean -xdf
- python3 .gitlab/fix-submodules.py
- git submodule sync --recursive
- git submodule update --init --recursive
- git checkout .gitmodules
......@@ -333,7 +343,6 @@ validate-x86_64-darwin:
TEST_ENV: "x86_64-darwin"
before_script:
- git clean -xdf && git submodule foreach git clean -xdf
- python3 .gitlab/fix-submodules.py
- git submodule sync --recursive
- git submodule update --init --recursive
- git checkout .gitmodules
......@@ -365,7 +374,6 @@ validate-x86_64-darwin:
- x86_64-linux
before_script:
- git clean -xdf && git submodule foreach git clean -xdf
- python3 .gitlab/fix-submodules.py
- git submodule sync --recursive
- git submodule update --init --recursive
- git checkout .gitmodules
......@@ -490,6 +498,10 @@ validate-x86_64-linux-deb9-debug:
stage: build
variables:
BUILD_FLAVOUR: validate
# Ensure that stage2 also has DEBUG enabled
ValidateSpeed: SLOW
# Override validate flavour default; see #16890.
BUILD_SPHINX_PDF: "YES"
TEST_TYPE: slowtest
TEST_ENV: "x86_64-linux-deb9-debug"
artifacts:
......@@ -580,7 +592,7 @@ release-x86_64-linux-deb8:
# x86_64-linux-alpine
#################################
release-x86_64-linux-alpine:
.build-x86_64-linux-alpine:
extends: .validate-linux
stage: full-build
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-alpine:$DOCKER_REV"
......@@ -592,14 +604,23 @@ release-x86_64-linux-alpine:
BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-alpine-linux.tar.xz"
# Can't use ld.gold due to #13958.
CONFIGURE_ARGS: "--disable-ld-override"
only:
- tags
cache:
key: linux-x86_64-alpine
artifacts:
when: always
expire_in: 2 week
release-x86_64-linux-alpine:
extends: .build-x86_64-linux-alpine
only:
- tags
nightly-x86_64-linux-alpine:
extends: .build-x86_64-linux-alpine
only:
variables:
- $NIGHTLY
#################################
# x86_64-linux-centos7
#################################
......@@ -657,7 +678,6 @@ validate-x86_64-linux-fedora27:
set TEMP=%cd%\tmp
- set PATH=C:\msys64\usr\bin;%PATH%
- python .gitlab/fix-submodules.py
- git submodule sync --recursive
- git submodule update --init --recursive
- git checkout .gitmodules
......@@ -671,6 +691,7 @@ validate-x86_64-linux-fedora27:
variables:
FORCE_SYMLINKS: 1
LANG: "en_US.UTF-8"
SPHINXBUILD: "/mingw64/bin/sphinx-build.exe"
cache:
paths:
- cabal-cache
......@@ -690,14 +711,19 @@ validate-x86_64-linux-fedora27:
bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex'
- bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --flavour=Quick --docs=no-sphinx binary-dist"
- mv _build/bindist/ghc*.tar.xz ghc.tar.xz
# FIXME: Testsuite disabled due to #16156.
# - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
- bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh` --flavour=quick test --summary-junit=./junit.xml --skip-perf"
# skipping perf tests for now since we build a quick-flavoured GHC,
# which might result in some broken perf tests?
tags:
- x86_64-windows
artifacts:
reports:
junit: junit.xml
expire_in: 2 week
when: always
paths:
- ghc.tar.xz
- junit.xml
validate-x86_64-windows-hadrian:
extends: .build-windows-hadrian
......@@ -839,7 +865,7 @@ doc-tarball:
stage: packaging
tags:
- x86_64-linux
image: ghcci/x86_64-linux-deb9:0.2
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
dependencies:
- validate-x86_64-linux-deb9-debug
- validate-x86_64-windows
......@@ -874,7 +900,7 @@ source-tarball:
stage: packaging
tags:
- x86_64-linux
image: ghcci/x86_64-linux-deb9:0.2
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
dependencies: []
only:
- tags
......@@ -888,7 +914,9 @@ source-tarball:
- ./configure
- make sdist
- mv sdistprep/*.xz .
- make show VALUE=version > version
- make show! --quiet VALUE=ProjectVersion > version
- source version
- echo "$ProjectVersion" > version
############################################################
......@@ -903,7 +931,7 @@ source-tarball:
.hackage:
<<: *only-default
stage: hackage
stage: testing
image: ghcci/x86_64-linux-deb9:0.2
tags:
- x86_64-linux
......@@ -929,6 +957,47 @@ nightly-hackage:
variables:
- $NIGHTLY
############################################################
# Nofib testing
############################################################
perf-nofib:
stage: testing
dependencies:
- release-x86_64-linux-deb9-dwarf
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
only:
refs:
- merge_requests
- master
- /ghc-[0-9]+\.[0-9]+/
tags:
- x86_64-linux
script:
- root=$(pwd)/ghc
- |
mkdir tmp
tar -xf ghc-*-x86_64-unknown-linux.tar.xz -C tmp
pushd tmp/ghc-*/
./configure --prefix=$root
make install
popd
rm -Rf tmp
- export BOOT_HC=$(which ghc)
- cabal update; cabal install -w $BOOT_HC regex-compat
- export PATH=$root/bin:$PATH
- make -C nofib boot mode=fast -j$CPUS
- "make -C nofib EXTRA_RUNTEST_OPTS='-cachegrind +RTS -V0 -RTS' NoFibRuns=1 mode=fast -j$CPUS 2>&1 | tee nofib.log"
artifacts:
expire_in: 12 week
when: always
paths:
- nofib.log
############################################################
# Documentation deployment via GitLab Pages
############################################################
pages:
stage: deploy
dependencies:
......
#!/usr/bin/env python3
"""
Fix submodule upstream URLs. This ensures that CI builds of GHC forks
clone their submodules from its usual location. Otherwise users would need to
fork all submodules before their CI builds would succeed.
"""
from pathlib import Path
import re
x = open('.gitmodules').read()
x = re.sub(r"url *= *\.\.", "url = https://gitlab.haskell.org/ghc", x)
open('.gitmodules', 'w').write(x)
import subprocess
def get_configs(config_file):
args = ['git', 'config', '-f', config_file.as_posix(), '--list']
out = subprocess.check_output(args)
configs = {}
for line in out.decode('UTF-8').split('\n'):
if '=' in line:
k,v = line.split('=')
configs[k] = v
return configs
def set_config(config_file, key, value):
args = ['git', 'config', '-f', config_file.as_posix(), '--replace', key, value]
subprocess.check_call(args)
upstreams = {
'utils/haddock': 'https://github.com/haskell/haddock'
}
modules_config = Path('.gitmodules')
def main():
for k,v in get_configs(modules_config).items():
match = re.match('submodule\.(.+)\.url', k)
if match is not None:
submod = match.group(1)
if submod in upstreams:
url = upstreams[submod]
else:
url = re.sub('\.\.', 'https://gitlab.haskell.org/ghc', v)
print('Using {submod} from {url}'.format(submod=submod, url=url))
set_config(modules_config, k, url)
if __name__ == '__main__':
main()
# Summary
## Summary
Write a brief description of the issue.
# Steps to reproduce
## Steps to reproduce
Please provide a set of concrete steps to reproduce the issue.
# Expected behavior
## Expected behavior
What do you expect the reproducer described above to do?
# Environment
## Environment
* GHC version used:
......
# Motivation
## Motivation
Briefly describe the problem your proposal solves and why this problem should
be solved.
# Proposal
## Proposal
Describe your proposed feature here.
......
......@@ -3,6 +3,7 @@
# A linter to warn for ASSERT macros which are separated from their argument
# list by a space, which Clang's CPP barfs on
from pathlib import Path
from linter import run_linters, RegexpLinter
linters = [
......@@ -20,5 +21,11 @@ linters = [
message='`#if !defined(x)` is preferred to `#ifndef x`'),
]
for l in linters:
# Need do document rules!
l.add_path_filter(lambda path: path != Path('docs', 'coding-style.html'))
# Don't lint vendored code
l.add_path_filter(lambda path: not path.name == 'config.guess')
if __name__ == '__main__':
run_linters(linters)
......@@ -13,7 +13,7 @@ from linter import run_linters, RegexpLinter
linters = [
RegexpLinter(r'--interactive',
message = "Warning: Use `$(TEST_HC_OPTS_INTERACTIVE)` instead of `--interactive -ignore-dot-ghci -v0`."
).add_path_filter(lambda path: path.suffix == '.T')
).add_path_filter(lambda path: path.name == 'Makefile')
]
if __name__ == '__main__':
......
......@@ -22,8 +22,9 @@ fi
curl --silent --show-error \
--request POST \
-F "token=$HEAD_HACKAGE_TRIGGER_TOKEN" \
-F "ref=gitlab-ci-nix" \
-F "ref=master" \
-F "variables[GHC_PIPELINE_ID]=$CI_PIPELINE_ID" \
-F "variables[EXTRA_HC_OPTS]=-dcore-lint" \
https://gitlab.haskell.org/api/v4/projects/$HEAD_HACKAGE_PROJECT_ID/trigger/pipeline \
| tee resp.json
......
[submodule "libraries/binary"]
path = libraries/binary
url = ../packages/binary.git
url = https://gitlab.haskell.org/ghc/packages/binary.git
ignore = untracked
[submodule "libraries/bytestring"]
path = libraries/bytestring
url = ../packages/bytestring.git
url = https://gitlab.haskell.org/ghc/packages/bytestring.git
ignore = untracked
[submodule "libraries/Cabal"]
path = libraries/Cabal
url = ../packages/Cabal.git
url = https://gitlab.haskell.org/ghc/packages/Cabal.git
ignore = untracked
[submodule "libraries/containers"]
path = libraries/containers
url = ../packages/containers.git
url = https://gitlab.haskell.org/ghc/packages/containers.git
ignore = untracked
[submodule "libraries/haskeline"]
path = libraries/haskeline
url = ../packages/haskeline.git
url = https://gitlab.haskell.org/ghc/packages/haskeline.git
ignore = untracked
[submodule "libraries/pretty"]
path = libraries/pretty
url = ../packages/pretty.git
url = https://gitlab.haskell.org/ghc/packages/pretty.git
ignore = untracked
[submodule "libraries/terminfo"]
path = libraries/terminfo
url = ../packages/terminfo.git
url = https://gitlab.haskell.org/ghc/packages/terminfo.git
ignore = untracked
[submodule "libraries/transformers"]
path = libraries/transformers
url = ../packages/transformers.git
url = https://gitlab.haskell.org/ghc/packages/transformers.git
ignore = untracked
[submodule "libraries/xhtml"]
path = libraries/xhtml
url = ../packages/xhtml.git
url = https://gitlab.haskell.org/ghc/packages/xhtml.git
ignore = untracked
[submodule "libraries/Win32"]
path = libraries/Win32
url = ../packages/Win32.git
url = https://gitlab.haskell.org/ghc/packages/Win32.git
ignore = untracked
[submodule "libraries/time"]
path = libraries/time
url = ../packages/time.git
url = https://gitlab.haskell.org/ghc/packages/time.git
ignore = untracked
[submodule "libraries/array"]
path = libraries/array
url = ../packages/array.git
url = https://gitlab.haskell.org/ghc/packages/array.git
ignore = untracked
[submodule "libraries/deepseq"]
path = libraries/deepseq
url = ../packages/deepseq.git
url = https://gitlab.haskell.org/ghc/packages/deepseq.git
ignore = untracked
[submodule "libraries/directory"]
path = libraries/directory
url = ../packages/directory.git
url = https://gitlab.haskell.org/ghc/packages/directory.git
ignore = untracked
[submodule "libraries/filepath"]
path = libraries/filepath
url = ../packages/filepath.git
url = https://gitlab.haskell.org/ghc/packages/filepath.git
ignore = untracked
[submodule "libraries/hpc"]
path = libraries/hpc
url = ../packages/hpc.git
url = https://gitlab.haskell.org/ghc/packages/hpc.git
ignore = untracked
[submodule "libraries/parsec"]
path = libraries/parsec
url = ../packages/parsec.git
url = https://gitlab.haskell.org/ghc/packages/parsec.git
ignore = untracked
[submodule "libraries/text"]
path = libraries/text
url = ../packages/text.git
url = https://gitlab.haskell.org/ghc/packages/text.git
ignore = untracked
[submodule "libraries/mtl"]
path = libraries/mtl
url = ../packages/mtl.git
url = https://gitlab.haskell.org/ghc/packages/mtl.git
ignore = untracked
[submodule "libraries/process"]
path = libraries/process
url = ../packages/process.git
url = https://gitlab.haskell.org/ghc/packages/process.git
ignore = untracked
[submodule "libraries/unix"]
path = libraries/unix
url = ../packages/unix.git
url = https://gitlab.haskell.org/ghc/packages/unix.git
ignore = untracked
branch = 2.7
[submodule "libraries/stm"]
path = libraries/stm
url = ../packages/stm.git
url = https://gitlab.haskell.org/ghc/packages/stm.git
ignore = untracked
[submodule "utils/haddock"]
path = utils/haddock
url = ../haddock.git
url = https://github.com/haskell/haddock.git
ignore = untracked
branch = ghc-head
[submodule "nofib"]
path = nofib
url = ../nofib.git
url = https://gitlab.haskell.org/ghc/nofib.git
ignore = untracked
[submodule "utils/hsc2hs"]
path = utils/hsc2hs
url = ../hsc2hs.git
url = https://gitlab.haskell.org/ghc/hsc2hs.git
ignore = untracked
[submodule "libffi-tarballs"]
path = libffi-tarballs
url = ../libffi-tarballs.git
url = https://gitlab.haskell.org/ghc/libffi-tarballs.git
ignore = untracked
[submodule "gmp-tarballs"]
path = libraries/integer-gmp/gmp/gmp-tarballs
url = ../gmp-tarballs.git
url = https://gitlab.haskell.org/ghc/gmp-tarballs.git
......@@ -17,6 +17,7 @@
# The compiler
/compiler/parser/ @int-index
/compiler/hsSyn/ @simonpj @rae
/compiler/typecheck/ @simonpj @rae
/compiler/rename/ @simonpj @rae
/compiler/types/ @simonpj @rae
......
......@@ -2112,7 +2112,8 @@ AC_DEFUN([XCODE_VERSION],[
# FIND_LLVM_PROG()
# --------------------------------
# Find where the llvm tools are. We have a special function to handle when they
# are installed with a version suffix (e.g., llc-3.1).
# are installed with a version suffix (e.g., llc-7, llc-7.0) and without (e.g.
# llc).
#
# $1 = the variable to set
# $2 = the command to look for
......@@ -2120,7 +2121,7 @@ AC_DEFUN([XCODE_VERSION],[
#
AC_DEFUN([FIND_LLVM_PROG],[
# Test for program with and without version name.
AC_CHECK_TOOLS([$1], [$2-$3 $2], [:])
AC_CHECK_TOOLS([$1], [$2-$3 $2-$3.0 $2], [:])
if test "$$1" != ":"; then
AC_MSG_CHECKING([$$1 is version $3])
if test `$$1 --version | grep -c "version $3"` -gt 0 ; then
......
......@@ -16,6 +16,11 @@ parser.add_argument('--validate', action='store_true', help='Run in validate mod
parser.add_argument('--hadrian', action='store_true', help='Do not assume the make base build system')
args = parser.parse_args()
# Packages whose libraries aren't in the submodule root
EXCEPTIONS = {
'libraries/containers/': 'libraries/containers/containers/'
}
def print_err(s):
print(dedent(s), file=sys.stderr)
......@@ -78,7 +83,7 @@ def check_boot_packages():
# but in an lndir tree we avoid making .git directories,
# so it doesn't exist. We therefore require that every repo
# has a LICENSE file instead.
license_path = os.path.join(dir_, 'LICENSE')
license_path = os.path.join(EXCEPTIONS.get(dir_+'/', dir_), 'LICENSE')
if not os.path.isfile(license_path):
die("""\
Error: %s doesn't exist
......@@ -91,9 +96,12 @@ def boot_pkgs():
for package in glob.glob("libraries/*/"):
packages_file = os.path.join(package, 'ghc-packages')
print(package)
if os.path.isfile(packages_file):
for subpkg in open(packages_file, 'r'):
library_dirs.append(os.path.join(package, subpkg.strip()))
elif package in EXCEPTIONS:
library_dirs.append(EXCEPTIONS[package])
else:
library_dirs.append(package)
......@@ -118,6 +126,9 @@ def boot_pkgs():
top = os.path.join(*['..'] * len(os.path.normpath(package).split(os.path.sep)))
ghc_mk = os.path.join(package, 'ghc.mk')
if os.path.exists(ghc_mk):
print('Skipping %s which already exists' % ghc_mk)
continue
print('Creating %s' % ghc_mk)
with open(ghc_mk, 'w') as f:
f.write(dedent(
......
#!/usr/bin/env nix-shell
#! nix-shell -i bash shell.nix
# This script sets up the build environment by invoking nix-shell shell.nix
# and then runs the hadrian executable.
function rl {
TARGET_FILE="$1"
cd "$(dirname "$TARGET_FILE")"
TARGET_FILE="$(basename "$TARGET_FILE")"
# Iterate down a (possible) chain of symlinks
while [ -L "$TARGET_FILE" ]
do
TARGET_FILE="$(readlink "$TARGET_FILE")"
cd "$(dirname "$TARGET_FILE")"
TARGET_FILE="$(basename "$TARGET_FILE")"
done
# Compute the canonicalized name by finding the physical path
# for the directory we're in and appending the target file.
PHYS_DIR="$(pwd -P)"
RESULT="$PHYS_DIR/$TARGET_FILE"
echo "$RESULT"
}
absoluteRoot="$(dirname "$(rl "$0")")"
echo $absoluteRoot
cd "$absoluteRoot"
hadrian \
--directory="$absoluteRoot/.." \
"$@"
......@@ -12,7 +12,7 @@ you will screw up the layout where they are used in case expressions!
/* Useful in the headers that we share with the RTS */
#define COMPILING_GHC 1
/* Pull in all the platform defines for this build (foo_TARGET_ARCH etc.) */
/* Pull in all the platform defines for this build (foo_HOST_ARCH etc.) */
#include "ghc_boot_platform.h"
/* Pull in the autoconf defines (HAVE_FOO), but don't include
......
......@@ -524,9 +524,17 @@ hasNoBinding :: Id -> Bool
-- Data constructor workers used to be things of this kind, but
-- they aren't any more. Instead, we inject a binding for
-- them at the CorePrep stage.
--
-- 'PrimOpId's also used to be of this kind. See Note [Primop wrappers] in PrimOp.hs.
-- for the history of this.
--
-- Note that CorePrep currently eta expands things no-binding things and this
-- can cause quite subtle bugs. See Note [Eta expansion of hasNoBinding things
-- in CorePrep] in CorePrep for details.
--
-- EXCEPT: unboxed tuples, which definitely have no binding
hasNoBinding id = case Var.idDetails id of
PrimOpId _ -> True -- See Note [Primop wrappers]
PrimOpId _ -> False -- See Note [Primop wrappers] in PrimOp.hs
FCallId _ -> True
DataConWorkId dc -> isUnboxedTupleCon dc || isUnboxedSumCon dc
_ -> isCompulsoryUnfolding (idUnfolding id)
......@@ -570,19 +578,6 @@ The easiest way to do this is for hasNoBinding to return True of all things
that have compulsory unfolding. Some Ids with a compulsory unfolding also
have a binding, but it does not harm to say they don't here, and its a very
simple way to fix #14561.
Note [Primop wrappers]
~~~~~~~~~~~~~~~~~~~~~~
Currently hasNoBinding claims that PrimOpIds don't have a curried
function definition. But actually they do, in GHC.PrimopWrappers,
which is auto-generated from prelude/primops.txt.pp. So actually, hasNoBinding
could return 'False' for PrimOpIds.
But we'd need to add something in CoreToStg to swizzle any unsaturated
applications of GHC.Prim.plusInt# to GHC.PrimopWrappers.plusInt#.
Nota Bene: GHC.PrimopWrappers is needed *regardless*, because it's
used by GHCi, which does not implement primops direct at all.
-}
isDeadBinder :: Id -> Bool
......
......@@ -61,7 +61,7 @@ import BasicTypes
import Binary
import Constants
import DynFlags
import Platform
import GHC.Platform
import UniqFM
import Util
......@@ -309,13 +309,11 @@ Int/Word range.
wrapLitNumber :: DynFlags -> Literal -> Literal
wrapLitNumber dflags v@(LitNumber nt i t) = case nt of
LitNumInt -> case platformWordSize (targetPlatform dflags) of
4 -> LitNumber nt (toInteger (fromIntegral i :: Int32)) t
8 -> LitNumber nt (toInteger (fromIntegral i :: Int64)) t
w -> panic ("wrapLitNumber: Unknown platformWordSize: " ++ show w)
PW4 -> LitNumber nt (toInteger (fromIntegral i :: Int32)) t