summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Mention new implementation of GHC.IORef.atomicSwapIORef in the changelogwip/T23333Bodigrim2023-05-121-0/+1
|
* hadrian: Fix mention of non-existent removeFiles functionBen Gamari2023-05-121-1/+1
| | | | | | | | | | | | Previously Hadrian's bindist Makefile referred to a `removeFiles` function that was previously defined by the `make` build system. Since the `make` build system is no longer around, this function is now undefined. Naturally, make being make, this appears to be silently ignored instead of producing an error. Fix this by rewriting it to `rm -f`. Closes #23373.
* Allow Core optimizations when interpreting bytecodeKrzysztof Gogolewski2023-05-1211-2/+61
| | | | | | | | | | Tracking ticket: #23056 MR: !10399 This adds the flag `-funoptimized-core-for-interpreter`, permitting use of the `-O` flag to enable optimizations when compiling with the interpreter backend, like in ghci.
* Don't panic in mkNewTyConRhssheaf2023-05-126-26/+133
| | | | | | | | | | | | | This function could come across invalid newtype constructors, as we only perform validity checking of newtypes once we are outside the knot-tied typechecking loop. This patch changes this function to fake up a stub type in the case of an invalid newtype, instead of panicking. This patch also changes "checkNewDataCon" so that it reports as many errors as possible at once. Fixes #23308
* Doc: Fix out-of-sync using-optimisation pagePierre Le Marre2023-05-111-37/+40
| | | | | | - Make explicit that default flag values correspond to their -O0 value. - Fix -fignore-interface-pragmas, -fstg-cse, -fdo-eta-reduction, -fcross-module-specialise, -fsolve-constant-dicts, -fworker-wrapper.
* JS: refactor jsSaturate to return a saturated JStat (#23328)Josh Meredith2023-05-119-103/+85
|
* hadrian: fix no_dynamic_libs flavour transformerCheng Shao2023-05-111-14/+6
| | | | | | | This patch fixes the no_dynamic_libs flavour transformer and make fully_static reuse it. Previously building with no_dynamic_libs fails since ghc program is still dynamic and transitively brings in dyn ways of rts which are produced by no rules.
* rts: Refine memory retention behaviour to account for pinned/compacted objectsMatthew Pickering2023-05-115-12/+131
| | | | | | | | | | | | | | | | | | | | | | | When using the copying collector there is still a lot of data which isn't copied (such as pinned, compacted, large objects etc). The logic to decide how much memory to retain didn't take into account that these wouldn't be copied. Therefore we pessimistically retained 2* the amount of memory for these blocks even though they wouldn't be copied by the collector. The solution is to split up the heap into two parts, the parts which will be copied and the parts which won't be copied. Then the appropiate factor is applied to each part individually (2 * for copying and 1.2 * for not copying). The T23221 test demonstrates this improvement with a program which first allocates many unpinned ByteArray# followed by many pinned ByteArray# and observes the difference in the ultimate memory baseline between the two. There are some charts on #23221. Fixes #23221
* Add a test for #21278Krzysztof Gogolewski2023-05-113-0/+21
|
* Add fused multiply-add instructionssheaf2023-05-1135-26/+1244
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds eight new primops that fuse a multiplication and an addition or subtraction: - `{fmadd,fmsub,fnmadd,fnmsub}{Float,Double}#` fmadd x y z is x * y + z, computed with a single rounding step. This patch implements code generation for these primops in the following backends: - X86, AArch64 and PowerPC NCG, - LLVM - C WASM uses the C implementation. The primops are unsupported in the JavaScript backend. The following constant folding rules are also provided: - compute a * b + c when a, b, c are all literals, - x * y + 0 ==> x * y, - ±1 * y + z ==> z ± y and x * ±1 + z ==> z ± x. NB: the constant folding rules incorrectly handle signed zero. This is a known limitation with GHC's floating-point constant folding rules (#21227), which we hope to resolve in the future.
* Document unlawfulness of instance Num FixedBodigrim2023-05-112-2/+9
| | | | Fixes #22712
* Add a test for #17284Krzysztof Gogolewski2023-05-114-1/+15
| | | | Since !10123 we now reject this program.
* Move "target has RTS linker" out of settingsRodrigo Mesquita2023-05-1110-24/+25
| | | | | | | | | | | | We move the "target has RTS linker" information out of configure into a predicate in GHC, and remove this option from the settings file where it is unnecessary -- it's information statically known from the platform. Note that previously we would consider `powerpc`s and `s390x`s other than `powerpc-ibm-aix*` and `s390x-ibm-linux` to have an RTS linker, but the RTS linker supports neither platform. Closes #23361
* Look both ways when looking for quantified equalitiesSimon Peyton Jones2023-05-116-52/+78
| | | | | When looking up (t1 ~# t2) in the quantified constraints, check both orientations. Forgetting this led to #23333.
* Build vanilla alpine bindistsMatthew Pickering2023-05-113-8/+141
| | | | | | | | | | | We currently attempt to build and distribute fully static alpine bindists (ones which could be used on any linux platform) but most people who use the alpine bindists want to use alpine to build their own static applications (for which a fully static bindist is not necessary). We should build and distribute these bindists for these users whilst the fully-static bindist is still unusable. Fixes #23349
* base: Export GHC.Conc.Sync.fromThreadIdBen Gamari2023-05-112-1/+10
| | | | Closes #22706.
* Bump hsc2hs submoduleCheng Shao2023-05-101-0/+0
| | | | Fixes #22981.
* ghc-prim: Generalize keepAlive#/touch# in state token typeBen Gamari2023-05-102-2/+4
| | | | Closes #23163.
* Make `(&)` representation polymorphic in the return typekonsumlamm2023-05-092-4/+7
|
* Adjust AArch64 stackFrameHeaderSizeSven Tennie2023-05-091-7/+6
| | | | | The prologue of each stack frame are the saved LR and FP registers, 8 byte each. I.e. the size of the stack frame header is 2 * 8 byte.
* nonmoving: Account for mutator allocations in bytes_allocatedBen Gamari2023-05-093-1/+7
| | | | | | | | | Previously we failed to account direct mutator allocations into the nonmoving heap against the mutator's allocation limit and `cap->total_allocated`. This only manifests during CAF evaluation (since we allocate the CAF's blackhole directly into the nonmoving heap). Fixes #23312.
* Add a regression test for #21050Krzysztof Gogolewski2023-05-093-0/+38
|
* JS: add GHC.JS.Optimizer, remove RTS.Printer, add Linker.Optdoyougnu2023-05-0919-395/+782
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This MR changes some simple optimizations and is a first step in re-architecting the JS backend pipeline to add the optimizer. In particular it: - removes simple peep hole optimizations from `GHC.StgToJS.Printer` and removes that module - adds module `GHC.JS.Optimizer` - defines the same peep hole opts that were removed only now they are `Syntax -> Syntax` transformations rather than `Syntax -> JS code` optimizations - hooks the optimizer into code gen - adds FuncStat and ForStat constructors to the backend. Working Ticket: - #22736 Related MRs: - MR !10142 - MR !10000 ------------------------- Metric Decrease: CoOpt_Read ManyAlternatives PmSeriesS PmSeriesT PmSeriesV T10421 T12707 T13253 T13253-spj T15164 T17516 T18140 T18282 T18698a T18698b T18923 T1969 T19695 T20049 T3064 T5321FD T5321Fun T783 T9198 T9233 T9630 -------------------------
* Make atomicSwapMutVar# an inline primopwip/ioref-swap-xchgBen Gamari2023-05-095-24/+20
|
* compiler: Implement atomicSwapIORef with xchgBen Gamari2023-05-098-6/+26
| | | | As requested by @treeowl in CLC#139.
* testsuite: Add test for atomicSwapIORefBen Gamari2023-05-093-0/+14
|
* Fix up rules for ghcup-metadata-nightly-pushBryan Richter2023-05-091-5/+2
|
* Add structured error messages for GHC.IfaceToCoreTorsten Schmits2023-05-084-6/+10
| | | | | | | | | Tracking ticket: #20114 MR: !10390 This converts uses of `mkTcRnUnknownMessage` to newly added constructors of `TcRnMessage`.
* rts: Fix data-race in hs_init_ghcwip/T22756Ben Gamari2023-05-081-8/+11
| | | | | | | | As noticed by @Terrorjack, `hs_init_ghc` previously used non-atomic increment/decrement on the RTS's initialization count. This may go wrong in a multithreaded program which initializes the runtime multiple times. Closes #22756.
* Add structured error messages for GHC.Rename.ModuleTorsten Schmits2023-05-0523-129/+282
| | | | | | | | | | | Tracking ticket: #20115 MR: !10361 This converts uses of `mkTcRnUnknownMessage` to newly added constructors of `TcRnMessage`. Only addresses the single warning missing from the previous MR.
* docs: Remove mentions of ArrayArray# from unlifted FFI sectionRodrigo Mesquita2023-05-051-21/+18
| | | | Fixes #23277
* Incrementally update ghcup metadata in ghc/ghcup-metadataMatthew Pickering2023-05-051-1/+32
| | | | | | | | | | | | | | | | | | This job paves the way for distributing nightly builds * A new repo https://gitlab.haskell.org/ghc/ghcup-metadata stores the metadata on the "updates" branch. * Each night this metadata is downloaded and the nightly builds are appended to the end of the metadata. * The update job only runs on the scheduled nightly pipeline, not just when NIGHTLY=1. Things which are not done yet * Modify the retention policy for nightly jobs * Think about building release flavour compilers to distribute nightly. Fixes #23334
* docs: Add Note [Timing of plugin initialization]Matthew Pickering2023-05-053-0/+25
|
* Rework plugin initialisation pointsAaron Allen2023-05-0516-22/+130
| | | | | | | | | | | | | | | | | | 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>
* driver: Use hooks from plugin_hsc_envMatthew Pickering2023-05-051-1/+1
| | | | | | 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.
* Use TemplateHaskellQuotes in TH.Syntax to construct NamesOleg Grenrus2023-05-051-25/+14
|
* Add structured error messages for GHC.Rename.UtilsTorsten Schmits2023-05-05126-390/+622
| | | | | | | | | Tracking ticket: #20115 MR: !10350 This converts uses of `mkTcRnUnknownMessage` to newly added constructors of `TcRnMessage`.
* Fix type variable substitution in gen_Newtype_fam_instsRyan Scott2023-05-045-9/+96
| | | | | | | | | | | | | Previously, `gen_Newtype_fam_insts` was substituting the type variable binders of a type family instance using `substTyVars`, which failed to take type variable dependencies into account. There is similar code in `GHC.Tc.TyCl.Class.tcATDefault` that _does_ perform this substitution properly, so this patch: 1. Factors out this code into a top-level `substATBndrs` function, and 2. Uses `substATBndrs` in `gen_Newtype_fam_insts`. Fixes #23329.
* Improved documentation for the Data.OldList.nub functionAndrei Borzenkov2023-05-041-3/+9
| | | | | | There was recomentation to use map head . group . sort instead of nub function, but containers library has more suitable and efficient analogue
* linear types: Don't add external names to the usage envKrzysztof Gogolewski2023-05-043-6/+12
| | | | This has no observable effect, but avoids storing useless data.
* base/encoding: add an allocations performance test (#22946)Josh Meredith2023-05-042-0/+39
|
* JavaScript: Correct arguments to h$appendToHsStringALuite Stegeman2023-05-041-1/+1
| | | | fixes #23278
* Fix remaining issues with bound checking (#23123)Sylvain Henry2023-05-049-577/+569
| | | | | | | | | | | | | | | | | | | | While fixing these I've also changed the way we store addresses into ByteArray#. Addr# are composed of two parts: a JavaScript array and an offset (32-bit number). Suppose we want to store an Addr# in a ByteArray# foo at offset i. Before this patch, we were storing both fields as a tuple in the "arr" array field: foo.arr[i] = [addr_arr, addr_offset]; Now we only store the array part in the "arr" field and the offset directly in the array: foo.dv.setInt32(i, addr_offset): foo.arr[i] = addr_arr; It avoids wasting space for the tuple.
* JS: fix bounds checking (Issue 23123)Josh Meredith2023-05-044-112/+183
| | | | | | | | | | | | | | | | | | | | * For ByteArray-based bounds-checking, the JavaScript backend must use the `len` field, instead of the inbuild JavaScript `length` field. * Range-based operations must also check both the start and end of the range for bounds * All indicies are valid for ranges of size zero, since they are essentially no-ops * For cases of ByteArray accesses (e.g. read as Int), the end index is (i * sizeof(type) + sizeof(type) - 1), while the previous implementation uses (i + sizeof(type) - 1). In the Int32 example, this is (i * 4 + 3) * IndexByteArrayOp_Word8As* primitives use byte array indicies (unlike the previous point), but now check both start and end indicies * Byte array copies now check if the arrays are the same by identity and then if the ranges overlap.
* Use hash-unit-ids in release jobsMatthew Pickering2023-05-043-11/+29
| | | | Includes fix upload_ghc_libs glob
* Add hashes to unit-ids created by hadrianromes2023-05-0454-140/+740
| | | | | | | | | | | This commit adds support for computing an inputs hash for packages compiled by hadrian. The result is that ABI incompatible packages should be given different hashes and therefore be distinct in a cabal store. Hashing is enabled by the `--flag`, and is off by default as the hash contains a hash of the source files. We enable it when we produce release builds so that the artifacts we distribute have the right unit ids.
* Validate compatibility of ghcs when loading pluginsromes2023-05-041-6/+13
| | | | | | | Ensure, when loading plugins, that the ghc the plugin depends on is the ghc loading the plugin -- otherwise fail to load the plugin. Progress towards #20742.
* Hardwire a better unit-id for ghcromes2023-05-049-21/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the unit-id of ghc-the-library was fixed as `ghc`. This was done primarily because the compiler must know the unit-id of some packages (including ghc) a-priori to define wired-in names. However, as seen in #20742, a reinstallable `ghc` whose unit-id is fixed to `ghc` might result in subtle bugs when different ghc's interact. A good example of this is having GHC_A load a plugin compiled by GHC_B, where GHC_A and GHC_B are linked to ghc-libraries that are ABI incompatible. Without a distinction between the unit-id of the ghc library GHC_A is linked against and the ghc library the plugin it is loading was compiled against, we can't check compatibility. This patch gives a slightly better unit-id to ghc (ghc-version) by (1) Not setting -this-unit-id to ghc, but rather to the new unit-id (modulo stage0) (2) Adding a definition to `GHC.Settings.Config` whose value is the new unit-id. (2.1) `GHC.Settings.Config` is generated by Hadrian (2.2) and also by cabal through `compiler/Setup.hs` This unit-id definition is imported by `GHC.Unit.Types` and used to set the wired-in unit-id of "ghc", which was previously fixed to "ghc" The commits following this one will improve the unit-id with a cabal-style package hash and check compatibility when loading plugins. Note that we also ensure that ghc's unit key matches unit id both when hadrian or cabal builds ghc, and in this way we no longer need to add `ghc` to the WiringMap.
* hadrian: Flavour: Change args -> extraArgsMatthew Pickering2023-05-0415-28/+30
| | | | | | | | | | | | | Previously in a flavour definition you could override all the flags which were passed to GHC. This causes issues when needed to compute a package hash because we need to know what these extra arguments are going to be before computing the hash. The solution is to modify flavour so that the arguments you pass here are just extra ones rather than all the arguments that you need to compile something. This makes things work more like how cabal.project files work when you give extra arguments to a package and also means that flavour transformers correctly affect the hash.
* Fix unlit path in cross bindistsamesgen2023-05-031-1/+1
|