[Git][ghc/ghc][wip/sand-witch/pattern- at a-binders] 23 commits: Stop configuring unused Ld command in `settings`

Andrei Borzenkov (@sand-witch) gitlab at gitlab.haskell.org
Thu Jun 29 07:05:02 UTC 2023



Andrei Borzenkov pushed to branch wip/sand-witch/pattern- at a-binders at Glasgow Haskell Compiler / GHC


Commits:
ecdc4353 by Rodrigo Mesquita at 2023-06-28T12:24:57-04:00
Stop configuring unused Ld command in `settings`

GHC has no direct dependence on the linker. Rather, we depend upon the C
compiler for linking and an object-merging program (which is typically
`ld`) for production of GHCi objects and merging of C stubs into final
object files.

Despite this, for historical reasons we still recorded information about
the linker into `settings`. Remove these entries from `settings`,
`hadrian/cfg/system.config`, as well as the `configure` logic
responsible for this information.

Closes #23566.

- - - - -
bf9ec3e4 by Bryan Richter at 2023-06-28T12:25:33-04:00
Remove extraneous debug output

- - - - -
7eb68dd6 by Bryan Richter at 2023-06-28T12:25:33-04:00
Work with unset vars in -e mode

- - - - -
49c27936 by Bryan Richter at 2023-06-28T12:25:33-04:00
Pass positional arguments in their positions

By quoting $cmd, the default "bash -i" is a single argument to run, and
no file named "bash -i" actually exists to be run.

- - - - -
887dc4fc by Bryan Richter at 2023-06-28T12:25:33-04:00
Handle unset value in -e context

- - - - -
5ffc7d7b by Rodrigo Mesquita at 2023-06-28T21:07:36-04:00
Configure CPP into settings

There is a distinction to be made between the Haskell Preprocessor and
the C preprocessor. The former is used to preprocess Haskell files,
while the latter is used in C preprocessing such as Cmm files.

In practice, they are both the same program (usually the C compiler) but
invoked with different flags.

Previously we would, at configure time, configure the haskell
preprocessor and save the configuration in the settings file, but,
instead of doing the same for CPP, we had hardcoded in GHC that the CPP
program was either `cc -E` or `cpp`.

This commit fixes that asymmetry by also configuring CPP at configure
time, and tries to make more explicit the difference between HsCpp and
Cpp (see Note [Preprocessing invocations]).

Note that we don't use the standard CPP and CPPFLAGS to configure Cpp,
but instead use the non-standard --with-cpp and --with-cpp-flags.
The reason is that autoconf sets CPP to "$CC -E", whereas we expect the
CPP command to be configured as a standalone executable rather than a
command. These are symmetrical with --with-hs-cpp and
--with-hs-cpp-flags.

Cleanup: Hadrian no longer needs to pass the CPP configuration for CPP
         to be C99 compatible through -optP, since we now configure that
         into settings.

Closes #23422

- - - - -
5efa9ca5 by Ben Gamari at 2023-06-28T21:08:13-04:00
hadrian: Always canonicalize topDirectory

Hadrian's `topDirectory` is intended to provide an absolute path to the
root of the GHC tree. However, if the tree is reached via a symlink this

One question here is whether the `canonicalizePath` call is expensive
enough to warrant caching. In a quick microbenchmark I observed that
`canonicalizePath "."` takes around 10us per call; this seems
sufficiently low not to worry.

Alternatively, another approach here would have been to rather move the
canonicalization into `m4/fp_find_root.m4`. This would have avoided
repeated canonicalization but sadly path canonicalization is a hard
problem in POSIX shell.

Addresses #22451.

- - - - -
b3e1436f by aadaa_fgtaa at 2023-06-28T21:08:53-04:00
Optimise ELF linker (#23464)

- cache last elements of `relTable`, `relaTable` and `symbolTables` in `ocInit_ELF`
- cache shndx table in ObjectCode
- run `checkProddableBlock` only with debug rts

- - - - -
30525b00 by Ben Gamari at 2023-06-28T21:09:30-04:00
compiler: Introduce MO_{ACQUIRE,RELEASE}_FENCE

- - - - -
b787e259 by Ben Gamari at 2023-06-28T21:09:30-04:00
compiler: Drop MO_WriteBarrier

rts: Drop write_barrier

- - - - -
7550b4a5 by Ben Gamari at 2023-06-28T21:09:30-04:00
rts: Drop load_store_barrier()

This is no longer used.

- - - - -
d5f2875e by Ben Gamari at 2023-06-28T21:09:31-04:00
rts: Drop last instances of prim_{write,read}_barrier

- - - - -
965ac2ba by Ben Gamari at 2023-06-28T21:09:31-04:00
rts: Eliminate remaining uses of load_load_barrier

- - - - -
0fc5cb97 by Sven Tennie at 2023-06-28T21:09:31-04:00
compiler: Drop MO_ReadBarrier

- - - - -
7a7d326c by Ben Gamari at 2023-06-28T21:09:31-04:00
rts: Drop load_load_barrier

This is no longer used.

- - - - -
9f63da66 by Sven Tennie at 2023-06-28T21:09:31-04:00
Delete write_barrier function

- - - - -
bb0ed354 by Ben Gamari at 2023-06-28T21:09:31-04:00
rts: Make collectFreshWeakPtrs definition a prototype

x86-64/Darwin's toolchain inexplicably warns that collectFreshWeakPtrs
needs to be a prototype.

- - - - -
ef81a1eb by Sven Tennie at 2023-06-28T21:10:08-04:00
Fix number of free double regs

D1..D4 are defined for aarch64 and thus not free.

- - - - -
c335fb7c by Ryan Scott at 2023-06-28T21:10:44-04:00
Fix typechecking of promoted empty lists

The `'[]` case in `tc_infer_hs_type` is smart enough to handle arity-0 uses of
`'[]` (see the newly added `T23543` test case for an example), but the `'[]`
case in `tc_hs_type` was not. We fix this by changing the `tc_hs_type` case to
invoke `tc_infer_hs_type`, as prescribed in `Note [Future-proofing the type
checker]`.

There are some benign changes to test cases' expected output due to the new
code path using `forall a. [a]` as the kind of `'[]` rather than `[k]`.

Fixes #23543.

- - - - -
fcf310e7 by Rodrigo Mesquita at 2023-06-28T21:11:21-04:00
Configure MergeObjs supports response files rather than Ld

The previous configuration script to test whether Ld supported response
files was
* Incorrect (see #23542)
* Used, in practice, to check if the *merge objects tool* supported
  response files.

This commit modifies the macro to run the merge objects tool (rather
than Ld), using a response file, and checking the result with $NM

Fixes #23542

- - - - -
78b2f3cc by Sylvain Henry at 2023-06-28T21:12:02-04:00
JS: fix JS stack printing (#23565)

- - - - -
09946c74 by Andrei Borzenkov at 2023-06-29T07:04:59+00:00
Draft: Type patterns (22478, 18986)

Improved name resolution and type checking of type patterns in constructors:

1. HsTyPat: a new dedicated data type that represents type patterns in
   HsConPatDetails instead of reusing HsPatSigType

2. rnHsTyPat: a new function that renames a type
   pattern and collects its binders into three groups:
    - explicitly bound type variables, excluding locally bound
      variables
    - implicitly bound type variables from kind signatures
      (only if ScopedTypeVariables are enabled)
    - named wildcards (only from kind signatures)
2a. rnHsPatSigTypeBindingVars: removed in favour of rnHsTyPat
2b. rnImplcitTvBndrs: removed because no longer needed

3. collect_pat: updated to collect type variable binders from type patterns
   (this means that types and terms use the same infrastructure to detect
   conflicting bindings, unused variables and name shadowing)
3a. CollVarTyVarBinders: a new CollectFlag constructor that enables
    collection of type variables

4. tcHsTyPat: a new function that typechecks type patterns, capable of
   handling polymorphic kinds.
   See Note [Type patterns: binders and unifiers]

Examples of code that is now accepted:

   f = \(P @a) -> \(P @a) -> ...  -- triggers -Wname-shadowing

   g :: forall a. Proxy a -> ...
   g (P @a) = ...                 -- also triggers -Wname-shadowing

   h (P @($(TH.varT (TH.mkName "t")))) = ...
                                  -- t is bound at splice time

   j (P @(a :: (x,x))) = ...      -- (x,x) is no longer rejected

   data T where
     MkT :: forall (f :: forall k. k -> Type).
       f Int -> f Maybe -> T
   k :: T -> ()
   k (MkT @f (x :: f Int) (y :: f Maybe)) = ()
                                  -- f :: forall k. k -> Type

Examples of code that is rejected with better error messages:

  f (Left @a @a _) = ...
  -- new message:
  --     • Conflicting definitions for ‘a’
  --       Bound at: Test.hs:1:11
  --                 Test.hs:1:14

Examples of code that is now rejected:

  {-# OPTIONS_GHC -Werror=unused-matches #-}
  f (P @a) = ()
  -- Defined but not used: type variable ‘a’

- - - - -
19f42c67 by Andrei Borzenkov at 2023-06-29T07:04:59+00:00
Add more notes and comments to the patch

- - - - -


30 changed files:

- .gitlab/ci.sh
- .gitlab/darwin/toolchain.nix
- compiler/GHC/Cmm/MachOp.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/AArch64/Instr.hs
- compiler/GHC/CmmToAsm/AArch64/Ppr.hs
- compiler/GHC/CmmToAsm/PPC/CodeGen.hs
- compiler/GHC/CmmToAsm/Reg/Graph/TrivColorable.hs
- compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToC.hs
- compiler/GHC/CmmToLlvm/CodeGen.hs
- compiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/Hs/Pat.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Parser/Types.hs
- compiler/GHC/Rename/HsType.hs
- compiler/GHC/Rename/Pat.hs
- compiler/GHC/Rename/Splice.hs
- compiler/GHC/Rename/Splice.hs-boot
- compiler/GHC/Rename/Utils.hs
- compiler/GHC/Settings.hs
- compiler/GHC/Settings/IO.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/94791a6126351f76240c7f76448bb22886f866ef...19f42c6793547def0cd5d5d29a6f4a0072146a4d

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/94791a6126351f76240c7f76448bb22886f866ef...19f42c6793547def0cd5d5d29a6f4a0072146a4d
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230629/f1f04031/attachment-0001.html>


More information about the ghc-commits mailing list