| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Taken froù!3658
|
| |
|
|
|
|
| |
They were added in 33173a51c77d9960d5009576ad9b67b646dfda3c, which constitutes GHC 8.10.1 / base-4.14.0.0
|
|
|
|
|
|
|
|
| |
Performance improvement:
T15185(normal) run/alloc 51112.0 41032.0 -19.7% GOOD
Metric Decrease:
T15185
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Primops types were dependent on the target word-size at *compiler*
compilation time. It's an issue for multi-target as GHC may not have the
correct primops types for the target.
This patch fixes some primops types: if they take or return fixed 64-bit
values they now always use `Int64#/Word64#`, even on 64-bit
architectures (where they used `Int#/Word#` before). Users of these
primops may now need to convert from Int64#/Word64# to Int#/Word# (a
no-op at runtime).
This is a stripped down version of !3658 which goes the all way of
changing the underlying primitive types of Word64/Int64. This is left
for future work.
T12545 allocations increase ~4% on some CI platforms and decrease ~3% on
AArch64.
Metric Increase:
T12545
Metric Decrease:
T12545
|
|
|
|
|
| |
Otherwise the instances aren't good list producers.
See Note [Stable Unfolding for list producers].
|
|
|
|
|
|
|
|
| |
This prepares us to actually use them when the native size is 64 bits
too.
I more than saitisfied my curiosity finding they were gated since
47774449c9d66b768a70851fe82c5222c1f60689.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fromIntegral is defined as:
{-# NOINLINE [1] fromIntegral #-}
fromIntegral :: (Integral a, Num b) => a -> b
fromIntegral = fromInteger . toInteger
Before this patch, we had a lot of rewrite rules for fromIntegral, to
avoid passing through Integer when there is a faster way, e.g.:
"fromIntegral/Int->Word" fromIntegral = \(I# x#) -> W# (int2Word# x#)
"fromIntegral/Word->Int" fromIntegral = \(W# x#) -> I# (word2Int# x#)
"fromIntegral/Word->Word" fromIntegral = id :: Word -> Word
Since we have added sized types and primops (Word8#, Int16#, etc.) and
Natural, this approach didn't really scale as there is a combinatorial
explosion of types. In addition, we really want these conversions to be
optimized for all these types and in every case (not only when
fromIntegral is explicitly used).
This patch removes all those ad-hoc fromIntegral rules. Instead we rely
on inlining and built-in constant-folding rules. There are not too many
native conversions between Integer/Natural and fixed size types, so we
can handle them all explicitly.
Foreign.C.Types was using rules to ensure that fromIntegral rules "sees"
through the newtype wrappers,e.g.:
{-# RULES
"fromIntegral/a->CSize" fromIntegral = \x -> CSize (fromIntegral x)
"fromIntegral/CSize->a" fromIntegral = \(CSize x) -> fromIntegral x
#-}
But they aren't necessary because coercions due to newtype deriving are
pushed out of the way. So this patch removes these rules (as
fromIntegral is now inlined, they won't match anymore anyway).
Summary:
* INLINE `fromIntegral`
* Add some missing constant-folding rules
* Remove every fromIntegral ad-hoc rules (fix #19907)
Fix #20062 (missing fromIntegral rules for sized primitives)
Performance:
- T12545 wiggles (tracked by #19414)
Metric Decrease:
T12545
T10359
Metric Increase:
T12545
|
|
|
|
| |
These are the last to be converted.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Word64#/Int64# are only used on 32-bit architectures. Before this patch,
operations on these types were directly using the FFI. Now we use real
primops that are then lowered into ccalls.
The advantage of doing this is that we can now perform constant folding on
Word64#/Int64# (#19024).
Most of this work was done by John Ericson in !3658. However this patch
doesn't go as far as e.g. changing Word64 to always be using Word64#.
Noticeable performance improvements
T9203(normal) run/alloc 89870808.0 66662456.0 -25.8% GOOD
haddock.Cabal(normal) run/alloc 14215777340.8 12780374172.0 -10.1% GOOD
haddock.base(normal) run/alloc 15420020877.6 13643834480.0 -11.5% GOOD
Metric Decrease:
T9203
haddock.Cabal
haddock.base
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ensure that division wrappers are INLINE
* make div/mod/divMod call quot/rem/quotRem (same code)
* this ensures that the quotRemWordN# primitive is used to implement
divMod (it wasn't the case for sized Words)
* make first argument strict for Natural and Integer (similarly to other
numeric types)
|
|
|
|
| |
Progress towards #19026
|
|
|
|
|
|
|
|
|
|
|
| |
We think the compiler is ready, so we can do this for all over the 8-,
16-, and 32-bit boxed types.
We are holding off on doing all the primops at once so things are easier
to investigate.
Metric Decrease:
T12545
|
|
|
|
|
|
|
| |
With a quick flavour I get:
before T12545(normal) ghc/alloc 8628109152
after T12545(normal) ghc/alloc 8559741088
|
|
|
|
|
| |
Like !5572, this is switching over a portion of the primops which seems
safe to use.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The first change makes the array ones use the proper fixed-size types,
which also means that just like before, they can be used without
explicit conversions with the boxed sized types. (Before, it was Int# /
Word# on both sides, now it is fixed sized on both sides).
For the second change, don't use "extend" or "narrow" in some of the
user-facing primops names for conversions.
- Names like `narrowInt32#` are misleading when `Int` is 32-bits.
- Names like `extendInt64#` are flat-out wrong when `Int is
32-bits.
- `narrow{Int,Word}<N>#` however map a type to itself, and so don't
suffer from this problem. They are left as-is.
These changes are batched together because Alex happend to use the array
ops. We can only use released versions of Alex at this time, sadly, and
I don't want to have to have a release thatwon't work for the final GHC
9.2. So by combining these we get all the changes for Alex done at once.
Bump hackage state in a few places, and also make that workflow slightly
easier for the future.
Bump minimum Alex version
Bump Cabal, array, bytestring, containers, text, and binary submodules
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This replaces all Word<N> = W<N># Word# and Int<N> = I<N># Int# with
Word<N> = W<N># Word<N># and Int<N> = I<N># Int<N>#, thus providing us
with properly sized primitives in the codegenerator instead of pretending
they are all full machine words.
This came up when implementing darwinpcs for arm64. The darwinpcs reqires
us to pack function argugments in excess of registers on the stack. While
most procedure call standards (pcs) assume arguments are just passed in
8 byte slots; and thus the caller does not know the exact signature to make
the call, darwinpcs requires us to adhere to the prototype, and thus have
the correct sizes. If we specify CInt in the FFI call, it should correspond
to the C int, and not just be Word sized, when it's only half the size.
This does change the expected output of T16402 but the new result is no
less correct as it eliminates the narrowing (instead of the `and` as was
previously done).
Bumps the array, bytestring, text, and binary submodules.
Co-Authored-By: Ben Gamari <ben@well-typed.com>
Metric Increase:
T13701
T14697
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* GHC.Natural isn't implemented in `base` anymore. It is provided by
ghc-bignum in GHC.Num.Natural. It means that we can safely use Natural
primitives in `base` without fearing issues with built-in rewrite
rules (cf #15286)
* `base` doesn't conditionally depend on an integer-* package anymore,
it depends on ghc-bignum
* Some duplicated code in integer-* can now be factored in GHC.Float
* ghc-bignum tries to use a uniform naming convention so most of the
other changes are renaming
|
|
|
|
|
| |
If we are on a 64 bit platform, we can use the efficient Enum Word
methods for the Enum Word64 instance.
|
|
|
|
| |
with s/16/32)
|
|
|
|
|
| |
The `Ix` class seems rather orthogonal to its original home in
`GHC.Arr`.
|
|
|
|
|
|
| |
This commit includes the necessary changes in code and
documentation to support a primop that reverses a word's
bits. It also includes a test.
|
|
|
|
|
|
|
| |
under -mbmi2
This works similarly to existing implementation for popCount.
Trac ticket: #16086.
|
|
|
|
| |
This reverts commit 76c8fd674435a652c75a96c85abbf26f1f221876.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Although the Haddock's for `shiftL` and `shiftR` do require the number
of bits to be non-negative, we should still check this before calling
out to primitives (which also have undefined behaviour for negative bit
shifts).
If a user _really_ wants to bypass checks that the number of bits is
sensible, they already have the aptly-named `unsafeShiftL`/`unsafeShiftR`
at their disposal.
See #16111.
|
|
|
|
| |
GHC Trac Issues: #15447
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add support for built-in Natural literals in Core.
- Replace MachInt,MachWord, LitInteger, etc. with a single LitNumber
constructor with a LitNumType field
- Support built-in Natural literals
- Add desugar warning for negative literals
- Move Maybe(..) from GHC.Base to GHC.Maybe for module dependency
reasons
This patch introduces only a few rules for Natural literals (compared
to Integer's rules). Factorization of the built-in rules for numeric
literals will be done in another patch as this one is already big to
review.
Test Plan:
validate
test build with integer-simple
Reviewers: hvr, bgamari, goldfire, Bodigrim, simonmar
Reviewed By: bgamari
Subscribers: phadej, simonpj, RyanGlScott, carter, hsyl20, rwbarton,
thomie
GHC Trac Issues: #14170, #14465
Differential Revision: https://phabricator.haskell.org/D4212
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: Validate
Reviewers: hvr, austin, bgamari
Reviewed By: hvr
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3353
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add @since annotations to instances in `base`.
Test Plan:
* ./validate # some commets shouldn't break the build
* review the annotations for absurdities.
Reviewers: ekmett, goldfire, RyanGlScott, austin, hvr, bgamari
Reviewed By: RyanGlScott, hvr, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2277
GHC Trac Issues: #11767
|
|
|
|
|
|
| |
This performs the same refactoring performed in D1980 for Eq on Ord,
rewriting the class operations in terms of monomorphic helpers than can
be reliably matched in rewrite rules.
|
|
|
|
|
|
|
| |
Due to a cut-and-paste error D1980 (#11688) broke 32-bit platforms. This
should fix it.
See #11750.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This is one solution to #11688, wherein (==) was inlined to soon
defeating a rewrite rule provided by bytestring. Since the RHSs of Eq's
methods are simple, there is little to be gained and much to be lost by
inlining them early.
For instance, the bytestring library provides,
```lang=haskell
break :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString)
breakByte :: Word8 -> ByteString -> (ByteString, ByteString)
```
and a rule
```
forall x. break ((==) x) = breakByte x
```
since `breakByte` implments an optimized version of `break (== x)` for
known `x :: Word8`. If we allow `(==)` to be inlined too early, we will
prevent this rule from firing. This was the cause of #11688.
This patch just defers the `Eq` methods, although it's likely worthwhile
giving `Ord` this same treatment. This regresses compiler allocations
for T9661 by about 8% due to the additional inlining that we now require
the simplifier to perform.
Updates the `bytestring` submodule to include updated rewrite rules
which match on `eqWord8` instead of `(==)`.
Test Plan:
* Validate, examine performance impact
Reviewers: simonpj, hvr, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1980
GHC Trac Issues: #11688
|
|
|
|
|
|
| |
Starting with Haddock 2.16 there's a new built-in support for since-annotations
Note: This exposes a bug in the `@since` implementation (see e.g. `Data.Bits`)
|
|
|
|
|
|
|
|
|
|
| |
This commit removes a couple of
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
by cleaning up the imports, as well as ensuring that all modules in the
GHC.* hierarchy avoid importing the `Prelude` module to clean-up the
import graph a bit.
|
|
|
|
|
|
|
|
| |
There don't seem to be any corresponding `{-# SOURCE #-}` for the removed
`.hs-boot`-files anymore (if there ever was any in the first place).
This also removes a commented out `{-# SOURCE #-}` import which turns up when
grepping the source for `{-# SOURCE #-}` occurences.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This exposes the newly added CLZ/CTZ primops from
e0c1767d0ea8d12e0a4badf43682a08784e379c6 (re #9340)
via two new methods `countLeadingZeros` and `countTrailingZeros`
in the `Data.Bits.FiniteBits` class.
The original proposal can be found at
http://www.haskell.org/pipermail/libraries/2014-August/023567.html
Test Plan: successful validate
Reviewers: ekmett, tibbe
GHC Trac Issues: #9532
Differential Revision: https://phabricator.haskell.org/D158
|
|
|
|
|
|
|
|
|
|
|
|
| |
The now obsolete (and redundant) `#hide` pragmas have been superseded by
`{-# OPTIONS_HADDOCK hide #-}` pragmas which are used by most of the
affected modules anyway.
This commit also adds proper `{-# OPTIONS_HADDOCK hide #-}` pragmas to
`GHC.Desugar` and `GHC.IO.Encoding.Iconv` which had only the ineffective
`#hide` annotation.
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These annotations were added in such a way, that the line
{{{
/Since: 4.7.0.0/
}}}
represents the last paragraph of the Haddock comment.
Maybe Haddock will have support for this meta-syntax at some point, and
be able to inherited the since-version property to the children of an
annotated symbol and display the since-version property in the rendered
documentation only in cases when it's not visually obvious (for
instance, when re-exporting documentation strings).
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
| |
|
|
|
|
|
|
|
|
| |
According to primops.txt.pp, the BSwap16Op and BSwap32Op primops
leave the higher bytes of their results undefined. We must clear
those higher bytes here before storing the result in a Word16/32.
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
| |
Authored-by: Vincent Hanquez <tab@snarc.org>
Signed-off-by: Austin Seipp <aseipp@pobox.com>
|
|
|
|
| |
This reverts commit 3ef0f91d4e9a3649581557ec4ba663db4306d7d5.
|
|
|
|
| |
Patch from Vincent Hanquez.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Do not have have an hs-boot file for Data.Typeable
* Instead make all the loops go through
GHC.Err (just a couple of magic functions)
GHC.Exception (some non-exceptional functions)
The main idea is
a) don't involve classes in the hs-boot world
b) loop through error cases where performance doesn't matter
c) be careful not to SOURCE import things that are bottom,
unless MkCore knows about them in eRROR_IDS, so that we
see their strictness
|
|
|
|
| |
in pointfree use.
|
| |
|
| |
|