summaryrefslogtreecommitdiff
path: root/libraries
Commit message (Collapse)AuthorAgeFilesLines
...
* Improve preprocessor error messageShayne Fletcher2021-07-291-1/+1
|
* Functor docs: link to free theorem explanation (#19300)Krzysztof Gogolewski2021-07-281-0/+3
|
* doc: fix copy/paste errorFraser Tweedale2021-07-271-2/+2
| | | | | | | | | The `divInt#` implementation note has heading: See Note [divInt# implementation] This seems to be a copy/paste mistake. Remove "See" from the heading.
* rts: Introduce and use ExecPage abstractionBen Gamari2021-07-271-36/+57
| | | | | Here we introduce a very thin abstraction for allocating, filling, and freezing executable pages to replace allocateExec.
* Check the buffer size *before* calling the continuation in withEncodedCStringMatthew Pickering2021-07-233-13/+63
| | | | | | | | | | | | | | | | | | | | This fixes a very subtle bug in withEncodedCString where a reference would be kept to the whole continuation until the continuation had finished executing. This was because the call to tryFillBufferAndCall could fail, if the buffer was already full and so the `go` helper would be recursively called on failure which necessitated keeping a reference to `act`. The failure could only happen during the initial checking phase of the function but not during the call to the continuation. Therefore the fix is to first perform the size check, potentially recursively and then finally calling tail calling the continuation. In the real world, this broke writing lazy bytestrings because a reference to the head of the bytestring would be retained in the continuation until the whole string had been written to a file. Fixes #20107
* Generalise reallyUnsafePtrEquality# and use itsheaf2021-07-236-4/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fixes #9192 and #17126 updates containers submodule 1. Changes the type of the primop `reallyUnsafePtrEquality#` to the most general version possible (heterogeneous as well as levity-polymorphic): > reallyUnsafePtrEquality# > :: forall {l :: Levity} {k :: Levity} > (a :: TYPE (BoxedRep l)) (b :: TYPE (BoxedRep k)) > . a -> b -> Int# 2. Adds a new internal module, `GHC.Ext.PtrEq`, which contains pointer equality operations that are now subsumed by `reallyUnsafePtrEquality#`. These functions are then re-exported by `GHC.Exts` (so that no function goes missing from the export list of `GHC.Exts`, which is user-facing). More specifically, `GHC.Ext.PtrEq` defines: - A new function: * reallyUnsafePtrEquality :: forall (a :: Type). a -> a -> Int# - Library definitions of ex-primops: * `sameMutableArray#` * `sameSmallMutableArray` * `sameMutableByteArray#` * `sameMutableArrayArray#` * `sameMutVar#` * `sameTVar#` * `sameMVar#` * `sameIOPort#` * `eqStableName#` - New functions for comparing non-mutable arrays: * `sameArray#` * `sameSmallArray#` * `sameByteArray#` * `sameArrayArray#` These were requested in #9192. Generally speaking, existing libraries that use `reallyUnsafePtrEquality#` will continue to work with the new, levity-polymorphic version. But not all! Some (`containers`, `unordered-containers`, `dependent-map`) contain the following: > unsafeCoerce# reallyUnsafePtrEquality# a b If we make `reallyUnsafePtrEquality#` levity-polymorphic, this code fails the current GHC representation-polymorphism checks. We agreed that the right solution here is to modify the library; in this case by deleting the call to `unsafeCoerce#`, since `reallyUnsafePtrEquality#` is now type-heterogeneous too.
* Use fix-sized equality primops for fixed size boxed typesJohn Ericson2021-07-212-12/+12
| | | | These are the last to be converted.
* template-haskell: Add support for default declarationsMario Blažević2021-07-215-0/+14
| | | | Fixes #19373
* Rename RecordPuns to NamedFieldPuns in LangExt.ExtensionAlfredo Di Napoli2021-07-191-1/+1
| | | | | | | | | | This commit renames the `RecordPuns` type constructor inside `GHC.LanguageExtensions.Type.hs` to `NamedFieldPuns`. The rationale is that the `RecordPuns` language extension was deprecated a long time ago, but it was still present in the AST, introducing an annoying mismatch between what GHC suggested (i.e. "use NamedFieldPuns") and what that translated into in terms of Haskell types.
* Bignum: don't allocate in bignat_mul (#20028)Sylvain Henry2021-07-191-4/+4
| | | | | We allocated the recursively entered `mul` helper function because it captures some args.
* Add Word64#/Int64# primopsSylvain Henry2021-07-1511-117/+16
| | | | | | | | | | | | | | | | | | | | | | | 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
* Added a hopefully clarificatory sentence about the notion of "atomicity" ↵Adrien2021-07-131-5/+13
| | | | presupposed in the documentation on MVar.
* Implement improved "get executable path" queryFraser Tweedale2021-07-063-2/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | System.Environment.getExecutablePath has some problems: - Some system-specific implementations throw an exception in some scenarios, e.g. when the executable file has been deleted - The Linux implementation succeeds but returns an invalid FilePath when the file has been deleted. - The fallback implementation returns argv[0] which is not necessarily an absolute path, and is subject to manipulation. - The documentation does not explain any of this. Breaking the getExecutablePath API or changing its behaviour is not an appealing direction. So we will provide a new API. There are two facets to the problem of querying the executable path: 1. Does the platform provide a reliable way to do it? This is statically known. 2. If so, is there a valid answer, and what is it? This may vary, even over the runtime of a single process. Accordingly, the type of the new mechanism is: Maybe (IO (Maybe FilePath)) This commit implements this mechanism, defining the query action for FreeBSD, Linux, macOS and Windows. Fixes: #10957 Fixes: #12377
* Fix cut/paste typo foldrM should be foldlMViktor Dukhovni2021-07-021-1/+1
|
* Detect underflow in fromIntegral/Int->Natural ruleSylvain Henry2021-07-021-3/+15
| | | | Fix #20066
* Fix type and strictness signature of forkOn#Ryan Scott2021-06-281-1/+1
| | | | | | This is a follow-up to #19992, which fixes the type and strictness signature for `fork#`. The `forkOn#` primop also needs analogous changes, which this patch accomplishes.
* Revert "Make reallyUnsafePtrEquality# levity-polymorphic"Matthew Pickering2021-06-272-9/+0
| | | | | | | | | | | | | | | | | | | | | | | This reverts commit d1f59540e8b7be96b55ab4b286539a70bc75416c. This commit breaks the build of unordered-containers ``` [3 of 9] Compiling Data.HashMap.Internal.Array ( Data/HashMap/Internal/Array.hs, dist/build/Data/HashMap/Internal/Array.o, dist/build/Data/HashMap/Internal/Array.dyn_o ) *** Parser [Data.HashMap.Internal.Array]: Parser [Data.HashMap.Internal.Array]: alloc=21043544 time=13.621 *** Renamer/typechecker [Data.HashMap.Internal.Array]: Renamer/typechecker [Data.HashMap.Internal.Array]: alloc=151218672 time=187.083 *** Desugar [Data.HashMap.Internal.Array]: ghc: panic! (the 'impossible' happened) GHC version 9.3.20210625: expectJust splitFunTy CallStack (from HasCallStack): error, called at compiler/GHC/Data/Maybe.hs:68:27 in ghc:GHC.Data.Maybe expectJust, called at compiler/GHC/Core/Type.hs:1247:14 in ghc:GHC.Core.Type ``` Revert containers submodule update
* Re-export UnliftedRep and UnliftedType from GHC.Extssheaf2021-06-261-1/+2
|
* Make reallyUnsafePtrEquality# levity-polymorphicsheaf2021-06-252-0/+9
| | | | fixes #17126, updates containers submodule
* fix sdist for base libraryLuite Stegeman2021-06-241-2/+0
| | | | | config.sub and config.guess aren't used anymore, so they should be removed from the base.cabal file
* Optimiser: Correctly deal with strings starting with unicode characters in ↵Matthew Pickering2021-06-231-0/+9
| | | | | | | | | | | | | | | | | | | | exprConApp_maybe For example: "\0" is encoded to "C0 80", then the rule would correct use a decoding function to work out the first character was "C0 80" but then just used BS.tail so the rest of the string was "80". This resulted in "\0" being transformed into '\C0\80' : unpackCStringUTF8# "80" Which is obviously bogus. I rewrote the function to call utf8UnconsByteString directly and avoid the roundtrip through Faststring so now the head/tail is computed by the same call. Fixes #19976
* ghc-bignum: trimed ~> trimmedMatthew Pickering2021-06-222-32/+32
| | | | Just a small typo which propagated through ghc-bignum
* Typos, minor comment fixesKrzysztof Gogolewski2021-06-221-8/+0
| | | | | | | | | | | | | | | | | | | - Remove fstName, sndName, fstIdKey, sndIdKey - no longer used, removed from basicKnownKeyNames - Remove breakpointId, breakpointCondId, opaqueTyCon, unknownTyCon - they were used in the old implementation of the GHCi debugger - Fix typos in comments - Remove outdated comment in Lint.hs - Use 'LitRubbish' instead of 'RubbishLit' for consistency - Remove comment about subkinding - superseded by Note [Kind Constraint and kind Type] - Mention ticket ID in a linear types error message - Fix formatting in using-warnings.rst and linear-types.rst - Remove comment about 'Any' in Dynamic.hs - Dynamic now uses Typeable + existential instead of Any - Remove codeGen/should_compile/T13233.hs This was added by accident, it is not used and T13233 is already in should_fail
* Fix naturalToFloat/DoubleSylvain Henry2021-06-194-10/+20
| | | | | | | | | | | * move naturalToFloat/Double from ghc-bignum to base:GHC.Float and make them wired-in (as their integerToFloat/Double counterparts) * use the same rounding method as integerToFloat/Double. This is an oversight of 540fa6b2cff3802877ff56a47ab3611e33a9ac86 * add passthrough rules for intToFloat, intToDouble, wordToFloat, wordToDouble.
* Fix type and strictness signature of fork#Simon Peyton Jones2021-06-191-1/+1
| | | | | | | | | | | When working eta-expansion and reduction, I found that fork# had a weaker strictness signature than it should have (#19992). In particular, it didn't record that it applies its argument exactly once. To this I needed to give it a proper type (its first argument is always a function, which in turn entailed a small change to the call in GHC.Conc.Sync This patch fixes it.
* Correct haddock annotations in GetOptDavid2021-06-191-3/+3
|
* Pass -DLIBICONV_PLUG when building base library on FreeBSD.Gleb Popov2021-06-181-0/+6
| | | | | | | | | | | If libiconv is installed from packages on the build machine, there is a high chance that the build system will pick up /usr/local/include/iconv.h instead of base /usr/include/iconv.h This additional preprocessor define makes package's libiconv header compatible with system one, fixing the build. Closes issue #19958
* Reword: representation instead of levitysheaf2021-06-106-12/+12
| | | | fixes #19756, updates haddock submodule
* winio: use synchronous access explicitly for handles that may not be ↵Tamar Christina2021-06-084-27/+125
| | | | asynchronous.
* Small ZipList optimisationViktor Dukhovni2021-06-071-2/+6
| | | | | | | | In (<|>) for ZipList, avoid processing the first argument twice (both as first argument of (++) and for its length in drop count of the second argument). Previously, the entire first argument was forced into memory, now (<|>) can run in constant space even with long inputs.
* Fix Integral instances for WordsSylvain Henry2021-06-042-110/+120
| | | | | | | | | | | | * 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)
* Make some simple primops levity-polymorphicsheaf2021-06-041-0/+20
| | | | Fixes #17817
* Improve wording of fold[lr]M documentation.Viktor Dukhovni2021-06-021-53/+77
| | | | | | | | | | | | | | | The sequencing of monadic effects in foldlM and foldrM was described as respectively right-associative and left-associative, but this could be confusing, as in essence we're just composing Kleisli arrows, whose composition is simply associative. What matters therefore is the order of sequencing of effects, which can be described more clearly without dragging in associativity as such. This avoids describing these folds as being both left-to-right and right-to-left depending on whether we're tracking effects or operator application. The new text should be easier to understand.
* sighparsonsmatt2021-05-291-1/+1
|
* Apply 2 suggestion(s) to 1 file(s)parsonsmatt2021-05-291-2/+2
|
* Address review comments, export from THparsonsmatt2021-05-293-1/+8
|
* Add `newDeclarationGroup` and provide documentation in reifyInstances and ↵parsonsmatt2021-05-291-0/+62
| | | | isInstance
* Use quotRemWord in showWordSylvain Henry2021-05-281-3/+5
| | | | | | | | | | | | | | | | | | Using the following high-quality benchmark (with -O2): main :: IO () main = do let go 0 = "" go n@(W# n#) = showWord n# (go (n -1)) print $ length (go 10000000) I get the following performance results: - remWord+quotRem: 0,76s user 0,00s system 99% cpu 0,762 total - quotRemWord: 0,45s user 0,01s system 99% cpu 0,456 total Note that showSignedInt already uses quotRemInt.
* [ci/darwin] use system provided iconv and cursesMoritz Angermann2021-05-252-2/+5
| | | | Also make sure to be able to build with non-apple-clang, while using apple's SDK on macOS
* docs: Fix example in toIntegralSizedMatthew Pickering2021-05-241-3/+3
| | | | | | Thanks to Mathnerd3141 for the fixed example. Fixes #19880
* Bignum: bump to version 1.1 (#19846)Sylvain Henry2021-05-192-1/+11
|
* Add pattern TypeRep (#19691), exported by Type.Reflection.Baldur Blöndal2021-05-193-5/+56
|
* Implement bitwise infix opsKoz Ross2021-05-191-0/+42
|
* Use fix-sized order primops for fixed size boxed typesJohn Ericson2021-05-132-24/+24
| | | | Progress towards #19026
* base: Update Unicode data to 13.0.0Ben Gamari2021-05-114-49/+99
| | | | (cherry picked from commit d22e087f7bf74341c4468f11b4eb0273033ca931)
* Bump binary submoduleBen Gamari2021-05-061-0/+0
| | | | Fixes #19631.
* Use fix-sized arithmetic primops for fixed size boxed typesJohn Ericson2021-05-063-108/+239
| | | | | | | | | | | 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
* Update documentation of 'Weak'bit2021-05-031-8/+7
|
* Move shift ops out of GHC.BaseSylvain Henry2021-05-033-66/+72
| | | | | | | With a quick flavour I get: before T12545(normal) ghc/alloc 8628109152 after T12545(normal) ghc/alloc 8559741088
* Use fix-sized bit-fiddling primops for fixed size boxed typesJohn Ericson2021-05-033-80/+145
| | | | | Like !5572, this is switching over a portion of the primops which seems safe to use.