[Git][ghc/ghc][wip/romes/linear-core] 90 commits: rts: improve memory ordering and add some comments in the StablePtr implementation
Rodrigo Mesquita (@alt-romes)
gitlab at gitlab.haskell.org
Tue May 9 23:28:18 UTC 2023
Rodrigo Mesquita pushed to branch wip/romes/linear-core at Glasgow Haskell Compiler / GHC
Commits:
a34aa8da by Adam Sandberg Ericsson at 2023-04-14T04:17:52-04:00
rts: improve memory ordering and add some comments in the StablePtr implementation
- - - - -
d7a768a4 by Matthew Pickering at 2023-04-14T04:18:28-04:00
docs: Generate docs/index.html with version number
* Generate docs/index.html to include the version of the ghc library
* This also fixes the packageVersions interpolations which were
- Missing an interpolation for `LIBRARY_ghc_VERSION`
- Double quoting the version so that "9.7" was being inserted.
Fixes #23121
- - - - -
d48fbfea by Simon Peyton Jones at 2023-04-14T04:19:05-04:00
Stop if type constructors have kind errors
Otherwise we get knock-on errors, such as #23252.
This makes GHC fail a bit sooner, and I have not attempted to add
recovery code, to add a fake TyCon place of the erroneous one,
in an attempt to get more type errors in one pass. We could
do that (perhaps) if there was a call for it.
- - - - -
2371d6b2 by Simon Peyton Jones at 2023-04-14T20:01:02+02:00
Major refactor in the handling of equality constraints
This MR substantially refactors the way in which the constraint
solver deals with equality constraints. The big thing is:
* Intead of a pipeline in which we /first/ canonicalise and /then/
interact (the latter including performing unification) the two steps
are more closely integreated into one. That avoids the current
rather indirect communication between the two steps.
The proximate cause for this refactoring is fixing #22194, which involve
solving [W] alpha[2] ~ Maybe (F beta[4])
by doing this:
alpha[2] := Maybe delta[2]
[W] delta[2] ~ F beta[4]
That is, we don't promote beta[4]! This is very like introducing a cycle
breaker, and was very awkward to do before, but now it is all nice.
See GHC.Tc.Utils.Unify Note [Promotion and level-checking] and
Note [Family applications in canonical constraints].
The big change is this:
* Several canonicalisation checks (occurs-check, cycle-breaking,
checking for concreteness) are combined into one new function:
GHC.Tc.Utils.Unify.checkTyEqRhs
This function is controlled by `TyEqFlags`, which says what to do
for foralls, type families etc.
* `canEqCanLHSFinish` now sees if unification is possible, and if so,
actually does it: see `canEqCanLHSFinish_try_unification`.
There are loads of smaller changes:
* The on-the-fly unifier `GHC.Tc.Utils.Unify.unifyType` has a
cheap-and-cheerful version of `checkTyEqRhs`, called
`simpleUnifyCheck`. If `simpleUnifyCheck` succeeds, it can unify,
otherwise it defers by emitting a constraint. This is simpler than
before.
* I simplified the swapping code in `GHC.Tc.Solver.Equality.canEqCanLHS`.
Especially the nasty stuff involving `swap_for_occurs` and
`canEqTyVarFunEq`. Much nicer now. See
Note [Orienting TyVarLHS/TyFamLHS]
Note [Orienting TyFamLHS/TyFamLHS]
* Added `cteSkolemOccurs`, `cteConcrete`, and `cteCoercionHole` to the
problems that can be discovered by `checkTyEqRhs`.
* I fixed #23199 `pickQuantifiablePreds`, which actually allows GHC to
to accept both cases in #22194 rather than rejecting both.
Yet smaller:
* Added a `synIsConcrete` flag to `SynonymTyCon` (alongside `synIsFamFree`)
to reduce the need for synonym expansion when checking concreteness.
Use it in `isConcreteType`.
* Renamed `isConcrete` to `isConcreteType`
* Defined `GHC.Core.TyCo.FVs.isInjectiveInType` as a more efficient
way to find if a particular type variable is used injectively than
finding all the injective variables. It is called in
`GHC.Tc.Utils.Unify.definitely_poly`, which in turn is used quite a
lot.
* Moved `rewriterView` to `GHC.Core.Type`, so we can use it from the
constraint solver.
Fixes #22194, #23199
Compile times decrease by an average of 0.1%; but there is a 7.4%
drop in compiler allocation on T15703.
Metric Decrease:
T15703
- - - - -
99b2734b by Simon Peyton Jones at 2023-04-14T20:01:02+02:00
Add some documentation about redundant constraints
- - - - -
3f2d0eb8 by Simon Peyton Jones at 2023-04-14T20:01:02+02:00
Improve partial signatures
This MR fixes #23223. The changes are in two places:
* GHC.Tc.Bind.checkMonomorphismRestriction
See the new `Note [When the MR applies]`
We now no longer stupidly attempt to apply the MR when the user
specifies a context, e.g. f :: Eq a => _ -> _
* GHC.Tc.Solver.decideQuantification
See rewritten `Note [Constraints in partial type signatures]`
Fixing this bug apparently breaks three tests:
* partial-sigs/should_compile/T11192
* partial-sigs/should_fail/Defaulting1MROff
* partial-sigs/should_fail/T11122
However they are all symptoms of #23232, so I'm marking them as
expect_broken(23232).
I feel happy about this MR. Nice.
- - - - -
23e2a8a0 by Simon Peyton Jones at 2023-04-14T20:01:02+02:00
Make approximateWC a bit cleverer
This MR fixes #23224: making approximateWC more clever
See the long `Note [ApproximateWC]` in GHC.Tc.Solver
All this is delicate and ad-hoc -- but it /has/ to be: we are
talking about inferring a type for a binding in the presence of
GADTs, type families and whatnot: known difficult territory.
We just try as hard as we can.
- - - - -
2c040246 by Matthew Pickering at 2023-04-15T00:57:14-04:00
docs: Update template-haskell docs to use Code Q a rather than Q (TExp a)
Since GHC Proposal #195, the type of [|| ... ||] has been Code Q a
rather than Q (TExp a). The documentation in the `template-haskell`
library wasn't updated to reflect this change.
Fixes #23148
- - - - -
0da18eb7 by Krzysztof Gogolewski at 2023-04-15T14:35:53+02:00
Show an error when we cannot default a concrete tyvar
Fixes #23153
- - - - -
bad2f8b8 by sheaf at 2023-04-15T15:14:36+02:00
Handle ConcreteTvs in inferResultToType
inferResultToType was discarding the ir_frr information, which meant
some metavariables ended up being MetaTvs instead of ConcreteTvs.
This function now creates new ConcreteTvs as necessary, instead of
always creating MetaTvs.
Fixes #23154
- - - - -
3b0ea480 by Simon Peyton Jones at 2023-04-16T18:12:20-04:00
Transfer DFunId_ness onto specialised bindings
Whether a binding is a DFunId or not has consequences for the `-fdicts-strict`
flag, essentially if we are doing demand analysis for a DFunId then `-fdicts-strict` does
not apply because the constraint solver can create recursive groups of dictionaries.
In #22549 this was fixed for the "normal" case, see
Note [Do not strictify the argument dictionaries of a dfun].
However the loop still existed if the DFunId was being specialised.
The problem was that the specialiser would specialise a DFunId and
turn it into a VanillaId and so the demand analyser didn't know to
apply special treatment to the binding anymore and the whole recursive
group was optimised to bottom.
The solution is to transfer over the DFunId-ness of the binding in the specialiser so
that the demand analyser knows not to apply the `-fstrict-dicts`.
Fixes #22549
- - - - -
a1371ebb by Oleg Grenrus at 2023-04-16T18:12:59-04:00
Add import lists to few GHC.Driver.Session imports
Related to https://gitlab.haskell.org/ghc/ghc/-/issues/23261.
There are a lot of GHC.Driver.Session which only use DynFlags,
but not the parsing code.
- - - - -
51479ceb by Matthew Pickering at 2023-04-17T08:08:48-04:00
Account for special GHC.Prim import in warnUnusedPackages
The GHC.Prim import is treated quite specially primarily because there
isn't an interface file for GHC.Prim. Therefore we record separately in
the ModSummary if it's imported or not so we don't go looking for it.
This logic hasn't made it's way to `-Wunused-packages` so if you
imported GHC.Prim then the warning would complain you didn't use
`-package ghc-prim`.
Fixes #23212
- - - - -
1532a8b2 by Simon Peyton Jones at 2023-04-17T08:09:24-04:00
Add regression test for #23199
- - - - -
0158c5f1 by Ryan Scott at 2023-04-17T18:43:27-04:00
validDerivPred: Reject exotic constraints in IrredPreds
This brings the `IrredPred` case in sync with the treatment of `ClassPred`s as
described in `Note [Valid 'deriving' predicate]` in `GHC.Tc.Validity`. Namely,
we should reject `IrredPred`s that are inferred from `deriving` clauses whose
arguments contain other type constructors, as described in `(VD2) Reject exotic
constraints` of that Note. This has the nice property that `deriving` clauses
whose inferred instance context mention `TypeError` will now emit the type
error in the resulting error message, which better matches existing intuitions
about how `TypeError` should work.
While I was in town, I noticed that much of `Note [Valid 'deriving' predicate]`
was duplicated in a separate `Note [Exotic derived instance contexts]` in
`GHC.Tc.Deriv.Infer`. I decided to fold the latter Note into the former so that
there is a single authority on describing the conditions under which an
inferred `deriving` constraint can be considered valid.
This changes the behavior of `deriving` in a way that existing code might
break, so I have made a mention of this in the GHC User's Guide. It seems very,
very unlikely that much code is relying on this strange behavior, however, and
even if there is, there is a clear, backwards-compatible migration path using
`StandaloneDeriving`.
Fixes #22696.
- - - - -
10364818 by Krzysztof Gogolewski at 2023-04-17T18:44:03-04:00
Misc cleanup
- Use dedicated list functions
- Make cloneBndrs and cloneRecIdBndrs monadic
- Fix invalid haddock comments in libraries/base
- - - - -
5e1d33d7 by Matthew Pickering at 2023-04-18T10:31:02-04:00
Convert interface file loading errors into proper diagnostics
This patch converts all the errors to do with loading interface files
into proper structured diagnostics.
* DriverMessage: Sometimes in the driver we attempt to load an interface
file so we embed the IfaceMessage into the DriverMessage.
* TcRnMessage: Most the time we are loading interface files during
typechecking, so we embed the IfaceMessage
This patch also removes the TcRnInterfaceLookupError constructor which
is superceded by the IfaceMessage, which is now structured compared to
just storing an SDoc before.
- - - - -
df1a5811 by sheaf at 2023-04-18T10:31:43-04:00
Don't panic in ltPatersonSize
The function GHC.Tc.Utils.TcType.ltPatersonSize would panic when it
encountered a type family on the RHS, as usually these are not allowed
(type families are not allowed on the RHS of class instances or of
quantified constraints). However, it is possible to still encounter
type families on the RHS after doing a bit of constraint solving, as
seen in test case T23171. This could trigger the panic in the call to
ltPatersonSize in GHC.Tc.Solver.Canonical.mk_strict_superclasses, which
is involved in avoiding loopy superclass constraints.
This patch simply changes ltPatersonSize to return "I don't know, because
there's a type family involved" in these cases.
Fixes #23171
- - - - -
d442ac05 by Sylvain Henry at 2023-04-19T20:04:35-04:00
JS: fix thread-related primops
- - - - -
7a96f90b by Bryan Richter at 2023-04-19T20:05:11-04:00
CI: Disable abi-test-nightly
See #23269
- - - - -
ab6c1d29 by Sylvain Henry at 2023-04-19T20:05:50-04:00
Testsuite: don't use obsolescent egrep (#22351)
Recent egrep displays the following message, breaking golden tests:
egrep: warning: egrep is obsolescent; using grep -E
Switch to using "grep -E" instead
- - - - -
f15b0ce5 by Matthew Pickering at 2023-04-20T11:01:06-04:00
hadrian: Pass haddock file arguments in a response file
In !10119 CI was failing on windows because the command line was too
long. We can mitigate this by passing the file arguments to haddock in a
response file.
We can't easily pass all the arguments in a response file because the
`+RTS` arguments can't be placed in the response file.
Fixes #23273
- - - - -
7012ec2f by tocic at 2023-04-20T11:01:42-04:00
Fix doc typo in GHC.Read.readList
- - - - -
5c873124 by sheaf at 2023-04-20T18:33:34-04:00
Implement -jsem: parallelism controlled by semaphores
See https://github.com/ghc-proposals/ghc-proposals/pull/540/ for a
complete description for the motivation for this feature.
The `-jsem` option allows a build tool to pass a semaphore to GHC which
GHC can use in order to control how much parallelism it requests.
GHC itself acts as a client in the GHC jobserver protocol.
```
GHC Jobserver Protocol
~~~~~~~~~~~~~~~~~~~~~~
This proposal introduces the GHC Jobserver Protocol. This protocol allows
a server to dynamically invoke many instances of a client process,
while restricting all of those instances to use no more than <n> capabilities.
This is achieved by coordination over a system semaphore (either a POSIX
semaphore [6]_ in the case of Linux and Darwin, or a Win32 semaphore [7]_
in the case of Windows platforms).
There are two kinds of participants in the GHC Jobserver protocol:
- The *jobserver* creates a system semaphore with a certain number of
available tokens.
Each time the jobserver wants to spawn a new jobclient subprocess, it **must**
first acquire a single token from the semaphore, before spawning
the subprocess. This token **must** be released once the subprocess terminates.
Once work is finished, the jobserver **must** destroy the semaphore it created.
- A *jobclient* is a subprocess spawned by the jobserver or another jobclient.
Each jobclient starts with one available token (its *implicit token*,
which was acquired by the parent which spawned it), and can request more
tokens through the Jobserver Protocol by waiting on the semaphore.
Each time a jobclient wants to spawn a new jobclient subprocess, it **must**
pass on a single token to the child jobclient. This token can either be the
jobclient's implicit token, or another token which the jobclient acquired
from the semaphore.
Each jobclient **must** release exactly as many tokens as it has acquired from
the semaphore (this does not include the implicit tokens).
```
Build tools such as cabal act as jobservers in the protocol and are
responsibile for correctly creating, cleaning up and managing the
semaphore.
Adds a new submodule (semaphore-compat) for managing and interacting
with semaphores in a cross-platform way.
Fixes #19349
- - - - -
52d3e9b4 by Ben Gamari at 2023-04-20T18:34:11-04:00
rts: Initialize Array# header in listThreads#
Previously the implementation of listThreads# failed to initialize the
header of the created array, leading to various nastiness.
Fixes #23071
- - - - -
1db30fe1 by Ben Gamari at 2023-04-20T18:34:11-04:00
testsuite: Add test for #23071
- - - - -
dae514f9 by tocic at 2023-04-21T13:31:21-04:00
Fix doc typos in libraries/base/GHC
- - - - -
113e21d7 by Sylvain Henry at 2023-04-21T13:32:01-04:00
Testsuite: replace some js_broken/js_skip predicates with req_c
Using req_c is more precise.
- - - - -
038bb031 by Krzysztof Gogolewski at 2023-04-21T18:03:04-04:00
Minor doc fixes
- Add docs/index.html to .gitignore.
It is created by ./hadrian/build docs, and it was the only file
in Hadrian's templateRules not present in .gitignore.
- Mention that MultiWayIf supports non-boolean guards
- Remove documentation of optdll - removed in 2007, 763daed95
- Fix markdown syntax
- - - - -
e826cdb2 by amesgen at 2023-04-21T18:03:44-04:00
User's guide: DeepSubsumption is implied by Haskell{98,2010}
- - - - -
499a1c20 by PHO at 2023-04-23T13:39:32-04:00
Implement executablePath for Solaris and make getBaseDir less platform-dependent
Use base-4.17 executablePath when possible, and fall back on
getExecutablePath when it's not available. The sole reason why getBaseDir
had #ifdef's was apparently that getExecutablePath wasn't reliable, and we
could reduce the number of CPP conditionals by making use of
executablePath instead.
Also export executablePath on js_HOST_ARCH.
- - - - -
97a6f7bc by tocic at 2023-04-23T13:40:08-04:00
Fix doc typos in libraries/base
- - - - -
787c6e8c by Ben Gamari at 2023-04-24T12:19:06-04:00
testsuite/T20137: Avoid impl.-defined behavior
Previously we would cast pointers to uint64_t. However, implementations
are allowed to either zero- or sign-extend such casts. Instead cast to
uintptr_t to avoid this.
Fixes #23247.
- - - - -
87095f6a by Cheng Shao at 2023-04-24T12:19:44-04:00
rts: always build 64-bit atomic ops
This patch does a few things:
- Always build 64-bit atomic ops in rts/ghc-prim, even on 32-bit
platforms
- Remove legacy "64bit" cabal flag of rts package
- Fix hs_xchg64 function prototype for 32-bit platforms
- Fix AtomicFetch test for wasm32
- - - - -
2685a12d by Cheng Shao at 2023-04-24T12:20:21-04:00
compiler: don't install signal handlers when the host platform doesn't have signals
Previously, large parts of GHC API will transitively invoke
withSignalHandlers, which doesn't work on host platforms without
signal functionality at all (e.g. wasm32-wasi). By making
withSignalHandlers a no-op on those platforms, we can make more parts
of GHC API work out of the box when signals aren't supported.
- - - - -
1338b7a3 by Cheng Shao at 2023-04-24T16:21:30-04:00
hadrian: fix non-ghc program paths passed to testsuite driver when testing cross GHC
- - - - -
1a10f556 by Bodigrim at 2023-04-24T16:22:09-04:00
Add since pragma to Data.Functor.unzip
- - - - -
0da9e882 by Soham Chowdhury at 2023-04-25T00:15:22-04:00
More informative errors for bad imports (#21826)
- - - - -
ebd5b078 by Josh Meredith at 2023-04-25T00:15:58-04:00
JS/base: provide implementation for mkdir (issue 22374)
- - - - -
8f656188 by Josh Meredith at 2023-04-25T18:12:38-04:00
JS: Fix h$base_access implementation (issue 22576)
- - - - -
74c55712 by Andrei Borzenkov at 2023-04-25T18:13:19-04:00
Give more guarntees about ImplicitParams (#23289)
- Added new section in the GHC user's guide that legends behavior of
nested implicit parameter bindings in these two cases:
let ?f = 1 in let ?f = 2 in ?f
and
data T where MkT :: (?f :: Int) => T
f :: T -> T -> Int
f MkT MkT = ?f
- Added new test case to examine this behavior.
- - - - -
c30ac25f by Sebastian Graf at 2023-04-26T14:50:51-04:00
DmdAnal: Unleash demand signatures of free RULE and unfolding binders (#23208)
In #23208 we observed that the demand signature of a binder occuring in a RULE
wasn't unleashed, leading to a transitively used binder being discarded as
absent. The solution was to use the same code path that we already use for
handling exported bindings.
See the changes to `Note [Absence analysis for stable unfoldings and RULES]`
for more details.
I took the chance to factor out the old notion of a `PlusDmdArg` (a pair of a
`VarEnv Demand` and a `Divergence`) into `DmdEnv`, which fits nicely into our
existing framework. As a result, I had to touch quite a few places in the code.
This refactoring exposed a few small bugs around correct handling of bottoming
demand environments. As a result, some strictness signatures now mention uniques
that weren't there before which caused test output changes to T13143, T19969 and
T22112. But these tests compared whole -ddump-simpl listings which is a very
fragile thing to begin with. I changed what exactly they test for based on the
symptoms in the corresponding issues.
There is a single regression in T18894 because we are more conservative around
stable unfoldings now. Unfortunately it is not easily fixed; let's wait until
there is a concrete motivation before invest more time.
Fixes #23208.
- - - - -
77f506b8 by Josh Meredith at 2023-04-26T14:51:28-04:00
Refactor GenStgRhs to include the Type in both constructors (#23280, #22576, #22364)
Carry the actual type of an expression through the PreStgRhs and into GenStgRhs
for use in later stages. Currently this is used in the JavaScript backend to fix
some tests from the above mentioned issues: EtaExpandLevPoly, RepPolyWrappedVar2,
T13822, T14749.
- - - - -
052e2bb6 by Alan Zimmerman at 2023-04-26T14:52:05-04:00
EPA: Use ExplicitBraces only in HsModule
!9018 brought in exact print annotations in LayoutInfo for open and
close braces at the top level.
But it retained them in the HsModule annotations too.
Remove the originals, so exact printing uses LayoutInfo
- - - - -
d5c4629b by Cheng Shao at 2023-04-27T16:00:35-04:00
ci: update ci.sh to actually run the entire testsuite for wasm backend
For the time being, we still need to use in-tree mode and can't test
the bindist yet.
- - - - -
533d075e by Cheng Shao at 2023-04-27T16:00:35-04:00
ci: additional wasm32 manual jobs in validate pipelines
This patch enables bignum native & unregisterised wasm32 jobs as
manual jobs in validate pipelines, which can be useful to prevent
breakage when working on wasm32 related patches.
- - - - -
b5f00811 by Cheng Shao at 2023-04-27T16:00:35-04:00
testsuite: fix cross prefix stripping
This patch fixes cross prefix stripping in the testsuite driver. The
normalization logic used to only handle prefixes of the triple form
<arch>-<vendor>-<os>, now it's relaxed to allow any number of tokens
in the prefix tuple, so the cross prefix stripping logic would work
when ghc is configured with something like --target=wasm32-wasi.
- - - - -
6f511c36 by Cheng Shao at 2023-04-27T16:00:35-04:00
testsuite: include target exe extension in heap profile filenames
This patch fixes hp2ps related framework failures when testing the
wasm backend by including target exe extension in heap profile
filenames.
- - - - -
e6416b10 by Cheng Shao at 2023-04-27T16:00:35-04:00
testsuite: exclude ghci ways if no rts linker is present
This patch implements logic to automatically exclude ghci ways when
there is no rts linker. It's way better than having to annotate
individual test cases.
- - - - -
791cce64 by Cheng Shao at 2023-04-27T16:00:35-04:00
testsuite: fix permission bits in copy_files
When the testsuite driver copy files instead of symlinking them, it
should also copy the permission bits, otherwise there'll be permission
denied errors. Also, enforce file copying when testing wasm32, since
wasmtime doesn't handle host symlinks quite well
(https://github.com/bytecodealliance/wasmtime/issues/6227).
- - - - -
aa6afe8a by Cheng Shao at 2023-04-27T16:00:35-04:00
testsuite: add the req_ghc_with_threaded_rts predicate
This patch adds the req_ghc_with_threaded_rts predicate to the
testsuite to assert the platform has threaded RTS, and mark some tests
as req_ghc_with_threaded_rts. Also makes ghc_with_threaded_rts a
config field instead of a global variable.
- - - - -
ce580426 by Cheng Shao at 2023-04-27T16:00:35-04:00
testsuite: add the req_process predicate
This patch adds the req_process predicate to the testsuite to assert
the platform has a process model, also marking tests that involve
spawning processes as req_process. Also bumps hpc & process submodule.
- - - - -
cb933665 by Cheng Shao at 2023-04-27T16:00:35-04:00
testsuite: add the req_host_target_ghc predicate
This patch adds the req_host_target_ghc predicate to the testsuite to
assert the ghc compiler being tested can compile both host/target
code. When testing cross GHCs this is not supported yet, but it may
change in the future.
- - - - -
b174a110 by Cheng Shao at 2023-04-27T16:00:35-04:00
testsuite: add missing annotations for some tests
This patch adds missing annotations (req_th, req_dynamic_lib_support,
req_rts_linker) to some tests. They were discovered when testing
wasm32, though it's better to be explicit about what features they
require, rather than simply adding when(arch('wasm32'), skip).
- - - - -
bd2bfdec by Cheng Shao at 2023-04-27T16:00:35-04:00
testsuite: wasm32-specific fixes
This patch includes all wasm32-specific testsuite fixes.
- - - - -
4eaf2c2a by Josh Meredith at 2023-04-27T16:01:11-04:00
JS: change GHC.JS.Transform.identsS/E/V to take a saturated IR (#23304)
- - - - -
57277662 by sheaf at 2023-04-29T20:23:06+02:00
Add the Unsatisfiable class
This commit implements GHC proposal #433, adding the Unsatisfiable
class to the GHC.TypeError module. This provides an alternative to
TypeError for which error reporting is more predictable: we report it
when we are reporting unsolved Wanted constraints.
Fixes #14983 #16249 #16906 #18310 #20835
- - - - -
00a8a5ff by Torsten Schmits at 2023-04-30T03:45:09-04:00
Add structured error messages for GHC.Rename.Names
Tracking ticket: #20115
MR: !10336
This converts uses of `mkTcRnUnknownMessage` to newly added constructors
of `TcRnMessage`.
- - - - -
931c8d82 by Ben Orchard at 2023-05-03T20:16:18-04:00
Add sized primitive literal syntax
Adds a new LANGUAGE pragma ExtendedLiterals, which enables defining
unboxed numeric literals such as `0xFF#Word8 :: Word8#`.
Implements GHC proposal 0451:
https://github.com/ghc-proposals/ghc-proposals/blob/b384a538b34f79d18a0201455b7b3c473bc8c936/proposals/0451-sized-literals.rst
Fixes #21422.
Bumps haddock submodule.
Co-authored-by: Krzysztof Gogolewski <krzysztof.gogolewski at tweag.io>
- - - - -
f3460845 by Bodigrim at 2023-05-03T20:16:57-04:00
Document instances of Double
- - - - -
1e9caa1a by Sylvain Henry at 2023-05-03T20:17:37-04:00
Bump Cabal submodule (#22356)
- - - - -
4eafb52a by sheaf at 2023-05-03T20:18:16-04:00
Don't forget to check the parent in an export list
Commit 3f374399 introduced a bug which caused us to forget to include
the parent of an export item of the form T(..) (that is, IEThingAll)
when checking for duplicate exports.
Fixes #23318
- - - - -
8fde4ac8 by amesgen at 2023-05-03T20:18:57-04:00
Fix unlit path in cross bindists
- - - - -
8cc9a534 by Matthew Pickering at 2023-05-04T14:58:14-04:00
hadrian: Flavour: Change args -> extraArgs
Previously in a flavour definition you could override all the flags
which were passed to GHC. This causes issues when needed to compute a
package hash because we need to know what these extra arguments are
going to be before computing the hash. The solution is to modify flavour
so that the arguments you pass here are just extra ones rather than all
the arguments that you need to compile something.
This makes things work more like how cabal.project files work when you
give extra arguments to a package and also means that flavour
transformers correctly affect the hash.
- - - - -
3fdb18f8 by romes at 2023-05-04T14:58:14-04:00
Hardwire a better unit-id for ghc
Previously, the unit-id of ghc-the-library was fixed as `ghc`.
This was done primarily because the compiler must know the unit-id of
some packages (including ghc) a-priori to define wired-in names.
However, as seen in #20742, a reinstallable `ghc` whose unit-id is fixed
to `ghc` might result in subtle bugs when different ghc's interact.
A good example of this is having GHC_A load a plugin compiled by GHC_B,
where GHC_A and GHC_B are linked to ghc-libraries that are ABI
incompatible. Without a distinction between the unit-id of the ghc library
GHC_A is linked against and the ghc library the plugin it is loading was
compiled against, we can't check compatibility.
This patch gives a slightly better unit-id to ghc (ghc-version) by
(1) Not setting -this-unit-id to ghc, but rather to the new unit-id (modulo stage0)
(2) Adding a definition to `GHC.Settings.Config` whose value is the new unit-id.
(2.1) `GHC.Settings.Config` is generated by Hadrian
(2.2) and also by cabal through `compiler/Setup.hs`
This unit-id definition is imported by `GHC.Unit.Types` and used to
set the wired-in unit-id of "ghc", which was previously fixed to "ghc"
The commits following this one will improve the unit-id with a
cabal-style package hash and check compatibility when loading plugins.
Note that we also ensure that ghc's unit key matches unit id both when
hadrian or cabal builds ghc, and in this way we no longer need to add
`ghc` to the WiringMap.
- - - - -
6689c9c6 by romes at 2023-05-04T14:58:14-04:00
Validate compatibility of ghcs when loading plugins
Ensure, when loading plugins, that the ghc the plugin depends on is the
ghc loading the plugin -- otherwise fail to load the plugin.
Progress towards #20742.
- - - - -
db4be339 by romes at 2023-05-04T14:58:14-04:00
Add hashes to unit-ids created by hadrian
This commit adds support for computing an inputs hash for packages
compiled by hadrian. The result is that ABI incompatible packages should
be given different hashes and therefore be distinct in a cabal store.
Hashing is enabled by the `--flag`, and is off by default as the hash
contains a hash of the source files. We enable it when we produce
release builds so that the artifacts we distribute have the right unit
ids.
- - - - -
944a9b94 by Matthew Pickering at 2023-05-04T14:58:14-04:00
Use hash-unit-ids in release jobs
Includes fix upload_ghc_libs glob
- - - - -
116d7312 by Josh Meredith at 2023-05-04T14:58:51-04:00
JS: fix bounds checking (Issue 23123)
* For ByteArray-based bounds-checking, the JavaScript backend must use the
`len` field, instead of the inbuild JavaScript `length` field.
* Range-based operations must also check both the start and end of the range
for bounds
* All indicies are valid for ranges of size zero, since they are essentially no-ops
* For cases of ByteArray accesses (e.g. read as Int), the end index is
(i * sizeof(type) + sizeof(type) - 1), while the previous implementation
uses (i + sizeof(type) - 1). In the Int32 example, this is (i * 4 + 3)
* IndexByteArrayOp_Word8As* primitives use byte array indicies (unlike
the previous point), but now check both start and end indicies
* Byte array copies now check if the arrays are the same by identity and
then if the ranges overlap.
- - - - -
2d5c1dde by Sylvain Henry at 2023-05-04T14:58:51-04:00
Fix remaining issues with bound checking (#23123)
While fixing these I've also changed the way we store addresses into
ByteArray#. Addr# are composed of two parts: a JavaScript array and an
offset (32-bit number).
Suppose we want to store an Addr# in a ByteArray# foo at offset i.
Before this patch, we were storing both fields as a tuple in the "arr"
array field:
foo.arr[i] = [addr_arr, addr_offset];
Now we only store the array part in the "arr" field and the offset
directly in the array:
foo.dv.setInt32(i, addr_offset):
foo.arr[i] = addr_arr;
It avoids wasting space for the tuple.
- - - - -
98c5ee45 by Luite Stegeman at 2023-05-04T14:59:31-04:00
JavaScript: Correct arguments to h$appendToHsStringA
fixes #23278
- - - - -
ca611447 by Josh Meredith at 2023-05-04T15:00:07-04:00
base/encoding: add an allocations performance test (#22946)
- - - - -
e3ddf58d by Krzysztof Gogolewski at 2023-05-04T15:00:44-04:00
linear types: Don't add external names to the usage env
This has no observable effect, but avoids storing useless data.
- - - - -
b3226616 by Andrei Borzenkov at 2023-05-04T15:01:25-04:00
Improved documentation for the Data.OldList.nub function
There was recomentation to use map head . group . sort instead of nub
function, but containers library has more suitable and efficient
analogue
- - - - -
e8b72ff6 by Ryan Scott at 2023-05-04T15:02:02-04:00
Fix type variable substitution in gen_Newtype_fam_insts
Previously, `gen_Newtype_fam_insts` was substituting the type variable binders
of a type family instance using `substTyVars`, which failed to take type
variable dependencies into account. There is similar code in
`GHC.Tc.TyCl.Class.tcATDefault` that _does_ perform this substitution properly,
so this patch:
1. Factors out this code into a top-level `substATBndrs` function, and
2. Uses `substATBndrs` in `gen_Newtype_fam_insts`.
Fixes #23329.
- - - - -
275836d2 by Torsten Schmits at 2023-05-05T08:43:02+00:00
Add structured error messages for GHC.Rename.Utils
Tracking ticket: #20115
MR: !10350
This converts uses of `mkTcRnUnknownMessage` to newly added constructors
of `TcRnMessage`.
- - - - -
983ce558 by Oleg Grenrus at 2023-05-05T13:11:29-04:00
Use TemplateHaskellQuotes in TH.Syntax to construct Names
- - - - -
a5174a59 by Matthew Pickering at 2023-05-05T18:42:31-04:00
driver: Use hooks from plugin_hsc_env
This fixes a bug in oneshot mode where hooks modified in a plugin
wouldn't be used in oneshot mode because we neglected to use the right
hsc_env. This was observed by @csabahruska.
- - - - -
18a7d03d by Aaron Allen at 2023-05-05T18:42:31-04:00
Rework plugin initialisation points
In general this patch pushes plugin initialisation points to earlier in
the pipeline. As plugins can modify the `HscEnv`, it's imperative that
the plugins are initialised as soon as possible and used thereafter.
For example, there are some new tests which modify hsc_logger and other
hooks which failed to fire before (and now do)
One consequence of this change is that the error for specifying the
usage of a HPT plugin from the command line has changed, because it's
now attempted to be loaded at initialisation rather than causing a
cyclic module import.
Closes #21279
Co-authored-by: Matthew Pickering <matthewtpickering at gmail.com>
- - - - -
6e776ed3 by Matthew Pickering at 2023-05-05T18:42:31-04:00
docs: Add Note [Timing of plugin initialization]
- - - - -
e1df8511 by Matthew Pickering at 2023-05-05T18:43:07-04:00
Incrementally update ghcup metadata in ghc/ghcup-metadata
This job paves the way for distributing nightly builds
* A new repo https://gitlab.haskell.org/ghc/ghcup-metadata stores the
metadata on the "updates" branch.
* Each night this metadata is downloaded and the nightly builds are
appended to the end of the metadata.
* The update job only runs on the scheduled nightly pipeline, not just
when NIGHTLY=1.
Things which are not done yet
* Modify the retention policy for nightly jobs
* Think about building release flavour compilers to distribute nightly.
Fixes #23334
- - - - -
8f303d27 by Rodrigo Mesquita at 2023-05-05T22:04:31-04:00
docs: Remove mentions of ArrayArray# from unlifted FFI section
Fixes #23277
- - - - -
994bda56 by Torsten Schmits at 2023-05-05T22:05:12-04:00
Add structured error messages for GHC.Rename.Module
Tracking ticket: #20115
MR: !10361
This converts uses of `mkTcRnUnknownMessage` to newly added constructors
of `TcRnMessage`.
Only addresses the single warning missing from the previous MR.
- - - - -
3e3a6be4 by Ben Gamari at 2023-05-08T12:15:19+00:00
rts: Fix data-race in hs_init_ghc
As noticed by @Terrorjack, `hs_init_ghc` previously used non-atomic
increment/decrement on the RTS's initialization count. This may go wrong
in a multithreaded program which initializes the runtime multiple times.
Closes #22756.
- - - - -
78c8dc50 by Torsten Schmits at 2023-05-08T21:41:51-04:00
Add structured error messages for GHC.IfaceToCore
Tracking ticket: #20114
MR: !10390
This converts uses of `mkTcRnUnknownMessage` to newly added constructors
of `TcRnMessage`.
- - - - -
0e2df4c9 by Bryan Richter at 2023-05-09T12:03:35+03:00
Fix up rules for ghcup-metadata-nightly-push
- - - - -
d2744218 by Rodrigo Mesquita at 2023-05-09T21:11:27+01:00
WIP: Anotate provenance and mult or usageenv
- - - - -
1abcc625 by Rodrigo Mesquita at 2023-05-09T21:11:29+01:00
More fixes, in particular in bindNonRec...
In bindNonRec make sure if we return a case instead of a let we make the
idBinding correct
- - - - -
3ed87df0 by Rodrigo Mesquita at 2023-05-09T21:11:29+01:00
Lint binding site matches id binding
- - - - -
8fbb2acf by Rodrigo Mesquita at 2023-05-10T00:25:54+01:00
ROMES: WIP improvements
In particular, we note that in dsUnliftedBind we pass to matchEquations
variables which were let bound, which get further down the line used in
matchOneConLike (and in bindNonRec too) as case-pattern bound variables!
In this situation, where we use originally let-bound variables as case
bound variables, we must ensure the case bound variables are set to be
`LambdaBound` with the correct multiplicity (which should be some mix of
scaling with the constructor annotated multiplicities)
TODO: The multiplicity corresponding to the constructor multiplicity
scaled by ...
- - - - -
30 changed files:
- .gitignore
- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- .gitlab/rel_eng/upload_ghc_libs.py
- .gitmodules
- cabal.project-reinstall
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types/Prim.hs
- compiler/GHC/ByteCode/Instr.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/FVs.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Make.hs
- compiler/GHC/Core/Map/Expr.hs
- compiler/GHC/Core/Map/Type.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Core/Opt/Exitify.hs
- compiler/GHC/Core/Opt/FloatIn.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Monad.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/82d4286bea775c525e5646e8f958aee4c17af607...8fbb2acf526295afdc873b44318c63a9def9026e
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/82d4286bea775c525e5646e8f958aee4c17af607...8fbb2acf526295afdc873b44318c63a9def9026e
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/20230509/152bd2ef/attachment-0001.html>
More information about the ghc-commits
mailing list