| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
We don't want to allow users to conjure up values of a `type data` type using
`tagToEnum#`, as these simply don't exist at the value level.
(cherry picked from commit ff8e99f69b203559b784014ab26c59b5553d128a)
|
|
|
|
|
|
|
|
|
| |
The data constructors for a `type data` declaration don't exist at the value
level, so we don't want GHC to warn users to match on them.
Fixes #22964.
(cherry picked from commit 96dc58b9225d91a7912957c6be5d9c7a95e51718)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Data constructor wrappers only make sense for _value_-level data constructors,
but data constructors for `type data` declarations only exist at the _type_
level. This patch does the following:
* The criteria in `GHC.Types.Id.Make.mkDataConRep` for whether a data
constructor receives a wrapper now consider whether or not its parent data
type was declared with `type data`, omitting a wrapper if this is the case.
* Now that `type data` data constructors no longer receive wrappers, there is a
spot of code in `refineDefaultAlt` that panics when it encounters a value
headed by a `type data` type constructor. I've fixed this with a special case
in `refineDefaultAlt` and expanded `Note [Refine DEFAULT case alternatives]`
to explain why we do this.
Fixes #22948.
(cherry picked from commit 4327d63594f73939a2b8ab015c1cb44eafd4b460)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Asm-shortcutting may produce relative references to symbols defined in
other compilation units. This is not something that MachO relocations
support (see #21972). For this reason we disable the optimisation on
Darwin. We do so without a warning since this flag is enabled by `-O2`.
Another way to address this issue would be to rather implement a
PLT-relocatable jump-table strategy. However, this would only benefit
Darwin and does not seem worth the effort.
Closes #21972.
(cherry picked from commit 8bed166bb79445f90015757fd5baac69a7b835df)
|
|
|
|
|
|
|
|
|
|
| |
As #22998 showed, we were floating an unlifted binding to top
level, which breaks a Core invariant.
The fix is easy, albeit a little bit conservative. See
Note [Care with unlifted bindings] in GHC.Core.Opt.Specialise
(cherry picked from commit 7192ef91c855e1fae6997f75cfde76aafd0b4bcf)
|
|
|
|
|
|
|
|
|
|
| |
As #23012 showed, GHC.Core.Opt.Simplify.Utils.prepareAlts was
using an OutType to construct an InAlt. When shadowing is in play,
this is outright wrong.
See Note [Shadowing in prepareAlts].
(cherry picked from commit ece092d07f343dcfb4563e4f42d53a2a1e449f1a)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As #23024 showed, in GHC.Core.Opt.Specialise.specImports, we were
generating specialisations (a locally-define function) for imported
functions; and then generating specialisations for those
locally-defined functions. The RULE for the latter should be
attached to the local Id, not put in the rules-for-imported-ids
set.
Fix is easy; similar to what happens in GHC.HsToCore.addExportFlagsAndRules
(cherry picked from commit 0c200ab78c814cb5d1efaf426f0d3d91ceab9f4d)
|
|
|
|
|
|
|
|
| |
The code wasn't taking into account some kind of overlap.
cgrun070 has been extended to test the missing case.
(cherry picked from commit 8b77f9bfceb456115f63349ad0ff66a5cea7ab59)
|
|
|
|
|
|
|
|
|
| |
As #23018 showed, in mkRuntimeRepCo we need to account for coercions
between TYPE and COERCION.
See Note [mkRuntimeRepCo] in GHC.Core.Coercion.
(cherry picked from commit bb500e2a2d039dc75c8bb80d47ea2349b97fbf1b)
|
|
|
|
|
|
|
|
|
| |
The test for naughtiness in record selectors is surprisingly subtle.
See the revised Note [Naughty record selectors] in GHC.Tc.TyCl.Utils.
Fixes #23038.
(cherry picked from commit cf118e2fac04b79cc7fa63cff0552190c3885bb9)
|
|
|
|
|
|
|
|
|
|
|
| |
GHC was accepting `foreign import javascript` declarations
on non-JavaScript platforms. This adds a check so that these
are only supported on an platform that supports the JavaScript
calling convention.
Fixes #22774
(cherry picked from commit 1d7c2e4c9d63a7b392024cfcde299849b8d667a8)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
register mapping
The wasm NCG used to map CCCS to a wasm global, based on the
observation that CCCS is a transient register that's already handled
by thread state load/store logic, so it doesn't need to be backed by
the rCCCS field in the register table.
Unfortunately, this is wrong, since even when Cmm execution hasn't
yielded back to the scheduler, the Cmm code may call enterFunCCS,
which does use rCCCS.
This breaks cost centre profiling in a subtle way, resulting in
inaccurate stack traces in some test cases. The fix is simple though:
just remove the CCCS mapping.
(cherry picked from commit 2592ab6924ee34ed0f0d82a7cb0aed393d93bb14)
|
|
|
|
|
|
|
|
|
|
|
| |
This patch updates the warning message introduced in commit
9fb4ca89bff9873e5f6a6849fa22a349c94deaae to specify an explicit
migration timeline: GHC will no longer support this constraint solving
mechanism starting from GHC 9.10.
Fixes #22912
(cherry picked from commit daee5602f753372bd4b81589aacd3df4a00257e8)
|
|
|
|
|
|
|
|
|
|
| |
The first argument is Int64# unconditionally, so we better produce
something of that type. This fixes a core lint error found in the ad
package.
Fixes #23019
(cherry picked from commit 3c9b89adb0c953de02d301623b13541a9fe5feda)
|
|
|
|
|
|
|
|
|
|
| |
Commit 7566fd9de38c67360c090f828923d41587af519c with the fix for #22798 was
incomplete as it failed to handle MULTILINE_COMMENT pseudo-instructions, and
didn't completly fix the compiler panics when compiling with `-fregs-graph`.
Fixes #23002
(cherry picked from commit 0ea260da3c2b32778758737f6145b2b23ce5f776)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Consider (#22849)
data T a where
MkT :: forall k (t::k->*) (ix::k). t ix -> T @k a
Then dubiousDataConInstArgTys MkT [Type, Foo] should return
[Foo (ix::Type)]
NOT [Foo (ix::k)]
A bit of an obscure case, but it's an outright bug, and the fix is easy.
(cherry picked from commit 955a99ea28a0d06de67f0595d366450281aab0c0)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We were failing to expand type synonyms in the function
GHC.Core.RoughMap.typeToRoughMatchLookupTc, even though the
RoughMap infrastructure crucially relies on type synonym expansion
to work.
This patch adds the missing type-synonym expansion.
Fixes #22985
(cherry picked from commit 8988eeef193f055d7b67de5aaa00590c63491fb5)
|
|
|
|
| |
(cherry picked from commit 324e925be847d3969724be3e1b82c25899aaca27)
|
|
|
|
|
|
|
|
|
|
|
| |
generateCgIPEStub already correctly implements the CmmTick finding
logic for when tables-next-to-code is on/off, but it used the wrong
predicate to decide when to switch between the two. Previously it
switches based on whether the codegen is unregisterised, but there do
exist registerised builds that disable tables-next-to-code! This patch
corrects that problem. Fixes #22896.
(cherry picked from commit 3b019a7ac8fc9059cc3213f6f95a2daef97ca442)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Following #22924 this patch narrows the test that stops
us decomposing newtypes. The key change is the use of
noGivenNewtypeReprEqs in GHC.Tc.Solver.Canonical.canTyConApp.
We went to and fro on the solution, as you can see in #22924.
The result is carefully documented in
Note [Decomoposing newtype equalities]
On the way I had revert most of
commit 3e827c3f74ef76d90d79ab6c4e71aa954a1a6b90
Author: Richard Eisenberg <rae@cs.brynmawr.edu>
Date: Mon Dec 5 10:14:02 2022 -0500
Do newtype unwrapping in the canonicaliser and rewriter
See Note [Unwrap newtypes first], which has the details.
It turns out that
(a) 3e827c3f makes GHC behave worse on some recursive newtypes
(see one of the tests on this commit)
(b) the finer-grained test (namely noGivenNewtypeReprEqs) renders
3e827c3f unnecessary
(cherry picked from commit 12965aba860676ec68cbced86eb18d6ec5cb83b3)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit aed1974e completely re-engineered the treatment of loopy
superclass dictionaries in instance declarations. Unfortunately,
it has the potential to break (albeit in a rather minor way) user code.
To alleviate migration concerns, this commit re-introduces the old
behaviour. Any reliance on this old behaviour triggers a warning,
controlled by `-Wloopy-superclass-solve`. The warning text explains
that GHC might produce bottoming evidence, and provides a migration
strategy.
This allows us to provide a graceful migration period, alerting users
when they are relying on this unsound behaviour.
Fixes #22912 #22891 #20666 #22894 #22905
(cherry picked from commit 9fb4ca89bff9873e5f6a6849fa22a349c94deaae)
|
|
|
|
|
|
|
|
|
| |
Do not apply the heuristic to associate a comment with a prior
declaration for the first declaration in the file.
Closes #22919
(cherry picked from commit f22cce70dc7b9da191a023a9677eaea491bb2688)
|
|
|
|
|
|
|
|
|
|
|
| |
Previously the AtomicRead and AtomicWrite operations were emitted as
out-of-line calls. However, these tend to be very important for
performance, especially the RELAXED case (which only exists for
ThreadSanitizer checking).
Fixes #22115.
(cherry picked from commit 6e52fcb915baa1acb38ad2b1f313e8e6a89899f5)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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@gmail.com>
(cherry picked from commit c31e87bbb13c0139b75acd234fd48eeb40cf50af)
|
|
|
|
|
|
|
|
| |
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.
(cherry picked from commit cc72e71298ce7e8ef7a2263a531f96d777db1800)
|
|
|
|
|
|
|
|
|
|
|
| |
generator.
* Let binders are now always assumed untagged for bytecode.
* Imported referenced are now always assumed to be untagged for bytecode.
Fixes #22840
(cherry picked from commit 382bd7dad9cd53254204f418190368667a127f64)
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch fixes a subtle bug in the typechecking of type
applications in patterns, e.g.
f (MkT @Int @a x y) = ...
See Note [Type applications in patterns] in GHC.Tc.Gen.Pat.
This fixes #19847, #22383, #19577, #21501
(cherry picked from commit 9f95db54e38b21782d058043abe42fd77abfb9ad)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Type variables from class/instance headers scope over class/instance
method type signatures, but DO NOT scope over the type signatures in
SPECIALISE and SPECIALISE instance pragmas.
The logic in GHC.Rename.Bind.rnMethodBinds correctly accounted for
SPECIALISE inline pragmas, but forgot to apply the same treatment
to method SPECIALISE pragmas, which lead to a Core Lint failure with
an out-of-scope type variable. This patch makes sure we apply the same
logic for both cases.
Fixes #22913
(cherry picked from commit 9ee761bf02cdd11c955454a222c85971d95dce11)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit caced75765472a1a94453f2e5a439dba0d04a265.
It seems the patch "Don't keep exit join points so much" is causing
wide-spread regressions in the bytestring library benchmarks. If I
revert it then the 9.6 numbers are better on average than 9.4.
See https://gitlab.haskell.org/ghc/ghc/-/issues/22893#note_479525
-------------------------
Metric Decrease:
MultiComponentModules
MultiComponentModulesRecomp
MultiLayerModules
MultiLayerModulesRecomp
MultiLayerModulesTH_Make
T12150
T13386
T13719
T21839c
T3294
parsing001
-------------------------
(cherry picked from commit 7eac2468a726f217dd97c5e2884f6b552e8ef11d)
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch removes . from the list of allowed characters in a non-quoted
overloaded label, as it was realised this steals syntax, e.g. (#.).
Users who want this functionality will have to add quotes around the
label, e.g. `#"17.28"`.
Fixes #22821
(cherry picked from commit b17fb3d96bd2e9f3bf96392f3b3b3e0aed7fe276)
|
|
|
|
| |
(cherry picked from commit 5a54ac0b2b915889950c83e04bf1beb08631891e)
|
|
|
|
|
|
|
|
| |
Add a CallerCC cost centre flavour for cost centres added by the
CallerCC pass. This avoids potential accidental shadowing between
CCs added by user annotations and ones added by CallerCC.
(cherry picked from commit bf3f88a1a5b23bdf304baca473c3ee797c5f86bd)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ticket #22807 pointed out that the RHS sharing was not compatible with
-fignore-interface-pragmas because the flag would remove unfoldings from
identifiers before the `extra-decls` field was populated.
For the 9.6 timescale the only solution is to disable this sharing,
which will make interface files bigger but this is acceptable for the
first release of `-fwrite-if-simplified-core`.
For 9.8 it would be good to fix this by implementing #20056 due to the
large number of other bugs that would fix.
I also improved the error message in tc_iface_binding to avoid the "no match
in record selector" error but it should never happen now as the entire
sharing logic is disabled.
Also added the currently broken test for #22807 which could be fixed by
!6080
Fixes #22807
(cherry picked from commit 0ada454703560b733fe3c920b87496ac1238c29e)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In #22764 a user noticed that a program implementing a simple atomic
counter via an STRef regressed significantly due to the introduction of
necessary atomic operations in the MutVar# primops (#22468). This
regression was caused by a bug in the NCG, which emitted an unnecessary
MFENCE instruction for a release-ordered atomic write. MFENCE is rather
only needed to achieve sequentially consistent ordering.
Fixes #22764.
(cherry picked from commit f058e3672b969f301b6b1637f8ab081654ec947a)
|
|
|
|
|
|
|
|
|
|
| |
Currently, the wasm NCG has an implicit assumption: all CmmSwitch
scrutinees are 32-bit integers. This is not always true; #22864 is one
counter-example with a 64-bit scrutinee. This patch fixes the logic by
explicitly converting the scrutinee to a word that can be used as a
br_table operand. Fixes #22871. Also includes a regression test.
(cherry picked from commit f0eefa3cf058879246991747dcd18c811402f9e5)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously we tried to lower the alignment requirement as far as
possible, based on the section kind inferred from the CLabel. For info
tables, .p2align 1 was applied given the GC should only need the
lowest bit to tag forwarding pointers. But this would lead to
unaligned loads/stores, which has a performance penalty even if the
wasm spec permits it. Furthermore, the test suite has shown memory
corruption in a few cases when compacting gc is used.
This patch takes a more conservative approach: all data sections
except C strings align to word size.
(cherry picked from commit da468391872f6be286db37a0f016a37f9f362509)
|
|
|
|
|
|
|
| |
Properly handle ForeignHints of ccall arguments/return value, insert
sign extends and truncations when handling signed subwords. Fixes #22852.
(cherry picked from commit 78c07219d5dad9730bbe3ec26ad22912ff22f058)
|
|
|
|
|
|
|
|
|
|
| |
* Allow filepath to be reinstalled
* Bump some version bounds to allow newer versions of libraries
* Rework testing logic to avoid "install --lib" and package env files
Fixes #22344
(cherry picked from commit 7cbdaad0396cee561f125c95f3352cebabd8ed99)
|
|
|
|
|
|
|
|
|
| |
The CmmBlock datacon was not handled in lower_CmmLit, since I thought
it would have been eliminated after proc-point splitting. Turns out it
still occurs in very rare occasions, and this patch is needed to fix
T9329 for wasm.
(cherry picked from commit 6ea2aa0293aedea2f873b7b5d9cff5e7b9e2f188)
|
|
|
|
|
|
|
|
| |
This patch fixes the W8/W16 literal narrowing logic in the wasm NCG,
which used to lower it to something like i32.const -1, without
properly zeroing-out the unused higher bits. Fixes #22608.
(cherry picked from commit 7e11c6dc25cb9dd14ae33ee9715ddbc8ebf9836e)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The key change is that in GHC.Core.Opt.Specialise.specLookupRule
we were using realIdUnfolding, which ignores the loop-breaker
flag. When given a loop breaker, rule matching therefore
looped infinitely -- #22802.
In fixing this I refactored a bit.
* Define GHC.Core.InScopeEnv as a data type, and use it.
(Previously it was a pair: hard to grep for.)
* Put several functions returning an IdUnfoldingFun into
GHC.Types.Id, namely
idUnfolding
alwaysActiveUnfoldingFun,
whenActiveUnfoldingFun,
noUnfoldingFun
and use them. (The are all loop-breaker aware.)
(cherry picked from commit d0f34f25ceaae9ef0a21f15f811469d0bed9da69)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch fixes two issues in the way that `type data` declarations were
reified with Template Haskell:
* `type data` data constructors are now properly reified using `DataConI`.
This is accomplished with a special case in `reifyTyCon`. Fixes #22818.
* `type data` type constructors are now reified in `reifyTyCon` using
`TypeDataD` instead of `DataD`. Fixes #22819.
(cherry picked from commit 2f1450521b816a7d287b72deba14d59b6ccfbdbf)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Unlike most other data constructors, data constructors declared with `type data`
are represented in `TyThing`s as `ATyCon` rather than `ADataCon`. The `ATyCon`
case in `tyThingParent_maybe` previously did not consider the possibility of
the underlying `TyCon` being a promoted data constructor, which led to the
oddities observed in #22817. This patch adds a dedicated special case in
`tyThingParent_maybe`'s `ATyCon` case for `type data` data constructors to fix
these oddities.
Fixes #22817.
(cherry picked from commit 20598ef6d9e26e2e0af9ac42a42e7be00d7cc4f3)
|
|
|
|
|
|
| |
Fixes #11270
(cherry picked from commit f83374f8649e5d8413e7ed585b0e058690c38563)
|
|
|
|
|
|
|
|
|
|
|
| |
We were treating a type-family instance as a non-orphan if there
was a type constructor on its /right-hand side/ that was local. Boo!
Utterly wrong. With this patch, we correctly check the /left-hand side/
instead!
Fixes #22717
(cherry picked from commit 638277ba7bd2683f539afb0bf469fe75376994e2)
|
|
|
|
|
|
|
|
|
|
| |
Previously various `Instr` queries used by the graph-colouring allocator
failed to handle a few pseudo-instructions. This manifested in compiler
panicks while compiling `SHA`, which uses `-fregs-graph`.
Fixes #22798.
(cherry picked from commit 7566fd9de38c67360c090f828923d41587af519c)
|
|
|
|
|
|
|
|
|
|
| |
Previously trivColourable for AArch64 claimed that at 18 registers were
trivially-colourable. This is incorrect as x18 is reserved by the platform on
AArch64/Darwin.
See #22798.
(cherry picked from commit 30989d137b8f3a8fddbfd116e04b48f23c24f86c)
|
|
|
|
|
|
|
|
|
| |
Previously various panics would rely on a half-written Show
instance, leading to very unhelpful errors. Fix this.
See #22798.
(cherry picked from commit be417a47c7695998dea0adc05489a7b8838a78b6)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
(cherry picked from commit b3a3534b6f75b34dc4db76e904e071485da6d5cc)
|
|
|
|
|
|
|
|
| |
types (#22043)"
This reverts commit 99aca26b652603bc62953157a48e419f737d352d.
(cherry picked from commit 56c1bd986ac13e3a1fe1149f011480e44f857f5a)
|