summaryrefslogtreecommitdiff
path: root/libraries
Commit message (Collapse)AuthorAgeFilesLines
* base: Update Unicode database to 14.0Ben Gamari2021-10-035-112/+208
| | | | Closes #20404.
* Add (++)/literal ruleSylvain Henry2021-10-021-0/+5
| | | | | | | | | | When we derive the Show instance of the big record in #16577, I get the following compilation times (with -O): Before: 0.91s After: 0.77s Metric Decrease: T19695
* Bump terminfo submodule to 0.4.1.5Ben Gamari2021-10-021-0/+0
| | | | Closes #20307.
* Rules for sized conversion primops (#19769)Sylvain Henry2021-09-301-0/+146
| | | | | Metric Decrease: T12545
* ghc-boot: Eliminate unnecessary use of getEnvironmentBen Gamari2021-09-301-2/+2
| | | | | | | | | Previously we were using `System.Environment.getEnvironment`, which decodes all environment variables into Haskell `String`s, where a simple environment lookup would do. This made the compiler's allocations unnecessarily dependent on the environment. Fixes #20431.
* Add a regression test for #17912Kamil Dworakowski2021-09-293-0/+36
|
* Remove special case for large objects in allocateForCompactFabian Thorand2021-09-294-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | allocateForCompact() is called when the current allocation for the compact region does not fit in the nursery. It previously had a special case for objects exceeding the large object threshold. In that case, it would allocate a new compact region block just for that object. That led to a lot of small blocks being allocated in compact regions with a larger default block size (`autoBlockW`). This commit removes this special case because having a lot of small compact region blocks contributes significantly to memory fragmentation. The removal should be valid because - a more generic case for allocating a new compact region block follows at the end of allocateForCompact(), and that one takes `autoBlockW` into account - the reason for allocating separate blocks for large objects in the main heap seems to be to avoid copying during GCs, but once inside the compact region, the object will never be copied anyway. Fixes #18757. A regression test T18757 was added.
* Use Info Table Provenances to decode cloned stack (#18163)Sven Tennie2021-09-234-37/+194
| | | | | | | | | | | | | | | | Emit an Info Table Provenance Entry (IPE) for every stack represeted info table if -finfo-table-map is turned on. To decode a cloned stack, lookupIPE() is used. It provides a mapping between info tables and their source location. Please see these notes for details: - [Stacktraces from Info Table Provenance Entries (IPE based stack unwinding)] - [Mapping Info Tables to Source Positions] Metric Increase: T12545
* Introduce stack snapshotting / cloning (#18741)Sven Tennie2021-09-232-0/+155
| | | | | | | | | | | | | | Add `StackSnapshot#` primitive type that represents a cloned stack (StgStack). The cloning interface consists of two functions, that clone either the treads own stack (cloneMyStack) or another threads stack (cloneThreadStack). The stack snapshot is offline/cold, i.e. it isn't evaluated any further. This is useful for analyses as it prevents concurrent modifications. For technical details, please see Note [Stack Cloning]. Co-authored-by: Ben Gamari <bgamari.foss@gmail.com> Co-authored-by: Matthew Pickering <matthewtpickering@gmail.com>
* base: Generalize newStablePtrPrimMVarSven Tennie2021-09-231-2/+2
| | | | | Make it polymorphic in the type of the MVar's value. This simple generalization makes it usable for `MVar a` instead of only `MVar ()` values.
* Fix minor inconsistency in documentationalirezaghey2021-09-221-2/+2
| | | | fixes #20388
* Clarify that malloc, free etc. are the ones from stdlib.hOleg Grenrus2021-09-221-0/+5
|
* docs: Fix examples for (un)escapeArgsMatthew Pickering2021-09-181-2/+2
| | | | | | | | | The examples were just missing the surrounding brackets. ghci> escapeArgs ["hello \"world\""] "hello\\ \\\"world\\\"\n" Fixes #20340
* Fix formatting of link in base/Type.ReflectionJoaquin "Florius" Azcarate2021-09-181-2/+1
|
* Add more instances for SoloDavid Feuer2021-09-183-0/+37
| | | | | | | | | Oleg Grenrus pointed out that `Solo` was missing `Eq`, `Ord`, `Bounded`, `Enum`, and `Ix` instances, which were all apparently available for the `OneTuple` type (in the `OneTuple` package). Though only the first three really seem useful, there's no reason not to take them all. For `Ix`, `Solo` naturally fills a gap between `()` and `(,)`.
* ghc-boot: Fix metadata handling of writeFileAtomicBen Gamari2021-09-172-0/+28
| | | | | | | | Previously the implementation of writeFileAtomic (which was stolen from Cabal) failed to preserve file mode, user and group, resulting in #14017. Fixes #14017.
* testsuite: Add test for #18382Ben Gamari2021-09-173-0/+16
|
* Improve error messages involving operators from Data.Type.OrdChristiaan Baaij2021-09-175-56/+160
| | | | Fixes #20009
* testsuite: Mark hDuplicateTo001 as fragile in concurrent waysBen Gamari2021-09-131-2/+1
| | | | As noted in #17568.
* Break recursion in GHC.Float.roundingMode# (#20352)Sebastian Graf2021-09-111-1/+1
| | | | | | | | | | | | | | | | Judging from the Assumption, we should never call `roundingMode#` on a negative number. Yet the strange "dummy" conversion from `IN` to `IP` and the following recursive call where making the function recursive. Replacing the call by a panic makes `roundingMode#` non-recursive, so that we may be able to inline it. Fixes #20352. It seems we trigger #19414 on some jobs, hence Metric Decrease: T12545
* Remove dubious Eq1 and Ord1 Fixed instances. Fixes #20309Oleg Grenrus2021-09-112-10/+0
|
* base: Numeric: remove 'Show' constraint on 'showIntAtBase'Guillaume Bouchard2021-09-081-6/+6
| | | | | | | | | | The constraint was there in order to show the 'Integral' value in case of error. Instead we can show the result of `toInteger`, which will be close (i.e. it will still show the same integer except if the 'Show' instance was funky). This changes a bit runtime semantic (i.e. exception string may be a bit different).
* Fix broken haddock @since fields in baseJoshua Price2021-09-085-3/+23
|
* base Data.Fixed: fix documentation typo: succ (0.000 :: Milli) /= 1.001 Jens Petersen2021-09-081-1/+1
| | | ie `succ (0000) == 0001` -- (not 1001)
* Bignum: refactor conversion rulesSylvain Henry2021-09-073-2/+312
| | | | | | | | * make "passthrough" rules non built-in: they don't need to * enhance note about efficient conversions between numeric types * make integerFromNatural a little more efficient * fix noinline pragma for naturalToWordClamp# (at least with non built-in rules, we get warnings in cases like this)
* Define returnA = idOleg Grenrus2021-09-062-1/+3
|
* fromEnum Natural: Throw error for non-representable valuesPeter Lebbing2021-09-062-4/+5
| | | | | | | | Starting with commit fe770c21, an error was thrown only for the values 2^63 to 2^64-1 inclusive (on a 64-bit machine), but not for higher values. Now, errors are thrown for all non-representable values again. Fixes #20291
* Export Solo from Data.TupleDavid Feuer2021-08-277-4/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | * The `Solo` type is intended to be the canonical lifted unary tuple. Up until now, it has only been available from `GHC.Tuple` in `ghc-prim`. Export it from `Data.Tuple` in `base`. I proposed this on the libraries list in December, 2020. https://mail.haskell.org/pipermail/libraries/2020-December/031061.html Responses from chessai https://mail.haskell.org/pipermail/libraries/2020-December/031062.html and George Wilson https://mail.haskell.org/pipermail/libraries/2021-January/031077.html were positive. There were no other responses. * Add Haddock documentation for Solo. * Give `Solo` a single field, `getSolo`, a custom `Show` instance that does *not* use record syntax, and a `Read` instance that accepts either record syntax or non-record syntax.
* Make Int64#/Word64# unconditionally availableJohn Ericson2021-08-193-3/+9
| | | | | | | | 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.
* Fix iconv detection in configure on OpenBSDGreg Steuck2021-08-151-1/+1
| | | | | | | | | This regressed in 544414ba604b13e0992ad87e90b8bdf45c43011c causing configure: error: iconv is required on non-Windows platforms More details: https://gitlab.haskell.org/ghc/ghc/-/commit/544414ba604b13e0992ad87e90b8bdf45c43011c#3bae3b74ae866493bd6b79df16cb638a5f2e0f87_106_106
* Detect TypeError when checking for insolubilitysheaf2021-08-151-27/+17
| | | | | | | | | | | | | | | We detect insoluble Givens by making getInertInsols take into account TypeError constraints, on top of insoluble equalities such as Int ~ Bool (which it already took into account). This allows pattern matches with insoluble contexts to be reported as redundant (tyOracle calls tcCheckGivens which calls getInertInsols). As a bonus, we get to remove a workaround in Data.Typeable.Internal: we can directly use a NotApplication type family, as opposed to needing to cook up an insoluble equality constraint. Fixes #11503 #14141 #16377 #20180
* Add a Typeable constraint to fromStaticPtr, addressing #19729David Simmons-Duffin2021-08-102-1/+9
|
* Move `/includes` to `/rts/include`, sort per package betterJohn Ericson2021-08-098-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | In order to make the packages in this repo "reinstallable", we need to associate source code with a specific packages. Having a top level `/includes` dir that mixes concerns (which packages' includes?) gets in the way of this. To start, I have moved everything to `rts/`, which is mostly correct. There are a few things however that really don't belong in the rts (like the generated constants haskell type, `CodeGen.Platform.h`). Those needed to be manually adjusted. Things of note: - No symlinking for sake of windows, so we hard-link at configure time. - `CodeGen.Platform.h` no longer as `.hs` extension (in addition to being moved to `compiler/`) so as not to confuse anyone, since it is next to Haskell files. - Blanket `-Iincludes` is gone in both build systems, include paths now more strictly respect per-package dependencies. - `deriveConstants` has been taught to not require a `--target-os` flag when generating the platform-agnostic Haskell type. Make takes advantage of this, but Hadrian has yet to.
* Make `PosixSource.h` installed and under `rts/`John Ericson2021-08-092-4/+4
| | | | | | is used outside of the rts so we do this rather than just fish it out of the repo in ad-hoc way, in order to make packages in this repo more self-contained.
* Remove ad-hoc fromIntegral rulesSylvain Henry2021-08-096-254/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Ensure that newtype deriving strategy is used for CTypesSylvain Henry2021-08-091-12/+6
|
* rts: Fix use of sized array in Heap.hBen Gamari2021-08-091-1/+1
| | | | | | Sized arrays cannot be used in headers that might be imported from C++. Fixes #20199.
* Consistent use of coercion and TypeApplicationsViktor Dukhovni2021-08-081-6/+11
| | | | | | | | | | | This makes the implementations of: - mapAccumL - mapAccumR - fmapDefault - foldMapDefault more uniform and match the approach in the overview.
* Rewrite of Traversable overviewViktor Dukhovni2021-08-081-211/+845
|
* Add Data.ByteArray, derived from primitiveBodigrim2021-08-053-0/+245
|
* Fix GHCi completion (#20101)Zubin Duggal2021-08-041-0/+0
| | | | Updates haskeline submodule
* Handle OverloadedRecordDot in TH (#20185)Zubin Duggal2021-08-035-0/+16
|
* Bump process submoduleBen Gamari2021-08-031-0/+0
|
* Disallow nonlinear fields in Template Haskell (#18378)Krzysztof Gogolewski2021-08-021-0/+4
|
* Constant-fold unpackAppendCString (fix #20174)Sylvain Henry2021-08-021-0/+2
| | | | | | | Minor renaming: since 1ed0409010afeaa318676e351b833aea659bf93a rules get an InScopeEnv arg (containing an IdUnfoldingFun) instead of an IdUnfoldingFun directly, hence I've renamed the parameter from "id_unf" to "env" for clarity.
* Fix spellingSylvain Henry2021-08-021-1/+1
|
* Improve documentation of openTempFile argsJulian Ospald2021-08-021-1/+3
| | | | | | | | | | https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettempfilenamew Specifically: > The null-terminated prefix string. The function uses up to the first > three characters of this string as the prefix of the file name. This > string must consist of characters in the OEM-defined character set.
* Add Generically (generic Semigroup, Monoid instances) and Generically1 ↵Baldur Blöndal2021-08-023-8/+175
| | | | (generic Functor, Applicative, Alternative, Eq1, Ord1 instances) to GHC.Generics.
* PrimOps: Add CAS op for all int sizesPeter Trommler2021-08-022-2/+11
| | | | | | | | | | | PPC NCG: Implement CAS inline for 32 and 64 bit testsuite: Add tests for smaller atomic CAS X86 NCG: Catch calls to CAS C fallback Primops: Add atomicCasWord[8|16|32|64]Addr# Add tests for atomicCasWord[8|16|32|64]Addr# Add changelog entry for new primops X86 NCG: Fix MO-Cmpxchg W64 on 32-bit arch ghc-prim: 64-bit CAS C fallback on all archs
* base: Document overflow behaviour of genericLengthSimon Jakobi2021-08-021-0/+9
|