[Git][ghc/ghc][wip/js-fileStat] 91 commits: Fix fragile RULE setup in GHC.Float
Josh Meredith (@JoshMeredith)
gitlab at gitlab.haskell.org
Thu Dec 8 09:59:09 UTC 2022
Josh Meredith pushed to branch wip/js-fileStat at Glasgow Haskell Compiler / GHC
Commits:
154c70f6 by Simon Peyton Jones at 2022-11-11T23:40:10+00:00
Fix fragile RULE setup in GHC.Float
In testing my type-vs-constraint patch I found that the handling
of Natural literals was very fragile -- and I somehow tripped that
fragility in my work.
So this patch fixes the fragility.
See Note [realToFrac natural-to-float]
This made a big (9%) difference in one existing test in
perf/should_run/T1-359
Metric Decrease:
T10359
- - - - -
778c6adc by Simon Peyton Jones at 2022-11-11T23:40:10+00:00
Type vs Constraint: finally nailed
This big patch addresses the rats-nest of issues that have plagued
us for years, about the relationship between Type and Constraint.
See #11715/#21623.
The main payload of the patch is:
* To introduce CONSTRAINT :: RuntimeRep -> Type
* To make TYPE and CONSTRAINT distinct throughout the compiler
Two overview Notes in GHC.Builtin.Types.Prim
* Note [TYPE and CONSTRAINT]
* Note [Type and Constraint are not apart]
This is the main complication.
The specifics
* New primitive types (GHC.Builtin.Types.Prim)
- CONSTRAINT
- ctArrowTyCon (=>)
- tcArrowTyCon (-=>)
- ccArrowTyCon (==>)
- funTyCon FUN -- Not new
See Note [Function type constructors and FunTy]
and Note [TYPE and CONSTRAINT]
* GHC.Builtin.Types:
- New type Constraint = CONSTRAINT LiftedRep
- I also stopped nonEmptyTyCon being built-in; it only needs to be wired-in
* Exploit the fact that Type and Constraint are distinct throughout GHC
- Get rid of tcView in favour of coreView.
- Many tcXX functions become XX functions.
e.g. tcGetCastedTyVar --> getCastedTyVar
* Kill off Note [ForAllTy and typechecker equality], in (old)
GHC.Tc.Solver.Canonical. It said that typechecker-equality should ignore
the specified/inferred distinction when comparein two ForAllTys. But
that wsa only weakly supported and (worse) implies that we need a separate
typechecker equality, different from core equality. No no no.
* GHC.Core.TyCon: kill off FunTyCon in data TyCon. There was no need for it,
and anyway now we have four of them!
* GHC.Core.TyCo.Rep: add two FunTyFlags to FunCo
See Note [FunCo] in that module.
* GHC.Core.Type. Lots and lots of changes driven by adding CONSTRAINT.
The key new function is sORTKind_maybe; most other changes are built
on top of that.
See also `funTyConAppTy_maybe` and `tyConAppFun_maybe`.
* Fix a longstanding bug in GHC.Core.Type.typeKind, and Core Lint, in
kinding ForAllTys. See new tules (FORALL1) and (FORALL2) in GHC.Core.Type.
(The bug was that before (forall (cv::t1 ~# t2). blah), where
blah::TYPE IntRep, would get kind (TYPE IntRep), but it should be
(TYPE LiftedRep). See Note [Kinding rules for types] in GHC.Core.Type.
* GHC.Core.TyCo.Compare is a new module in which we do eqType and cmpType.
Of course, no tcEqType any more.
* GHC.Core.TyCo.FVs. I moved some free-var-like function into this module:
tyConsOfType, visVarsOfType, and occCheckExpand. Refactoring only.
* GHC.Builtin.Types. Compiletely re-engineer boxingDataCon_maybe to
have one for each /RuntimeRep/, rather than one for each /Type/.
This dramatically widens the range of types we can auto-box.
See Note [Boxing constructors] in GHC.Builtin.Types
The boxing types themselves are declared in library ghc-prim:GHC.Types.
GHC.Core.Make. Re-engineer the treatment of "big" tuples (mkBigCoreVarTup
etc) GHC.Core.Make, so that it auto-boxes unboxed values and (crucially)
types of kind Constraint. That allows the desugaring for arrows to work;
it gathers up free variables (including dictionaries) into tuples.
See Note [Big tuples] in GHC.Core.Make.
There is still work to do here: #22336. But things are better than
before.
* GHC.Core.Make. We need two absent-error Ids, aBSENT_ERROR_ID for types of
kind Type, and aBSENT_CONSTRAINT_ERROR_ID for vaues of kind Constraint.
Ditto noInlineId vs noInlieConstraintId in GHC.Types.Id.Make;
see Note [inlineId magic].
* GHC.Core.TyCo.Rep. Completely refactor the NthCo coercion. It is now called
SelCo, and its fields are much more descriptive than the single Int we used to
have. A great improvement. See Note [SelCo] in GHC.Core.TyCo.Rep.
* GHC.Core.RoughMap.roughMatchTyConName. Collapse TYPE and CONSTRAINT to
a single TyCon, so that the rough-map does not distinguish them.
* GHC.Core.DataCon
- Mainly just improve documentation
* Some significant renamings:
GHC.Core.Multiplicity: Many --> ManyTy (easier to grep for)
One --> OneTy
GHC.Core.TyCo.Rep TyCoBinder --> GHC.Core.Var.PiTyBinder
GHC.Core.Var TyCoVarBinder --> ForAllTyBinder
AnonArgFlag --> FunTyFlag
ArgFlag --> ForAllTyFlag
GHC.Core.TyCon TyConTyCoBinder --> TyConPiTyBinder
Many functions are renamed in consequence
e.g. isinvisibleArgFlag becomes isInvisibleForAllTyFlag, etc
* I refactored FunTyFlag (was AnonArgFlag) into a simple, flat data type
data FunTyFlag
= FTF_T_T -- (->) Type -> Type
| FTF_T_C -- (-=>) Type -> Constraint
| FTF_C_T -- (=>) Constraint -> Type
| FTF_C_C -- (==>) Constraint -> Constraint
* GHC.Tc.Errors.Ppr. Some significant refactoring in the TypeEqMisMatch case
of pprMismatchMsg.
* I made the tyConUnique field of TyCon strict, because I
saw code with lots of silly eval's. That revealed that
GHC.Settings.Constants.mAX_SUM_SIZE can only be 63, because
we pack the sum tag into a 6-bit field. (Lurking bug squashed.)
Fixes
* #21530
Updates haddock submodule slightly.
Performance changes
~~~~~~~~~~~~~~~~~~~
I was worried that compile times would get worse, but after
some careful profiling we are down to a geometric mean 0.1%
increase in allocation (in perf/compiler). That seems fine.
There is a big runtime improvement in T10359
Metric Decrease:
LargeRecord
MultiLayerModulesTH_OneShot
T13386
T13719
Metric Increase:
T8095
- - - - -
360f5fec by Simon Peyton Jones at 2022-11-11T23:40:11+00:00
Indent closing "#-}" to silence HLint
- - - - -
e160cf47 by Krzysztof Gogolewski at 2022-11-12T08:05:28-05:00
Fix merge conflict in T18355.stderr
Fixes #22446
- - - - -
294f9073 by Simon Peyton Jones at 2022-11-12T23:14:13+00:00
Fix a trivial typo in dataConNonlinearType
Fixes #22416
- - - - -
268a3ce9 by Ben Gamari at 2022-11-14T09:36:57-05:00
eventlog: Ensure that IPE output contains actual info table pointers
The refactoring in 866c736e introduced a rather subtle change in the
semantics of the IPE eventlog output, changing the eventlog field from
encoding info table pointers to "TNTC pointers" (which point to entry
code when tables-next-to-code is enabled). Fix this.
Fixes #22452.
- - - - -
d91db679 by Matthew Pickering at 2022-11-14T16:48:10-05:00
testsuite: Add tests for T22347
These are fixed in recent versions but might as well add regression
tests.
See #22347
- - - - -
8f6c576b by Matthew Pickering at 2022-11-14T16:48:45-05:00
testsuite: Improve output from tests which have failing pre_cmd
There are two changes:
* If a pre_cmd fails, then don't attempt to run the test.
* If a pre_cmd fails, then print the stdout and stderr from running that
command (which hopefully has a nice error message).
For example:
```
=====> 1 of 1 [0, 0, 0]
*** framework failure for test-defaulting-plugin(normal) pre_cmd failed: 2
** pre_cmd was "$MAKE -s --no-print-directory -C defaulting-plugin package.test-defaulting-plugin TOP={top}".
stdout:
stderr:
DefaultLifted.hs:19:13: error: [GHC-76037]
Not in scope: type constructor or class ‘Typ’
Suggested fix:
Perhaps use one of these:
‘Type’ (imported from GHC.Tc.Utils.TcType),
data constructor ‘Type’ (imported from GHC.Plugins)
|
19 | instance Eq Typ where
| ^^^
make: *** [Makefile:17: package.test-defaulting-plugin] Error 1
Performance Metrics (test environment: local):
```
Fixes #22329
- - - - -
2b7d5ccc by Madeline Haraj at 2022-11-14T22:44:17+00:00
Implement UNPACK support for sum types.
This is based on osa's unpack_sums PR from ages past.
The meat of the patch is implemented in dataConArgUnpackSum
and described in Note [UNPACK for sum types].
- - - - -
78f7ecb0 by Andreas Klebinger at 2022-11-14T22:20:29-05:00
Expand on the need to clone local binders.
Fixes #22402.
- - - - -
65ce43cc by Krzysztof Gogolewski at 2022-11-14T22:21:05-05:00
Fix :i Constraint printing "type Constraint = Constraint"
Since Constraint became a synonym for CONSTRAINT 'LiftedRep,
we need the same code for handling printing as for the synonym
Type = TYPE 'LiftedRep.
This addresses the same bug as #18594, so I'm reusing the test.
- - - - -
94549f8f by ARATA Mizuki at 2022-11-15T21:36:03-05:00
configure: Don't check for an unsupported version of LLVM
The upper bound is not inclusive.
Fixes #22449
- - - - -
02d3511b by Bodigrim at 2022-11-15T21:36:41-05:00
Fix capitalization in haddock for TestEquality
- - - - -
08bf2881 by Cheng Shao at 2022-11-16T09:16:29+00:00
base: make Foreign.Marshal.Pool use RTS internal arena for allocation
`Foreign.Marshal.Pool` used to call `malloc` once for each allocation
request. Each `Pool` maintained a list of allocated pointers, and
traverses the list to `free` each one of those pointers. The extra O(n)
overhead is apparently bad for a `Pool` that serves a lot of small
allocation requests.
This patch uses the RTS internal arena to implement `Pool`, with these
benefits:
- Gets rid of the extra O(n) overhead.
- The RTS arena is simply a bump allocator backed by the block
allocator, each allocation request is likely faster than a libc
`malloc` call.
Closes #14762 #18338.
- - - - -
37cfe3c0 by Krzysztof Gogolewski at 2022-11-16T14:50:06-05:00
Misc cleanup
* Replace catMaybes . map f with mapMaybe f
* Use concatFS to concatenate multiple FastStrings
* Fix documentation of -exclude-module
* Cleanup getIgnoreCount in GHCi.UI
- - - - -
b0ac3813 by Lawton Nichols at 2022-11-19T03:22:14-05:00
Give better errors for code corrupted by Unicode smart quotes (#21843)
Previously, we emitted a generic and potentially confusing error during lexical
analysis on programs containing smart quotes (“/”/‘/’). This commit adds
smart quote-aware lexer errors.
- - - - -
cb8430f8 by Sebastian Graf at 2022-11-19T03:22:49-05:00
Make OpaqueNo* tests less noisy to unrelated changes
- - - - -
b1a8af69 by Sebastian Graf at 2022-11-19T03:22:49-05:00
Simplifier: Consider `seq` as a `BoringCtxt` (#22317)
See `Note [Seq is boring]` for the rationale.
Fixes #22317.
- - - - -
9fd11585 by Sebastian Graf at 2022-11-19T03:22:49-05:00
Make T21839c's ghc/max threshold more forgiving
- - - - -
4b6251ab by Simon Peyton Jones at 2022-11-19T03:23:24-05:00
Be more careful when reporting unbound RULE binders
See Note [Variables unbound on the LHS] in GHC.HsToCore.Binds.
Fixes #22471.
- - - - -
e8f2b80d by Peter Trommler at 2022-11-19T03:23:59-05:00
PPC NCG: Fix generating assembler code
Fixes #22479
- - - - -
f2f9ef07 by Bodigrim at 2022-11-20T18:39:30-05:00
Extend documentation for Data.IORef
- - - - -
ef511b23 by Simon Peyton Jones at 2022-11-20T18:40:05-05:00
Buglet in GHC.Tc.Module.checkBootTyCon
This lurking bug used the wrong function to compare two
types in GHC.Tc.Module.checkBootTyCon
It's hard to trigger the bug, which only came up during
!9343, so there's no regression test in this MR.
- - - - -
451aeac3 by Bodigrim at 2022-11-20T18:40:44-05:00
Add since pragmas for c_interruptible_open and hostIsThreaded
- - - - -
8d6aaa49 by Duncan Coutts at 2022-11-22T02:06:16-05:00
Introduce CapIOManager as the per-cap I/O mangager state
Rather than each I/O manager adding things into the Capability structure
ad-hoc, we should have a common CapIOManager iomgr member of the
Capability structure, with a common interface to initialise etc.
The content of the CapIOManager struct will be defined differently for
each I/O manager implementation. Eventually we should be able to have
the CapIOManager be opaque to the rest of the RTS, and known just to the
I/O manager implementation. We plan for that by making the Capability
contain a pointer to the CapIOManager rather than containing the
structure directly.
Initially just move the Unix threaded I/O manager's control FD.
- - - - -
8901285e by Duncan Coutts at 2022-11-22T02:06:17-05:00
Add hook markCapabilityIOManager
To allow I/O managers to have GC roots in the Capability, within the
CapIOManager structure.
Not yet used in this patch.
- - - - -
5cf709c5 by Duncan Coutts at 2022-11-22T02:06:17-05:00
Move APPEND_TO_BLOCKED_QUEUE from cmm to C
The I/O and delay blocking primitives for the non-threaded way
currently access the blocked_queue and sleeping_queue directly.
We want to move where those queues are to make their ownership clearer:
to have them clearly belong to the I/O manager impls rather than to the
scheduler. Ultimately we will want to change their representation too.
It's inconvenient to do that if these queues are accessed directly from
cmm code. So as a first step, replace the APPEND_TO_BLOCKED_QUEUE with a
C version appendToIOBlockedQueue(), and replace the open-coded
sleeping_queue insertion with insertIntoSleepingQueue().
- - - - -
ced9acdb by Duncan Coutts at 2022-11-22T02:06:17-05:00
Move {blocked,sleeping}_queue from scheduler global vars to CapIOManager
The blocked_queue_{hd,tl} and the sleeping_queue are currently
cooperatively managed between the scheduler and (some but not all of)
the non-threaded I/O manager implementations.
They lived as global vars with the scheduler, but are poked by I/O
primops and the I/O manager backends.
This patch is a step on the path towards making the management of I/O or
timer blocking belong to the I/O managers and not the scheduler.
Specifically, this patch moves the {blocked,sleeping}_queue from being
global vars in the scheduler to being members of the CapIOManager struct
within each Capability. They are not yet exclusively used by the I/O
managers: they are still poked from a couple other places, notably in
the scheduler before calling awaitEvent.
- - - - -
0f68919e by Duncan Coutts at 2022-11-22T02:06:17-05:00
Remove the now-unused markScheduler
The global vars {blocked,sleeping}_queue are now in the Capability and
so get marked there via markCapabilityIOManager.
- - - - -
39a91f60 by Duncan Coutts at 2022-11-22T02:06:17-05:00
Move macros for checking for pending IO or timers
from Schedule.h to Schedule.c and IOManager.h
This is just moving, the next step will be to rejig them slightly.
For the non-threaded RTS the scheduler needs to be able to test for
there being pending I/O operation or pending timers. The implementation
of these tests should really be considered to be part of the I/O
managers and not part of the scheduler.
- - - - -
664b034b by Duncan Coutts at 2022-11-22T02:06:17-05:00
Replace EMPTY_{BLOCKED,SLEEPING}_QUEUE macros by function
These are the macros originaly from Scheduler.h, previously moved to
IOManager.h, and now replaced with a single inline function
anyPendingTimeoutsOrIO(). We can use a single function since the two
macros were always checked together.
Note that since anyPendingTimeoutsOrIO is defined for all IO manager
cases, including threaded, we do not need to guard its use by cpp
#if !defined(THREADED_RTS)
- - - - -
32946220 by Duncan Coutts at 2022-11-22T02:06:17-05:00
Expand emptyThreadQueues inline for clarity
It was not really adding anything. The name no longer meant anything
since those I/O and timeout queues do not belong to the scheuler.
In one of the two places it was used, the comments already had to
explain what it did, whereas now the code matches the comment nicely.
- - - - -
9943baf9 by Duncan Coutts at 2022-11-22T02:06:17-05:00
Move the awaitEvent declaration into IOManager.h
And add or adjust comments at the use sites of awaitEvent.
- - - - -
054dcc9d by Duncan Coutts at 2022-11-22T02:06:17-05:00
Pass the Capability *cap explicitly to awaitEvent
It is currently only used in the non-threaded RTS so it works to use
MainCapability, but it's a bit nicer to pass the cap anyway. It's
certainly shorter.
- - - - -
667fe5a4 by Duncan Coutts at 2022-11-22T02:06:17-05:00
Pass the Capability *cap explicitly to appendToIOBlockedQueue
And to insertIntoSleepingQueue. Again, it's a bit cleaner and simpler
though not strictly necessary given that these primops are currently
only used in the non-threaded RTS.
- - - - -
7181b074 by Duncan Coutts at 2022-11-22T02:06:17-05:00
Reveiew feedback: improve one of the TODO comments
The one about the nonsense (const False) test on WinIO for there being any IO
or timers pending, leading to unnecessary complication later in the
scheduler.
- - - - -
e5b68183 by Andreas Klebinger at 2022-11-22T02:06:52-05:00
Optimize getLevity.
Avoid the intermediate data structures allocated by splitTyConApp.
This avoids ~0.5% of allocations for a build using -O2.
Fixes #22254
- - - - -
de5fb348 by Andreas Klebinger at 2022-11-22T02:07:28-05:00
hadrian:Set TNTC when running testsuite.
- - - - -
9d61c182 by Oleg Grenrus at 2022-11-22T15:59:34-05:00
Add unsafePtrEquality# restricted to UnliftedTypes
- - - - -
e817c871 by Jonathan Dowland at 2022-11-22T16:00:14-05:00
utils/unlit: adjust parser to match Report spec
The Haskell 2010 Report says that, for Latex-style Literate format,
"Program code begins on the first line following a line that begins
\begin{code}". (This is unchanged from the 98 Report)
However the unlit.c implementation only matches a line that contains
"\begin{code}" and nothing else. One consequence of this is that one
cannot suffix Latex options to the code environment. I.e., this does
not work:
\begin{code}[label=foo,caption=Foo Code]
Adjust the matcher to conform to the specification from the Report.
The Haskell Wiki currently recommends suffixing a '%' to \begin{code}
in order to deliberately hide a code block from Haskell. This is bad
advice, as it's relying on an implementation quirk rather than specified
behaviour. None-the-less, some people have tried to use it, c.f.
<https://mail.haskell.org/pipermail/haskell-cafe/2009-September/066780.html>
An alternative solution is to define a separate, equivalent Latex
environment to "code", that is functionally identical in Latex but
ignored by unlit. This should not be a burden: users are required to
manually define the code environment anyway, as it is not provided
by the Latex verbatim or lstlistings packages usually used for
presenting code in documents.
Fixes #3549.
- - - - -
0b7fef11 by Teo Camarasu at 2022-11-23T12:44:33-05:00
Fix eventlog all option
Previously it didn't enable/disable nonmoving_gc and ticky event types
Fixes #21813
- - - - -
04d0618c by Arnaud Spiwack at 2022-11-23T12:45:14-05:00
Expand Note [Linear types] with the stance on linting linearity
Per the discussion on #22123
- - - - -
e1538516 by Lawton Nichols at 2022-11-23T12:45:55-05:00
Add documentation on custom Prelude modules (#22228)
Specifically, custom Prelude modules that are named `Prelude`.
- - - - -
b5c71454 by Sylvain Henry at 2022-11-23T12:46:35-05:00
Don't let configure perform trivial substitutions (#21846)
Hadrian now performs substitutions, especially to generate .cabal files
from .cabal.in files. Two benefits:
1. We won't have to re-configure when we modify thing.cabal.in. Hadrian
will take care of this for us.
2. It paves the way to allow the same package to be configured
differently by Hadrian in the same session. This will be useful to
fix #19174: we want to build a stage2 cross-compiler for the host
platform and a stage1 compiler for the cross target platform in the
same Hadrian session.
- - - - -
99aca26b by nineonine at 2022-11-23T12:47:11-05:00
CApiFFI: add ConstPtr for encoding const-qualified pointer return types (#22043)
Previously, when using `capi` calling convention in foreign declarations,
code generator failed to handle const-cualified pointer return types.
This resulted in CC toolchain throwing `-Wincompatible-pointer-types-discards-qualifiers`
warning.
`Foreign.C.Types.ConstPtr` newtype was introduced to handle these cases -
special treatment was put in place to generate appropritetly qualified C
wrapper that no longer triggers the above mentioned warning.
Fixes #22043
- - - - -
040bfdc3 by M Farkas-Dyck at 2022-11-23T21:59:03-05:00
Scrub some no-warning pragmas.
- - - - -
178c1fd8 by Vladislav Zavialov at 2022-11-23T21:59:39-05:00
Check if the SDoc starts with a single quote (#22488)
This patch fixes pretty-printing of character literals
inside promoted lists and tuples.
When we pretty-print a promoted list or tuple whose first element
starts with a single quote, we want to add a space between the opening
bracket and the element:
'[True] -- ok
'[ 'True] -- ok
'['True] -- not ok
If we don't add the space, we accidentally produce a character
literal '['.
Before this patch, pprSpaceIfPromotedTyCon inspected the type as an AST
and tried to guess if it would be rendered with a single quote. However,
it missed the case when the inner type was itself a character literal:
'[ 'x'] -- ok
'['x'] -- not ok
Instead of adding this particular case, I opted for a more future-proof
solution: check the SDoc directly. This way we can detect if the single
quote is actually there instead of trying to predict it from the AST.
The new function is called spaceIfSingleQuote.
- - - - -
11627c42 by Matthew Pickering at 2022-11-23T22:00:15-05:00
notes: Fix references to HPT space leak note
Updating this note was missed when updating the HPT to the HUG.
Fixes #22477
- - - - -
86ff1523 by Andrei Borzenkov at 2022-11-24T17:24:51-05:00
Convert diagnostics in GHC.Rename.Expr to proper TcRnMessage (#20115)
Problem: avoid usage of TcRnMessageUnknown
Solution:
The following `TcRnMessage` messages has been introduced:
TcRnNoRebindableSyntaxRecordDot
TcRnNoFieldPunsRecordDot
TcRnIllegalStaticExpression
TcRnIllegalStaticFormInSplice
TcRnListComprehensionDuplicateBinding
TcRnEmptyStmtsGroup
TcRnLastStmtNotExpr
TcRnUnexpectedStatementInContext
TcRnIllegalTupleSection
TcRnIllegalImplicitParameterBindings
TcRnSectionWithoutParentheses
Co-authored-by: sheaf <sam.derbyshire at gmail.com>
- - - - -
d198a19a by Cheng Shao at 2022-11-24T17:25:29-05:00
rts: fix missing Arena.h symbols in RtsSymbols.c
It was an unfortunate oversight in !8961 and broke devel2 builds.
- - - - -
5943e739 by Bodigrim at 2022-11-25T04:38:28-05:00
Assorted fixes to avoid Data.List.{head,tail}
- - - - -
1f1b99b8 by sheaf at 2022-11-25T04:38:28-05:00
Review suggestions for assorted fixes to avoid Data.List.{head,tail}
- - - - -
13d627bb by Vladislav Zavialov at 2022-11-25T04:39:04-05:00
Print unticked promoted data constructors (#20531)
Before this patch, GHC unconditionally printed ticks before promoted
data constructors:
ghci> type T = True -- unticked (user-written)
ghci> :kind! T
T :: Bool
= 'True -- ticked (compiler output)
After this patch, GHC prints ticks only when necessary:
ghci> type F = False -- unticked (user-written)
ghci> :kind! F
F :: Bool
= False -- unticked (compiler output)
ghci> data False -- introduce ambiguity
ghci> :kind! F
F :: Bool
= 'False -- ticked by necessity (compiler output)
The old behavior can be enabled by -fprint-redundant-promotion-ticks.
Summary of changes:
* Rename PrintUnqualified to NamePprCtx
* Add QueryPromotionTick to it
* Consult the GlobalRdrEnv to decide whether to print a tick (see mkPromTick)
* Introduce -fprint-redundant-promotion-ticks
Co-authored-by: Artyom Kuznetsov <hi at wzrd.ht>
- - - - -
d10dc6bd by Simon Peyton Jones at 2022-11-25T22:31:27+00:00
Fix decomposition of TyConApps
Ticket #22331 showed that we were being too eager to decompose
a Wanted TyConApp, leading to incompleteness in the solver.
To understand all this I ended up doing a substantial rewrite
of the old Note [Decomposing equalities], now reborn as
Note [Decomposing TyConApp equalities]. Plus rewrites of other
related Notes.
The actual fix is very minor and actually simplifies the code: in
`can_decompose` in `GHC.Tc.Solver.Canonical.canTyConApp`, we now call
`noMatchableIrreds`. A closely related refactor: we stop trying to
use the same "no matchable givens" function here as in
`matchClassInst`. Instead split into two much simpler functions.
- - - - -
2da5c38a by Will Hawkins at 2022-11-26T04:05:04-05:00
Redirect output of musttail attribute test
Compilation output from test for support of musttail attribute leaked to
the console.
- - - - -
0eb1c331 by Cheng Shao at 2022-11-28T08:55:53+00:00
Move hs_mulIntMayOflo cbits to ghc-prim
It's only used by wasm NCG at the moment, but ghc-prim is a more
reasonable place for hosting out-of-line primops. Also, we only need a
single version of hs_mulIntMayOflo.
- - - - -
36b53a9d by Cheng Shao at 2022-11-28T09:05:57+00:00
compiler: generate ccalls for clz/ctz/popcnt in wasm NCG
We used to generate a single wasm clz/ctz/popcnt opcode, but it's
wrong when it comes to subwords, so might as well generate ccalls for
them. See #22470 for details.
- - - - -
d4134e92 by Cheng Shao at 2022-11-28T23:48:14-05:00
compiler: remove unused MO_U_MulMayOflo
We actually only emit MO_S_MulMayOflo and never emit MO_U_MulMayOflo anywhere.
- - - - -
8d15eadc by Apoorv Ingle at 2022-11-29T03:09:31-05:00
Killing cc_fundeps, streamlining kind equality orientation, and type equality processing order
Fixes: #217093
Associated to #19415
This change
* Flips the orientation of the the generated kind equality coercion in canEqLHSHetero;
* Removes `cc_fundeps` in CDictCan as the check was incomplete;
* Changes `canDecomposableTyConAppOk` to ensure we process kind equalities before type equalities and avoiding a call to `canEqLHSHetero` while processing wanted TyConApp equalities
* Adds 2 new tests for validating the change
- testsuites/typecheck/should_compile/T21703.hs and
- testsuites/typecheck/should_fail/T19415b.hs (a simpler version of T19415.hs)
* Misc: Due to the change in the equality direction some error messages now have flipped type mismatch errors
* Changes in Notes:
- Note [Fundeps with instances, and equality orientation] supercedes Note [Fundeps with instances]
- Added Note [Kind Equality Orientation] to visualize the kind flipping
- Added Note [Decomposing Dependent TyCons and Processing Wanted Equalties]
- - - - -
646969d4 by Krzysztof Gogolewski at 2022-11-29T03:10:13-05:00
Change printing of sized literals to match the proposal
Literals in Core were printed as e.g. 0xFF#16 :: Int16#.
The proposal 451 now specifies syntax 0xFF#Int16.
This change affects the Core printer only - more to be done later.
Part of #21422.
- - - - -
02e282ec by Simon Peyton Jones at 2022-11-29T03:10:48-05:00
Be a bit more selective about floating bottoming expressions
This MR arranges to float a bottoming expression to the top
only if it escapes a value lambda.
See #22494 and Note [Floating to the top] in SetLevels.
This has a generally beneficial effect in nofib
+-------------------------------++----------+
| ||tsv (rel) |
+===============================++==========+
| imaginary/paraffins || -0.93% |
| imaginary/rfib || -0.05% |
| real/fem || -0.03% |
| real/fluid || -0.01% |
| real/fulsom || +0.05% |
| real/gamteb || -0.27% |
| real/gg || -0.10% |
| real/hidden || -0.01% |
| real/hpg || -0.03% |
| real/scs || -11.13% |
| shootout/k-nucleotide || -0.01% |
| shootout/n-body || -0.08% |
| shootout/reverse-complement || -0.00% |
| shootout/spectral-norm || -0.02% |
| spectral/fibheaps || -0.20% |
| spectral/hartel/fft || -1.04% |
| spectral/hartel/solid || +0.33% |
| spectral/hartel/wave4main || -0.35% |
| spectral/mate || +0.76% |
+===============================++==========+
| geom mean || -0.12% |
The effect on compile time is generally slightly beneficial
Metrics: compile_time/bytes allocated
----------------------------------------------
MultiLayerModulesTH_OneShot(normal) +0.3%
PmSeriesG(normal) -0.2%
PmSeriesT(normal) -0.1%
T10421(normal) -0.1%
T10421a(normal) -0.1%
T10858(normal) -0.1%
T11276(normal) -0.1%
T11303b(normal) -0.2%
T11545(normal) -0.1%
T11822(normal) -0.1%
T12150(optasm) -0.1%
T12234(optasm) -0.3%
T13035(normal) -0.2%
T16190(normal) -0.1%
T16875(normal) -0.4%
T17836b(normal) -0.2%
T17977(normal) -0.2%
T17977b(normal) -0.2%
T18140(normal) -0.1%
T18282(normal) -0.1%
T18304(normal) -0.2%
T18698a(normal) -0.1%
T18923(normal) -0.1%
T20049(normal) -0.1%
T21839r(normal) -0.1%
T5837(normal) -0.4%
T6048(optasm) +3.2% BAD
T9198(normal) -0.2%
T9630(normal) -0.1%
TcPlugin_RewritePerf(normal) -0.4%
hard_hole_fits(normal) -0.1%
geo. mean -0.0%
minimum -0.4%
maximum +3.2%
The T6048 outlier is hard to pin down, but it may be the effect of
reading in more interface files definitions. It's a small program for
which compile time is very short, so I'm not bothered about it.
Metric Increase:
T6048
- - - - -
ab23dc5e by Ben Gamari at 2022-11-29T03:11:25-05:00
testsuite: Mark unpack_sums_6 as fragile due to #22504
This test is explicitly dependent upon runtime, which is generally not
appropriate given that the testsuite is run in parallel and generally
saturates the CPU.
- - - - -
def47dd3 by Ben Gamari at 2022-11-29T03:11:25-05:00
testsuite: Don't use grep -q in unpack_sums_7
`grep -q` closes stdin as soon as it finds the pattern it is looking
for, resulting in #22484.
- - - - -
cc25d52e by Sylvain Henry at 2022-11-29T09:44:31+01:00
Add Javascript backend
Add JS backend adapted from the GHCJS project by Luite Stegeman.
Some features haven't been ported or implemented yet. Tests for these
features have been disabled with an associated gitlab ticket.
Bump array submodule
Work funded by IOG.
Co-authored-by: Jeffrey Young <jeffrey.young at iohk.io>
Co-authored-by: Luite Stegeman <stegeman at gmail.com>
Co-authored-by: Josh Meredith <joshmeredith2008 at gmail.com>
- - - - -
68c966cd by sheaf at 2022-11-30T09:31:25-05:00
Fix @since annotations on WithDict and Coercible
Fixes #22453
- - - - -
a3a8e9e9 by Simon Peyton Jones at 2022-11-30T09:32:03-05:00
Be more careful in GHC.Tc.Solver.Interact.solveOneFromTheOther
We were failing to account for the cc_pend_sc flag in this
important function, with the result that we expanded superclasses
forever.
Fixes #22516.
- - - - -
a9d9b8c0 by Simon Peyton Jones at 2022-11-30T09:32:03-05:00
Use mkNakedFunTy in tcPatSynSig
As #22521 showed, in tcPatSynSig we make a "fake type" to
kind-generalise; and that type has unzonked type variables in it. So
we must not use `mkFunTy` (which checks FunTy's invariants) via
`mkPhiTy` when building this type. Instead we need to use
`mkNakedFunTy`.
Easy fix.
- - - - -
31462d98 by Andreas Klebinger at 2022-11-30T14:50:58-05:00
Properly cast values when writing/reading unboxed sums.
Unboxed sums might store a Int8# value as Int64#. This patch
makes sure we keep track of the actual value type.
See Note [Casting slot arguments] for the details.
- - - - -
10a2a7de by Oleg Grenrus at 2022-11-30T14:51:39-05:00
Move Void to GHC.Base...
This change would allow `Void` to be used deeper in module graph.
For example exported from `Prelude` (though that might be already
possible).
Also this change includes a change `stimes @Void _ x = x`,
https://github.com/haskell/core-libraries-committee/issues/95
While the above is not required, maintaining old stimes behavior
would be tricky as `GHC.Base` doesn't know about `Num` or `Integral`,
which would require more hs-boot files.
- - - - -
b4cfa8e2 by Sebastian Graf at 2022-11-30T14:52:24-05:00
DmdAnal: Reflect the `seq` of strict fields of a DataCon worker (#22475)
See the updated `Note [Data-con worker strictness]`
and the new `Note [Demand transformer for data constructors]`.
Fixes #22475.
- - - - -
d87f28d8 by Baldur Blöndal at 2022-11-30T21:16:36+01:00
Make Functor a quantified superclass of Bifunctor.
See https://github.com/haskell/core-libraries-committee/issues/91 for
discussion.
This change relates Bifunctor with Functor by requiring second = fmap.
Moreover this change is a step towards unblocking the major version bump
of bifunctors and profunctors to major version 6. This paves the way to
move the Profunctor class into base. For that Functor first similarly
becomes a superclass of Profunctor in the new major version 6.
- - - - -
72cf4c5d by doyougnu at 2022-12-01T12:36:44-05:00
FastString: SAT bucket_match
Metric Decrease:
MultiLayerModulesTH_OneShot
- - - - -
afc2540d by Simon Peyton Jones at 2022-12-01T12:37:20-05:00
Add a missing varToCoreExpr in etaBodyForJoinPoint
This subtle bug showed up when compiling a library with 9.4.
See #22491. The bug is present in master, but it is hard to
trigger; the new regression test T22491 fails in 9.4.
The fix was easy: just add a missing varToCoreExpr in
etaBodyForJoinPoint.
The fix is definitely right though!
I also did some other minor refatoring:
* Moved the preInlineUnconditionally test in simplExprF1 to
before the call to joinPointBinding_maybe, to avoid fruitless
eta-expansion.
* Added a boolean from_lam flag to simplNonRecE, to avoid two
fruitless tests, and commented it a bit better.
These refactorings seem to save 0.1% on compile-time allocation in
perf/compiler; with a max saving of 1.4% in T9961
Metric Decrease:
T9961
- - - - -
81eeec7f by M Farkas-Dyck at 2022-12-01T12:37:56-05:00
CI: Forbid the fully static build on Alpine to fail.
To do so, we mark some tests broken in this configuration.
- - - - -
c5d1bf29 by Bryan Richter at 2022-12-01T12:37:56-05:00
CI: Remove ARMv7 jobs
These jobs fail (and are allowed to fail) nearly every time.
Soon they won't even be able to run at all, as we won't currently have
runners that can run them.
Fixing the latter problem is tracked in #22409.
I went ahead and removed all settings and configurations.
- - - - -
d82992fd by Bryan Richter at 2022-12-01T12:37:56-05:00
CI: Fix CI lint
Failure was introduced by conflicting changes to gen_ci.hs that did
*not* trigger git conflicts.
- - - - -
ce126993 by Simon Peyton Jones at 2022-12-02T01:22:12-05:00
Refactor TyCon to have a top-level product
This patch changes the representation of TyCon so that it has
a top-level product type, with a field that gives the details
(newtype, type family etc), #22458.
Not much change in allocation, but execution seems to be a bit
faster.
Includes a change to the haddock submodule to adjust for API changes.
- - - - -
74c767df by Matthew Pickering at 2022-12-02T01:22:48-05:00
ApplicativeDo: Set pattern location before running exhaustiveness checker
This improves the error messages of the exhaustiveness checker when
checking statements which have been moved around with ApplicativeDo.
Before:
Test.hs:2:3: warning: [GHC-62161] [-Wincomplete-uni-patterns]
Pattern match(es) are non-exhaustive
In a pattern binding:
Patterns of type ‘Maybe ()’ not matched: Nothing
|
2 | let x = ()
| ^^^^^^^^^^
After:
Test.hs:4:3: warning: [GHC-62161] [-Wincomplete-uni-patterns]
Pattern match(es) are non-exhaustive
In a pattern binding:
Patterns of type ‘Maybe ()’ not matched: Nothing
|
4 | ~(Just res1) <- seq x (pure $ Nothing @())
|
Fixes #22483
- - - - -
85ecc1a0 by Matthew Pickering at 2022-12-02T19:46:43-05:00
Add special case for :Main module in `GHC.IfaceToCore.mk_top_id`
See Note [Root-main Id]
The `:Main` special binding is actually defined in the current module
(hence don't go looking for it externally) but the module name is rOOT_MAIN
rather than the current module so we need this special case.
There was already some similar logic in `GHC.Rename.Env` for
External Core, but now the "External Core" is in interface files it
needs to be moved here instead.
Fixes #22405
- - - - -
108c319f by Krzysztof Gogolewski at 2022-12-02T19:47:18-05:00
Fix linearity checking in Lint
Lint was not able to see that x*y <= x*y, because this inequality
was decomposed to x <= x*y && y <= x*y, but there was no rule
to see that x <= x*y.
Fixes #22546.
- - - - -
bb674262 by Bryan Richter at 2022-12-03T04:38:46-05:00
Mark T16916 fragile
See https://gitlab.haskell.org/ghc/ghc/-/issues/16966
- - - - -
5d267d46 by Vladislav Zavialov at 2022-12-03T04:39:22-05:00
Refactor: FreshOrReuse instead of addTyClTyVarBinds
This is a refactoring that should have no effect on observable behavior.
Prior to this change, GHC.HsToCore.Quote contained a few closely related
functions to process type variable bindings: addSimpleTyVarBinds,
addHsTyVarBinds, addQTyVarBinds, and addTyClTyVarBinds.
We can classify them by their input type and name generation strategy:
Fresh names only Reuse bound names
+---------------------+-------------------+
[Name] | addSimpleTyVarBinds | |
[LHsTyVarBndr flag GhcRn] | addHsTyVarBinds | |
LHsQTyVars GhcRn | addQTyVarBinds | addTyClTyVarBinds |
+---------------------+-------------------+
Note how two functions are missing. Because of this omission, there were
two places where a LHsQTyVars value was constructed just to be able to pass it
to addTyClTyVarBinds:
1. mk_qtvs in addHsOuterFamEqnTyVarBinds -- bad
2. mkHsQTvs in repFamilyDecl -- bad
This prevented me from making other changes to LHsQTyVars, so the main
goal of this refactoring is to get rid of those workarounds.
The most direct solution would be to define the missing functions.
But that would lead to a certain amount of code duplication. To avoid
code duplication, I factored out the name generation strategy into a
function parameter:
data FreshOrReuse
= FreshNamesOnly
| ReuseBoundNames
addSimpleTyVarBinds :: FreshOrReuse -> ...
addHsTyVarBinds :: FreshOrReuse -> ...
addQTyVarBinds :: FreshOrReuse -> ...
- - - - -
c189b831 by Vladislav Zavialov at 2022-12-03T04:39:22-05:00
addHsOuterFamEqnTyVarBinds: use FreshNamesOnly for explicit binders
Consider this example:
[d| instance forall a. C [a] where
type forall b. G [a] b = Proxy b |]
When we process "forall b." in the associated type instance, it is
unambiguously the binding site for "b" and we want a fresh name for it.
Therefore, FreshNamesOnly is more fitting than ReuseBoundNames.
This should not have any observable effect but it avoids pointless
lookups in the MetaEnv.
- - - - -
42512264 by Ross Paterson at 2022-12-03T10:32:45+00:00
Handle type data declarations in Template Haskell quotations and splices (fixes #22500)
This adds a TypeDataD constructor to the Template Haskell Dec type,
and ensures that the constructors it contains go in the TyCls namespace.
- - - - -
1a767fa3 by Vladislav Zavialov at 2022-12-05T05:18:50-05:00
Add BufSpan to EpaLocation (#22319, #22558)
The key part of this patch is the change to mkTokenLocation:
- mkTokenLocation (RealSrcSpan r _) = TokenLoc (EpaSpan r)
+ mkTokenLocation (RealSrcSpan r mb) = TokenLoc (EpaSpan r mb)
mkTokenLocation used to discard the BufSpan, but now it is saved and can
be retrieved from LHsToken or LHsUniToken.
This is made possible by the following change to EpaLocation:
- data EpaLocation = EpaSpan !RealSrcSpan
+ data EpaLocation = EpaSpan !RealSrcSpan !(Strict.Maybe BufSpan)
| ...
The end goal is to make use of the BufSpan in Parser/PostProcess/Haddock.
- - - - -
cd31acad by sheaf at 2022-12-06T15:45:58-05:00
Hadrian: fix ghcDebugAssertions off-by-one error
Commit 6b2f7ffe changed the logic that decided whether to enable debug
assertions. However, it had an off-by-one error, as the stage parameter
to the function inconsistently referred to the stage of the compiler
being used to build or the stage of the compiler we are building.
This patch makes it consistent. Now the parameter always refers to the
the compiler which is being built.
In particular, this patch re-enables
assertions in the stage 2 compiler when building with devel2 flavour,
and disables assertions in the stage 2 compiler when building with
validate flavour.
Some extra performance tests are now run in the "validate" jobs because
the stage2 compiler no longer contains assertions.
-------------------------
Metric Decrease:
CoOpt_Singletons
MultiComponentModules
MultiComponentModulesRecomp
MultiLayerModulesTH_OneShot
T11374
T12227
T12234
T13253-spj
T13701
T14683
T14697
T15703
T17096
T17516
T18304
T18478
T18923
T5030
T9872b
TcPlugin_RewritePerf
Metric Increase:
MultiComponentModules
MultiComponentModulesRecomp
MultiLayerModules
MultiLayerModulesRecomp
MultiLayerModulesTH_Make
T13386
T13719
T3294
T9233
T9675
parsing001
-------------------------
- - - - -
21d66db1 by mrkun at 2022-12-06T15:46:38-05:00
Push DynFlags out of runInstallNameTool
- - - - -
aaaaa79b by mrkun at 2022-12-06T15:46:38-05:00
Push DynFlags out of askOtool
- - - - -
4e28f49e by mrkun at 2022-12-06T15:46:38-05:00
Push DynFlags out of runInjectRPaths
- - - - -
a7422580 by mrkun at 2022-12-06T15:46:38-05:00
Push DynFlags out of Linker.MacOS
- - - - -
d2c9c1b6 by Josh Meredith at 2022-12-08T09:58:43+00:00
WIP JS fileStat
- - - - -
12 changed files:
- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- compiler/GHC.hs
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Names/TH.hs
- compiler/GHC/Builtin/PrimOps.hs
- + compiler/GHC/Builtin/PrimOps/Casts.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types.hs-boot
- compiler/GHC/Builtin/Types/Literals.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8fc49c596806ca1fec853a8787b1ae3b4730d7c3...d2c9c1b6b166bfee1632efc9b0208a83c6ee4c7a
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8fc49c596806ca1fec853a8787b1ae3b4730d7c3...d2c9c1b6b166bfee1632efc9b0208a83c6ee4c7a
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/20221208/99966b82/attachment-0001.html>
More information about the ghc-commits
mailing list