[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: NCG/LA64: adjust register usage to avoid src-register being clobbered
by Marge Bot (@marge-bot) 07 Feb '26
by Marge Bot (@marge-bot) 07 Feb '26
07 Feb '26
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
2e39a340 by Peng Fan at 2026-02-07T03:42:01-05:00
NCG/LA64: adjust register usage to avoid src-register being clobbered
- - - - -
9faf1b35 by Teo Camarasu at 2026-02-07T03:42:43-05:00
ghc-internal: Delete unnecessary GHC.Internal.Data.Ix
This module merely re-exports GHC.Internal.Ix. It was copied from
`base` when `ghc-internal` was split, but there is no reason to have
this now. So, let's delete it.
Resolves #26848
- - - - -
badaf1da by Sven Tennie at 2026-02-07T06:17:36-05:00
Add cabal.project file to generate-ci
This fixes the HLS setup for our CI code generation script
(generate-ci).
The project file simply makes `generate-ci` of the cabal file
discoverable.
- - - - -
fc696817 by Andreas Klebinger at 2026-02-07T06:17:37-05:00
CI: Don't collapse test results.
This puts test output back into the primary test log instead of a
subsection removing the need to expand a section to see test results.
While the intention was good in practice the old behaviour mostly wastes time
by requiring expansion of the section.
Fixes #26882
- - - - -
10 changed files:
- .gitlab/ci.sh
- + .gitlab/generate-ci/cabal.project
- compiler/GHC/CmmToAsm/LA64/CodeGen.hs
- libraries/base/src/Data/Ix.hs
- libraries/ghc-internal/ghc-internal.cabal.in
- − libraries/ghc-internal/src/GHC/Internal/Data/Ix.hs
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/base-exports.stdout-ws-32
Changes:
=====================================
.gitlab/ci.sh
=====================================
@@ -655,7 +655,6 @@ function install_bindist() {
}
function test_hadrian() {
- start_section test-hadrian "Test via Hadrian"
check_msys2_deps _build/stage1/bin/ghc --version
check_release_build
@@ -777,7 +776,6 @@ function test_hadrian() {
info "STAGE2_TEST=$?"
fi
- end_section test-hadrian
}
function summarise_hi_files() {
=====================================
.gitlab/generate-ci/cabal.project
=====================================
@@ -0,0 +1 @@
+packages: .
=====================================
compiler/GHC/CmmToAsm/LA64/CodeGen.hs
=====================================
@@ -1784,16 +1784,18 @@ genClz :: Width -> LocalReg -> CmmExpr -> NatM InstrBlock
genClz w dst src = do
platform <- getPlatform
(reg_x, _, code_x) <- getSomeReg src
+ tmp <- getNewRegNat II64
let dst_reg = getRegisterReg platform (CmmLocal dst)
if w `elem` [W32, W64] then do
return (code_x `snocOL` CLZ (OpReg w dst_reg) (OpReg w reg_x))
else if w `elem` [W8, W16] then do
+ -- Process uniformly according to one data length, W32.
return (code_x `appOL` toOL
[
- MOV (OpReg W64 dst_reg) (OpImm (ImmInt 1)),
- SLL (OpReg W64 dst_reg) (OpReg W64 dst_reg) (OpImm (ImmInt (31-shift))),
- SLL (OpReg W64 reg_x) (OpReg W64 reg_x) (OpImm (ImmInt (32-shift))),
- OR (OpReg W64 dst_reg) (OpReg W64 dst_reg) (OpReg W64 reg_x),
+ MOV (OpReg W64 tmp) (OpImm (ImmInt 1)),
+ SLL (OpReg W64 tmp) (OpReg W64 tmp) (OpImm (ImmInt (31-shift))),
+ SLL (OpReg W64 dst_reg) (OpReg W32 reg_x) (OpImm (ImmInt (32-shift))),
+ OR (OpReg W64 dst_reg) (OpReg W64 tmp) (OpReg W64 dst_reg),
CLZ (OpReg W64 dst_reg) (OpReg W32 dst_reg)
]
)
@@ -1806,16 +1808,17 @@ genCtz :: Width -> LocalReg -> CmmExpr -> NatM InstrBlock
genCtz w dst src = do
platform <- getPlatform
(reg_x, _, code_x) <- getSomeReg src
+ tmp <- getNewRegNat II64
let dst_reg = getRegisterReg platform (CmmLocal dst)
if w `elem` [W32, W64] then do
return (code_x `snocOL` CTZ (OpReg w dst_reg) (OpReg w reg_x))
else if w `elem` [W8, W16] then do
return (code_x `appOL` toOL
[
- MOV (OpReg W64 dst_reg) (OpImm (ImmInt 1)),
- SLL (OpReg W64 dst_reg) (OpReg W64 dst_reg) (OpImm (ImmInt shift)),
- BSTRPICK II64 (OpReg W64 reg_x) (OpReg W64 reg_x) (OpImm (ImmInt (shift-1))) (OpImm (ImmInt 0)),
- OR (OpReg W64 dst_reg) (OpReg W64 dst_reg) (OpReg W64 reg_x),
+ MOV (OpReg W64 tmp) (OpImm (ImmInt 1)),
+ SLL (OpReg W64 tmp) (OpReg W64 tmp) (OpImm (ImmInt shift)),
+ BSTRPICK II64 (OpReg W64 dst_reg) (OpReg W64 reg_x) (OpImm (ImmInt (shift-1))) (OpImm (ImmInt 0)),
+ OR (OpReg W64 dst_reg) (OpReg W64 dst_reg) (OpReg W64 tmp),
CTZ (OpReg W64 dst_reg) (OpReg W64 dst_reg)
]
)
=====================================
libraries/base/src/Data/Ix.hs
=====================================
@@ -1,4 +1,4 @@
-{-# LANGUAGE Safe #-}
+{-# LANGUAGE Trustworthy #-}
-- |
--
@@ -42,4 +42,4 @@ module Data.Ix
-- <https://www.haskell.org/onlinereport/haskell2010/haskellch19.html>.
) where
-import GHC.Internal.Data.Ix
+import GHC.Internal.Ix
=====================================
libraries/ghc-internal/ghc-internal.cabal.in
=====================================
@@ -153,7 +153,6 @@ Library
GHC.Internal.Data.Functor.Identity
GHC.Internal.Data.Functor.Utils
GHC.Internal.Data.IORef
- GHC.Internal.Data.Ix
GHC.Internal.Data.List
GHC.Internal.Data.List.NonEmpty
GHC.Internal.Data.Maybe
=====================================
libraries/ghc-internal/src/GHC/Internal/Data/Ix.hs deleted
=====================================
@@ -1,64 +0,0 @@
-{-# LANGUAGE Trustworthy #-}
-
------------------------------------------------------------------------------
--- |
--- Module : GHC.Internal.Data.Ix
--- Copyright : (c) The University of Glasgow 2001
--- License : BSD-style (see the file libraries/base/LICENSE)
---
--- Maintainer : libraries(a)haskell.org
--- Stability : stable
--- Portability : portable
---
--- The 'Ix' class is used to map a contiguous subrange of values in
--- type onto integers. It is used primarily for array indexing
--- (see the array package). 'Ix' uses row-major order.
---
------------------------------------------------------------------------------
-
-module GHC.Internal.Data.Ix
- (
- -- * The 'Ix' class
- Ix
- ( range
- , index
- , inRange
- , rangeSize
- )
- -- Ix instances:
- --
- -- Ix Char
- -- Ix Int
- -- Ix Integer
- -- Ix Bool
- -- Ix Ordering
- -- Ix ()
- -- (Ix a, Ix b) => Ix (a, b)
- -- ...
-
- -- * Deriving Instances of 'Ix'
- -- | Derived instance declarations for the class 'Ix' are only possible
- -- for enumerations (i.e. datatypes having only nullary constructors)
- -- and single-constructor datatypes, including arbitrarily large tuples,
- -- whose constituent types are instances of 'Ix'.
- --
- -- * For an enumeration, the nullary constructors are assumed to be
- -- numbered left-to-right with the indices being 0 to n-1 inclusive. This
- -- is the same numbering defined by the 'Enum' class. For example, given
- -- the datatype:
- --
- -- > data Colour = Red | Orange | Yellow | Green | Blue | Indigo | Violet
- --
- -- we would have:
- --
- -- > range (Yellow,Blue) == [Yellow,Green,Blue]
- -- > index (Yellow,Blue) Green == 1
- -- > inRange (Yellow,Blue) Red == False
- --
- -- * For single-constructor datatypes, the derived instance declarations
- -- are as shown for tuples in chapter 19, section 2 of the Haskell 2010 report:
- -- <https://www.haskell.org/onlinereport/haskell2010/haskellch19.html>.
-
- ) where
-
-import GHC.Internal.Ix
=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -1286,7 +1286,7 @@ module Data.Int where
data Int8 = ...
module Data.Ix where
- -- Safety: Safe
+ -- Safety: Trustworthy
type Ix :: * -> Constraint
class GHC.Internal.Classes.Ord a => Ix a where
range :: (a, a) -> [a]
=====================================
testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
=====================================
@@ -1286,7 +1286,7 @@ module Data.Int where
data Int8 = ...
module Data.Ix where
- -- Safety: Safe
+ -- Safety: Trustworthy
type Ix :: * -> Constraint
class GHC.Internal.Classes.Ord a => Ix a where
range :: (a, a) -> [a]
=====================================
testsuite/tests/interface-stability/base-exports.stdout-mingw32
=====================================
@@ -1286,7 +1286,7 @@ module Data.Int where
data Int8 = ...
module Data.Ix where
- -- Safety: Safe
+ -- Safety: Trustworthy
type Ix :: * -> Constraint
class GHC.Internal.Classes.Ord a => Ix a where
range :: (a, a) -> [a]
=====================================
testsuite/tests/interface-stability/base-exports.stdout-ws-32
=====================================
@@ -1286,7 +1286,7 @@ module Data.Int where
data Int8 = ...
module Data.Ix where
- -- Safety: Safe
+ -- Safety: Trustworthy
type Ix :: * -> Constraint
class GHC.Internal.Classes.Ord a => Ix a where
range :: (a, a) -> [a]
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/fcf250997fce8696ccefe2cc8a671b…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/fcf250997fce8696ccefe2cc8a671b…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][master] ghc-internal: Delete unnecessary GHC.Internal.Data.Ix
by Marge Bot (@marge-bot) 07 Feb '26
by Marge Bot (@marge-bot) 07 Feb '26
07 Feb '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
9faf1b35 by Teo Camarasu at 2026-02-07T03:42:43-05:00
ghc-internal: Delete unnecessary GHC.Internal.Data.Ix
This module merely re-exports GHC.Internal.Ix. It was copied from
`base` when `ghc-internal` was split, but there is no reason to have
this now. So, let's delete it.
Resolves #26848
- - - - -
7 changed files:
- libraries/base/src/Data/Ix.hs
- libraries/ghc-internal/ghc-internal.cabal.in
- − libraries/ghc-internal/src/GHC/Internal/Data/Ix.hs
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/base-exports.stdout-ws-32
Changes:
=====================================
libraries/base/src/Data/Ix.hs
=====================================
@@ -1,4 +1,4 @@
-{-# LANGUAGE Safe #-}
+{-# LANGUAGE Trustworthy #-}
-- |
--
@@ -42,4 +42,4 @@ module Data.Ix
-- <https://www.haskell.org/onlinereport/haskell2010/haskellch19.html>.
) where
-import GHC.Internal.Data.Ix
+import GHC.Internal.Ix
=====================================
libraries/ghc-internal/ghc-internal.cabal.in
=====================================
@@ -153,7 +153,6 @@ Library
GHC.Internal.Data.Functor.Identity
GHC.Internal.Data.Functor.Utils
GHC.Internal.Data.IORef
- GHC.Internal.Data.Ix
GHC.Internal.Data.List
GHC.Internal.Data.List.NonEmpty
GHC.Internal.Data.Maybe
=====================================
libraries/ghc-internal/src/GHC/Internal/Data/Ix.hs deleted
=====================================
@@ -1,64 +0,0 @@
-{-# LANGUAGE Trustworthy #-}
-
------------------------------------------------------------------------------
--- |
--- Module : GHC.Internal.Data.Ix
--- Copyright : (c) The University of Glasgow 2001
--- License : BSD-style (see the file libraries/base/LICENSE)
---
--- Maintainer : libraries(a)haskell.org
--- Stability : stable
--- Portability : portable
---
--- The 'Ix' class is used to map a contiguous subrange of values in
--- type onto integers. It is used primarily for array indexing
--- (see the array package). 'Ix' uses row-major order.
---
------------------------------------------------------------------------------
-
-module GHC.Internal.Data.Ix
- (
- -- * The 'Ix' class
- Ix
- ( range
- , index
- , inRange
- , rangeSize
- )
- -- Ix instances:
- --
- -- Ix Char
- -- Ix Int
- -- Ix Integer
- -- Ix Bool
- -- Ix Ordering
- -- Ix ()
- -- (Ix a, Ix b) => Ix (a, b)
- -- ...
-
- -- * Deriving Instances of 'Ix'
- -- | Derived instance declarations for the class 'Ix' are only possible
- -- for enumerations (i.e. datatypes having only nullary constructors)
- -- and single-constructor datatypes, including arbitrarily large tuples,
- -- whose constituent types are instances of 'Ix'.
- --
- -- * For an enumeration, the nullary constructors are assumed to be
- -- numbered left-to-right with the indices being 0 to n-1 inclusive. This
- -- is the same numbering defined by the 'Enum' class. For example, given
- -- the datatype:
- --
- -- > data Colour = Red | Orange | Yellow | Green | Blue | Indigo | Violet
- --
- -- we would have:
- --
- -- > range (Yellow,Blue) == [Yellow,Green,Blue]
- -- > index (Yellow,Blue) Green == 1
- -- > inRange (Yellow,Blue) Red == False
- --
- -- * For single-constructor datatypes, the derived instance declarations
- -- are as shown for tuples in chapter 19, section 2 of the Haskell 2010 report:
- -- <https://www.haskell.org/onlinereport/haskell2010/haskellch19.html>.
-
- ) where
-
-import GHC.Internal.Ix
=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -1286,7 +1286,7 @@ module Data.Int where
data Int8 = ...
module Data.Ix where
- -- Safety: Safe
+ -- Safety: Trustworthy
type Ix :: * -> Constraint
class GHC.Internal.Classes.Ord a => Ix a where
range :: (a, a) -> [a]
=====================================
testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
=====================================
@@ -1286,7 +1286,7 @@ module Data.Int where
data Int8 = ...
module Data.Ix where
- -- Safety: Safe
+ -- Safety: Trustworthy
type Ix :: * -> Constraint
class GHC.Internal.Classes.Ord a => Ix a where
range :: (a, a) -> [a]
=====================================
testsuite/tests/interface-stability/base-exports.stdout-mingw32
=====================================
@@ -1286,7 +1286,7 @@ module Data.Int where
data Int8 = ...
module Data.Ix where
- -- Safety: Safe
+ -- Safety: Trustworthy
type Ix :: * -> Constraint
class GHC.Internal.Classes.Ord a => Ix a where
range :: (a, a) -> [a]
=====================================
testsuite/tests/interface-stability/base-exports.stdout-ws-32
=====================================
@@ -1286,7 +1286,7 @@ module Data.Int where
data Int8 = ...
module Data.Ix where
- -- Safety: Safe
+ -- Safety: Trustworthy
type Ix :: * -> Constraint
class GHC.Internal.Classes.Ord a => Ix a where
range :: (a, a) -> [a]
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9faf1b3575652a5e379cc2f2c0a1266…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9faf1b3575652a5e379cc2f2c0a1266…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][master] NCG/LA64: adjust register usage to avoid src-register being clobbered
by Marge Bot (@marge-bot) 07 Feb '26
by Marge Bot (@marge-bot) 07 Feb '26
07 Feb '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
2e39a340 by Peng Fan at 2026-02-07T03:42:01-05:00
NCG/LA64: adjust register usage to avoid src-register being clobbered
- - - - -
1 changed file:
- compiler/GHC/CmmToAsm/LA64/CodeGen.hs
Changes:
=====================================
compiler/GHC/CmmToAsm/LA64/CodeGen.hs
=====================================
@@ -1784,16 +1784,18 @@ genClz :: Width -> LocalReg -> CmmExpr -> NatM InstrBlock
genClz w dst src = do
platform <- getPlatform
(reg_x, _, code_x) <- getSomeReg src
+ tmp <- getNewRegNat II64
let dst_reg = getRegisterReg platform (CmmLocal dst)
if w `elem` [W32, W64] then do
return (code_x `snocOL` CLZ (OpReg w dst_reg) (OpReg w reg_x))
else if w `elem` [W8, W16] then do
+ -- Process uniformly according to one data length, W32.
return (code_x `appOL` toOL
[
- MOV (OpReg W64 dst_reg) (OpImm (ImmInt 1)),
- SLL (OpReg W64 dst_reg) (OpReg W64 dst_reg) (OpImm (ImmInt (31-shift))),
- SLL (OpReg W64 reg_x) (OpReg W64 reg_x) (OpImm (ImmInt (32-shift))),
- OR (OpReg W64 dst_reg) (OpReg W64 dst_reg) (OpReg W64 reg_x),
+ MOV (OpReg W64 tmp) (OpImm (ImmInt 1)),
+ SLL (OpReg W64 tmp) (OpReg W64 tmp) (OpImm (ImmInt (31-shift))),
+ SLL (OpReg W64 dst_reg) (OpReg W32 reg_x) (OpImm (ImmInt (32-shift))),
+ OR (OpReg W64 dst_reg) (OpReg W64 tmp) (OpReg W64 dst_reg),
CLZ (OpReg W64 dst_reg) (OpReg W32 dst_reg)
]
)
@@ -1806,16 +1808,17 @@ genCtz :: Width -> LocalReg -> CmmExpr -> NatM InstrBlock
genCtz w dst src = do
platform <- getPlatform
(reg_x, _, code_x) <- getSomeReg src
+ tmp <- getNewRegNat II64
let dst_reg = getRegisterReg platform (CmmLocal dst)
if w `elem` [W32, W64] then do
return (code_x `snocOL` CTZ (OpReg w dst_reg) (OpReg w reg_x))
else if w `elem` [W8, W16] then do
return (code_x `appOL` toOL
[
- MOV (OpReg W64 dst_reg) (OpImm (ImmInt 1)),
- SLL (OpReg W64 dst_reg) (OpReg W64 dst_reg) (OpImm (ImmInt shift)),
- BSTRPICK II64 (OpReg W64 reg_x) (OpReg W64 reg_x) (OpImm (ImmInt (shift-1))) (OpImm (ImmInt 0)),
- OR (OpReg W64 dst_reg) (OpReg W64 dst_reg) (OpReg W64 reg_x),
+ MOV (OpReg W64 tmp) (OpImm (ImmInt 1)),
+ SLL (OpReg W64 tmp) (OpReg W64 tmp) (OpImm (ImmInt shift)),
+ BSTRPICK II64 (OpReg W64 dst_reg) (OpReg W64 reg_x) (OpImm (ImmInt (shift-1))) (OpImm (ImmInt 0)),
+ OR (OpReg W64 dst_reg) (OpReg W64 dst_reg) (OpReg W64 tmp),
CTZ (OpReg W64 dst_reg) (OpReg W64 dst_reg)
]
)
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2e39a340868cb23508ad63471e1c4cc…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2e39a340868cb23508ad63471e1c4cc…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/supersven/generate-ci_fix_hls_setup] Add cabal.project file to generate-ci
by Sven Tennie (@supersven) 07 Feb '26
by Sven Tennie (@supersven) 07 Feb '26
07 Feb '26
Sven Tennie pushed to branch wip/supersven/generate-ci_fix_hls_setup at Glasgow Haskell Compiler / GHC
Commits:
756596a1 by Sven Tennie at 2026-02-07T09:11:20+01:00
Add cabal.project file to generate-ci
This fixes the HLS setup for our CI code generation script
(generate-ci).
The project file simply makes `generate-ci` of the cabal file
discoverable.
- - - - -
1 changed file:
- + .gitlab/generate-ci/cabal.project
Changes:
=====================================
.gitlab/generate-ci/cabal.project
=====================================
@@ -0,0 +1 @@
+packages: .
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/756596a16906f34eb5c13abbcacfb38…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/756596a16906f34eb5c13abbcacfb38…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/supersven/generate-ci_fix_hls_setup] Add cabal.project file to generate-ci
by Sven Tennie (@supersven) 07 Feb '26
by Sven Tennie (@supersven) 07 Feb '26
07 Feb '26
Sven Tennie pushed to branch wip/supersven/generate-ci_fix_hls_setup at Glasgow Haskell Compiler / GHC
Commits:
a285c6c5 by Sven Tennie at 2026-02-07T08:57:36+01:00
Add cabal.project file to generate-ci
This fixes the HLS setup for our CI code generation script
(generate-ci).
- - - - -
1 changed file:
- + .gitlab/generate-ci/cabal.project
Changes:
=====================================
.gitlab/generate-ci/cabal.project
=====================================
@@ -0,0 +1 @@
+packages: .
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a285c6c50fc13452859797ee210492a…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a285c6c50fc13452859797ee210492a…
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] 53 commits: PPC NCG: Generate clear right insn at arch width
by Sven Tennie (@supersven) 07 Feb '26
by Sven Tennie (@supersven) 07 Feb '26
07 Feb '26
Sven Tennie pushed to branch wip/romes/hadrian-cross-stage2-rebase_SVEN_FINAL at Glasgow Haskell Compiler / GHC
Commits:
56db94f7 by Peter Trommler at 2026-01-26T11:26:18+01:00
PPC NCG: Generate clear right insn at arch width
The clear right immediate (clrrxi) is only available in word and
doubleword width. Generate clrrxi instructions at architecture
width for all MachOp widths.
Fixes #24145
- - - - -
5957a8ad by Wolfgang Jeltsch at 2026-01-27T06:11:40-05:00
Add operations for obtaining operating-system handles
This contribution implements CLC proposal #369. It adds operations for
obtaining POSIX file descriptors and Windows handles that underlie
Haskell handles. Those operating system handles can also be obtained
without such additional operations, but this is more involved and, more
importantly, requires using internals.
- - - - -
86a0510c by Greg Steuck at 2026-01-27T06:12:34-05:00
Move flags to precede patterns for grep and read files directly
This makes the tests pass with non-GNU (i.e. POSIX-complicant) tools.
There's no reason to use cat and pipe where direct file argument works.
- - - - -
50761451 by Cheng Shao at 2026-01-27T21:51:23-05:00
ci: update darwin boot ghc to 9.10.3
This patch updates darwin boot ghc to 9.10.3, along with other related
updates, and pays off some technical debt here:
- Update `nixpkgs` and use the `nixpkgs-25.05-darwin` channel.
- Update the `niv` template.
- Update LLVM to 21 and update `llvm-targets` to reflect LLVM 21
layout changes for arm64/x86_64 darwin targets.
- Use `stdenvNoCC` to prevent nix packaged apple sdk from being used
by boot ghc, and manually set `DEVELOPER_DIR`/`SDKROOT` to enforce
the usage of system-wide command line sdk for macos.
- When building nix derivation for boot ghc, run `configure` via the
`arch` command so that `configure` and its subprocesses pick up the
manually specified architecture.
- Remove the previous horrible hack that obliterates `configure` to
make autoconf test result in true. `configure` now properly does its
job.
- Remove the now obsolete configure args and post install settings
file patching logic.
- Use `scheme-small` for texlive to avoid build failures in certain
unused texlive packages, especially on x86_64-darwin.
- - - - -
94dcd15e by Matthew Pickering at 2026-01-27T21:52:05-05:00
Evaluate backtraces for "error" exceptions at the moment they are thrown
See Note [Capturing the backtrace in throw] and
Note [Hiding precise exception signature in throw] which explain the
implementation.
This commit makes `error` and `throw` behave the same with regard to
backtraces. Previously, exceptions raised by `error` would not contain
useful IPE backtraces.
I did try and implement `error` in terms of `throw` but it started to
involve putting diverging functions into hs-boot files, which seemed to
risky if the compiler wouldn't be able to see if applying a function
would diverge.
CLC proposal: https://github.com/haskell/core-libraries-committee/issues/383
Fixes #26751
- - - - -
ef35e3ea by Teo Camarasu at 2026-01-27T21:52:46-05:00
ghc-internal: move all Data instances to Data.Data
Most instances of Data are defined in GHC.Internal.Data.Data.
Let's move all remaining instance there.
This moves other modules down in the dependency hierarchy allowing for
more parallelism, and it decreases the likelihood that we would need to
load this heavy .hi file if we don't actually need it.
Resolves #26830
Metric Decrease:
T12227
T16875
- - - - -
5e0ec555 by sheaf at 2026-01-28T06:56:38-05:00
Add test case for #25679
This commit adds the T25679 test case. The test now passes, thanks to
commit 1e53277af36d3f0b6ad5491f70ffc5593a49dcfd.
Fixes #25679
- - - - -
f1cd1611 by sheaf at 2026-01-28T06:56:38-05:00
Improve defaulting of representational equalities
This commit makes the defaulting of representational equalities, introduced
in 1e53277a, a little bit more robust. Now, instead of calling the eager
unifier, it calls the full-blown constraint solver, which means that it can
handle some subtle situations, e.g. involving functional dependencies and
type-family injectivity annotations, such as:
type family F a = r | r -> a
type instance F Int = Bool
[W] F beta ~R Bool
- - - - -
25edf516 by sheaf at 2026-01-28T06:56:38-05:00
Improve errors for unsolved representational equalities
This commit adds a new field of CtLoc, CtExplanations, which allows the
typechecker to leave some information about what it has done. For the moment,
it is only used to improve error messages for unsolved representational
equalities. The typechecker will now accumulate, when unifying at
representational role:
- out-of-scope newtype constructors,
- type constructors that have nominal role in a certain argument,
- over-saturated type constructors,
- AppTys, e.g. `c a ~R# c b`, to report that we must assume that 'c' has
nominal role in its parameters,
- data family applications that do not reduce, potentially preventing
newtype unwrapping.
Now, instead of having to re-construct the possible errors after the fact,
we simply consult the CtExplanations field.
Additionally, this commit modifies the typechecker error messages that
concern out-of-scope newtype constructors. The error message now depends
on whether we have an import suggestion to provide to the user:
- If we have an import suggestion for the newtype constructor,
the message will be of the form:
The data constructor MkN of the newtype N is out of scope
Suggested fix: add 'MkN' to the import list in the import of 'M'
- If we don't have any import suggestions, the message will be
of the form:
NB: The type 'N' is an opaque newtype, whose constructor is hidden
Fixes #15850, #20289, #20468, #23731, #25949, #26137
- - - - -
4d0e6da1 by Simon Peyton Jones at 2026-01-28T06:57:19-05:00
Fix two bugs in short-cut constraint solving
There are two main changes here:
* Use `isSolvedWC` rather than `isEmptyWC` in `tryShortCutSolver`
The residual constraint may have some fully-solved, but
still-there implications, and we don't want them to abort short
cut solving! That bug caused #26805.
* In the short-cut solver, we abandon the fully-solved residual
constraint; but we may thereby lose track of Givens that are
needed, and either report them as redundant or prune evidence
bindings that are in fact needed.
This bug stopped the `constraints` package from compiling;
see the trail in !15389.
The second bug led me to (another) significant refactoring
of the mechanism for tracking needed EvIds. See the new
Note [Tracking needed EvIds] in GHC.Tc.Solver.Solve
It's simpler and much less head-scratchy now.
Some particulars:
* An EvBindsVar now tracks NeededEvIds
* We deal with NeededEvIds for an implication only when it is
fully solved. Much simpler!
* `tryShortCutTcS` now takes a `TcM WantedConstraints` rather than
`TcM Bool`, so that is can plumb the needed EvIds correctly.
* Remove `ic_need` and `ic_need_implic` from Implication (hooray),
and add `ics_dm` and `ics_non_dm` to `IC_Solved`.
Pure refactor
* Shorten data constructor `CoercionHole` to `CH`, following
general practice in GHC.
* Rename `EvBindMap` to `EvBindsMap` for consistency
- - - - -
662480b7 by Cheng Shao at 2026-01-28T06:58:00-05:00
ci: use debian validate bindists instead of fedora release bindists in testing stage
This patch changes the `abi-test`, `hadrian-multi` and `perf` jobs in
the full-ci pipeline testing stage to use debian validate bindists
instead of fedora release bindists, to increase pipeline level
parallelism and allow full-ci pipelines to complete earlier. Closes #26818.
- - - - -
39581ec6 by Cheng Shao at 2026-01-28T06:58:40-05:00
ci: run perf test with -j$cores
This patch makes the perf ci job compile Cabal with -j$cores to speed
up the job.
- - - - -
607b287b by Wolfgang Jeltsch at 2026-01-28T15:41:53+02:00
Remove `GHC.Desugar` from `base`
`GHC.Desugar` was deprecated and should have been removed in GHC 9.14.
However, the removal was forgotten, although there was a code block that
was intended to trigger a compilation error when the GHC version in use
was 9.14 or later. This code sadly didn’t work, because the
`__GLASGOW_HASKELL__` macro was misspelled as `__GLASGOW_HASKELL`.
- - - - -
e8f5a45d by sterni at 2026-01-29T04:19:18-05:00
users_guide: fix runtime error during build with Sphinx 9.1.0
Appears that pathto is stricter about what it accepts now.
Tested Sphinx 8.2.3 and 9.1.0 on the ghc-9.10 branch.
Resolves #26810.
Co-authored-by: Martin Weinelt <hexa(a)darmstadt.ccc.de>
- - - - -
ce2d62fb by Jessica Clarke at 2026-01-29T19:48:51-05:00
PPC NCG: Use libcall for 64-bit cmpxchg on 32-bit PowerPC
There is no native instruction for this, and even if there were a
register pair version we could use, the implementation here is assuming
the values fit in a single register, and we end up only using / defining
the low halves of the registers.
Fixes: b4d39adbb5 ("PrimOps: Add CAS op for all int sizes")
Fixes: #23969
- - - - -
43d97761 by Michael Karcher at 2026-01-29T19:49:43-05:00
NCG for PPC: add pattern for CmmRegOff to iselExpr64
Closes #26828
- - - - -
aeeb4a20 by Matthew Pickering at 2026-01-30T11:42:47-05:00
determinism: Use deterministic map for Strings in TyLitMap
When generating typeable evidence the types we need evidence for all
cached in a TypeMap, the order terms are retrieved from a type map
determines the order the bindings appear in the program.
A TypeMap is quite diligent to use deterministic maps, apart from in the
TyLitMap, which uses a UniqFM for storing strings, whose ordering
depends on the Unique of the FastString.
This can cause non-deterministic .hi and .o files.
An unexpected side-effect is the error message but RecordDotSyntaxFail8
changing. I looked into this with Sam and this change caused the
constraints to be solved in a different order which results in a
slightly different error message. I have accepted the new test, since
the output before was non-deterministic and the new output is consistent
with the other messages in that file.
Fixes #26846
- - - - -
9e4d70c2 by Andrew Lelechenko at 2026-01-30T11:43:29-05:00
Upgrade text submodule to 2.1.4
- - - - -
631fa5ae by Recursion Ninja at 2026-01-31T22:30:11+00:00
Decouple `L.S.H.Decls` from importing `GHC.Types.Basic`
Data-types within `GHC.Types.Basic` which describe components of
the AST are migrated to `Language.Haskell.Syntax.Basic`. Related
function definitions are also moved.
Types moved to L.H.S. because they are part of the AST:
* TopLevelFlag
* RuleName
Types moved from L.H.S. to GHC.Hs. because they are not needed in the AST:
* TyConFlavour
* TypeOrData
* NewOrData
Migrated instances:
* `Outputable` instances moved to in `GHC.Utils.Outputable`
* `Binary` instance of `Boxity` moved to to `GHC.Utils.Binary`
* Other `Binary` instances are orphans to be migrated later.
The `OverlapMode` data-type is given a TTG extension point.
The `OverlapFlag` data-type, which depends on `OverlapMode`,
is updated to support `OverlapMode` with a GHC "pass" type paramerter.
In order to avoid module import cycles, `OverlapMode` and `OverlapFlag`
are migrated to new modules (no way around this).
* Migrated `OverlapMode` to new module `Language.Haskell.Syntax.Overlap`
* Migrated `OverlapFlag` to new module `GHC.Hs.Decls.Overlap`
- - - - -
9769cc03 by Simon Hengel at 2026-02-01T04:21:03-05:00
Update the documentation for MultiWayIf (fixes #25376)
(so that it matches the implementation)
- - - - -
5fc9442a by Peter Trommler at 2026-02-01T04:21:44-05:00
hadrian: Fix dependency generation for assembler
Assembler files allow # for comments unless in column 1. A modern
cpp for C treats those a preprocessor directives. We tell gcc that
a .S file is assembler with cpp and not C.
Fixes #26819
- - - - -
269c4087 by Simon Peyton Jones at 2026-02-01T19:38:10-05:00
Include current phase in the range for rule/unfoldings
This MR fixes a bad loop in the compiler: #26826.
The fix is to add (WAR2) to
Note [What is active in the RHS of a RULE or unfolding?]
in GHC.Core.Opt.Simplify.Utils
- - - - -
ddf1434f by Vladislav Zavialov at 2026-02-01T19:38:52-05:00
Refactor: merge HsMultilineString into HsString (#26860)
Before this patch, HsLit defined two separate constructors to represent
single-line and multi-line strings:
data HsLit x
...
| HsString (XHsString x) FastString
| HsMultilineString (XHsMultilineString x) FastString
I found this to be an unnecessary complication and an obstacle to unifying
HsLit with HsTyLit. Now we use HsString for both kinds of literals.
One user-facing change here is `ppr (HsString st s)` behaving differently for
single-line strings containing newlines:
x = "first line \
\asdf\n\
\second line"
Previously, the literal was fed to `ftext` with its newlines, producing an
ill-formed SDoc. This issue is now addressed by using `split` for both
single-line and multi-line strings:
vcat $ map text $ split '\n' (unpackFS src)
See the parser/should_fail/T26860ppr test.
In addition (and unrelatedly to the main payload of this patch),
drop the unused pmPprHsLit helper.
- - - - -
2b4f463c by Simon Peyton Jones at 2026-02-02T17:32:32+00:00
Remove exprIsCheap from doFloatFromRhs
See #26854 and Note [Float when expandable]
This patch simplifies the code, by removing an extra unnecessary test.
- - - - -
9db7f21f by Brandon Chinn at 2026-02-03T09:15:10-05:00
Refactor: make function patterns exhaustive
Also added missing (==) logic for:
* HsMultilineString
* HsInt{8,16,32}
* HsWord{8,16,32}
- - - - -
aa9c5e2c by Hécate Kleidukos at 2026-02-03T15:58:35-05:00
driver: Hide source paths at verbosity level 1 by default
- - - - -
c64cca1e by mangoiv at 2026-02-03T15:59:29-05:00
ExplicitLevelImports: check staging for types just like for values
Previously, imported types were entirely exempted from staging checks as
the implicit stage persistance assumed to be all imported types to be
well staged. ExplicitLevelImports' change specification, however, does
not do such an exemption. Thus we want to introduce such a check, just
like we have for values.
ExplicitLevelImports does not, however, talk about local names - from
its perspective, we could theoretically keep treating locally introduced
types specially - e.g. an ill-staged used in a quote would only emit a
warning, not an error. To allow for a potential future migration away
from such wrinkles as the staging check in notFound
(see Note [Out of scope might be a staging error]) we consistently do
the strict staging check that we also do for value if ExplicitLevelImports
is on.
Closes #26098
- - - - -
5f0dbeb6 by Simon Hengel at 2026-02-03T16:00:12-05:00
Use Haddock formatting in deprecation message of `initNameCache`
- - - - -
01ecb612 by Andreas Klebinger at 2026-02-04T09:56:25-05:00
testsuite: Explicitly use utf-8 encoding in rts-includes linter.
Not doing so caused failures on windows, as python failed to pick a
reasonable encoding even with locale set.
Fixes #26850
- - - - -
ea0d1317 by Zubin Duggal at 2026-02-04T09:57:06-05:00
Bump transformers submodule to 0.6.3.0
Fixes #26790
- - - - -
cbe4300e by Simon Peyton Jones at 2026-02-05T04:31:04-05:00
Fix subtle bug in GHC.Core.Utils.mkTick
This patch fixes a decade-old bug in `mkTick`, which
could generate type-incorrect code! See the diagnosis
in #26772.
The new code is simpler and easier to understand.
(As #26772 says, I think it could be improved further.)
- - - - -
a193a8da by Simon Peyton Jones at 2026-02-05T04:31:04-05:00
Modify a debug-trace in the Simplifier
...just to show a bit more information.
- - - - -
b579dfdc by Simon Peyton Jones at 2026-02-05T04:31:04-05:00
Fix long-standing interaction between ticks and casts
The code for Note [Eliminate Identity Cases] was simply wrong when
ticks and casts interacted. This patch fixes the interaction.
It was shown up when validating #26772, although it's not the exactly
the bug that's reported by #26772. Nor is it easy to reproduce, hence
no regression test.
- - - - -
fac0de1e by Cheng Shao at 2026-02-05T04:31:49-05:00
libraries: bump Cabal submodule to 3.16.1.0
- - - - -
00589122 by Cheng Shao at 2026-02-05T04:31:49-05:00
libraries: bump deepseq submodule to 1.5.2.0
Also:
- Get rid of usage of deprecated `NFData` function instance in the
compiler
- `T21391` still relies on `NFData` function instance, add
`-Wno-deprecations` for the time being.
- - - - -
84474c71 by Cheng Shao at 2026-02-05T04:31:50-05:00
libraries: bump directory submodule to 1.3.10.1
- - - - -
1a9f4662 by Cheng Shao at 2026-02-05T04:31:50-05:00
libraries: bump exceptions submodule to 0.10.12
- - - - -
772a5fca by Matthew Pickering at 2026-02-07T06:55:00+00: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.
- - - - -
a609849f by Matthew Pickering at 2026-02-07T06:55:00+00:00
Use explicit syntax rather than pure
- - - - -
f5ac77f0 by Matthew Pickering at 2026-02-07T06:55:00+00: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
- - - - -
c29de7ff by Matthew Pickering at 2026-02-07T06:55:00+00: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).
- - - - -
708d2bbf by Matthew Pickering at 2026-02-07T06:55:00+00: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)
- - - - -
f8fb6ac0 by Matthew Pickering at 2026-02-07T06:55:00+00: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
T12227
T18140
T18282
T9233
-------------------------
Co-authored-by: Sven Tennie <sven.tennie(a)gmail.com>
Fix rebase: settings-use-distro-mingw is now staged
- - - - -
f81de46e by Matthew Pickering at 2026-02-07T06:55:00+00: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.
- - - - -
fe171815 by Matthew Pickering at 2026-02-07T06:55:00+00: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
- - - - -
cf2d2159 by Matthew Pickering at 2026-02-07T06:55:00+00: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
- - - - -
2e3b1cb3 by Sven Tennie at 2026-02-07T06:55:00+00:00
ci: Increase timeout for emulators
Test runs with emulators naturally take longer than on native machines.
Generate jobs.yml
- - - - -
53e262ff by Sven Tennie at 2026-02-07T06:55:00+00: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
- - - - -
37572da9 by Matthew Pickering at 2026-02-07T06:55:00+00: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.
- - - - -
bd397a5b by Sven Tennie at 2026-02-07T06:55:00+00:00
Javascript skip T23697
See #22355 about how HSC2HS and the Javascript target don't play well
together.
- - - - -
4b06bfbb by Sven Tennie at 2026-02-07T06:55:00+00: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.
- - - - -
4f307a1f by Sven Tennie at 2026-02-07T06:55:00+00:00
Windows needs NM_STAGE0 as well
The stage0 always needs nm.
- - - - -
81f7af42 by Sven Tennie at 2026-02-07T06:55:00+00: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.
- - - - -
324 changed files:
- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/darwin/nix/sources.json
- .gitlab/darwin/toolchain.nix
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- compiler/GHC/CmmToAsm/PPC/CodeGen.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/FamInstEnv.hs
- compiler/GHC/Core/InstEnv.hs
- compiler/GHC/Core/Map/Type.hs
- compiler/GHC/Core/Opt/OccurAnal.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/WorkWrap.hs
- compiler/GHC/Core/Predicate.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/TyCo/Subst.hs
- compiler/GHC/Core/TyCo/Tidy.hs
- compiler/GHC/Core/TyCon/RecWalk.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/Data/Maybe.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs/Decls.hs
- + compiler/GHC/Hs/Decls/Overlap.hs
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/Hs/Lit.hs
- compiler/GHC/Hs/Syn/Type.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Errors/Types.hs
- compiler/GHC/HsToCore/Match/Literal.hs
- compiler/GHC/HsToCore/Pmc/Solver.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/String.hs
- compiler/GHC/Rename/Env.hs
- compiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/HsType.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Rename/Names.hs
- compiler/GHC/Rename/Splice.hs
- compiler/GHC/Rename/Splice.hs-boot
- compiler/GHC/Rename/Unbound.hs
- compiler/GHC/Tc/Deriv.hs
- compiler/GHC/Tc/Deriv/Utils.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/Default.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Instance/Class.hs
- compiler/GHC/Tc/Instance/Family.hs
- compiler/GHC/Tc/Solver/Default.hs
- compiler/GHC/Tc/Solver/Dict.hs
- compiler/GHC/Tc/Solver/Equality.hs
- compiler/GHC/Tc/Solver/InertSet.hs
- compiler/GHC/Tc/Solver/Monad.hs
- compiler/GHC/Tc/Solver/Solve.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/Types/Constraint.hs
- compiler/GHC/Tc/Types/CtLoc.hs
- compiler/GHC/Tc/Types/Evidence.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Utils/Env.hs
- compiler/GHC/Tc/Utils/Instantiate.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/Tc/Utils/Unify.hs
- compiler/GHC/Tc/Zonk/TcType.hs
- compiler/GHC/Tc/Zonk/Type.hs
- compiler/GHC/ThToHs.hs
- compiler/GHC/Types/Basic.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Types/InlinePragma.hs
- compiler/GHC/Types/Name.hs
- compiler/GHC/Types/Name/Cache.hs
- compiler/GHC/Types/RepType.hs
- compiler/GHC/Types/Var.hs
- compiler/GHC/Unit/Module/ModIface.hs
- compiler/GHC/Unit/Types.hs
- compiler/GHC/Utils/Binary.hs
- compiler/GHC/Utils/Monad.hs
- compiler/GHC/Utils/Outputable.hs
- compiler/GHC/Utils/Trace.hs
- compiler/Language/Haskell/Syntax/Basic.hs
- compiler/Language/Haskell/Syntax/Decls.hs
- + compiler/Language/Haskell/Syntax/Decls/Overlap.hs
- compiler/Language/Haskell/Syntax/Extension.hs
- compiler/Language/Haskell/Syntax/Lit.hs
- compiler/ghc.cabal.in
- configure.ac
- distrib/configure.ac.in
- docs/users_guide/9.16.1-notes.rst
- docs/users_guide/exts/multiway_if.rst
- docs/users_guide/rtd-theme/layout.html
- 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/Program.hs
- hadrian/src/Rules/Register.hs
- hadrian/src/Rules/Test.hs
- hadrian/src/Settings.hs
- hadrian/src/Settings/Builders/Cabal.hs
- hadrian/src/Settings/Builders/Cc.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/Cabal
- libraries/base/base.cabal.in
- libraries/base/changelog.md
- − libraries/base/src/GHC/Desugar.hs
- + libraries/base/src/System/IO/OS.hs
- libraries/base/tests/IO/all.T
- + libraries/base/tests/IO/osHandles001FileDescriptors.hs
- + libraries/base/tests/IO/osHandles001FileDescriptors.stdout
- + libraries/base/tests/IO/osHandles001WindowsHandles.hs
- + libraries/base/tests/IO/osHandles001WindowsHandles.stdout
- + libraries/base/tests/IO/osHandles002FileDescriptors.hs
- + libraries/base/tests/IO/osHandles002FileDescriptors.stderr
- + libraries/base/tests/IO/osHandles002FileDescriptors.stdin
- + libraries/base/tests/IO/osHandles002FileDescriptors.stdout
- + libraries/base/tests/IO/osHandles002WindowsHandles.hs
- + libraries/base/tests/IO/osHandles002WindowsHandles.stderr
- + libraries/base/tests/IO/osHandles002WindowsHandles.stdin
- + libraries/base/tests/IO/osHandles002WindowsHandles.stdout
- libraries/base/tests/T23454.stderr
- libraries/base/tests/all.T
- libraries/base/tests/perf/Makefile
- libraries/deepseq
- libraries/directory
- libraries/exceptions
- libraries/ghc-internal/ghc-internal.cabal.in
- libraries/ghc-internal/src/GHC/Internal/Data/Data.hs
- libraries/ghc-internal/src/GHC/Internal/Err.hs
- libraries/ghc-internal/src/GHC/Internal/Exts.hs
- libraries/ghc-internal/src/GHC/Internal/Functor/ZipList.hs
- + libraries/ghc-internal/src/GHC/Internal/System/IO/OS.hs
- libraries/ghc-internal/tests/stack-annotation/all.T
- + libraries/ghc-internal/tests/stack-annotation/ann_frame005.hs
- + libraries/ghc-internal/tests/stack-annotation/ann_frame005.stdout
- libraries/text
- libraries/transformers
- llvm-targets
- m4/fp_find_nm.m4
- m4/fptools_set_platform_vars.m4
- m4/prep_target_file.m4
- testsuite/ghc-config/ghc-config.hs
- testsuite/mk/test.mk
- testsuite/tests/backpack/cabal/bkpcabal08/bkpcabal08.stdout
- testsuite/tests/count-deps/CountDepsAst.stdout
- testsuite/tests/count-deps/CountDepsParser.stdout
- + testsuite/tests/default/T25825.hs
- testsuite/tests/default/all.T
- testsuite/tests/deriving/should_fail/T1496.stderr
- testsuite/tests/deriving/should_fail/T4846.stderr
- testsuite/tests/deriving/should_fail/T5498.stderr
- testsuite/tests/deriving/should_fail/T6147.stderr
- testsuite/tests/deriving/should_fail/T7148.stderr
- testsuite/tests/deriving/should_fail/T7148a.stderr
- 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/T16318/Makefile
- testsuite/tests/driver/T18125/Makefile
- testsuite/tests/driver/T20030/test1/all.T
- testsuite/tests/driver/T20030/test2/all.T
- testsuite/tests/driver/T20030/test3/all.T
- testsuite/tests/driver/T20030/test4/all.T
- testsuite/tests/driver/T20030/test5/all.T
- testsuite/tests/driver/T20030/test6/all.T
- testsuite/tests/driver/T8526/T8526.script
- testsuite/tests/driver/bytecode-object/Makefile
- testsuite/tests/driver/bytecode-object/bytecode_object19.stdout
- testsuite/tests/driver/dynamicToo/dynamicToo001/Makefile
- testsuite/tests/driver/fat-iface/fat014.script
- testsuite/tests/driver/implicit-dyn-too/Makefile
- testsuite/tests/driver/multipleHomeUnits/all.T
- testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_recomp_th.stdout
- testsuite/tests/gadt/CasePrune.stderr
- + testsuite/tests/ghc-api/TypeMapStringLiteral.hs
- testsuite/tests/ghc-api/all.T
- testsuite/tests/ghc-e/should_fail/all.T
- testsuite/tests/ghci.debugger/scripts/T26042b.stdout
- testsuite/tests/ghci.debugger/scripts/T26042c.stdout
- testsuite/tests/ghci.debugger/scripts/T26042d2.stdout
- testsuite/tests/ghci.debugger/scripts/T26042f2.stdout
- testsuite/tests/ghci.debugger/scripts/T8487.stdout
- testsuite/tests/ghci.debugger/scripts/break011.stdout
- testsuite/tests/ghci.debugger/scripts/break017.stdout
- testsuite/tests/ghci.debugger/scripts/break025.stdout
- − testsuite/tests/ghci/linking/T11531.stderr
- testsuite/tests/ghci/prog018/prog018.script
- testsuite/tests/ghci/scripts/T13869.script
- testsuite/tests/ghci/scripts/T13997.script
- testsuite/tests/ghci/scripts/T17669.script
- testsuite/tests/ghci/scripts/T18330.script
- testsuite/tests/ghci/scripts/T18330.stdout
- testsuite/tests/ghci/scripts/T1914.script
- testsuite/tests/ghci/scripts/T20217.script
- testsuite/tests/ghci/scripts/T6105.script
- testsuite/tests/ghci/scripts/T8042.script
- testsuite/tests/ghci/scripts/T8042recomp.script
- testsuite/tests/ghci/should_run/Makefile
- testsuite/tests/indexed-types/should_fail/T9580.stderr
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/base-exports.stdout-ws-32
- testsuite/tests/interface-stability/ghc-experimental-exports.stdout
- testsuite/tests/interface-stability/ghc-experimental-exports.stdout-mingw32
- testsuite/tests/javascript/closure/all.T
- testsuite/tests/linear/should_fail/LinearRole.stderr
- testsuite/tests/linters/regex-linters/check-rts-includes.py
- testsuite/tests/parser/should_fail/RecordDotSyntaxFail8.stderr
- + testsuite/tests/parser/should_fail/T26860ppr.hs
- + testsuite/tests/parser/should_fail/T26860ppr.stderr
- testsuite/tests/parser/should_fail/all.T
- testsuite/tests/roles/should_fail/RolesIArray.stderr
- testsuite/tests/rts/T13676.script
- testsuite/tests/simplCore/should_compile/T21391.hs
- + testsuite/tests/simplCore/should_compile/T26805.hs
- + testsuite/tests/simplCore/should_compile/T26805.stderr
- + testsuite/tests/simplCore/should_compile/T26826.hs
- testsuite/tests/simplCore/should_compile/all.T
- + testsuite/tests/th/T26098A_quote.hs
- + testsuite/tests/th/T26098A_splice.hs
- + testsuite/tests/th/T26098_local.hs
- + testsuite/tests/th/T26098_local.stderr
- + testsuite/tests/th/T26098_quote.hs
- + testsuite/tests/th/T26098_quote.stderr
- + testsuite/tests/th/T26098_splice.hs
- + testsuite/tests/th/T26098_splice.stderr
- testsuite/tests/th/all.T
- + testsuite/tests/typecheck/should_compile/T26805a.hs
- testsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_fail/T10285.stderr
- testsuite/tests/typecheck/should_fail/T10534.stderr
- testsuite/tests/typecheck/should_fail/T10715b.stderr
- testsuite/tests/typecheck/should_fail/T11347.stderr
- testsuite/tests/typecheck/should_fail/T15801.stderr
- + testsuite/tests/typecheck/should_fail/T15850.hs
- + testsuite/tests/typecheck/should_fail/T15850.stderr
- + testsuite/tests/typecheck/should_fail/T15850_Lib.hs
- + testsuite/tests/typecheck/should_fail/T20289.hs
- + testsuite/tests/typecheck/should_fail/T20289.stderr
- + testsuite/tests/typecheck/should_fail/T20289_A.hs
- testsuite/tests/typecheck/should_fail/T22645.stderr
- testsuite/tests/typecheck/should_fail/T22924a.stderr
- + testsuite/tests/typecheck/should_fail/T23731.hs
- + testsuite/tests/typecheck/should_fail/T23731.stderr
- + testsuite/tests/typecheck/should_fail/T23731b.hs
- + testsuite/tests/typecheck/should_fail/T23731b.stderr
- + testsuite/tests/typecheck/should_fail/T23731b_aux.hs
- + testsuite/tests/typecheck/should_fail/T25679.hs
- + testsuite/tests/typecheck/should_fail/T25679.stderr
- + testsuite/tests/typecheck/should_fail/T25949.hs
- + testsuite/tests/typecheck/should_fail/T25949.stderr
- + testsuite/tests/typecheck/should_fail/T25949_aux.hs
- + testsuite/tests/typecheck/should_fail/T26137.hs
- + testsuite/tests/typecheck/should_fail/T26137.stderr
- testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr
- testsuite/tests/typecheck/should_fail/TcCoercibleFail3.stderr
- testsuite/tests/typecheck/should_fail/all.T
- utils/check-exact/ExactPrint.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs
- utils/haddock/haddock-api/src/Haddock/Convert.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
- utils/haddock/haddock-api/src/Haddock/Types.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/53c60329b440b9e43a129a05d2895c…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/53c60329b440b9e43a129a05d2895c…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 2 commits: NCG/LA64: adjust register usage to avoid src-register being clobbered
by Marge Bot (@marge-bot) 07 Feb '26
by Marge Bot (@marge-bot) 07 Feb '26
07 Feb '26
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
27d3046e by Peng Fan at 2026-02-06T20:20:46-05:00
NCG/LA64: adjust register usage to avoid src-register being clobbered
- - - - -
fcf25099 by Teo Camarasu at 2026-02-06T20:20:48-05:00
ghc-internal: Delete unnecessary GHC.Internal.Data.Ix
This module merely re-exports GHC.Internal.Ix. It was copied from
`base` when `ghc-internal` was split, but there is no reason to have
this now. So, let's delete it.
Resolves #26848
- - - - -
8 changed files:
- compiler/GHC/CmmToAsm/LA64/CodeGen.hs
- libraries/base/src/Data/Ix.hs
- libraries/ghc-internal/ghc-internal.cabal.in
- − libraries/ghc-internal/src/GHC/Internal/Data/Ix.hs
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/base-exports.stdout-ws-32
Changes:
=====================================
compiler/GHC/CmmToAsm/LA64/CodeGen.hs
=====================================
@@ -1784,16 +1784,18 @@ genClz :: Width -> LocalReg -> CmmExpr -> NatM InstrBlock
genClz w dst src = do
platform <- getPlatform
(reg_x, _, code_x) <- getSomeReg src
+ tmp <- getNewRegNat II64
let dst_reg = getRegisterReg platform (CmmLocal dst)
if w `elem` [W32, W64] then do
return (code_x `snocOL` CLZ (OpReg w dst_reg) (OpReg w reg_x))
else if w `elem` [W8, W16] then do
+ -- Process uniformly according to one data length, W32.
return (code_x `appOL` toOL
[
- MOV (OpReg W64 dst_reg) (OpImm (ImmInt 1)),
- SLL (OpReg W64 dst_reg) (OpReg W64 dst_reg) (OpImm (ImmInt (31-shift))),
- SLL (OpReg W64 reg_x) (OpReg W64 reg_x) (OpImm (ImmInt (32-shift))),
- OR (OpReg W64 dst_reg) (OpReg W64 dst_reg) (OpReg W64 reg_x),
+ MOV (OpReg W64 tmp) (OpImm (ImmInt 1)),
+ SLL (OpReg W64 tmp) (OpReg W64 tmp) (OpImm (ImmInt (31-shift))),
+ SLL (OpReg W64 dst_reg) (OpReg W32 reg_x) (OpImm (ImmInt (32-shift))),
+ OR (OpReg W64 dst_reg) (OpReg W64 tmp) (OpReg W64 dst_reg),
CLZ (OpReg W64 dst_reg) (OpReg W32 dst_reg)
]
)
@@ -1806,16 +1808,17 @@ genCtz :: Width -> LocalReg -> CmmExpr -> NatM InstrBlock
genCtz w dst src = do
platform <- getPlatform
(reg_x, _, code_x) <- getSomeReg src
+ tmp <- getNewRegNat II64
let dst_reg = getRegisterReg platform (CmmLocal dst)
if w `elem` [W32, W64] then do
return (code_x `snocOL` CTZ (OpReg w dst_reg) (OpReg w reg_x))
else if w `elem` [W8, W16] then do
return (code_x `appOL` toOL
[
- MOV (OpReg W64 dst_reg) (OpImm (ImmInt 1)),
- SLL (OpReg W64 dst_reg) (OpReg W64 dst_reg) (OpImm (ImmInt shift)),
- BSTRPICK II64 (OpReg W64 reg_x) (OpReg W64 reg_x) (OpImm (ImmInt (shift-1))) (OpImm (ImmInt 0)),
- OR (OpReg W64 dst_reg) (OpReg W64 dst_reg) (OpReg W64 reg_x),
+ MOV (OpReg W64 tmp) (OpImm (ImmInt 1)),
+ SLL (OpReg W64 tmp) (OpReg W64 tmp) (OpImm (ImmInt shift)),
+ BSTRPICK II64 (OpReg W64 dst_reg) (OpReg W64 reg_x) (OpImm (ImmInt (shift-1))) (OpImm (ImmInt 0)),
+ OR (OpReg W64 dst_reg) (OpReg W64 dst_reg) (OpReg W64 tmp),
CTZ (OpReg W64 dst_reg) (OpReg W64 dst_reg)
]
)
=====================================
libraries/base/src/Data/Ix.hs
=====================================
@@ -1,4 +1,4 @@
-{-# LANGUAGE Safe #-}
+{-# LANGUAGE Trustworthy #-}
-- |
--
@@ -42,4 +42,4 @@ module Data.Ix
-- <https://www.haskell.org/onlinereport/haskell2010/haskellch19.html>.
) where
-import GHC.Internal.Data.Ix
+import GHC.Internal.Ix
=====================================
libraries/ghc-internal/ghc-internal.cabal.in
=====================================
@@ -153,7 +153,6 @@ Library
GHC.Internal.Data.Functor.Identity
GHC.Internal.Data.Functor.Utils
GHC.Internal.Data.IORef
- GHC.Internal.Data.Ix
GHC.Internal.Data.List
GHC.Internal.Data.List.NonEmpty
GHC.Internal.Data.Maybe
=====================================
libraries/ghc-internal/src/GHC/Internal/Data/Ix.hs deleted
=====================================
@@ -1,64 +0,0 @@
-{-# LANGUAGE Trustworthy #-}
-
------------------------------------------------------------------------------
--- |
--- Module : GHC.Internal.Data.Ix
--- Copyright : (c) The University of Glasgow 2001
--- License : BSD-style (see the file libraries/base/LICENSE)
---
--- Maintainer : libraries(a)haskell.org
--- Stability : stable
--- Portability : portable
---
--- The 'Ix' class is used to map a contiguous subrange of values in
--- type onto integers. It is used primarily for array indexing
--- (see the array package). 'Ix' uses row-major order.
---
------------------------------------------------------------------------------
-
-module GHC.Internal.Data.Ix
- (
- -- * The 'Ix' class
- Ix
- ( range
- , index
- , inRange
- , rangeSize
- )
- -- Ix instances:
- --
- -- Ix Char
- -- Ix Int
- -- Ix Integer
- -- Ix Bool
- -- Ix Ordering
- -- Ix ()
- -- (Ix a, Ix b) => Ix (a, b)
- -- ...
-
- -- * Deriving Instances of 'Ix'
- -- | Derived instance declarations for the class 'Ix' are only possible
- -- for enumerations (i.e. datatypes having only nullary constructors)
- -- and single-constructor datatypes, including arbitrarily large tuples,
- -- whose constituent types are instances of 'Ix'.
- --
- -- * For an enumeration, the nullary constructors are assumed to be
- -- numbered left-to-right with the indices being 0 to n-1 inclusive. This
- -- is the same numbering defined by the 'Enum' class. For example, given
- -- the datatype:
- --
- -- > data Colour = Red | Orange | Yellow | Green | Blue | Indigo | Violet
- --
- -- we would have:
- --
- -- > range (Yellow,Blue) == [Yellow,Green,Blue]
- -- > index (Yellow,Blue) Green == 1
- -- > inRange (Yellow,Blue) Red == False
- --
- -- * For single-constructor datatypes, the derived instance declarations
- -- are as shown for tuples in chapter 19, section 2 of the Haskell 2010 report:
- -- <https://www.haskell.org/onlinereport/haskell2010/haskellch19.html>.
-
- ) where
-
-import GHC.Internal.Ix
=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -1286,7 +1286,7 @@ module Data.Int where
data Int8 = ...
module Data.Ix where
- -- Safety: Safe
+ -- Safety: Trustworthy
type Ix :: * -> Constraint
class GHC.Internal.Classes.Ord a => Ix a where
range :: (a, a) -> [a]
=====================================
testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
=====================================
@@ -1286,7 +1286,7 @@ module Data.Int where
data Int8 = ...
module Data.Ix where
- -- Safety: Safe
+ -- Safety: Trustworthy
type Ix :: * -> Constraint
class GHC.Internal.Classes.Ord a => Ix a where
range :: (a, a) -> [a]
=====================================
testsuite/tests/interface-stability/base-exports.stdout-mingw32
=====================================
@@ -1286,7 +1286,7 @@ module Data.Int where
data Int8 = ...
module Data.Ix where
- -- Safety: Safe
+ -- Safety: Trustworthy
type Ix :: * -> Constraint
class GHC.Internal.Classes.Ord a => Ix a where
range :: (a, a) -> [a]
=====================================
testsuite/tests/interface-stability/base-exports.stdout-ws-32
=====================================
@@ -1286,7 +1286,7 @@ module Data.Int where
data Int8 = ...
module Data.Ix where
- -- Safety: Safe
+ -- Safety: Trustworthy
type Ix :: * -> Constraint
class GHC.Internal.Classes.Ord a => Ix a where
range :: (a, a) -> [a]
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2bfb63390fb6b4f31e4c1e394394ff…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2bfb63390fb6b4f31e4c1e394394ff…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/fix-26700] Decoupling L.H.S.Decls from GHC.Types.ForeignCall
by recursion-ninja (@recursion-ninja) 06 Feb '26
by recursion-ninja (@recursion-ninja) 06 Feb '26
06 Feb '26
recursion-ninja pushed to branch wip/fix-26700 at Glasgow Haskell Compiler / GHC
Commits:
f6123da9 by Recursion Ninja at 2026-02-06T17:35:03-05:00
Decoupling L.H.S.Decls from GHC.Types.ForeignCall
- Adding TTG extension point for 'CCallTarget'
- Adding TTG extension point for 'CType'
- Adding TTG extension point for 'Header'
- Moving ForeignCall types that do not need extension
to new L.H.S.Decls.Foreign module
- - - - -
42 changed files:
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/CoreToStg.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/HsToCore/Errors/Types.hs
- compiler/GHC/HsToCore/Foreign/C.hs
- compiler/GHC/HsToCore/Foreign/Call.hs
- compiler/GHC/HsToCore/Foreign/Decl.hs
- compiler/GHC/HsToCore/Foreign/JavaScript.hs
- compiler/GHC/HsToCore/Foreign/Wasm.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/StgToByteCode.hs
- compiler/GHC/StgToCmm/Foreign.hs
- compiler/GHC/StgToJS/FFI.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/Foreign.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/Types/ErrCtxt.hs
- compiler/GHC/ThToHs.hs
- compiler/GHC/Types/ForeignCall.hs
- compiler/Language/Haskell/Syntax/Decls.hs
- + compiler/Language/Haskell/Syntax/Decls/Foreign.hs
- compiler/Language/Haskell/Syntax/Extension.hs
- compiler/ghc.cabal.in
- libraries/text
- libraries/transformers
- testsuite/tests/count-deps/CountDepsAst.stdout
- testsuite/tests/count-deps/CountDepsParser.stdout
- utils/check-exact/ExactPrint.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs
- utils/haddock/haddock-api/src/Haddock/Backends/LaTeX.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs
- utils/haddock/haddock-api/src/Haddock/Interface/LexParseRn.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
- utils/haddock/haddock-api/src/Haddock/InterfaceFile.hs
- utils/haddock/haddock-api/src/Haddock/Types.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f6123da9619d0eadc8f3a9fb4e6e8d1…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f6123da9619d0eadc8f3a9fb4e6e8d1…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/fix-26700] 2 commits: Addressing code review comments
by recursion-ninja (@recursion-ninja) 06 Feb '26
by recursion-ninja (@recursion-ninja) 06 Feb '26
06 Feb '26
recursion-ninja pushed to branch wip/fix-26700 at Glasgow Haskell Compiler / GHC
Commits:
73251e50 by Recursion Ninja at 2026-02-06T16:07:21-05:00
Addressing code review comments
- - - - -
9ddbfca5 by Recursion Ninja at 2026-02-06T16:50:48-05:00
Correcting 'Haddock' and 'Exact-Print' builds
- - - - -
27 changed files:
- compiler/GHC/CoreToStg.hs
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/HsToCore/Errors/Types.hs
- compiler/GHC/HsToCore/Foreign/C.hs
- compiler/GHC/HsToCore/Foreign/Call.hs
- compiler/GHC/HsToCore/Foreign/Decl.hs
- compiler/GHC/HsToCore/Foreign/JavaScript.hs
- compiler/GHC/HsToCore/Foreign/Wasm.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/StgToByteCode.hs
- compiler/GHC/StgToCmm/Foreign.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/Foreign.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/Types/ErrCtxt.hs
- compiler/GHC/Types/ForeignCall.hs
- compiler/Language/Haskell/Syntax/Decls.hs
- compiler/Language/Haskell/Syntax/Decls/Foreign.hs
- compiler/Language/Haskell/Syntax/Extension.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs
- utils/haddock/haddock-api/src/Haddock/Backends/LaTeX.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs
- utils/haddock/haddock-api/src/Haddock/Interface/LexParseRn.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
- utils/haddock/haddock-api/src/Haddock/InterfaceFile.hs
- utils/haddock/haddock-api/src/Haddock/Types.hs
Changes:
=====================================
compiler/GHC/CoreToStg.hs
=====================================
@@ -554,10 +554,11 @@ mkStgApp f how_bound core_args stg_args res_ty
StgOpApp (StgPrimOp op) stg_args res_ty
-- A call to some primitive Cmm function.
- FCallId (CCall (CCallSpec (StaticTarget ext lbl ForeignFunction)
- PrimCallConv _))
+ FCallId (CCall (CCallSpec
+ (StaticTarget ext lbl ForeignFunction) PrimCallConv _))
+ | TargetIsInThat unit <- staticTargetUnit ext
-> assert exactly_saturated $
- StgOpApp (StgPrimCallOp (PrimCall lbl (staticTargetUnit ext))) stg_args res_ty
+ StgOpApp (StgPrimCallOp (PrimCall lbl unit)) stg_args res_ty
-- A regular foreign call.
FCallId call -> assert exactly_saturated $
=====================================
compiler/GHC/Hs/Instances.hs
=====================================
@@ -33,7 +33,6 @@ import GHC.Types.Name.Reader (WithUserRdr(..))
import GHC.Types.InlinePragma (ActivationGhc)
import GHC.Data.BooleanFormula (BooleanFormula(..))
import Language.Haskell.Syntax.Decls
-import Language.Haskell.Syntax.Decls.Foreign
import Language.Haskell.Syntax.Decls.Overlap (OverlapMode(..))
import Language.Haskell.Syntax.Extension (Anno)
import Language.Haskell.Syntax.Binds.InlinePragma (ActivationX(..), InlinePragma(..))
@@ -250,16 +249,21 @@ deriving instance Data (CImportSpec GhcPs)
deriving instance Data (CImportSpec GhcRn)
deriving instance Data (CImportSpec GhcTc)
--- deriving instance (DataIdLR p p) => Data (CImportSpec p)
+-- deriving instance (DataIdLR p p) => Data (CCallTarget p)
deriving instance Data (CCallTarget GhcPs)
deriving instance Data (CCallTarget GhcRn)
deriving instance Data (CCallTarget GhcTc)
--- deriving instance (DataIdLR p p) => Data (CImportSpec p)
+-- deriving instance (DataIdLR p p) => Data (CType p)
deriving instance Data (CType GhcPs)
deriving instance Data (CType GhcRn)
deriving instance Data (CType GhcTc)
+-- deriving instance (DataIdLR p p) => Data (Header p)
+deriving instance Data (Header GhcPs)
+deriving instance Data (Header GhcRn)
+deriving instance Data (Header GhcTc)
+
-- deriving instance (DataIdLR p p) => Data (RuleDecls p)
deriving instance Data (RuleDecls GhcPs)
deriving instance Data (RuleDecls GhcRn)
=====================================
compiler/GHC/HsToCore/Errors/Types.hs
=====================================
@@ -13,7 +13,6 @@ import GHC.Driver.Flags (WarningFlag)
import GHC.Hs
import GHC.HsToCore.Pmc.Solver.Types
import GHC.Types.Error
-import GHC.Types.ForeignCall (CLabelString)
import GHC.Types.Id
import GHC.Types.InlinePragma (ActivationGhc)
import GHC.Types.Name (Name)
=====================================
compiler/GHC/HsToCore/Foreign/C.hs
=====================================
@@ -68,29 +68,28 @@ dsCFExport:: Id -- Either the exported Id,
-- from C, and its representation type
-> CLabelString -- The name to export to C land
-> CCallConv
- -> ForeignKind -- If it is a function,
- -- then is foreign export dynamic
- -- so invoke IO action that's hanging off
- -- the first argument's stable pointer
+ -> ExportLinking -- If foreign export is dynamic
+ -- then invoke IO action that's hanging off
+ -- the first argument's stable pointer
-> DsM ( CHeader -- contents of Module_stub.h
, CStub -- contents of Module_stub.c
, String -- string describing type to pass to createAdj.
)
-dsCFExport fn_id co ext_name cconv target_kind = do
+dsCFExport fn_id co ext_name cconv isDyn = do
let
ty = coercionRKind co
(bndrs, orig_res_ty) = tcSplitPiTys ty
fe_arg_tys' = mapMaybe anonPiTyBinderType_maybe bndrs
-- We must use tcSplits here, because we want to see
-- the (IO t) in the corner of the type!
- fe_arg_tys = case target_kind of
- ForeignFunction -> tail fe_arg_tys'
- _ -> fe_arg_tys'
+ (fe_arg_tys, m_fn_id) = case isDyn of
+ ExportIsDynamic -> (tail fe_arg_tys', Nothing)
+ ExportIsStatic -> (fe_arg_tys', Just fn_id)
-- Look at the result type of the exported function, orig_res_ty
- -- If it's IO t, return (t, ForeignFunction)
- -- If it's plain t, return (t, ForeignValue)
+ -- If it's IO t, return (t, True)
+ -- If it's plain t, return (t, False)
(res_ty, is_IO_res_ty) = case tcSplitIOType_maybe orig_res_ty of
-- The function already returns IO t
Just (_ioTyCon, res_ty) -> (res_ty, True)
@@ -99,16 +98,14 @@ dsCFExport fn_id co ext_name cconv target_kind = do
dflags <- getDynFlags
return $
- mkFExportCBits dflags ext_name
- (if isDyn then Nothing else Just fn_id)
- fe_arg_tys res_ty is_IO_res_ty cconv
+ mkFExportCBits dflags ext_name m_fn_id fe_arg_tys res_ty is_IO_res_ty cconv
dsCImport :: Id
-> Coercion
-> CImportSpec GhcTc
-> CCallConv
-> Safety
- -> Maybe Header
+ -> Maybe (Header GhcTc)
-> DsM ([Binding], CHeader, CStub)
dsCImport id co (CLabel cid) _ _ _ = do
let ty = coercionLKind co
@@ -186,7 +183,7 @@ dsCFExportDynamic id co0 cconv = do
export_ty = mkVisFunTyMany stable_ptr_ty arg_ty
bindIOId <- dsLookupGlobalId bindIOName
stbl_value <- newSysLocalMDs stable_ptr_ty
- (h_code, c_code, typestring) <- dsCFExport id (mkRepReflCo export_ty) fe_nm cconv True
+ (h_code, c_code, typestring) <- dsCFExport id (mkRepReflCo export_ty) fe_nm cconv ExportIsDynamic
let
{-
The arguments to the external function which will
@@ -203,7 +200,7 @@ dsCFExportDynamic id co0 cconv = do
-- (probably in the RTS.)
adjustor = fsLit "createAdjustor"
- ccall_adj <- dsCCall adjustor (moduleUnit mod) adj_args PlayRisky (mkTyConApp io_tc [res_ty])
+ ccall_adj <- dsCCall adjustor adj_args PlayRisky (mkTyConApp io_tc [res_ty])
-- PlayRisky: the adjustor doesn't allocate in the Haskell heap or do a callback
let io_app = mkLams tvs $
@@ -231,7 +228,7 @@ dsCFExportDynamic id co0 cconv = do
-- | Foreign calls
-dsFCall :: Id -> Coercion -> ForeignCall -> Maybe Header
+dsFCall :: Id -> Coercion -> ForeignCall -> Maybe (Header GhcTc)
-> DsM ([(Id, Expr TyVar)], CHeader, CStub)
dsFCall fn_id co fcall mDeclHeader = do
let
@@ -331,7 +328,7 @@ dsFCall fn_id co fcall mDeclHeader = do
toCName :: Id -> String
toCName i = showSDocOneLine defaultSDocContext (pprCode (ppr (idName i)))
-toCType :: Type -> (Maybe Header, SDoc)
+toCType :: Type -> (Maybe (Header GhcTc), SDoc)
toCType = f False
where f voidOK t
-- First, if we have (Ptr t) of (FunPtr t), then we need to
@@ -382,7 +379,7 @@ mkFExportCBits :: DynFlags
-> Maybe Id -- Just==static, Nothing==dynamic
-> [Type]
-> Type
- -> ForeignKind -- Function <=> returns an IO type
+ -> Bool -- True <=> returns an IO type
-> CCallConv
-> (CHeader,
CStub,
@@ -519,7 +516,7 @@ mkFExportCBits dflags c_nm maybe_target arg_htys res_hty io_res_ty cc
char '&' <> cap <>
text "rts_apply" <> parens (
cap
- <> (if io_res_ty == ForeignFunction
+ <> (if io_res_ty
then text "ghc_hs_iface->runIO_closure"
else text "ghc_hs_iface->runNonIO_closure")
<> comma
=====================================
compiler/GHC/HsToCore/Foreign/Call.hs
=====================================
@@ -42,7 +42,6 @@ import GHC.Types.Literal
import GHC.Types.RepType (typePrimRep1)
import GHC.Tc.Utils.TcType
-import GHC.Unit (Unit)
import GHC.Builtin.Types.Prim
import GHC.Builtin.Types
@@ -93,20 +92,19 @@ follows:
-}
dsCCall :: CLabelString -- C routine to invoke
- -> Unit -- Module unit of the C routine
-> [CoreExpr] -- Arguments (desugared)
-- Precondition: none have representation-polymorphic types
-> Safety -- Safety of the call
-> Type -- Type of the result: IO t
-> DsM CoreExpr -- Result, of type ???
-dsCCall lbl unit args may_gc result_ty
+dsCCall lbl args may_gc result_ty
= do (unboxed_args, arg_wrappers) <- mapAndUnzipM unboxArg args
(ccall_result_ty, res_wrapper) <- boxResult result_ty
uniq <- newUnique
let stExt = StaticTargetGhc
{ staticTargetLabel = NoSourceText
- , staticTargetUnit = unit
+ , staticTargetUnit = TargetIsInThisUnit
}
target = StaticTarget stExt lbl ForeignFunction
the_fcall = CCall (CCallSpec target CCallConv may_gc)
=====================================
compiler/GHC/HsToCore/Foreign/Decl.hs
=====================================
@@ -24,7 +24,7 @@ import GHC.HsToCore.Monad
import GHC.Hs
import GHC.Types.Id
-import GHC.Types.ForeignCall
+import GHC.Types.ForeignCall (ExportLinking(..))
import GHC.Types.ForeignStubs
import GHC.Unit.Module
import GHC.Core.Coercion
@@ -93,7 +93,7 @@ dsForeigns' fos = do
, fd_e_ext = co
, fd_fe = CExport _
(L _ (CExportStatic ext_nm cconv)) }) = do
- (h, c, _, ids, bs) <- dsFExport id co ext_nm cconv False
+ (h, c, _, ids, bs) <- dsFExport id co ext_nm cconv ExportIsStatic
return (h, c, ids, bs)
{-
@@ -165,7 +165,7 @@ dsFExport :: Id -- Either the exported Id,
-- from C, and its representation type
-> CLabelString -- The name to export to C land
-> CCallConv
- -> Bool -- True => foreign export dynamic
+ -> ExportLinking -- True => foreign export dynamic
-- so invoke IO action that's hanging off
-- the first argument's stable pointer
-> DsM ( CHeader -- contents of Module_stub.h
=====================================
compiler/GHC/HsToCore/Foreign/JavaScript.hs
=====================================
@@ -72,9 +72,9 @@ dsJsFExport
-- from C, and its representation type
-> CLabelString -- The name to export to C land
-> CCallConv
- -> Bool -- True => foreign export dynamic
- -- so invoke IO action that's hanging off
- -- the first argument's stable pointer
+ -> ExportLinking -- If foreign export is dynamic
+ -- then invoke IO action that's hanging off
+ -- the first argument's stable pointer
-> DsM ( CHeader -- contents of Module_stub.h
, CStub -- contents of Module_stub.c
, String -- string describing type to pass to createAdj.
@@ -87,9 +87,9 @@ dsJsFExport fn_id co ext_name cconv isDyn = do
(fe_arg_tys', orig_res_ty) = tcSplitFunTys sans_foralls
-- We must use tcSplits here, because we want to see
-- the (IO t) in the corner of the type!
- fe_arg_tys = case target_kind of
- ForeignFunction -> tail fe_arg_tys'
- _ -> fe_arg_tys'
+ (fe_arg_tys, m_fn_id) = case isDyn of
+ ExportIsDynamic -> (tail fe_arg_tys', Nothing)
+ ExportIsStatic -> (fe_arg_tys', Just fn_id)
-- Look at the result type of the exported function, orig_res_ty
-- If it's IO t, return (t, True)
@@ -101,8 +101,7 @@ dsJsFExport fn_id co ext_name cconv isDyn = do
Nothing -> (orig_res_ty, False)
platform <- targetPlatform <$> getDynFlags
return $
- mkFExportJSBits platform ext_name
- (if isDyn then Nothing else Just fn_id)
+ mkFExportJSBits platform ext_name m_fn_id
(map scaledThing fe_arg_tys) res_ty is_IO_res_ty cconv
mkFExportJSBits
@@ -231,7 +230,7 @@ dsJsImport
-> CImportSpec GhcTc
-> CCallConv
-> Safety
- -> Maybe Header
+ -> Maybe (Header GhcTc)
-> DsM ([Binding], CHeader, CStub)
dsJsImport id co (CLabel cid) _ _ _ = do
let ty = coercionLKind co
@@ -283,7 +282,7 @@ dsJsFExportDynamic id co0 cconv = do
export_ty = mkVisFunTyMany stable_ptr_ty arg_ty
bindIOId <- dsLookupGlobalId bindIOName
stbl_value <- newSysLocalMDs stable_ptr_ty
- (h_code, c_code, typestring) <- dsJsFExport id (mkRepReflCo export_ty) fe_nm cconv True
+ (h_code, c_code, typestring) <- dsJsFExport id (mkRepReflCo export_ty) fe_nm cconv ExportIsDynamic
let
{-
The arguments to the external function which will
@@ -300,7 +299,7 @@ dsJsFExportDynamic id co0 cconv = do
-- (probably in the RTS.)
adjustor = fsLit "createAdjustor"
- ccall_adj <- dsCCall adjustor (moduleUnit mod) adj_args PlayRisky (mkTyConApp io_tc [res_ty])
+ ccall_adj <- dsCCall adjustor adj_args PlayRisky (mkTyConApp io_tc [res_ty])
-- PlayRisky: the adjustor doesn't allocate in the Haskell heap or do a callback
let io_app = mkLams tvs $
@@ -321,7 +320,7 @@ dsJsFExportDynamic id co0 cconv = do
toJsName :: Id -> String
toJsName i = renderWithContext defaultSDocContext (pprCode (ppr (idName i)))
-dsJsCall :: Id -> Coercion -> ForeignCall -> Maybe Header
+dsJsCall :: Id -> Coercion -> ForeignCall -> Maybe (Header GhcTc)
-> DsM ([(Id, Expr TyVar)], CHeader, CStub)
dsJsCall fn_id co (CCall (CCallSpec target cconv safety)) _mDeclHeader = do
let
@@ -650,7 +649,7 @@ mkJsCall u tgt args t = mkFCall u ccall args t
where
stExt = StaticTargetGhc
{ staticTargetLabel = NoSourceText
- , staticTargetUnit = ghcInternalUnit
+ , staticTargetUnit = TargetIsInThat ghcInternalUnit
}
ccall = CCall $ CCallSpec
(StaticTarget stExt tgt ForeignFunction)
=====================================
compiler/GHC/HsToCore/Foreign/Wasm.hs
=====================================
@@ -42,7 +42,6 @@ import GHC.Types.Name
import GHC.Types.SourceText
import GHC.Types.SrcLoc
import GHC.Types.Var
-import GHC.Unit
import GHC.Utils.Outputable
import GHC.Utils.Panic
@@ -131,7 +130,7 @@ dsWasmJSDynamicExport ::
Synchronicity ->
Id ->
Coercion ->
- Unit ->
+ CCallStaticTargetUnit ->
DsM ([Binding], CHeader, CStub, [Id])
dsWasmJSDynamicExport sync fn_id co unitId = do
sp_tycon <- dsLookupTyCon stablePtrTyConName
@@ -308,7 +307,7 @@ dsWasmJSStaticImport ::
Id ->
Coercion ->
String ->
- Unit ->
+ CCallStaticTargetUnit ->
Synchronicity ->
DsM ([Binding], CHeader, CStub)
dsWasmJSStaticImport fn_id co js_src' unitId sync = do
@@ -399,7 +398,7 @@ uniqueCFunName = do
mkWrapperName cfun_num "ghc_wasm_jsffi" ""
importBindingRHS ::
- Unit ->
+ CCallStaticTargetUnit ->
FastString ->
[TyVar] ->
[Scaled Type] ->
=====================================
compiler/GHC/Rename/Module.hs
=====================================
@@ -423,7 +423,7 @@ rnHsForeignDecl (ForeignExport { fd_name = name, fd_sig_ty = ty, fd_fe = spec })
--
patchForeignImport :: Unit -> (ForeignImport GhcPs) -> (ForeignImport GhcRn)
patchForeignImport unit (CImport ext cconv safety fs spec)
- = CImport ext cconv safety fs (patchCImportSpec unit spec)
+ = CImport ext cconv safety (renameHeader <$> fs) (patchCImportSpec unit spec)
patchCImportSpec :: Unit -> CImportSpec GhcPs -> CImportSpec GhcRn
patchCImportSpec unit = \case
@@ -437,7 +437,7 @@ patchCCallTarget unit = \case
StaticTarget sTxt label targetKind ->
let ext = StaticTargetGhc
{ staticTargetLabel = sTxt
- , staticTargetUnit = unit
+ , staticTargetUnit = TargetIsInThat unit
}
in StaticTarget ext label targetKind
@@ -2037,7 +2037,7 @@ rnDataDefn doc (HsDataDefn { dd_cType = cType, dd_ctxt = context, dd_cons = cond
}
where
rn_ctype :: CType GhcPs -> CType GhcRn
- rn_ctype (CType x y z) = CType x y z
+ rn_ctype (CType x y z) = CType x (renameHeader <$> y) z
h98_style = not $ anyLConIsGadt condecls -- Note [Stupid theta]
rn_derivs ds
=====================================
compiler/GHC/StgToByteCode.hs
=====================================
@@ -27,8 +27,6 @@ import GHC.Cmm.Utils
import GHC.Platform
import GHC.Platform.Profile
-import GHC.Hs.Extension ( GhcTc )
-
import GHCi.FFI
import GHC.Types.Basic
import GHC.Utils.Outputable
@@ -671,8 +669,8 @@ schemeT d s p (StgOpApp (StgPrimOp op) args _ty) = do
-- Otherwise we have to do a call to the primop wrapper instead :(
_ -> doTailCall d s p (primOpId op) (reverse args)
-schemeT d s p (StgOpApp (StgPrimCallOp (PrimCall label unit)) args result_ty)
- = generatePrimCall d s p label unit result_ty args
+schemeT d s p (StgOpApp (StgPrimCallOp (PrimCall label _)) args result_ty)
+ = generatePrimCall d s p label result_ty args
schemeT d s p (StgConApp con _cn args _tys)
-- Case 2: Unboxed tuple
@@ -1869,11 +1867,10 @@ generatePrimCall
-> Sequel
-> BCEnv
-> CLabelString -- where to call
- -> Unit
-> Type
-> [StgArg] -- args (atoms)
-> BcM BCInstrList
-generatePrimCall d s p target _mb_unit _result_ty args
+generatePrimCall d s p target _result_ty args
= do
profile <- getProfile
let
@@ -1931,13 +1928,13 @@ generateCCall
:: StackDepth
-> Sequel
-> BCEnv
- -> CCallSpec GhcTc -- where to call
+ -> CCallSpec -- where to call
-> Type
-> [StgArg] -- args (atoms)
-> BcM BCInstrList
generateCCall d0 s p (CCallSpec target PrimCallConv _) result_ty args
- | (StaticTarget ext label _) <- target
- = generatePrimCall d0 s p label (staticTargetUnit ext) result_ty args
+ | (StaticTarget _ label _) <- target
+ = generatePrimCall d0 s p label result_ty args
| otherwise
= panic "GHC.StgToByteCode.generateCCall: primcall convention only supports static targets"
generateCCall d0 s p (CCallSpec target _ safety) result_ty args
@@ -2643,7 +2640,7 @@ isFollowableArg P = True
isFollowableArg _ = False
-- | Indicate if the calling convention is supported
-isSupportedCConv :: CCallSpec p -> Bool
+isSupportedCConv :: CCallSpec -> Bool
isSupportedCConv (CCallSpec _ cconv _) = case cconv of
CCallConv -> True -- we explicitly pattern match on every
StdCallConv -> False -- convention to ensure that a warning
=====================================
compiler/GHC/StgToCmm/Foreign.hs
=====================================
@@ -81,8 +81,9 @@ cgForeignCall (CCall (CCallSpec target cconv safety)) typ stg_args res_ty
StaticTarget _ _ ForeignValue ->
panic "cgForeignCall: unexpected FFI value import"
StaticTarget ext lbl ForeignFunction ->
- let labelSource =
- ForeignLabelInPackage . toUnitId $ staticTargetUnit ext
+ let labelSource = case staticTargetUnit ext of
+ TargetIsInThisUnit -> ForeignLabelInThisPackage
+ TargetIsInThat unit -> ForeignLabelInPackage $ toUnitId unit
in ( unzip cmm_args
, CmmLit
(CmmLabel (mkForeignLabel lbl labelSource IsFunction)))
=====================================
compiler/GHC/Tc/Errors/Types.hs
=====================================
@@ -197,7 +197,6 @@ import GHC.Types.Basic
import GHC.Types.Error
import GHC.Types.Avail
import GHC.Types.Hint
-import GHC.Types.ForeignCall ( CLabelString )
import GHC.Types.Id.Info ( RecSelParent(..) )
import GHC.Types.InlinePragma (InlinePragma(..))
import GHC.Types.Name (NamedThing(..), Name, OccName, getSrcLoc, getSrcSpan)
=====================================
compiler/GHC/Tc/Gen/Foreign.hs
=====================================
@@ -292,7 +292,7 @@ tcCheckFIType arg_tys res_ty idecl@(CImport src (L lc cconv) safety mh (CLabel c
check (isFFILabelTy (mkScaledFunTys arg_tys res_ty))
(TcRnIllegalForeignType Nothing)
cconv' <- checkCConv (Right idecl) cconv
- return $ CImport src (L lc cconv') safety mh (CLabel cLabel)
+ return $ CImport src (L lc cconv') safety (typeCheckHeader <$> mh) (CLabel cLabel)
tcCheckFIType arg_tys res_ty idecl@(CImport src (L lc cconv) safety mh CWrapper) = do
-- Foreign wrapper (former foreign export dynamic)
@@ -310,7 +310,7 @@ tcCheckFIType arg_tys res_ty idecl@(CImport src (L lc cconv) safety mh CWrapper)
where
(arg1_tys, res1_ty) = tcSplitFunTys arg1_ty
_ -> addErrTc (TcRnIllegalForeignType Nothing OneArgExpected)
- return (CImport src (L lc cconv') safety mh CWrapper)
+ return (CImport src (L lc cconv') safety (typeCheckHeader <$> mh) CWrapper)
tcCheckFIType arg_tys res_ty idecl@(CImport src (L lc cconv) (L ls safety) mh
(CFunction target))
@@ -361,7 +361,7 @@ tcCheckFIType arg_tys res_ty idecl@(CImport src (L lc cconv) (L ls safety) mh
_ -> return ()
return $ cImport' cconv'
where
- cImport' cConv = CImport src (L lc cConv) cSafe mh cFun
+ cImport' cConv = CImport src (L lc cConv) cSafe (typeCheckHeader <$> mh) cFun
cFun = CFunction $ rnCCallTarget target
cSafe = L ls safety
=====================================
compiler/GHC/Tc/TyCl.hs
=====================================
@@ -75,7 +75,7 @@ import GHC.Core.TyCon
import GHC.Core.DataCon
import GHC.Core.Unify
-import GHC.Types.ForeignCall ( CType(..) )
+import GHC.Types.ForeignCall ( typeCheckCType )
import GHC.Types.Id
import GHC.Types.Id.Make
import GHC.Types.Var
@@ -3599,13 +3599,11 @@ tcDataDefn err_ctxt roles_info tc_name
{ data_cons <- tcConDecls DDataType rec_tycon tc_bndrs res_kind cons
; tc_rhs <- mk_tc_rhs hsc_src rec_tycon data_cons
; tc_rep_nm <- newTyConRepName tc_name
- ; let tc_ctype :: CType GhcRn -> CType GhcTc
- tc_ctype (CType x y z) = CType x y z
; return (mkAlgTyCon tc_name kind
bndrs nb_eta
res_kind
(roles_info tc_name)
- (fmap (tc_ctype . unLoc) cType)
+ (fmap (typeCheckCType . unLoc) cType)
stupid_theta tc_rhs
(VanillaAlgTyCon tc_rep_nm)
gadt_syntax)
=====================================
compiler/GHC/Tc/TyCl/Instance.hs
=====================================
@@ -69,7 +69,7 @@ import GHC.Types.Var as Var
import GHC.Types.Var.Env
import GHC.Types.Var.Set
import GHC.Types.Basic
-import GHC.Types.ForeignCall ( CType(..) )
+import GHC.Types.ForeignCall ( typeCheckCType )
import GHC.Types.Id
import GHC.Types.InlinePragma
import GHC.Types.SourceFile
@@ -827,13 +827,11 @@ tcDataFamInstDecl mb_clsinfo tv_skol_env
-- NB: Use the full ty_binders from the pats. See bullet toward
-- the end of Note [Data type families] in GHC.Core.TyCon
- tc_ctype :: CType GhcRn -> CType GhcTc
- tc_ctype (CType x y z) = CType x y z
rep_tc = mkAlgTyCon rep_tc_name user_kind
ty_binders (length extra_tcbs)
res_kind
(map (const Nominal) ty_binders)
- (fmap (tc_ctype . unLoc) cType) stupid_theta
+ (fmap (typeCheckCType . unLoc) cType) stupid_theta
tc_rhs parent
gadt_syntax
-- We always assume that indexed types are recursive. Why?
=====================================
compiler/GHC/Tc/Types/ErrCtxt.hs
=====================================
@@ -39,7 +39,6 @@ import GHC.Utils.Outputable ( Outputable(..) )
import Language.Haskell.Syntax
import Language.Haskell.Syntax.Basic ( FieldLabelString(..) )
-import Language.Haskell.Syntax.Decls.Foreign ( ForeignDecl(..) )
import GHC.Boot.TH.Syntax qualified as TH
import qualified Data.List.NonEmpty as NE
=====================================
compiler/GHC/Types/ForeignCall.hs
=====================================
@@ -39,6 +39,8 @@ module GHC.Types.ForeignCall (
ForeignExport(..),
-- ** Specification
CExportSpec(..),
+ -- ** Linking flags
+ ExportLinking(..),
-- * Foreign import types
-- ** Data-type
@@ -47,6 +49,7 @@ module GHC.Types.ForeignCall (
CCallTarget(..),
-- *** GHC extension point
StaticTargetGhc(..),
+ CCallStaticTargetUnit(..),
-- *** Queries
isDynamicTarget,
-- ** Foreign target kind
@@ -65,6 +68,8 @@ module GHC.Types.ForeignCall (
-- *** Construction
defaultCType,
mkCType,
+ -- *** Conversion
+ typeCheckCType,
-- *** GHC extension point
CTypeGhc(..),
@@ -83,6 +88,9 @@ module GHC.Types.ForeignCall (
pprCLabelString,
-- ** Header
Header(..),
+ -- *** Conversion
+ renameHeader,
+ typeCheckHeader,
) where
import GHC.Prelude
@@ -101,7 +109,6 @@ import Language.Haskell.Syntax.Extension
import Data.Char
import Data.Data (Data)
import Data.Functor ((<&>))
-import Data.String (fromString)
import Control.DeepSeq (NFData(..))
@@ -113,8 +120,8 @@ import Control.DeepSeq (NFData(..))
************************************************************************
-}
-newtype ForeignCall = CCall (CCallSpec GhcTc)
- deriving ( Eq )
+newtype ForeignCall = CCall CCallSpec
+ deriving (Eq)
isSafeForeignCall :: ForeignCall -> Bool
isSafeForeignCall (CCall (CCallSpec _ _ safe)) = playSafe safe
@@ -141,12 +148,12 @@ playInterruptible _ = False
************************************************************************
-}
-data CCallSpec pass
- = CCallSpec (CCallTarget pass) -- What to call
- CCallConv -- Calling convention to use.
- Safety
-
-deriving instance forall p. IsPass p => Eq (CCallSpec (GhcPass p))
+data CCallSpec
+ = CCallSpec
+ (CCallTarget GhcTc) -- What to call
+ CCallConv -- Calling convention to use.
+ Safety
+ deriving (Eq)
isDynamicTarget :: CCallTarget p -> Bool
isDynamicTarget DynamicTarget{} = True
@@ -180,7 +187,7 @@ isCLabelString lbl
-- Printing into C files:
-instance forall p. IsPass p => Outputable (CCallSpec (GhcPass p)) where
+instance Outputable CCallSpec where
ppr (CCallSpec fun cconv safety)
= hcat [ whenPprDebug callconv, ppr_fun fun, text " ::" ]
where
@@ -191,15 +198,14 @@ instance forall p. IsPass p => Outputable (CCallSpec (GhcPass p)) where
ppr_fun = \case
DynamicTarget{} -> text "__ffi_dyn_ccall" <> gc_suf <+> text "\"\""
- st@(StaticTarget _ label isFun) ->
+ StaticTarget ext label isFun ->
let pCallType = case isFun of
ForeignValue -> text "__ffi_static_ccall_value"
ForeignFunction -> text "__ffi_static_ccall"
- (srcTxt, pPkgId) = case ghcPass @p of
- GhcPs | StaticTarget ext _ _ <- st -> (ext, empty)
- GhcRn | StaticTarget ext _ _ <- st -> (staticTargetLabel ext, ppr $ staticTargetUnit ext)
- GhcTc | StaticTarget ext _ _ <- st -> (staticTargetLabel ext, ppr $ staticTargetUnit ext)
-
+ pprUnit ext = case staticTargetUnit ext of
+ TargetIsInThisUnit -> empty
+ TargetIsInThat unit -> ppr unit
+ (srcTxt, pPkgId) = (staticTargetLabel ext, pprUnit ext)
in pCallType
<> gc_suf
<+> pPkgId
@@ -209,12 +215,21 @@ instance forall p. IsPass p => Outputable (CCallSpec (GhcPass p)) where
defaultCType :: String -> CType (GhcPass p)
defaultCType =
- CType (CTypeGhc NoSourceText NoSourceText) Nothing . fromString
+ CType (CTypeGhc NoSourceText NoSourceText) Nothing . fsLit
-mkCType :: SourceText -> SourceText -> Maybe Header -> FastString -> CType (GhcPass p)
+mkCType :: SourceText -> SourceText -> Maybe (Header (GhcPass p)) -> FastString -> CType (GhcPass p)
mkCType x y m =
CType (CTypeGhc x y) m
+typeCheckCType :: CType GhcRn -> CType GhcTc
+typeCheckCType (CType x y z) = CType x (typeCheckHeader <$> y) z
+
+typeCheckHeader :: Header GhcRn -> Header GhcTc
+typeCheckHeader (Header a b) = Header a b
+
+renameHeader :: Header GhcPs -> Header GhcRn
+renameHeader (Header a b) = Header a b
+
{-
************************************************************************
* *
@@ -227,7 +242,7 @@ instance Binary ForeignCall where
put_ bh (CCall aa) = put_ bh aa
get bh = do aa <- get bh; return (CCall aa)
-instance forall p. IsPass p => Binary (CCallSpec (GhcPass p)) where
+instance Binary CCallSpec where
put_ bh (CCallSpec aa ab ac) = do
put_ bh aa
put_ bh ab
@@ -241,7 +256,7 @@ instance forall p. IsPass p => Binary (CCallSpec (GhcPass p)) where
instance NFData ForeignCall where
rnf (CCall c) = rnf c
-instance forall p. IsPass p => NFData (CCallSpec (GhcPass p)) where
+instance NFData CCallSpec where
rnf (CCallSpec t c s) = rnf t `seq` rnf c `seq` rnf s
instance Binary CCallConv where
@@ -264,12 +279,27 @@ instance Binary CCallConv where
3 -> return CApiConv
_ -> return JavaScriptCallConv
--- If Nothing, then it's taken to be in the current package.
+-- |
+-- Determine whether the JavaScript Foreign Function export should be
+-- dynamically linked or statically linked.
+data ExportLinking
+ = ExportIsDynamic
+ | ExportIsStatic
+
+-- |
+-- Which compilation 'Unit' is the static target in,
+-- either it is in this currently compiling compilation 'Unit',
+-- or it is in /that other/, compilation 'Unit'.
+data CCallStaticTargetUnit
+ = TargetIsInThisUnit -- ^ In this current 'Unit'.
+ | TargetIsInThat Unit -- ^ In that other 'Unit'.
+ deriving (Data, Eq)
+
data StaticTargetGhc = StaticTargetGhc
{ staticTargetLabel :: SourceText
- , staticTargetUnit :: CCallStaticUnit
+ , staticTargetUnit :: CCallStaticTargetUnit
-- ^ What package the function is in.
- -- If 'CCallStaticThisUnit', then it's taken to be in the current package
+ -- If 'CCallStaticTargetUnit', then it's taken to be in the current package
-- Note: This information is only used for PrimCalls on Windows.
-- See CLabel.labelDynamic and CoreToStg.coreToStgApp
-- for the difference in representation between PrimCalls
@@ -290,13 +320,36 @@ type instance XStaticTarget GhcTc = StaticTargetGhc
type instance XDynamicTarget (GhcPass p) = NoExtField
type instance XXCCallTarget (GhcPass p) = DataConCantHappen
-type instance XCType (GhcPass p) = CTypeGhc
-type instance XXCType (GhcPass p) = DataConCantHappen
+type instance XCType (GhcPass p) = CTypeGhc
+type instance XXCType (GhcPass p) = DataConCantHappen
+
+type instance XHeader (GhcPass p) = SourceText
+type instance XXHeader (GhcPass p) = DataConCantHappen
+
+deriving instance Eq (Header (GhcPass p))
instance NFData (CType (GhcPass p)) where
rnf (CType ext mh fs) =
rnf ext `seq` rnf mh `seq` rnf fs
+instance NFData (Header (GhcPass p)) where
+ rnf (Header s h) =
+ rnf s `seq` rnf h
+
+instance NFData CCallStaticTargetUnit where
+ rnf = \case
+ TargetIsInThisUnit -> ()
+ TargetIsInThat unit -> rnf unit
+
+instance Binary CCallStaticTargetUnit where
+ put_ bh = \case
+ TargetIsInThisUnit -> putByte bh 0
+ TargetIsInThat unit -> putByte bh 1 *> put_ bh unit
+
+ get bh = getByte bh >>= \case
+ 0 -> pure TargetIsInThisUnit
+ _ -> TargetIsInThat <$> get bh
+
instance NFData CTypeGhc where
rnf st =
rnf (cTypeSourceText st) `seq`
@@ -406,7 +459,7 @@ instance Binary ForeignKind where
0 -> ForeignValue
_ -> ForeignFunction
-instance Binary Header where
+instance Binary (Header (GhcPass p)) where
put_ bh (Header s h) = put_ bh s >> put_ bh h
get bh = do
s <- get bh
@@ -447,7 +500,7 @@ instance Outputable (CType (GhcPass p)) where
Nothing -> empty
Just h -> ppr h
-instance Outputable Header where
+instance Outputable (Header (GhcPass p)) where
ppr (Header st h) = pprWithSourceText st (doubleQuotes $ ppr h)
instance Outputable Safety where
=====================================
compiler/Language/Haskell/Syntax/Decls.hs
=====================================
@@ -51,12 +51,10 @@ module Language.Haskell.Syntax.Decls (
-- ** Template haskell declaration splice
SpliceDecoration(..),
SpliceDecl(..), LSpliceDecl,
-{-
-- ** Foreign function interface declarations
ForeignDecl(..), LForeignDecl, ForeignImport(..), ForeignExport(..),
CCallConv(..), CCallTarget(..), CExportSpec(..), CImportSpec(..), CLabelString,
CType(..), Header(..), Safety(..),
--}
-- ** Data-constructor declarations
ConDecl(..), LConDecl,
HsConDeclH98Details,
=====================================
compiler/Language/Haskell/Syntax/Decls/Foreign.hs
=====================================
@@ -61,19 +61,21 @@ module Language.Haskell.Syntax.Decls.Foreign (
-- ** CType
XCType,
XXCType,
+ -- ** Header
+ XHeader,
+ XXHeader,
) where
import Language.Haskell.Syntax.Extension
import Language.Haskell.Syntax.Type
import GHC.Data.FastString (FastString)
-import GHC.Types.SourceText (SourceText)
import Control.DeepSeq
import Data.Data hiding (TyCon, Fixity, Infix)
import Data.Maybe
import Data.Eq
-import Prelude (Enum, Show, seq)
+import Prelude (Enum, Show)
{-
************************************************************************
@@ -120,27 +122,27 @@ data ForeignDecl pass
-- |
-- Specification Of an imported external entity in dependence on the calling
-- convention
---
--- Import of a C entity
---
--- * the two strings specifying a header file or library
--- may be empty, which indicates the absence of a
--- header or object specification (both are not used
--- in the case of `CWrapper' and when `CFunction'
--- has a dynamic target)
---
--- * the calling convention is irrelevant for code
--- generation in the case of `CLabel', but is needed
--- for pretty printing
---
--- * `Safety' is irrelevant for `CLabel' and `CWrapper'
---
data ForeignImport pass
- = CImport
+ = -- |
+ -- Import of a C entity
+ --
+ -- * the two strings specifying a header file or library
+ -- may be empty, which indicates the absence of a
+ -- header or object specification (both are not used
+ -- in the case of `CWrapper' and when `CFunction'
+ -- has a dynamic target)
+ --
+ -- * the calling convention is irrelevant for code
+ -- generation in the case of `CLabel', but is needed
+ -- for pretty printing
+ --
+ -- * `Safety' is irrelevant for `CLabel' and `CWrapper'
+ --
+ CImport
(XCImport pass)
(XRec pass CCallConv) -- ccall
(XRec pass Safety) -- interruptible, safe or unsafe
- (Maybe Header) -- name of C header
+ (Maybe (Header pass)) -- name of C header
(CImportSpec pass) -- details of the C entity
| XForeignImport !(XXForeignImport pass)
@@ -208,12 +210,6 @@ data CCallTarget pass
| DynamicTarget (XDynamicTarget pass)
| XCCallTarget !(XXCCallTarget pass)
-deriving instance {-# OVERLAPPABLE #-} (
- Eq (XStaticTarget pass),
- Eq (XDynamicTarget pass),
- Eq (XXCCallTarget pass)) =>
- Eq (CCallTarget pass)
-
data CExportSpec
-- | foreign export ccall foo :: ty
= CExportStatic
@@ -227,33 +223,17 @@ type CLabelString = FastString -- A C label, completely unencoded
data CType pass
= CType
(XCType pass)
- (Maybe Header) -- header to include for this type
+ (Maybe (Header pass)) -- header to include for this type
FastString
| XCType !(XXCType pass)
-deriving instance {-# OVERLAPPABLE #-}
- ( Eq (XCType pass)
- , Eq (XXCType pass)
- ) =>
- Eq (CType pass)
-
-instance {-# OVERLAPPABLE #-}
- ( NFData (XCType pass)
- , NFData (XXCType pass)
- ) => NFData (CType pass) where
- rnf = \case
- CType ext mh fs -> rnf ext `seq` rnf mh `seq` rnf fs
- XCType ext -> rnf ext
-
-- The filename for a C header file
-- See Note [Pragma source text] in "GHC.Types.SourceText"
-data Header = Header
- SourceText -- pretty printing to EXT point
- FastString
- deriving (Eq, Data)
-
-instance NFData Header where
- rnf (Header s h) = rnf s `seq` rnf h
+data Header pass
+ = Header
+ (XHeader pass)
+ FastString
+ | XHeader !(XXHeader pass)
data Safety
= PlaySafe -- ^ Might invoke Haskell GC, or do a call back, or
=====================================
compiler/Language/Haskell/Syntax/Extension.hs
=====================================
@@ -392,6 +392,11 @@ type family XXCCallTarget x
type family XCType x
type family XXCType x
+-- -------------------------------------
+-- Header type family
+type family XHeader x
+type family XXHeader x
+
-- -------------------------------------
-- ForeignDecl type families
type family XForeignImport x
=====================================
utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs
=====================================
@@ -29,7 +29,7 @@ import Data.Foldable (toList)
import Data.List (intercalate, isPrefixOf)
import Data.Maybe
import Data.Version
-import GHC
+import GHC hiding (Header)
import GHC.Core.InstEnv
import qualified GHC.Driver.DynFlags as DynFlags
import GHC.Driver.Ppr
=====================================
utils/haddock/haddock-api/src/Haddock/Backends/LaTeX.hs
=====================================
@@ -27,7 +27,7 @@ import Data.List (sort)
import Data.List.NonEmpty (NonEmpty (..))
import qualified Data.Map as Map
import qualified Data.Maybe as Maybe
-import GHC hiding (HsTypeGhcPsExt (..), fromMaybeContext)
+import GHC hiding (Header, HsTypeGhcPsExt (..), fromMaybeContext)
import GHC.Core.Type (Specificity (..))
import GHC.Data.FastString (unpackFS)
import GHC.Types.Name (getOccString, nameOccName, tidyNameOcc)
=====================================
utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs
=====================================
@@ -24,7 +24,7 @@ module Haddock.Backends.Xhtml.DocMarkup
import Data.List (intersperse)
import Data.Maybe (fromMaybe)
-import GHC
+import GHC hiding (Header)
import GHC.Types.Name
import Text.XHtml hiding (name, p, quote)
=====================================
utils/haddock/haddock-api/src/Haddock/Interface/LexParseRn.hs
=====================================
@@ -30,7 +30,7 @@ import Data.Functor
import Data.List (maximumBy, (\\))
import Data.Ord
import qualified Data.Set as Set
-import GHC
+import GHC hiding (Header)
import GHC.Data.EnumSet as EnumSet
import GHC.Data.FastString (unpackFS)
import GHC.Driver.Session
=====================================
utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
=====================================
@@ -33,13 +33,14 @@ import qualified Data.Map.Strict as Map
import qualified Data.Set as Set
import Data.Traversable (mapM)
-import GHC hiding (NoLink, HsTypeGhcPsExt (..))
+import GHC hiding (Header, NoLink, HsTypeGhcPsExt (..))
import GHC.Builtin.Types (eqTyCon_RDR, tupleDataConName, tupleTyConName)
import GHC.Core.TyCon (tyConResKind)
import GHC.Driver.DynFlags (getDynFlags)
import GHC.Hs.Decls.Overlap (OverlapMode(..))
import GHC.Types.Basic (TupleSort (..))
-import GHC.Types.ForeignCall
+import GHC.Types.ForeignCall hiding (Header)
+import qualified GHC.Types.ForeignCall as Hs (Header(..))
import GHC.Types.Name
import GHC.Types.Name.Reader (RdrName (Exact))
import Language.Haskell.Syntax.BooleanFormula(BooleanFormula(..))
@@ -683,7 +684,10 @@ renameDataDefn
)
renameCType :: CType GhcRn -> CType DocNameI
-renameCType (CType _ y z) = CType NoExtField y z
+renameCType (CType _ y z) = CType NoExtField (renameHeader' <$> y) z
+
+renameHeader' :: Hs.Header GhcRn -> Hs.Header DocNameI
+renameHeader' (Hs.Header _ s) = Hs.Header NoExtField s
renameCon :: ConDecl GhcRn -> RnM (ConDecl DocNameI)
renameCon
@@ -834,7 +838,8 @@ renameForD (ForeignExport _ lname ltype x) = do
return (ForeignExport noExtField lname' ltype' (renameForE x))
renameForI :: ForeignImport GhcRn -> ForeignImport DocNameI
-renameForI (CImport _ cconv safety mHeader spec) = CImport noExtField cconv safety mHeader (renameForISpec spec)
+renameForI (CImport _ cconv safety mHeader spec) =
+ CImport noExtField cconv safety (renameHeader' <$> mHeader) (renameForISpec spec)
renameForE :: ForeignExport GhcRn -> ForeignExport DocNameI
renameForE (CExport _ spec) = CExport noExtField spec
=====================================
utils/haddock/haddock-api/src/Haddock/InterfaceFile.hs
=====================================
@@ -42,7 +42,7 @@ import Data.IORef
import Data.Map (Map)
import Data.Version
import Data.Word
-import GHC hiding (NoLink)
+import GHC hiding (Header, NoLink)
import GHC.Data.FastMutInt
import GHC.Data.FastString
import GHC.Iface.Binary (getWithUserData, putSymbolTable)
=====================================
utils/haddock/haddock-api/src/Haddock/Types.hs
=====================================
@@ -51,7 +51,7 @@ import Data.Data (Data)
import Data.Map (Map)
import qualified Data.Map as Map
import qualified Data.Set as Set
-import GHC
+import GHC hiding (Header)
import GHC.Data.BooleanFormula (BooleanFormula)
import GHC.Driver.Session (Language)
import qualified GHC.LanguageExtensions as LangExt
@@ -833,6 +833,7 @@ type instance Anno (HsSigType DocNameI) = SrcSpanAnnA
type instance Anno (BooleanFormula DocNameI) = SrcSpanAnnL
type instance Anno (OverlapMode DocNameI) = EpAnn AnnPragma
type instance Anno (CType DocNameI) = EpAnn AnnPragma
+type instance Anno (Header DocNameI) = EpAnn AnnPragma
type XRecCond a =
( XParTy a ~ (EpToken "(", EpToken ")")
@@ -934,6 +935,9 @@ type instance XXCCallTarget DocNameI = DataConCantHappen
type instance XCType DocNameI = NoExtField
type instance XXCType DocNameI = DataConCantHappen
+type instance XHeader DocNameI = NoExtField
+type instance XXHeader DocNameI = DataConCantHappen
+
type instance XConDeclGADT DocNameI = NoExtField
type instance XConDeclH98 DocNameI = NoExtField
type instance XXConDecl DocNameI = DataConCantHappen
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/be1dab4db2cea22c4a7b8548fbc68d…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/be1dab4db2cea22c4a7b8548fbc68d…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
06 Feb '26
Andreas Klebinger pushed to branch wip/andreask/hadrian_race at Glasgow Haskell Compiler / GHC
Commits:
75e48726 by Andreas Klebinger at 2026-02-06T21:11:05+01:00
wibbles
- - - - -
2 changed files:
- libraries/ghc-boot/GHC/Unit/Database.hs
- utils/ghc-pkg/Main.hs
Changes:
=====================================
libraries/ghc-boot/GHC/Unit/Database.hs
=====================================
@@ -418,7 +418,6 @@ isDbOpenReadMode = \case
--
readPackageDbForGhc :: FilePath -> IO [DbUnitInfo]
readPackageDbForGhc file = do
- hPutStrLn stderr $ "readPackageDbForGhc:" ++ show file
withLockedPackageDb DbOpenReadOnly file $ \_ -> do
decodeFromFile file DbOpenReadOnly getDbForGhc >>= \case
(pkgs, DbOpenReadOnly) -> return pkgs
=====================================
utils/ghc-pkg/Main.hs
=====================================
@@ -2249,4 +2249,4 @@ dieOnSingleFileDb :: FilePath -> IO a
dieOnSingleFileDb path =
die $ "ghc no longer supports single-file style package "
++ "databases (" ++ path ++ ") use 'ghc-pkg init'"
- ++ "to create the database with the correct format."
\ No newline at end of file
+ ++ "to create the database with the correct format."
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/75e48726b1a5d92fdb4ce6558fbada7…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/75e48726b1a5d92fdb4ce6558fbada7…
You're receiving this email because of your account on gitlab.haskell.org.
1
0