summaryrefslogtreecommitdiff
path: root/compiler/GHC/Data/FastString.hs
Commit message (Collapse)AuthorAgeFilesLines
* Suggestions due to hlintMatthew Pickering2022-02-241-2/+1
| | | | | It turns out this job hasn't been running for quite a while (perhaps ever) so there are quite a few failures when running the linter locally.
* Fix a few Note inconsistenciesBen Gamari2022-02-011-1/+1
|
* Avoid GHC_STAGE and other include bitsJohn Ericson2021-11-051-7/+5
| | | | | | | | | We should strive to make our includes in terms of the RTS as much as possible. One place there that is not possible, the llvm version, we make a new tiny header Stage numbers are somewhat arbitrary, if we simple need a newer RTS, we should say so.
* Don't use FastString for UTF-8 encoding onlySylvain Henry2021-10-021-2/+10
|
* Perf: fix appendFSSylvain Henry2021-06-191-2/+2
| | | | To append 2 FastString we don't need to convert them into ByteString: use ShortByteString's Semigroup instance instead.
* DerivingVia for Hsc instances. GND for NonDetFastString and LexicalFastString.Baldur Blöndal2021-06-161-9/+6
|
* Remove useless {-# LANGUAGE CPP #-} pragmasSylvain Henry2021-05-121-3/+1
|
* Move GlobalVar macros into GHC.Utils.GlobalVarsSylvain Henry2021-05-121-1/+2
| | | | | That's the only place where they are used and they shouldn't be used elsewhere.
* Replace (ptext .. sLit) with `text`Sylvain Henry2021-04-291-9/+6
| | | | | | | | | | | | | | | 1. `text` is as efficient as `ptext . sLit` thanks to the rewrite rules 2. `text` is visually nicer than `ptext . sLit` 3. `ptext . sLit` encourages using one `ptext` for several `sLit` as in: ptext $ case xy of ... -> sLit ... ... -> sLit ... which may allocate SDoc's TextBeside constructors at runtime instead of sharing them into CAFs.
* Bump bytestring submodule to 0.11.1.0Ben Gamari2021-03-101-0/+2
|
* FastString: Use FastMutInt instead of IORef IntBen Gamari2021-03-101-12/+13
| | | | This saves at least one I# allocation per FastString.
* FastMutInt: Ensure that newFastMutInt initializes valueBen Gamari2021-03-101-5/+5
| | | | Updates haddock submodule.
* Fix array and cleanup conversion primops (#19026)Sylvain Henry2021-03-031-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* The Char kind (#11342)Daniel Rogozin2021-02-061-0/+7
| | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Rinat Stryungis <rinat.stryungis@serokell.io> Implement GHC Proposal #387 * Parse char literals 'x' at the type level * New built-in type families CmpChar, ConsSymbol, UnconsSymbol * New KnownChar class (cf. KnownSymbol and KnownNat) * New SomeChar type (cf. SomeSymbol and SomeNat) * CharTyLit support in template-haskell Updated submodules: binary, haddock. Metric Decrease: T5205 haddock.base Metric Increase: Naperian T13035
* Ppr: compute length of string literals at compile time (#19266)Sylvain Henry2021-01-291-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | SDoc string literals created for example with `text "xyz"` are converted into `PtrString` (`Addr#` + size in bytes) with a rewrite rule to avoid allocating a String. Before this patch, the size in bytes was still computed at runtime. For every literal, we obtained the following pseudo STG: x :: Addr# x = "xzy"# s :: PtrString s = \u [] case ffi:strlen [x realWorld#] of (# _, sz #) -> PtrString [x sz] But since GHC 9.0, we can use `cstringLength#` instead to get: x :: Addr# x = "xzy"# s :: PtrString s = PtrString! [x 3#] Literals become statically known constructor applications. Allocations seem to decrease a little in perf tests (between -0.1% and -0.7% on CI).
* Add the proper HLint rules and remove redundant keywords from compilerHécate2020-11-011-3/+7
|
* CosmeticLeif Metcalf2020-09-171-1/+1
|
* Make Z-encoding comment into a noteLeif Metcalf2020-09-171-1/+2
|
* Remove "Ord FastString" instanceSylvain Henry2020-09-011-18/+59
| | | | | | | | | | | | | | | | | | | FastStrings can be compared in 2 ways: by Unique or lexically. We don't want to bless one particular way with an "Ord" instance because it leads to bugs (#18562) or to suboptimal code (e.g. using lexical comparison while a Unique comparison would suffice). UTF-8 encoding has the advantage that sorting strings by their encoded bytes also sorts them by their Unicode code points, without having to decode the actual code points. BUT GHC uses Modified UTF-8 which diverges from UTF-8 by encoding \0 as 0xC080 instead of 0x00 (to avoid null bytes in the middle of a String so that the string can still be null-terminated). This patch adds a new `utf8CompareShortByteString` function that performs sorting by bytes but that also takes Modified UTF-8 into account. It is much more performant than decoding the strings into [Char] to perform comparisons (which we did in the previous patch). Bump haddock submodule
* Fix FastString lexicographic ordering (fix #18562)Sylvain Henry2020-09-011-1/+3
|
* FastString: Reintroduce character count cacheDaniel Gröber2020-07-221-12/+14
| | | | | | | | Metric Increase: ManyConstructors Metric Decrease: T4029
* Use IO constructor instead of `stToIO . ST`Daniel Gröber2020-07-221-6/+4
|
* Use ShortByteString for FastStringDaniel Gröber2020-07-221-117/+80
| | | | | | | | | | | | | | | There are multiple reasons we want this: - Fewer allocations: ByteString has 3 fields, ShortByteString just has one. - ByteString memory is pinned: - This can cause fragmentation issues (see for example #13110) but also - makes using FastStrings in compact regions impossible. Metric Decrease: T5837 T12150 T12234 T12425
* Remove length field from FastStringDaniel Gröber2020-07-221-24/+24
|
* Clean up haddock hyperlinks of GHC.* (part1)Takenobu Tani2020-06-251-3/+3
| | | | | | | | | | | | | | | | | | | This updates haddock comments only. This patch focuses to update for hyperlinks in GHC API's haddock comments, because broken links especially discourage newcomers. This includes the following hierarchies: - GHC.Hs.* - GHC.Core.* - GHC.Stg.* - GHC.Cmm.* - GHC.Types.* - GHC.Data.* - GHC.Builtin.* - GHC.Parser.* - GHC.Driver.* - GHC top
* Implement cstringLength# and FinalPtrAndrew Martin2020-05-231-2/+3
| | | | | | | | | | | | | | | | | | | | This function and its accompanying rule resolve issue #5218. A future PR to the bytestring library will make the internal Data.ByteString.Internal.unsafePackAddress compute string length with cstringLength#. This will improve the status quo because it is eligible for constant folding. Additionally, introduce a new data constructor to ForeignPtrContents named FinalPtr. This additional data constructor, when used in the IsString instance for ByteString, leads to more Core-to-Core optimization opportunities, fewer runtime allocations, and smaller binaries. Also, this commit re-exports all the functions from GHC.CString (including cstringLength#) in GHC.Exts. It also adds a new test driver. This test driver is used to perform substring matches on Core that is dumped after all the simplifier passes. In this commit, it is used to check that constant folding of cstringLength# works.
* Modules: Utils and Data (#13009)Sylvain Henry2020-04-261-0/+693
Update Haddock submodule Metric Increase: haddock.compiler