Cheng Shao pushed to branch wip/fix-darwin-toolchain-cruft at Glasgow Haskell Compiler / GHC
Commits:
-
52d00c05
by Simon Peyton Jones at 2026-01-07T10:24:21-05:00
-
ab0a5594
by Cheng Shao at 2026-01-07T10:25:04-05:00
-
bb3a2ba1
by Cheng Shao at 2026-01-07T10:25:44-05:00
-
7971f5dd
by Cheng Shao at 2026-01-07T10:26:26-05:00
-
4df96993
by Cheng Shao at 2026-01-07T10:27:08-05:00
-
8a3900a3
by Aaron Allen at 2026-01-07T10:27:57-05:00
-
a0b980af
by Cheng Shao at 2026-01-07T10:28:38-05:00
-
50a58757
by Cheng Shao at 2026-01-07T10:29:20-05:00
-
da40e553
by Simon Peyton Jones at 2026-01-07T10:30:00-05:00
-
d3c67758
by Cheng Shao at 2026-01-07T17:26:17+01:00
23 changed files:
- .gitlab/darwin/nix/sources.json
- .gitlab/darwin/nix/sources.nix
- .gitlab/darwin/toolchain.nix
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Iface/Recomp.hs
- hadrian/doc/flavours.md
- hadrian/src/Base.hs
- hadrian/src/Builder.hs
- hadrian/src/Flavour.hs
- hadrian/src/Hadrian/Haskell/Hash.hs
- hadrian/src/Oracles/Setting.hs
- hadrian/src/Rules/Register.hs
- hadrian/src/Settings/Flavours/Validate.hs
- llvm-targets
- + testsuite/tests/driver/recomp26705/M.hs
- + testsuite/tests/driver/recomp26705/M2A.hs
- + testsuite/tests/driver/recomp26705/M2B.hs
- + testsuite/tests/driver/recomp26705/Makefile
- + testsuite/tests/driver/recomp26705/all.T
- + testsuite/tests/driver/recomp26705/recomp26705.stderr
- + testsuite/tests/simplCore/should_compile/T26681.hs
- testsuite/tests/simplCore/should_compile/all.T
- utils/deriveConstants/Main.hs
Changes:
| 1 | 1 | {
|
| 2 | - "niv": {
|
|
| 3 | - "branch": "master",
|
|
| 4 | - "description": "Easy dependency management for Nix projects",
|
|
| 5 | - "homepage": "https://github.com/nmattia/niv",
|
|
| 6 | - "owner": "nmattia",
|
|
| 7 | - "repo": "niv",
|
|
| 8 | - "rev": "e0ca65c81a2d7a4d82a189f1e23a48d59ad42070",
|
|
| 9 | - "sha256": "1pq9nh1d8nn3xvbdny8fafzw87mj7gsmp6pxkdl65w2g18rmcmzx",
|
|
| 10 | - "type": "tarball",
|
|
| 11 | - "url": "https://github.com/nmattia/niv/archive/e0ca65c81a2d7a4d82a189f1e23a48d59ad42070.tar.gz",
|
|
| 12 | - "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
|
| 13 | - },
|
|
| 14 | 2 | "nixpkgs": {
|
| 15 | - "branch": "nixos-unstable",
|
|
| 3 | + "branch": "nixpkgs-25.05-darwin",
|
|
| 16 | 4 | "description": "Nix Packages collection",
|
| 17 | 5 | "homepage": "",
|
| 18 | 6 | "owner": "nixos",
|
| 19 | 7 | "repo": "nixpkgs",
|
| 20 | - "rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60",
|
|
| 21 | - "sha256": "1anwxmjpm21msnnlrjdz19w31bxnbpn4kgf93sn3npihi7wf4a8h",
|
|
| 8 | + "rev": "ac62194c3917d5f474c1a844b6fd6da2db95077d",
|
|
| 9 | + "sha256": "0v6bd1xk8a2aal83karlvc853x44dg1n4nk08jg3dajqyy0s98np",
|
|
| 22 | 10 | "type": "tarball",
|
| 23 | - "url": "https://github.com/nixos/nixpkgs/archive/2893f56de08021cffd9b6b6dfc70fd9ccd51eb60.tar.gz",
|
|
| 11 | + "url": "https://github.com/nixos/nixpkgs/archive/ac62194c3917d5f474c1a844b6fd6da2db95077d.tar.gz",
|
|
| 24 | 12 | "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
| 25 | 13 | }
|
| 26 | 14 | } |
| ... | ... | @@ -10,29 +10,50 @@ let |
| 10 | 10 | let
|
| 11 | 11 | name' = sanitizeName name + "-src";
|
| 12 | 12 | in
|
| 13 | - if spec.builtin or true then
|
|
| 14 | - builtins_fetchurl { inherit (spec) url sha256; name = name'; }
|
|
| 15 | - else
|
|
| 16 | - pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
|
|
| 13 | + if spec.builtin or true then
|
|
| 14 | + builtins_fetchurl { inherit (spec) url sha256; name = name'; }
|
|
| 15 | + else
|
|
| 16 | + pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
|
|
| 17 | 17 | |
| 18 | 18 | fetch_tarball = pkgs: name: spec:
|
| 19 | 19 | let
|
| 20 | 20 | name' = sanitizeName name + "-src";
|
| 21 | 21 | in
|
| 22 | - if spec.builtin or true then
|
|
| 23 | - builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
|
|
| 24 | - else
|
|
| 25 | - pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
|
|
| 22 | + if spec.builtin or true then
|
|
| 23 | + builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
|
|
| 24 | + else
|
|
| 25 | + pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
|
|
| 26 | 26 | |
| 27 | 27 | fetch_git = name: spec:
|
| 28 | 28 | let
|
| 29 | 29 | ref =
|
| 30 | - if spec ? ref then spec.ref else
|
|
| 30 | + spec.ref or (
|
|
| 31 | 31 | if spec ? branch then "refs/heads/${spec.branch}" else
|
| 32 | - if spec ? tag then "refs/tags/${spec.tag}" else
|
|
| 33 | - abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
|
|
| 32 | + if spec ? tag then "refs/tags/${spec.tag}" else
|
|
| 33 | + abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"
|
|
| 34 | + );
|
|
| 35 | + submodules = spec.submodules or false;
|
|
| 36 | + submoduleArg =
|
|
| 37 | + let
|
|
| 38 | + nixSupportsSubmodules = builtins.compareVersions builtins.nixVersion "2.4" >= 0;
|
|
| 39 | + emptyArgWithWarning =
|
|
| 40 | + if submodules
|
|
| 41 | + then
|
|
| 42 | + builtins.trace
|
|
| 43 | + (
|
|
| 44 | + "The niv input \"${name}\" uses submodules "
|
|
| 45 | + + "but your nix's (${builtins.nixVersion}) builtins.fetchGit "
|
|
| 46 | + + "does not support them"
|
|
| 47 | + )
|
|
| 48 | + { }
|
|
| 49 | + else { };
|
|
| 50 | + in
|
|
| 51 | + if nixSupportsSubmodules
|
|
| 52 | + then { inherit submodules; }
|
|
| 53 | + else emptyArgWithWarning;
|
|
| 34 | 54 | in
|
| 35 | - builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; };
|
|
| 55 | + builtins.fetchGit
|
|
| 56 | + ({ url = spec.repo; inherit (spec) rev; inherit ref; } // submoduleArg);
|
|
| 36 | 57 | |
| 37 | 58 | fetch_local = spec: spec.path;
|
| 38 | 59 | |
| ... | ... | @@ -66,16 +87,16 @@ let |
| 66 | 87 | hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
|
| 67 | 88 | hasThisAsNixpkgsPath = <nixpkgs> == ./.;
|
| 68 | 89 | in
|
| 69 | - if builtins.hasAttr "nixpkgs" sources
|
|
| 70 | - then sourcesNixpkgs
|
|
| 71 | - else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
|
|
| 72 | - import <nixpkgs> {}
|
|
| 73 | - else
|
|
| 74 | - abort
|
|
| 75 | - ''
|
|
| 76 | - Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
|
|
| 77 | - add a package called "nixpkgs" to your sources.json.
|
|
| 78 | - '';
|
|
| 90 | + if builtins.hasAttr "nixpkgs" sources
|
|
| 91 | + then sourcesNixpkgs
|
|
| 92 | + else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
|
|
| 93 | + import <nixpkgs> { }
|
|
| 94 | + else
|
|
| 95 | + abort
|
|
| 96 | + ''
|
|
| 97 | + Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
|
|
| 98 | + add a package called "nixpkgs" to your sources.json.
|
|
| 99 | + '';
|
|
| 79 | 100 | |
| 80 | 101 | # The actual fetching function.
|
| 81 | 102 | fetch = pkgs: name: spec:
|
| ... | ... | @@ -95,13 +116,13 @@ let |
| 95 | 116 | # the path directly as opposed to the fetched source.
|
| 96 | 117 | replace = name: drv:
|
| 97 | 118 | let
|
| 98 | - saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
|
|
| 119 | + saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name;
|
|
| 99 | 120 | ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
|
| 100 | 121 | in
|
| 101 | - if ersatz == "" then drv else
|
|
| 102 | - # this turns the string into an actual Nix path (for both absolute and
|
|
| 103 | - # relative paths)
|
|
| 104 | - if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
|
|
| 122 | + if ersatz == "" then drv else
|
|
| 123 | + # this turns the string into an actual Nix path (for both absolute and
|
|
| 124 | + # relative paths)
|
|
| 125 | + if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
|
|
| 105 | 126 | |
| 106 | 127 | # Ports of functions for older nix versions
|
| 107 | 128 | |
| ... | ... | @@ -112,7 +133,7 @@ let |
| 112 | 133 | );
|
| 113 | 134 | |
| 114 | 135 | # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
|
| 115 | - range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
|
|
| 136 | + range = first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1);
|
|
| 116 | 137 | |
| 117 | 138 | # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
|
| 118 | 139 | stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
|
| ... | ... | @@ -123,43 +144,46 @@ let |
| 123 | 144 | concatStrings = builtins.concatStringsSep "";
|
| 124 | 145 | |
| 125 | 146 | # https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
|
| 126 | - optionalAttrs = cond: as: if cond then as else {};
|
|
| 147 | + optionalAttrs = cond: as: if cond then as else { };
|
|
| 127 | 148 | |
| 128 | 149 | # fetchTarball version that is compatible between all the versions of Nix
|
| 129 | 150 | builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
|
| 130 | 151 | let
|
| 131 | 152 | inherit (builtins) lessThan nixVersion fetchTarball;
|
| 132 | 153 | in
|
| 133 | - if lessThan nixVersion "1.12" then
|
|
| 134 | - fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
|
|
| 135 | - else
|
|
| 136 | - fetchTarball attrs;
|
|
| 154 | + if lessThan nixVersion "1.12" then
|
|
| 155 | + fetchTarball ({ inherit url; } // (optionalAttrs (name != null) { inherit name; }))
|
|
| 156 | + else
|
|
| 157 | + fetchTarball attrs;
|
|
| 137 | 158 | |
| 138 | 159 | # fetchurl version that is compatible between all the versions of Nix
|
| 139 | 160 | builtins_fetchurl = { url, name ? null, sha256 }@attrs:
|
| 140 | 161 | let
|
| 141 | 162 | inherit (builtins) lessThan nixVersion fetchurl;
|
| 142 | 163 | in
|
| 143 | - if lessThan nixVersion "1.12" then
|
|
| 144 | - fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
|
|
| 145 | - else
|
|
| 146 | - fetchurl attrs;
|
|
| 164 | + if lessThan nixVersion "1.12" then
|
|
| 165 | + fetchurl ({ inherit url; } // (optionalAttrs (name != null) { inherit name; }))
|
|
| 166 | + else
|
|
| 167 | + fetchurl attrs;
|
|
| 147 | 168 | |
| 148 | 169 | # Create the final "sources" from the config
|
| 149 | 170 | mkSources = config:
|
| 150 | - mapAttrs (
|
|
| 151 | - name: spec:
|
|
| 152 | - if builtins.hasAttr "outPath" spec
|
|
| 153 | - then abort
|
|
| 154 | - "The values in sources.json should not have an 'outPath' attribute"
|
|
| 155 | - else
|
|
| 156 | - spec // { outPath = replace name (fetch config.pkgs name spec); }
|
|
| 157 | - ) config.sources;
|
|
| 171 | + mapAttrs
|
|
| 172 | + (
|
|
| 173 | + name: spec:
|
|
| 174 | + if builtins.hasAttr "outPath" spec
|
|
| 175 | + then
|
|
| 176 | + abort
|
|
| 177 | + "The values in sources.json should not have an 'outPath' attribute"
|
|
| 178 | + else
|
|
| 179 | + spec // { outPath = replace name (fetch config.pkgs name spec); }
|
|
| 180 | + )
|
|
| 181 | + config.sources;
|
|
| 158 | 182 | |
| 159 | 183 | # The "config" used by the fetchers
|
| 160 | 184 | mkConfig =
|
| 161 | 185 | { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
|
| 162 | - , sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
|
|
| 186 | + , sources ? if sourcesFile == null then { } else builtins.fromJSON (builtins.readFile sourcesFile)
|
|
| 163 | 187 | , system ? builtins.currentSystem
|
| 164 | 188 | , pkgs ? mkPkgs sources system
|
| 165 | 189 | }: rec {
|
| ... | ... | @@ -171,4 +195,4 @@ let |
| 171 | 195 | };
|
| 172 | 196 | |
| 173 | 197 | in
|
| 174 | -mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); } |
|
| 198 | +mkSources (mkConfig { }) // { __functor = _: settings: mkSources (mkConfig settings); } |
| ... | ... | @@ -11,69 +11,67 @@ let |
| 11 | 11 | hsPkgs = pkgs.haskellPackages;
|
| 12 | 12 | alex = hsPkgs.alex;
|
| 13 | 13 | happy = hsPkgs.happy;
|
| 14 | - targetTriple = pkgs.stdenv.targetPlatform.config;
|
|
| 14 | + targetTriple = pkgs.stdenvNoCC.targetPlatform.config;
|
|
| 15 | 15 | |
| 16 | 16 | ghcBindists = let version = ghc.version; in {
|
| 17 | - aarch64-darwin = hostPkgs.fetchurl {
|
|
| 17 | + aarch64-darwin = hostPkgs.fetchzip {
|
|
| 18 | 18 | url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-aarch64-apple-darwin.tar.xz";
|
| 19 | - sha256 = "sha256-/6+DtdeossBJIMbjkJwL4h3eJ7rzgNCV+ifoQKOi6AQ=";
|
|
| 19 | + hash = "sha512-xUlt7zc/OT3a1SR0BxmFFgrabPkWUENATdw4NbQwEi5+nH5yPau+HSrGI5UUoKdO4gdpgZlPaxtI7eSk0fx1+g==";
|
|
| 20 | 20 | };
|
| 21 | - x86_64-darwin = hostPkgs.fetchurl {
|
|
| 21 | + x86_64-darwin = hostPkgs.fetchzip {
|
|
| 22 | 22 | url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-x86_64-apple-darwin.tar.xz";
|
| 23 | - sha256 = "sha256-jPIhiJMOENesUnDUJeIaPatgavc6ZVSTY5NFIAxlC+k=";
|
|
| 23 | + hash = "sha512-4/INeJwPPGbOj9MepwnIvIg2lvFkqS8w/3U/I8f6gCsoNlgwPr78iyY9vd6vfMONR1GxNQU3L/lxE07F3P0Qag==";
|
|
| 24 | 24 | };
|
| 25 | - |
|
| 26 | 25 | };
|
| 27 | 26 | |
| 28 | - ghc = pkgs.stdenv.mkDerivation rec {
|
|
| 29 | - version = "9.10.1";
|
|
| 27 | + ghc = pkgs.stdenvNoCC.mkDerivation rec {
|
|
| 28 | + version = "9.10.3";
|
|
| 30 | 29 | name = "ghc";
|
| 31 | - src = ghcBindists.${pkgs.stdenv.hostPlatform.system};
|
|
| 30 | + src = ghcBindists.${pkgs.stdenvNoCC.hostPlatform.system};
|
|
| 31 | + |
|
| 32 | + dontUpdateAutotoolsGnuConfigScripts = true;
|
|
| 33 | + |
|
| 32 | 34 | configureFlags = [
|
| 33 | - "CC=/usr/bin/clang"
|
|
| 34 | - "CLANG=/usr/bin/clang"
|
|
| 35 | 35 | "AR=/usr/bin/ar"
|
| 36 | - "LLC=${llvm}/bin/llc"
|
|
| 37 | - "OPT=${llvm}/bin/opt"
|
|
| 38 | - "LLVMAS=${llvm_clang}/bin/clang"
|
|
| 39 | - "CONF_CC_OPTS_STAGE2=--target=${targetTriple}"
|
|
| 40 | - "CONF_CXX_OPTS_STAGE2=--target=${targetTriple}"
|
|
| 41 | - "CONF_GCC_LINKER_OPTS_STAGE2=--target=${targetTriple}"
|
|
| 36 | + "CC=/usr/bin/clang"
|
|
| 37 | + "CXX=/usr/bin/clang++"
|
|
| 38 | + "INSTALL=/usr/bin/install"
|
|
| 39 | + "INSTALL_NAME_TOOL=/usr/bin/install_name_tool"
|
|
| 40 | + "MergeObjsCmd=/usr/bin/ld"
|
|
| 41 | + "NM=/usr/bin/nm"
|
|
| 42 | + "OTOOL=/usr/bin/otool"
|
|
| 43 | + "RANLIB=/usr/bin/ranlib"
|
|
| 42 | 44 | ];
|
| 43 | - buildPhase = "true";
|
|
| 44 | - |
|
| 45 | - # This is a horrible hack because the configure script invokes /usr/bin/clang
|
|
| 46 | - # without a `--target` flag. Then depending on whether the `nix` binary itself is
|
|
| 47 | - # a native x86 or arm64 binary means that /usr/bin/clang thinks it needs to run in
|
|
| 48 | - # x86 or arm64 mode.
|
|
| 49 | - |
|
| 50 | - # The correct answer for the check in question is the first one we try, so by replacing
|
|
| 51 | - # the condition to true; we select the right C++ standard library still.
|
|
| 52 | - preConfigure = ''
|
|
| 53 | - sed "s/\"\$CC\" -o actest actest.o \''${1} 2>\/dev\/null/true/i" configure > configure.new
|
|
| 54 | - mv configure.new configure
|
|
| 55 | - chmod +x configure
|
|
| 56 | - cat configure
|
|
| 57 | 45 | |
| 46 | + # Use the arch command to explicitly specify architecture, so that
|
|
| 47 | + # configure and its subprocesses would pick up the architecture we
|
|
| 48 | + # choose via the system argument.
|
|
| 49 | + preConfigure = pkgs.lib.optionalString (system == "aarch64-darwin") ''
|
|
| 50 | + substituteInPlace configure \
|
|
| 51 | + --replace-fail "#! /bin/sh" "#!/usr/bin/env -S /usr/bin/arch -arm64 /bin/sh"
|
|
| 52 | + '' + pkgs.lib.optionalString (system == "x86_64-darwin") ''
|
|
| 53 | + substituteInPlace configure \
|
|
| 54 | + --replace-fail "#! /bin/sh" "#!/usr/bin/env -S /usr/bin/arch -x86_64 /bin/sh"
|
|
| 55 | + '' + ''
|
|
| 56 | + unset DEVELOPER_DIR SDKROOT
|
|
| 57 | + export DEVELOPER_DIR="$(/usr/bin/xcode-select --print-path)"
|
|
| 58 | + export SDKROOT="$(/usr/bin/xcrun --sdk macosx --show-sdk-path)"
|
|
| 58 | 59 | '';
|
| 59 | 60 | |
| 61 | + dontPatchShebangsInConfigure = true;
|
|
| 62 | + |
|
| 60 | 63 | # N.B. Work around #20253.
|
| 61 | 64 | nativeBuildInputs = [ pkgs.gnused ];
|
| 62 | - postInstallPhase = ''
|
|
| 63 | - settings="$out/lib/ghc-${version}/settings"
|
|
| 64 | - sed -i -e "s%\"llc\"%\"${llvm}/bin/llc\"%" $settings
|
|
| 65 | - sed -i -e "s%\"opt\"%\"${llvm}/bin/opt\"%" $settings
|
|
| 66 | - sed -i -e "s%\"clang\"%\"/usr/bin/clang\"%" $settings
|
|
| 67 | - sed -i -e 's%("C compiler command", "")%("C compiler command", "/usr/bin/clang")%' $settings
|
|
| 68 | - sed -i -e 's%("C compiler flags", "")%("C compiler flags", "--target=${targetTriple}")%' $settings
|
|
| 69 | - sed -i -e 's%("C++ compiler flags", "")%("C++ compiler flags", "--target=${targetTriple}")%' $settings
|
|
| 70 | - sed -i -e 's%("C compiler link flags", "")%("C compiler link flags", "--target=${targetTriple}")%' $settings
|
|
| 71 | - '';
|
|
| 65 | + |
|
| 66 | + dontBuild = true;
|
|
| 67 | + |
|
| 68 | + enableParallelInstalling = true;
|
|
| 69 | + |
|
| 70 | + dontFixup = true;
|
|
| 72 | 71 | |
| 73 | 72 | # Sanity check: verify that we can compile hello world.
|
| 74 | 73 | doInstallCheck = true;
|
| 75 | 74 | installCheckPhase = ''
|
| 76 | - unset DYLD_LIBRARY_PATH
|
|
| 77 | 75 | $out/bin/ghc --info
|
| 78 | 76 | cd $TMP
|
| 79 | 77 | mkdir test-ghc; cd test-ghc
|
| ... | ... | @@ -91,13 +89,13 @@ let |
| 91 | 89 | ourtexlive = with pkgs;
|
| 92 | 90 | texlive.combine {
|
| 93 | 91 | inherit (texlive)
|
| 94 | - scheme-medium collection-xetex fncychap titlesec tabulary varwidth
|
|
| 92 | + scheme-small collection-xetex fncychap tex-gyre titlesec tabulary varwidth
|
|
| 95 | 93 | framed capt-of wrapfig needspace dejavu-otf helvetic upquote;
|
| 96 | 94 | };
|
| 97 | 95 | fonts = with pkgs; makeFontsConf { fontDirectories = [ dejavu_fonts ]; };
|
| 98 | 96 | |
| 99 | - llvm = pkgs.llvm_15;
|
|
| 100 | - llvm_clang = pkgs.llvmPackages_15.clang-unwrapped;
|
|
| 97 | + llvm = pkgs.llvm_21;
|
|
| 98 | + llvm_clang = pkgs.llvmPackages_21.clang-unwrapped;
|
|
| 101 | 99 | in
|
| 102 | 100 | pkgs.writeTextFile {
|
| 103 | 101 | name = "toolchain";
|
| ... | ... | @@ -91,6 +91,7 @@ import GHC.Core.Utils |
| 91 | 91 | import GHC.Core.Opt.Arity ( exprBotStrictness_maybe, isOneShotBndr )
|
| 92 | 92 | import GHC.Core.FVs -- all of it
|
| 93 | 93 | import GHC.Core.Subst
|
| 94 | +import GHC.Core.TyCo.Subst( lookupTyVar )
|
|
| 94 | 95 | import GHC.Core.Make ( sortQuantVars )
|
| 95 | 96 | import GHC.Core.Type ( Type, tyCoVarsOfType
|
| 96 | 97 | , mightBeUnliftedType, closeOverKindsDSet
|
| ... | ... | @@ -466,8 +467,8 @@ lvlCase env scrut_fvs scrut' case_bndr ty alts |
| 466 | 467 | ty' = substTyUnchecked (le_subst env) ty
|
| 467 | 468 | |
| 468 | 469 | incd_lvl = incMinorLvl (le_ctxt_lvl env)
|
| 469 | - dest_lvl = maxFvLevel (const True) env scrut_fvs
|
|
| 470 | - -- Don't abstract over type variables, hence const True
|
|
| 470 | + dest_lvl = maxFvLevel includeTyVars env scrut_fvs
|
|
| 471 | + -- Don't abstract over type variables, hence includeTyVars
|
|
| 471 | 472 | |
| 472 | 473 | lvl_alt alts_env (AnnAlt con bs rhs)
|
| 473 | 474 | = do { rhs' <- lvlMFE new_env True rhs
|
| ... | ... | @@ -719,8 +720,11 @@ hasFreeJoin :: LevelEnv -> DVarSet -> Bool |
| 719 | 720 | -- (In the latter case it won't be a join point any more.)
|
| 720 | 721 | -- Not treating top-level ones specially had a massive effect
|
| 721 | 722 | -- on nofib/minimax/Prog.prog
|
| 722 | -hasFreeJoin env fvs
|
|
| 723 | - = not (maxFvLevel isJoinId env fvs == tOP_LEVEL)
|
|
| 723 | +hasFreeJoin env fvs = anyDVarSet bad_join fvs
|
|
| 724 | + where
|
|
| 725 | + bad_join v = isJoinId v &&
|
|
| 726 | + maxIn True env v tOP_LEVEL /= tOP_LEVEL
|
|
| 727 | + |
|
| 724 | 728 | |
| 725 | 729 | {- Note [Saving work]
|
| 726 | 730 | ~~~~~~~~~~~~~~~~~~~~~
|
| ... | ... | @@ -1607,10 +1611,10 @@ destLevel env fvs fvs_ty is_function is_bot |
| 1607 | 1611 | |
| 1608 | 1612 | | otherwise = max_fv_id_level
|
| 1609 | 1613 | where
|
| 1610 | - max_fv_id_level = maxFvLevel isId env fvs -- Max over Ids only; the
|
|
| 1611 | - -- tyvars will be abstracted
|
|
| 1614 | + max_fv_id_level = maxFvLevel idsOnly env fvs -- Max over Ids only; the
|
|
| 1615 | + -- tyvars will be abstracted
|
|
| 1612 | 1616 | |
| 1613 | - as_far_as_poss = maxFvLevel' isId env fvs_ty
|
|
| 1617 | + as_far_as_poss = maxFvLevel' idsOnly env fvs_ty
|
|
| 1614 | 1618 | -- See Note [Floating and kind casts]
|
| 1615 | 1619 | |
| 1616 | 1620 | {- Note [Floating and kind casts]
|
| ... | ... | @@ -1768,28 +1772,47 @@ extendCaseBndrEnv le@(LE { le_subst = subst, le_env = id_env }) |
| 1768 | 1772 | , le_env = add_id id_env (case_bndr, scrut_var) }
|
| 1769 | 1773 | extendCaseBndrEnv env _ _ = env
|
| 1770 | 1774 | |
| 1771 | -maxFvLevel :: (Var -> Bool) -> LevelEnv -> DVarSet -> Level
|
|
| 1772 | -maxFvLevel max_me env var_set
|
|
| 1773 | - = nonDetStrictFoldDVarSet (maxIn max_me env) tOP_LEVEL var_set
|
|
| 1775 | +includeTyVars, idsOnly :: Bool
|
|
| 1776 | +idsOnly = False
|
|
| 1777 | +includeTyVars = True
|
|
| 1778 | + |
|
| 1779 | +maxFvLevel :: Bool -> LevelEnv -> DVarSet -> Level
|
|
| 1780 | +maxFvLevel include_tyvars env var_set
|
|
| 1781 | + = nonDetStrictFoldDVarSet (maxIn include_tyvars env) tOP_LEVEL var_set
|
|
| 1774 | 1782 | -- It's OK to use a non-deterministic fold here because maxIn commutes.
|
| 1775 | 1783 | |
| 1776 | -maxFvLevel' :: (Var -> Bool) -> LevelEnv -> TyCoVarSet -> Level
|
|
| 1784 | +maxFvLevel' :: Bool -> LevelEnv -> TyCoVarSet -> Level
|
|
| 1777 | 1785 | -- Same but for TyCoVarSet
|
| 1778 | -maxFvLevel' max_me env var_set
|
|
| 1779 | - = nonDetStrictFoldUniqSet (maxIn max_me env) tOP_LEVEL var_set
|
|
| 1786 | +maxFvLevel' include_tyvars env var_set
|
|
| 1787 | + = nonDetStrictFoldUniqSet (maxIn include_tyvars env) tOP_LEVEL var_set
|
|
| 1780 | 1788 | -- It's OK to use a non-deterministic fold here because maxIn commutes.
|
| 1781 | 1789 | |
| 1782 | -maxIn :: (Var -> Bool) -> LevelEnv -> InVar -> Level -> Level
|
|
| 1783 | -maxIn max_me (LE { le_lvl_env = lvl_env, le_env = id_env }) in_var lvl
|
|
| 1790 | +maxIn :: Bool -> LevelEnv -> InVar -> Level -> Level
|
|
| 1791 | +-- True <=> include tyvars
|
|
| 1792 | +maxIn include_tyvars env@(LE { le_subst = subst, le_env = id_env }) in_var lvl
|
|
| 1793 | + | isId in_var
|
|
| 1784 | 1794 | = case lookupVarEnv id_env in_var of
|
| 1795 | + Nothing -> maxOut env in_var lvl
|
|
| 1785 | 1796 | Just (abs_vars, _) -> foldr max_out lvl abs_vars
|
| 1786 | - Nothing -> max_out in_var lvl
|
|
| 1787 | - where
|
|
| 1788 | - max_out out_var lvl
|
|
| 1789 | - | max_me out_var = case lookupVarEnv lvl_env out_var of
|
|
| 1790 | - Just lvl' -> maxLvl lvl' lvl
|
|
| 1791 | - Nothing -> lvl
|
|
| 1792 | - | otherwise = lvl -- Ignore some vars depending on max_me
|
|
| 1797 | + where
|
|
| 1798 | + max_out out_var lvl
|
|
| 1799 | + | isTyVar out_var && not include_tyvars
|
|
| 1800 | + = lvl
|
|
| 1801 | + | otherwise = maxOut env out_var lvl
|
|
| 1802 | + |
|
| 1803 | + | include_tyvars -- TyVars
|
|
| 1804 | + = case lookupTyVar subst in_var of
|
|
| 1805 | + Just ty -> nonDetStrictFoldVarSet (maxOut env) lvl (tyCoVarsOfType ty)
|
|
| 1806 | + Nothing -> maxOut env in_var lvl
|
|
| 1807 | + |
|
| 1808 | + | otherwise -- Ignore free tyvars
|
|
| 1809 | + = lvl
|
|
| 1810 | + |
|
| 1811 | +maxOut :: LevelEnv -> OutVar -> Level -> Level
|
|
| 1812 | +maxOut (LE { le_lvl_env = lvl_env }) out_var lvl
|
|
| 1813 | + = case lookupVarEnv lvl_env out_var of
|
|
| 1814 | + Just lvl' -> maxLvl lvl' lvl
|
|
| 1815 | + Nothing -> lvl
|
|
| 1793 | 1816 | |
| 1794 | 1817 | lookupVar :: LevelEnv -> Id -> LevelledExpr
|
| 1795 | 1818 | lookupVar le v = case lookupVarEnv (le_env le) v of
|
| ... | ... | @@ -1797,7 +1797,9 @@ declExtras fix_fn ann_fn rule_env inst_env fi_env dm_env complete_env decl |
| 1797 | 1797 | IfaceSynonym{} -> IfaceSynonymExtras (fix_fn n)
|
| 1798 | 1798 | (ann_fn (AnnOccName n))
|
| 1799 | 1799 | IfaceFamily{} -> IfaceFamilyExtras (fix_fn n)
|
| 1800 | - (map ifFamInstAxiom (lookupOccEnvL fi_env n))
|
|
| 1800 | + (map ifFamInstAxiom (lookupOccEnvL fi_env n)
|
|
| 1801 | + ++ map ifDFun (lookupOccEnvL inst_env n)
|
|
| 1802 | + )
|
|
| 1801 | 1803 | (ann_fn (AnnOccName n))
|
| 1802 | 1804 | IfacePatSyn{} -> IfacePatSynExtras (fix_fn n) (lookup_complete_match n)
|
| 1803 | 1805 | _other -> IfaceOtherDeclExtras
|
| ... | ... | @@ -297,7 +297,11 @@ The supported transformers are listed below: |
| 297 | 297 | </tr>
|
| 298 | 298 | <tr>
|
| 299 | 299 | <td><code>assertions</code></td>
|
| 300 | - <td>Build the stage2 compiler with assertions enabled. </td>
|
|
| 300 | + <td>Build the stage2 compiler with <code>-DDEBUG</code> assertions enabled. </td>
|
|
| 301 | + </tr>
|
|
| 302 | + <tr>
|
|
| 303 | + <td><code>assertions_stage1</code></td>
|
|
| 304 | + <td>Build the stage1 compiler with <code>-DDEBUG</code> assertions enabled. </td>
|
|
| 301 | 305 | </tr>
|
| 302 | 306 | <tr>
|
| 303 | 307 | <td><code>fully_static</code></td>
|
| ... | ... | @@ -149,14 +149,10 @@ ghcLibDeps stage iplace = do |
| 149 | 149 | ps <- mapM (\f -> stageLibPath stage <&> (-/- f))
|
| 150 | 150 | [ "llvm-targets"
|
| 151 | 151 | , "llvm-passes"
|
| 152 | - , "ghc-interp.js"
|
|
| 153 | 152 | , "settings"
|
| 154 | 153 | , "targets" -/- "default.target"
|
| 155 | 154 | , "ghc-usage.txt"
|
| 156 | 155 | , "ghci-usage.txt"
|
| 157 | - , "dyld.mjs"
|
|
| 158 | - , "post-link.mjs"
|
|
| 159 | - , "prelude.mjs"
|
|
| 160 | 156 | ]
|
| 161 | 157 | cxxStdLib <- systemCxxStdLibConfPath (PackageDbLoc stage iplace)
|
| 162 | 158 | return (cxxStdLib : ps)
|
| ... | ... | @@ -170,8 +170,6 @@ data Builder = Alex |
| 170 | 170 | | GhcPkg GhcPkgMode Stage
|
| 171 | 171 | | Haddock HaddockMode
|
| 172 | 172 | | Happy
|
| 173 | - | Hp2Ps
|
|
| 174 | - | Hpc
|
|
| 175 | 173 | | HsCpp
|
| 176 | 174 | | JsCpp
|
| 177 | 175 | | Hsc2Hs Stage
|
| ... | ... | @@ -211,10 +209,6 @@ builderProvenance = \case |
| 211 | 209 | Haddock _ -> context Stage1 haddock
|
| 212 | 210 | Hsc2Hs _ -> context stage0Boot hsc2hs
|
| 213 | 211 | Unlit -> context stage0Boot unlit
|
| 214 | - |
|
| 215 | - -- Never used
|
|
| 216 | - Hpc -> context Stage1 hpcBin
|
|
| 217 | - Hp2Ps -> context stage0Boot hp2ps
|
|
| 218 | 212 | _ -> Nothing
|
| 219 | 213 | where
|
| 220 | 214 | context s p = Just $ vanillaContext s p
|
| ... | ... | @@ -70,7 +70,8 @@ flavourTransformers = M.fromList |
| 70 | 70 | , "fully_static" =: fullyStatic
|
| 71 | 71 | , "host_fully_static" =: hostFullyStatic
|
| 72 | 72 | , "collect_timings" =: collectTimings
|
| 73 | - , "assertions" =: enableAssertions
|
|
| 73 | + , "assertions" =: enableAssertions Stage2
|
|
| 74 | + , "assertions_stage1" =: enableAssertions Stage1
|
|
| 74 | 75 | , "debug_ghc" =: debugGhc Stage2
|
| 75 | 76 | , "debug_stage1_ghc" =: debugGhc Stage1
|
| 76 | 77 | , "lint" =: enableLinting
|
| ... | ... | @@ -169,10 +170,10 @@ werror = |
| 169 | 170 | -- | Build C and Haskell objects with debugging information.
|
| 170 | 171 | enableDebugInfo :: Flavour -> Flavour
|
| 171 | 172 | enableDebugInfo = addArgs $ notStage0 ? mconcat
|
| 172 | - [ builder (Ghc CompileHs) ? pure ["-g3"]
|
|
| 173 | - , builder (Ghc CompileCWithGhc) ? pure ["-optc-g3"]
|
|
| 174 | - , builder (Ghc CompileCppWithGhc) ? pure ["-optcxx-g3"]
|
|
| 175 | - , builder (Cc CompileC) ? arg "-g3"
|
|
| 173 | + [ builder (Ghc CompileHs) ? pure ["-g3", "-optc-fno-omit-frame-pointer"]
|
|
| 174 | + , builder (Ghc CompileCWithGhc) ? pure ["-optc-g3", "-optc-fno-omit-frame-pointer"]
|
|
| 175 | + , builder (Ghc CompileCppWithGhc) ? pure ["-optcxx-g3", "-optcxx-fno-omit-frame-pointer"]
|
|
| 176 | + , builder (Cc CompileC) ? pure ["-g3", "-fno-omit-frame-pointer"]
|
|
| 176 | 177 | , builder (Cabal Setup) ? arg "--disable-library-stripping"
|
| 177 | 178 | , builder (Cabal Setup) ? arg "--disable-executable-stripping"
|
| 178 | 179 | ]
|
| ... | ... | @@ -393,12 +394,12 @@ enableLateCCS = addArgs |
| 393 | 394 | ? ((Profiling `wayUnit`) <$> getWay)
|
| 394 | 395 | ? arg "-fprof-late"
|
| 395 | 396 | |
| 396 | --- | Enable assertions for the stage2 compiler
|
|
| 397 | -enableAssertions :: Flavour -> Flavour
|
|
| 398 | -enableAssertions flav = flav { ghcDebugAssertions = f }
|
|
| 397 | +-- | Enable -DDEBUG assertions in the compiler, at a specified stage
|
|
| 398 | +enableAssertions :: Stage -> Flavour -> Flavour
|
|
| 399 | +enableAssertions stage flav = flav { ghcDebugAssertions = f }
|
|
| 399 | 400 | where
|
| 400 | - f Stage2 = True
|
|
| 401 | - f st = ghcDebugAssertions flav st
|
|
| 401 | + f s | s == stage = True
|
|
| 402 | + | otherwise = ghcDebugAssertions flav s
|
|
| 402 | 403 | |
| 403 | 404 | -- | Build the stage3 compiler using the non-moving GC.
|
| 404 | 405 | enableBootNonmovingGc :: Flavour -> Flavour
|
| ... | ... | @@ -84,7 +84,6 @@ data PackageHashConfigInputs = PackageHashConfigInputs { |
| 84 | 84 | pkgHashDynExe :: Bool,
|
| 85 | 85 | pkgHashProfLib :: Bool,
|
| 86 | 86 | pkgHashProfExe :: Bool,
|
| 87 | - pkgHashSplitObjs :: Bool,
|
|
| 88 | 87 | pkgHashSplitSections :: Bool,
|
| 89 | 88 | pkgHashStripLibs :: Bool,
|
| 90 | 89 | pkgHashStripExes :: Bool,
|
| ... | ... | @@ -140,7 +139,6 @@ pkgHashOracle = void $ addOracleCache $ \(PkgHashKey (stag, pkg)) -> do |
| 140 | 139 | pkgHashDynExe = dyn_ghc
|
| 141 | 140 | pkgHashProfLib = profiling `Set.member` libWays
|
| 142 | 141 | pkgHashProfExe = pkg == ghc && ghcProfiled flav stag
|
| 143 | - pkgHashSplitObjs = False -- Deprecated
|
|
| 144 | 142 | pkgHashSplitSections = ghcSplitSections flav
|
| 145 | 143 | pkgHashStripExes = False
|
| 146 | 144 | pkgHashStripLibs = False
|
| ... | ... | @@ -239,7 +237,6 @@ renderPackageHashInputs PackageHashInputs{ |
| 239 | 237 | , opt "dynamic-exe" False show pkgHashDynExe
|
| 240 | 238 | , opt "prof-lib" False show pkgHashProfLib
|
| 241 | 239 | , opt "prof-exe" False show pkgHashProfExe
|
| 242 | - , opt "split-objs" False show pkgHashSplitObjs
|
|
| 243 | 240 | , opt "split-sections" False show pkgHashSplitSections
|
| 244 | 241 | , opt "stripped-lib" False show pkgHashStripLibs
|
| 245 | 242 | , opt "stripped-exe" True show pkgHashStripExes
|
| ... | ... | @@ -9,7 +9,7 @@ module Oracles.Setting ( |
| 9 | 9 | |
| 10 | 10 | -- ** Target platform things
|
| 11 | 11 | anyTargetOs, anyTargetArch, anyHostOs,
|
| 12 | - isElfTarget, isOsxTarget, isWinTarget, isJsTarget, isArmTarget,
|
|
| 12 | + isElfTarget, isOsxTarget, isWinTarget, isJsTarget, isWasmTarget, isArmTarget,
|
|
| 13 | 13 | isWinHost,
|
| 14 | 14 | targetArmVersion
|
| 15 | 15 | ) where
|
| ... | ... | @@ -128,6 +128,9 @@ isWinTarget = anyTargetOs [OSMinGW32] |
| 128 | 128 | isJsTarget :: Action Bool
|
| 129 | 129 | isJsTarget = anyTargetArch [ArchJavaScript]
|
| 130 | 130 | |
| 131 | +isWasmTarget :: Action Bool
|
|
| 132 | +isWasmTarget = anyTargetArch [ArchWasm32]
|
|
| 133 | + |
|
| 131 | 134 | isOsxTarget :: Action Bool
|
| 132 | 135 | isOsxTarget = anyTargetOs [OSDarwin]
|
| 133 | 136 |
| ... | ... | @@ -118,7 +118,18 @@ registerPackageRules rs stage iplace = do |
| 118 | 118 | pkgName <- getPackageNameFromConfFile conf
|
| 119 | 119 | let pkg = unsafeFindPackageByName pkgName
|
| 120 | 120 | |
| 121 | - when (pkg == compiler) $ need =<< ghcLibDeps stage iplace
|
|
| 121 | + when (pkg == compiler) $ do
|
|
| 122 | + baseDeps <- ghcLibDeps stage iplace
|
|
| 123 | + jsTarget <- isJsTarget
|
|
| 124 | + wasmTarget <- isWasmTarget
|
|
| 125 | + libPath <- stageLibPath stage
|
|
| 126 | + let jsDeps
|
|
| 127 | + | jsTarget = ["ghc-interp.js"]
|
|
| 128 | + | otherwise = []
|
|
| 129 | + wasmDeps
|
|
| 130 | + | wasmTarget = ["dyld.mjs", "post-link.mjs", "prelude.mjs"]
|
|
| 131 | + | otherwise = []
|
|
| 132 | + need (baseDeps ++ map (libPath -/-) (jsDeps ++ wasmDeps))
|
|
| 122 | 133 | |
| 123 | 134 | -- Only used in guard when Stage0 {} but can be GlobalLibs or InTreeLibs
|
| 124 | 135 | isBoot <- (pkg `notElem`) <$> stagePackages stage
|
| 1 | 1 | module Settings.Flavours.Validate (validateFlavour, slowValidateFlavour,
|
| 2 | 2 | quickValidateFlavour) where
|
| 3 | 3 | |
| 4 | -import qualified Data.Set as Set
|
|
| 5 | 4 | |
| 6 | 5 | import Expression
|
| 7 | 6 | import Flavour
|
| 8 | -import Oracles.Flag
|
|
| 9 | 7 | import {-# SOURCE #-} Settings.Default
|
| 10 | 8 | |
| 11 | 9 | -- Please update doc/flavours.md when changing this file.
|
| 12 | 10 | validateFlavour :: Flavour
|
| 13 | -validateFlavour = enableLinting $ werror $ defaultFlavour
|
|
| 11 | +validateFlavour = enableLinting $ quickValidateFlavour
|
|
| 14 | 12 | { name = "validate"
|
| 15 | 13 | , extraArgs = validateArgs <> defaultHaddockExtraArgs
|
| 16 | - , libraryWays = Set.fromList <$>
|
|
| 17 | - mconcat [ pure [vanilla]
|
|
| 18 | - , notStage0 ? platformSupportsSharedLibs ? pure [dynamic]
|
|
| 19 | - ]
|
|
| 20 | - , rtsWays = Set.fromList <$>
|
|
| 21 | - mconcat [ pure [vanilla, debug]
|
|
| 22 | - , targetSupportsThreadedRts ? pure [threaded, threadedDebug]
|
|
| 23 | - , notStage0 ? platformSupportsSharedLibs ? pure
|
|
| 24 | - [ dynamic, debugDynamic
|
|
| 25 | - ]
|
|
| 26 | - , notStage0 ? platformSupportsSharedLibs ? targetSupportsThreadedRts ? pure
|
|
| 27 | - [ threadedDynamic, threadedDebugDynamic ]
|
|
| 28 | - ]
|
|
| 29 | 14 | , ghcDebugAssertions = (<= Stage1)
|
| 30 | 15 | }
|
| 31 | 16 | |
| ... | ... | @@ -59,6 +44,6 @@ quickValidateArgs = sourceArgs SourceArgs |
| 59 | 44 | }
|
| 60 | 45 | |
| 61 | 46 | quickValidateFlavour :: Flavour
|
| 62 | -quickValidateFlavour = werror $ validateFlavour
|
|
| 47 | +quickValidateFlavour = werror $ disableProfiledLibs $ defaultFlavour
|
|
| 63 | 48 | { name = "quick-validate"
|
| 64 | 49 | , extraArgs = quickValidateArgs } |
| ... | ... | @@ -44,8 +44,8 @@ |
| 44 | 44 | ,("riscv64-unknown-linux", ("e-m:e-p:64:64-i64:64-i128:128-n64-S128", "", "+m +a +f +d +c +relax"))
|
| 45 | 45 | ,("loongarch64-unknown-linux-gnu", ("e-m:e-p:64:64-i64:64-i128:128-n64-S128", "", "+f +d"))
|
| 46 | 46 | ,("loongarch64-unknown-linux", ("e-m:e-p:64:64-i64:64-i128:128-n64-S128", "", "+f +d"))
|
| 47 | -,("x86_64-apple-darwin", ("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", "penryn", ""))
|
|
| 48 | -,("arm64-apple-darwin", ("e-m:o-i64:64-i128:128-n32:64-S128", "generic", "+v8.3a +fp-armv8 +neon +crc +crypto +fullfp16 +ras +lse +rdm +rcpc +zcm +zcz +sha2 +aes"))
|
|
| 47 | +,("x86_64-apple-darwin", ("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", "core2", ""))
|
|
| 48 | +,("arm64-apple-darwin", ("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32", "apple-m1", "+v8.4a +aes +altnzcv +ccdp +ccpp +complxnum +crc +dotprod +flagm +fp-armv8 +fp16fml +fptoint +fullfp16 +jsconv +lse +neon +pauth +perfmon +predres +ras +rcpc +rdm +sb +sha2 +sha3 +specrestrict +ssbs"))
|
|
| 49 | 49 | ,("aarch64-apple-ios", ("e-m:o-i64:64-i128:128-n32:64-S128", "apple-a7", "+fp-armv8 +neon +crypto +zcm +zcz +sha2 +aes"))
|
| 50 | 50 | ,("x86_64-apple-ios", ("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", "core2", ""))
|
| 51 | 51 | ,("amd64-portbld-freebsd", ("e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", "x86-64", ""))
|
| 1 | +module M where
|
|
| 2 | +import M2
|
|
| 3 | + |
|
| 4 | +x :: TD () -> String
|
|
| 5 | +x = show |
| 1 | +{-# LANGUAGE TypeFamilies #-}
|
|
| 2 | +module M2 where
|
|
| 3 | + |
|
| 4 | +data family TD a
|
|
| 5 | + |
|
| 6 | +data instance TD () = TDI
|
|
| 7 | + deriving Show |
| 1 | +{-# LANGUAGE TypeFamilies #-}
|
|
| 2 | +module M2 where
|
|
| 3 | + |
|
| 4 | +data family TD a
|
|
| 5 | + |
|
| 6 | +data instance TD () = TDI |
| 1 | +TOP=../../..
|
|
| 2 | +include $(TOP)/mk/boilerplate.mk
|
|
| 3 | +include $(TOP)/mk/test.mk
|
|
| 4 | + |
|
| 5 | +# Recompilation tests
|
|
| 6 | + |
|
| 7 | +recomp26705:
|
|
| 8 | + cp M2A.hs M2.hs
|
|
| 9 | + '$(TEST_HC)' $(TEST_HC_OPTS) --make M.hs
|
|
| 10 | + sleep 1
|
|
| 11 | + cp M2B.hs M2.hs
|
|
| 12 | + # This should fail
|
|
| 13 | + if '$(TEST_HC)' $(TEST_HC_OPTS) --make M.hs; then false; fi |
| 1 | +test('recomp26705', [extra_files(['M2A.hs', 'M.hs', 'M2B.hs']),
|
|
| 2 | + when(fast(), skip), ignore_stdout],
|
|
| 3 | + makefile_test, []) |
| 1 | +M.hs:5:5: error: [GHC-39999]
|
|
| 2 | + • No instance for ‘Show (TD ())’ arising from a use of ‘show’
|
|
| 3 | + • In the expression: show
|
|
| 4 | + In an equation for ‘x’: x = show
|
|
| 5 | + |
| 1 | +{-# LANGUAGE BangPatterns #-}
|
|
| 2 | +{-# LANGUAGE DataKinds #-}
|
|
| 3 | +{-# LANGUAGE GADTs #-}
|
|
| 4 | +{-# LANGUAGE PolyKinds #-}
|
|
| 5 | +{-# LANGUAGE ScopedTypeVariables #-}
|
|
| 6 | +{-# LANGUAGE StandaloneKindSignatures #-}
|
|
| 7 | +{-# LANGUAGE TypeApplications #-}
|
|
| 8 | +{-# LANGUAGE TypeFamilies #-}
|
|
| 9 | +{-# LANGUAGE TypeOperators #-}
|
|
| 10 | + |
|
| 11 | +module T26681 where
|
|
| 12 | + |
|
| 13 | +import Data.Kind (Type)
|
|
| 14 | +import Data.Type.Equality
|
|
| 15 | +import GHC.TypeLits
|
|
| 16 | +import qualified Unsafe.Coerce
|
|
| 17 | + |
|
| 18 | + |
|
| 19 | +{-# NOINLINE unsafeCoerceRefl #-}
|
|
| 20 | +unsafeCoerceRefl :: a :~: b
|
|
| 21 | +unsafeCoerceRefl = Unsafe.Coerce.unsafeCoerce Refl
|
|
| 22 | + |
|
| 23 | +type family MapJust l where
|
|
| 24 | + MapJust '[] = '[]
|
|
| 25 | + MapJust (x : xs) = Just x : MapJust xs
|
|
| 26 | + |
|
| 27 | +type family Tail l where
|
|
| 28 | + Tail (_ : xs) = xs
|
|
| 29 | + |
|
| 30 | +lemMapJustCons :: MapJust sh :~: Just n : sh' -> sh :~: n : Tail sh
|
|
| 31 | +lemMapJustCons Refl = unsafeCoerceRefl
|
|
| 32 | + |
|
| 33 | + |
|
| 34 | +type ListX :: [Maybe Nat] -> (Maybe Nat -> Type) -> Type
|
|
| 35 | +data ListX sh f where
|
|
| 36 | + ConsX :: !(f n) -> ListX (n : sh) f
|
|
| 37 | + |
|
| 38 | + |
|
| 39 | +data JustN n where
|
|
| 40 | + JustN :: JustN (Just n)
|
|
| 41 | + |
|
| 42 | +data UnconsListSRes f sh1 = forall n sh. (n : sh ~ sh1) => UnconsListSRes
|
|
| 43 | + |
|
| 44 | +listsUncons :: forall sh1 f. ListX (MapJust sh1) JustN -> UnconsListSRes f sh1
|
|
| 45 | +listsUncons (ConsX JustN)
|
|
| 46 | + | Refl <- lemMapJustCons @sh1 Refl
|
|
| 47 | + = UnconsListSRes |
| ... | ... | @@ -563,3 +563,4 @@ test('T26115', [grep_errmsg(r'DFun')], compile, ['-O -ddump-simpl -dsuppress-uni |
| 563 | 563 | test('T26116', normal, compile, ['-O -ddump-rules'])
|
| 564 | 564 | test('T26117', [grep_errmsg(r'==')], compile, ['-O -ddump-simpl -dsuppress-uniques'])
|
| 565 | 565 | test('T26349', normal, compile, ['-O -ddump-rules'])
|
| 566 | +test('T26681', normal, compile, ['-O']) |
| ... | ... | @@ -397,7 +397,6 @@ wanteds os = concat |
| 397 | 397 | ,fieldOffset Both "StgRegTable" "rHpAlloc"
|
| 398 | 398 | ,structField C "StgRegTable" "rCurrentAlloc"
|
| 399 | 399 | ,structField C "StgRegTable" "rRet"
|
| 400 | - ,structField C "StgRegTable" "rNursery"
|
|
| 401 | 400 | |
| 402 | 401 | ,defIntOffset Both "stgEagerBlackholeInfo"
|
| 403 | 402 | "FUN_OFFSET(stgEagerBlackholeInfo)"
|
| ... | ... | @@ -405,7 +404,6 @@ wanteds os = concat |
| 405 | 404 | ,defIntOffset Both "stgGCFun" "FUN_OFFSET(stgGCFun)"
|
| 406 | 405 | |
| 407 | 406 | ,fieldOffset Both "Capability" "r"
|
| 408 | - ,fieldOffset C "Capability" "lock"
|
|
| 409 | 407 | ,structField C "Capability" "no"
|
| 410 | 408 | ,structField C "Capability" "mut_lists"
|
| 411 | 409 | ,structField C "Capability" "context_switch"
|
| ... | ... | @@ -424,18 +422,11 @@ wanteds os = concat |
| 424 | 422 | ,structField C "bdescr" "link"
|
| 425 | 423 | ,structField Both "bdescr" "flags"
|
| 426 | 424 | |
| 427 | - ,structSize C "generation"
|
|
| 428 | 425 | ,structField C "generation" "n_new_large_words"
|
| 429 | - ,structField C "generation" "weak_ptr_list"
|
|
| 430 | 426 | |
| 431 | 427 | ,structSize Both "CostCentreStack"
|
| 432 | - ,structField C "CostCentreStack" "ccsID"
|
|
| 433 | 428 | ,structFieldH Both "CostCentreStack" "mem_alloc"
|
| 434 | 429 | ,structFieldH Both "CostCentreStack" "scc_count"
|
| 435 | - ,structField C "CostCentreStack" "prevStack"
|
|
| 436 | - |
|
| 437 | - ,structField C "CostCentre" "ccID"
|
|
| 438 | - ,structField C "CostCentre" "link"
|
|
| 439 | 430 | |
| 440 | 431 | ,structField C "StgHeader" "info"
|
| 441 | 432 | ,structField_ Both "StgHeader_ccs" "StgHeader" "prof.ccs"
|
| ... | ... | @@ -472,18 +463,14 @@ wanteds os = concat |
| 472 | 463 | ,closurePayload C "StgArrBytes" "payload"
|
| 473 | 464 | |
| 474 | 465 | ,closureField C "StgTSO" "_link"
|
| 475 | - ,closureField C "StgTSO" "global_link"
|
|
| 476 | 466 | ,closureField C "StgTSO" "what_next"
|
| 477 | 467 | ,closureField C "StgTSO" "why_blocked"
|
| 478 | 468 | ,closureField C "StgTSO" "block_info"
|
| 479 | 469 | ,closureField C "StgTSO" "blocked_exceptions"
|
| 480 | 470 | ,closureField C "StgTSO" "id"
|
| 481 | 471 | ,closureField C "StgTSO" "cap"
|
| 482 | - ,closureField C "StgTSO" "saved_errno"
|
|
| 483 | 472 | ,closureField C "StgTSO" "trec"
|
| 484 | 473 | ,closureField C "StgTSO" "flags"
|
| 485 | - ,closureField C "StgTSO" "dirty"
|
|
| 486 | - ,closureField C "StgTSO" "bq"
|
|
| 487 | 474 | ,closureField C "StgTSO" "label"
|
| 488 | 475 | ,closureField C "StgTSO" "bound"
|
| 489 | 476 | ,closureField Both "StgTSO" "alloc_limit"
|
| ... | ... | @@ -496,8 +483,6 @@ wanteds os = concat |
| 496 | 483 | ,closureField C "StgStack" "dirty"
|
| 497 | 484 | ,closureField C "StgStack" "marking"
|
| 498 | 485 | |
| 499 | - ,structSize C "StgTSOProfInfo"
|
|
| 500 | - |
|
| 501 | 486 | ,closureField Both "StgUpdateFrame" "updatee"
|
| 502 | 487 | ,closureField Both "StgOrigThunkInfoFrame" "info_ptr"
|
| 503 | 488 | |
| ... | ... | @@ -519,19 +504,15 @@ wanteds os = concat |
| 519 | 504 | ,closureFieldGcptr C "StgAP" "fun"
|
| 520 | 505 | ,closurePayload C "StgAP" "payload"
|
| 521 | 506 | |
| 522 | - ,thunkSize C "StgAP_STACK"
|
|
| 523 | 507 | ,closureField C "StgAP_STACK" "size"
|
| 524 | 508 | ,closureFieldGcptr C "StgAP_STACK" "fun"
|
| 525 | 509 | ,closurePayload C "StgAP_STACK" "payload"
|
| 526 | 510 | |
| 527 | - ,closureSize C "StgContinuation"
|
|
| 528 | 511 | ,closureField C "StgContinuation" "apply_mask_frame"
|
| 529 | 512 | ,closureField C "StgContinuation" "mask_frame_offset"
|
| 530 | 513 | ,closureField C "StgContinuation" "stack_size"
|
| 531 | 514 | ,closurePayload C "StgContinuation" "stack"
|
| 532 | 515 | |
| 533 | - ,thunkSize C "StgSelector"
|
|
| 534 | - |
|
| 535 | 516 | ,closureFieldGcptr C "StgInd" "indirectee"
|
| 536 | 517 | |
| 537 | 518 | ,closureSize C "StgMutVar"
|
| ... | ... | @@ -552,10 +533,6 @@ wanteds os = concat |
| 552 | 533 | ,closureField C "StgCatchRetryFrame" "first_code"
|
| 553 | 534 | ,closureField C "StgCatchRetryFrame" "alt_code"
|
| 554 | 535 | |
| 555 | - ,closureField C "StgTVarWatchQueue" "closure"
|
|
| 556 | - ,closureField C "StgTVarWatchQueue" "next_queue_entry"
|
|
| 557 | - ,closureField C "StgTVarWatchQueue" "prev_queue_entry"
|
|
| 558 | - |
|
| 559 | 536 | ,closureSize C "StgTVar"
|
| 560 | 537 | ,closureField C "StgTVar" "current_value"
|
| 561 | 538 | ,closureField C "StgTVar" "first_watch_queue_entry"
|
| ... | ... | @@ -595,29 +572,19 @@ wanteds os = concat |
| 595 | 572 | ,closureSize C "StgStableName"
|
| 596 | 573 | ,closureField C "StgStableName" "sn"
|
| 597 | 574 | |
| 598 | - ,closureSize C "StgBlockingQueue"
|
|
| 599 | - ,closureField C "StgBlockingQueue" "bh"
|
|
| 600 | - ,closureField C "StgBlockingQueue" "owner"
|
|
| 601 | - ,closureField C "StgBlockingQueue" "queue"
|
|
| 602 | - ,closureField C "StgBlockingQueue" "link"
|
|
| 603 | - |
|
| 604 | 575 | ,closureSize C "MessageBlackHole"
|
| 605 | 576 | ,closureField C "MessageBlackHole" "link"
|
| 606 | 577 | ,closureField C "MessageBlackHole" "tso"
|
| 607 | 578 | ,closureField C "MessageBlackHole" "bh"
|
| 608 | 579 | |
| 609 | - ,closureSize C "StgCompactNFData"
|
|
| 610 | 580 | ,closureField C "StgCompactNFData" "totalW"
|
| 611 | - ,closureField C "StgCompactNFData" "autoBlockW"
|
|
| 612 | 581 | ,closureField C "StgCompactNFData" "nursery"
|
| 613 | - ,closureField C "StgCompactNFData" "last"
|
|
| 614 | 582 | ,closureField C "StgCompactNFData" "hp"
|
| 615 | 583 | ,closureField C "StgCompactNFData" "hpLim"
|
| 616 | 584 | ,closureField C "StgCompactNFData" "hash"
|
| 617 | 585 | ,closureField C "StgCompactNFData" "result"
|
| 618 | 586 | |
| 619 | 587 | ,structSize C "StgCompactNFDataBlock"
|
| 620 | - ,structField C "StgCompactNFDataBlock" "self"
|
|
| 621 | 588 | ,structField C "StgCompactNFDataBlock" "owner"
|
| 622 | 589 | ,structField C "StgCompactNFDataBlock" "next"
|
| 623 | 590 | |
| ... | ... | @@ -635,10 +602,7 @@ wanteds os = concat |
| 635 | 602 | "RTS_FLAGS" "DebugFlags.zero_on_gc"
|
| 636 | 603 | ,structField_ C "RtsFlags_GcFlags_initialStkSize"
|
| 637 | 604 | "RTS_FLAGS" "GcFlags.initialStkSize"
|
| 638 | - ,structField_ C "RtsFlags_MiscFlags_tickInterval"
|
|
| 639 | - "RTS_FLAGS" "MiscFlags.tickInterval"
|
|
| 640 | 605 | |
| 641 | - ,structSize C "StgFunInfoExtraFwd"
|
|
| 642 | 606 | ,structField C "StgFunInfoExtraFwd" "slow_apply"
|
| 643 | 607 | ,structField C "StgFunInfoExtraFwd" "fun_type"
|
| 644 | 608 | ,structFieldH Both "StgFunInfoExtraFwd" "arity"
|
| ... | ... | @@ -652,11 +616,9 @@ wanteds os = concat |
| 652 | 616 | ,structField_ C "StgFunInfoExtraRev_bitmap_offset" "StgFunInfoExtraRev" "b.bitmap_offset"
|
| 653 | 617 | |
| 654 | 618 | ,structField C "StgLargeBitmap" "size"
|
| 655 | - ,fieldOffset C "StgLargeBitmap" "bitmap"
|
|
| 656 | 619 | |
| 657 | 620 | ,structSize C "snEntry"
|
| 658 | 621 | ,structField C "snEntry" "sn_obj"
|
| 659 | - ,structField C "snEntry" "addr"
|
|
| 660 | 622 | |
| 661 | 623 | ,structSize C "spEntry"
|
| 662 | 624 | ,structField C "spEntry" "addr"
|
| ... | ... | @@ -672,51 +634,15 @@ wanteds os = concat |
| 672 | 634 | else []
|
| 673 | 635 | |
| 674 | 636 | -- struct HsIface
|
| 675 | - ,structField C "HsIface" "processRemoteCompletion_closure"
|
|
| 676 | - ,structField C "HsIface" "runIO_closure"
|
|
| 677 | - ,structField C "HsIface" "runNonIO_closure"
|
|
| 678 | 637 | ,structField C "HsIface" "Z0T_closure"
|
| 679 | 638 | ,structField C "HsIface" "True_closure"
|
| 680 | 639 | ,structField C "HsIface" "False_closure"
|
| 681 | - ,structField C "HsIface" "unpackCString_closure"
|
|
| 682 | - ,structField C "HsIface" "runFinalizzerBatch_closure"
|
|
| 683 | - ,structField C "HsIface" "stackOverflow_closure"
|
|
| 684 | 640 | ,structField C "HsIface" "heapOverflow_closure"
|
| 685 | - ,structField C "HsIface" "allocationLimitExceeded_closure"
|
|
| 686 | - ,structField C "HsIface" "blockedIndefinitelyOnMVar_closure"
|
|
| 687 | - ,structField C "HsIface" "blockedIndefinitelyOnSTM_closure"
|
|
| 688 | 641 | ,structField C "HsIface" "cannotCompactFunction_closure"
|
| 689 | 642 | ,structField C "HsIface" "cannotCompactPinned_closure"
|
| 690 | 643 | ,structField C "HsIface" "cannotCompactMutable_closure"
|
| 691 | - ,structField C "HsIface" "nonTermination_closure"
|
|
| 692 | 644 | ,structField C "HsIface" "nestedAtomically_closure"
|
| 693 | 645 | ,structField C "HsIface" "noMatchingContinuationPrompt_closure"
|
| 694 | - ,structField C "HsIface" "blockedOnBadFD_closure"
|
|
| 695 | - ,structField C "HsIface" "runSparks_closure"
|
|
| 696 | - ,structField C "HsIface" "ensureIOManagerIsRunning_closure"
|
|
| 697 | - ,structField C "HsIface" "interruptIOManager_closure"
|
|
| 698 | - ,structField C "HsIface" "ioManagerCapabilitiesChanged_closure"
|
|
| 699 | - ,structField C "HsIface" "runHandlersPtr_closure"
|
|
| 700 | - ,structField C "HsIface" "flushStdHandles_closure"
|
|
| 701 | - ,structField C "HsIface" "runMainIO_closure"
|
|
| 702 | - ,structField C "HsIface" "Czh_con_info"
|
|
| 703 | - ,structField C "HsIface" "Izh_con_info"
|
|
| 704 | - ,structField C "HsIface" "Fzh_con_info"
|
|
| 705 | - ,structField C "HsIface" "Dzh_con_info"
|
|
| 706 | - ,structField C "HsIface" "Wzh_con_info"
|
|
| 707 | - ,structField C "HsIface" "runAllocationLimitHandler_closure"
|
|
| 708 | - ,structField C "HsIface" "Ptr_con_info"
|
|
| 709 | - ,structField C "HsIface" "FunPtr_con_info"
|
|
| 710 | - ,structField C "HsIface" "I8zh_con_info"
|
|
| 711 | - ,structField C "HsIface" "I16zh_con_info"
|
|
| 712 | - ,structField C "HsIface" "I32zh_con_info"
|
|
| 713 | - ,structField C "HsIface" "I64zh_con_info"
|
|
| 714 | - ,structField C "HsIface" "W8zh_con_info"
|
|
| 715 | - ,structField C "HsIface" "W16zh_con_info"
|
|
| 716 | - ,structField C "HsIface" "W32zh_con_info"
|
|
| 717 | - ,structField C "HsIface" "W64zh_con_info"
|
|
| 718 | - ,structField C "HsIface" "StablePtr_con_info"
|
|
| 719 | - ,structField C "HsIface" "StackSnapshot_closure"
|
|
| 720 | 646 | ,structField C "HsIface" "divZZeroException_closure"
|
| 721 | 647 | ,structField C "HsIface" "underflowException_closure"
|
| 722 | 648 | ,structField C "HsIface" "overflowException_closure"
|