summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* CI: Don't run lint-submods on nightlywip/T22325Bryan Richter2022-10-281-0/+3
| | | | Fixes #22325
* Minor SDoc-related cleanupKrzysztof Gogolewski2022-10-2822-134/+138
| | | | | | | | | | | * Rename pprCLabel to pprCLabelStyle, and use the name pprCLabel for a function using CStyle (analogous to pprAsmLabel) * Move LabelStyle to the CLabel module, it no longer needs to be in Outputable. * Move calls to 'text' right next to literals, to make sure the text/str rule is triggered. * Remove FastString/String roundtrip in Tc.Deriv.Generate * Introduce showSDocForUser', which abstracts over a pattern in GHCi.UI
* Pass correct package db when testing stage1.Zubin Duggal2022-10-282-2/+2
| | | | It used to pick the db for stage-2 which obviously didn't work.
* Fix broken link to `async` packageEvan Relf2022-10-271-1/+1
|
* Add missing dict binds to specialiserSimon Peyton Jones2022-10-274-14/+741
| | | | | | | | | | I had forgotten to add the auxiliary dict bindings to the /unfolding/ of a specialised function. This caused #22358, which reports failures when compiling Hackage packages fixed-vector indexed-traversable Regression test T22357 is snarfed from indexed-traversable
* Remove source location information from interface filesOwen Shepherd2022-10-278-72/+88
| | | | | | | | | | | | | This change aims to minimize source location information leaking into interface files, which makes ABI hashes dependent on the build location. The `Binary (Located a)` instance has been removed completely. It seems that the HIE interface still needs the ability to serialize SrcSpans, but by wrapping the instances, it should be a lot more difficult to inadvertently add source location information.
* Use TcRnVDQInTermType in noNestedForallsContextsErr (#20115)Vladislav Zavialov2022-10-268-23/+29
| | | | | | | | | | | | | | | | | | | | | When faced with VDQ in the type of a term, GHC generates the following error message: Illegal visible, dependent quantification in the type of a term (GHC does not yet support this) Prior to this patch, there were two ways this message could have been generated and represented: 1. with the dedicated constructor TcRnVDQInTermType (see check_type in GHC.Tc.Validity) 2. with the transitional constructor TcRnUnknownMessage (see noNestedForallsContextsErr in GHC.Rename.Utils) Not only this led to duplication of code generating the final SDoc, it also made it tricky to track the origin of the error message. This patch fixes the problem by using TcRnVDQInTermType exclusively.
* Testsuite: more precise test optionsSylvain Henry2022-10-2647-160/+145
| | | | | Necessary for newer cross-compiling backends (JS, Wasm) that don't support TH yet.
* Introduce TcRnWithHsDocContext (#22346)Vladislav Zavialov2022-10-2638-105/+122
| | | | | | | | | | | | | | | | | Before this patch, GHC used withHsDocContext to attach an HsDocContext to an error message: addErr $ mkTcRnUnknownMessage $ mkPlainError noHints (withHsDocContext ctxt msg) The problem with this approach is that it only works with TcRnUnknownMessage. But could we attach an HsDocContext to a structured error message in a generic way? This patch solves the problem by introducing a new constructor to TcRnMessage: data TcRnMessage where ... TcRnWithHsDocContext :: !HsDocContext -> !TcRnMessage -> TcRnMessage ...
* Broaden the in-scope sets for liftEnvSubst and composeTCvSubstRyan Scott2022-10-264-3/+37
| | | | | | | | | | | | | | | | | This patch fixes two distinct (but closely related) buglets that were uncovered in #22235: * `liftEnvSubst` used an empty in-scope set, which was not wide enough to cover the variables in the range of the substitution. This patch fixes this by populating the in-scope set from the free variables in the range of the substitution. * `composeTCvSubst` applied the first substitution argument to the range of the second substitution argument, but the first substitution's in-scope set was not wide enough to cover the range of the second substutition. We similarly fix this issue in this patch by widening the first substitution's in-scope set before applying it. Fixes #22235.
* Cleanup String/FastString conversionsKrzysztof Gogolewski2022-10-2517-99/+67
| | | | | | | Remove unused mkPtrString and isUnderscoreFS. We no longer use mkPtrString since 1d03d8bef96. Remove unnecessary conversions between FastString and String and back.
* llvm-targets: Add datalayouts for big-endian AArch64 targetsBen Gamari2022-10-252-0/+6
| | | | | | Fixes #22311. Thanks to @zeldin for the patch.
* Add GHC.SysTools.Cpp moduleSylvain Henry2022-10-254-156/+246
| | | | Move doCpp out of the driver to be able to use it in the upcoming JS backend.
* Enable popcount rewrite rule when cross-compilingSylvain Henry2022-10-251-1/+1
| | | | | The comment applies only when host's word size < target's word size. So we can relax the guard.
* Numeric exceptions: replace FFI calls with primopsSylvain Henry2022-10-257-65/+41
| | | | | | | | | | | | | ghc-bignum needs a way to raise numerical exceptions defined in base package. At the time we used FFI calls into primops defined in the RTS. These FFI calls had to be wrapped into hacky bottoming functions because "foreign import prim" syntax doesn't support giving a bottoming demand to the foreign call (cf #16929). These hacky wrapper functions trip up the JavaScript backend (#21078) because they are polymorphic in their return type. This commit replaces them with primops very similar to raise# but raising predefined exceptions.
* Make the specialiser handle polymorphic specialisationSimon Peyton Jones2022-10-257-76/+419
| | | | | | | | | | | | | | | | | | | | | | | | | | | Ticket #13873 unexpectedly showed that a SPECIALISE pragma made a program run (a lot) slower, because less specialisation took place overall. It turned out that the specialiser was missing opportunities because of quantified type variables. It was quite easy to fix. The story is given in Note [Specialising polymorphic dictionaries] Two other minor fixes in the specialiser * There is no benefit in specialising data constructor /wrappers/. (They can appear overloaded because they are given a dictionary to store in the constructor.) Small guard in canSpecImport. * There was a buglet in the UnspecArg case of specHeader, in the case where there is a dead binder. We need a LitRubbish filler for the specUnfolding stuff. I expanded Note [Drop dead args from specialisations] to explain. There is a 4% increase in compile time for T15164, because we generate more specialised code. This seems OK. Metric Increase: T15164
* Fix binder-swap bugSimon Peyton Jones2022-10-257-106/+162
| | | | | | | | | | | | | | | | | | | | | | | This patch fixes #21229 properly, by avoiding doing a binder-swap on dictionary Ids. This is pretty subtle, and explained in Note [Care with binder-swap on dictionaries]. Test is already in simplCore/should_run/T21229 This allows us to restore a feature to the specialiser that we had to revert: see Note [Specialising polymorphic dictionaries]. (This is done in a separate patch.) I also modularised things, using a new function scrutBinderSwap_maybe in all the places where we are (effectively) doing a binder-swap, notably * Simplify.Iteration.addAltUnfoldings * SpecConstr.extendCaseBndrs In Simplify.Iteration.addAltUnfoldings I also eliminated a guard Many <- idMult case_bndr because we concluded, in #22123, that it was doing no good.
* Improve stg lint for unboxed sums.Andreas Klebinger2022-10-241-11/+39
| | | | | | | It now properly lints cases where sums end up distributed over multiple args after unarise. Fixes #22026.
* Convert Diagnostics in GHC.Tc.Gen.Splice (#20116)Aaron Allen2022-10-2458-237/+717
| | | | | | | Replaces uses of `TcRnUnknownMessage` in `GHC.Tc.Gen.Splice` with structured diagnostics. closes #20116
* Pin used way for test cloneMyStack (#21977)Sven Tennie2022-10-241-1/+5
| | | | | cloneMyStack checks the order of closures on the cloned stack. This may change for different ways. Thus we limit this test to one way (normal).
* Class layout info (#19623)Vladislav Zavialov2022-10-2328-148/+252
| | | | Updates the haddock submodule.
* hadrian: Improve error for wrong key/value errors.Andreas Klebinger2022-10-221-1/+2
|
* Introduce a standard thunk for allocating stringsÖmer Sinan Ağacan2022-10-2211-37/+231
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently for a top-level closure in the form hey = unpackCString# x we generate code like this: Main.hey_entry() // [R1] { info_tbls: [(c2T4, label: Main.hey_info rep: HeapRep static { Thunk } srt: Nothing)] stack_info: arg_space: 8 updfr_space: Just 8 } {offset c2T4: // global _rqm::P64 = R1; if ((Sp + 8) - 24 < SpLim) (likely: False) goto c2T5; else goto c2T6; c2T5: // global R1 = _rqm::P64; call (stg_gc_enter_1)(R1) args: 8, res: 0, upd: 8; c2T6: // global (_c2T1::I64) = call "ccall" arg hints: [PtrHint, PtrHint] result hints: [PtrHint] newCAF(BaseReg, _rqm::P64); if (_c2T1::I64 == 0) goto c2T3; else goto c2T2; c2T3: // global call (I64[_rqm::P64])() args: 8, res: 0, upd: 8; c2T2: // global I64[Sp - 16] = stg_bh_upd_frame_info; I64[Sp - 8] = _c2T1::I64; R2 = hey1_r2Gg_bytes; Sp = Sp - 16; call GHC.CString.unpackCString#_info(R2) args: 24, res: 0, upd: 24; } } This code is generated for every string literal. Only difference between top-level closures like this is the argument for the bytes of the string (hey1_r2Gg_bytes in the code above). With this patch we introduce a standard thunk in the RTS, called stg_MK_STRING_info, that does what `unpackCString# x` does, except it gets the bytes address from the payload. Using this, for the closure above, we generate this: Main.hey_closure" { Main.hey_closure: const stg_MK_STRING_info; const 0; // padding for indirectee const 0; // static link const 0; // saved info const hey1_r1Gg_bytes; // the payload } This is much smaller in code. Metric Decrease: T10421 T11195 T12150 T12425 T16577 T18282 T18698a T18698b Co-Authored By: Ben Gamari <ben@well-typed.com>
* Delete `eqExpr`, since GHC 9.4 has been released.M Farkas-Dyck2022-10-213-13/+5
|
* template-haskell: Improve documentation of strictness annotation typesTeo Camarasu2022-10-211-6/+18
| | | | | | | | Before it was undocumentated that DecidedLazy can be returned by reifyConStrictness for strict fields. This can happen when a field has an unlifted type or its the single field of a newtype constructor. Fixes #21380
* Scrub some partiality in `GHC.Core.Opt.Simplify.Utils`.M Farkas-Dyck2022-10-211-8/+9
|
* Write response files in UTF-8 on WindowsBen Gamari2022-10-211-4/+0
| | | | | | | | This reverts the workaround introduced in f63c8ef33ec9666688163abe4ccf2d6c0428a7e7, which taught our response file logic to write response files with the `latin1` encoding to workaround `gcc`'s lacking Unicode support. This is now no longer necessary (and in fact actively unhelpful) since we rather use Clang.
* Fix manifest filename when writing Windows .rc filesBen Gamari2022-10-211-3/+1
| | | | | As noted in #12971, we previously used `show` which resulted in inappropriate escaping of non-ASCII characters.
* Fix syntaxKrzysztof Gogolewski2022-10-211-1/+1
|
* Document how to quote certain names with spacesDavid Feuer2022-10-211-7/+8
| | | | | | | Quoting a name for Template Haskell is a bit tricky if the second character of that name is a single quote. The User's Guide falsely claimed that it was impossible. Document how to do it. Fixes #22236
* runhaskellEric Lindblad2022-10-211-1/+1
|
* rts: remove use of `TIME_WITH_SYS_TIME`Nicolas Trangez2022-10-213-25/+8
| | | | | | | | | | | | | | | | | | | | | | | `autoreconf` will insert an `m4_warning` when the obsolescent `AC_HEADER_TIME` macro is used: > Update your code to rely only on HAVE_SYS_TIME_H, > then remove this warning and the obsolete code below it. > All current systems provide time.h; it need not be checked for. > Not all systems provide sys/time.h, but those that do, all allow > you to include it and time.h simultaneously. Presence of `sys/time.h` was already checked in an earlier `AC_CHECK_HEADERS` invocation, so `AC_HEADER_TIME` can be dropped and guards relying on `TIME_WITH_SYS_TIME` can be reworked to (unconditionally) include `time.h` and include `sys/time.h` based on `HAVE_SYS_TIME_H`. Note the documentation of `AC_HEADER_TIME` in (at least) Autoconf 2.67 says > This macro is obsolescent, as current systems can include both files > when they exist. New programs need not use this macro.
* build: get rid of `HAVE_TIME_H`Nicolas Trangez2022-10-219-20/+4
| | | | | | | | | | | | As advertized by `autoreconf`: > All current systems provide time.h; it need not be checked for. Hence, remove the check for it in `configure.ac` and remove conditional inclusion of the header in `HAVE_TIME_H` blocks where applicable. The `time.h` header was being included in various source files without a `HAVE_TIME_H` guard already anyway.
* remove a no-warn directive from GHC.Cmm.ContFlowOptCurran McConnell2022-10-212-6/+9
| | | | | | | | | | | | | | | | | This patch is motivated by the desire to remove the {-# OPTIONS_GHC -fno-warn-incomplete-patterns #-} directive at the top of GHC.Cmm.ContFlowOpt. (Based on the text in this coding standards doc, I understand it's a goal of the project to remove such directives.) I chose this task because I'm a new contributor to GHC, and it seemed like a good way to get acquainted with the patching process. In order to address the warning that arose when I removed the no-warn directive, I added a case to removeUnreachableBlocksProc to handle the CmmData constructor. Clearly, since this partial function has not been erroring out in the wild, its inputs are always in practice wrapped by the CmmProc constructor. Therefore the CmmData case is handled by a precise panic (which is an improvement over the partial pattern match from before).
* ci: Make fat014 test robustMatthew Pickering2022-10-202-4/+1
| | | | | | | | For some reason I implemented this as a makefile test rather than a ghci_script test. Hopefully making it a ghci_script test makes it more robust. Fixes #22313
* CoreToStg: purge `DynFlags`.M Farkas-Dyck2022-10-204-55/+86
|
* TyEq:N assertion: only for saturated applicationssheaf2022-10-194-6/+41
| | | | | | | | | | The assertion that checked TyEq:N in canEqCanLHSFinish incorrectly triggered in the case of an unsaturated newtype TyCon heading the RHS, even though we can't unwrap such an application. Now, we only trigger an assertion failure in case of a saturated application of a newtype TyCon. Fixes #22310
* Fix typo in `Opt_WriteIfSimplifiedCore`'s nameGergő Érdi2022-10-194-7/+7
|
* Small language fixes in 'Using GHC'Jan Hrček2022-10-191-6/+6
|
* Add SpliceTypes test for hie filesMatthew Pickering2022-10-193-0/+57
| | | | | | | This test checks that typed splices and quotes get the right type information when used in hiefiles. See #21619
* Rename unsafeOverlap_matches -> unsafeOverlap_match in UnsafeOverlapsheaf2022-10-193-6/+4
|
* More precise types for fields of OverlappingInstances and UnsafeOverlap in ↵Bodigrim2022-10-193-34/+23
| | | | | | | | | | TcSolverReportMsg It's clear from asserts in `GHC.Tc.Errors` that `overlappingInstances_matches` and `unsafeOverlapped` are supposed to be non-empty, and `unsafeOverlap_matches` contains a single instance, but these invariants are immediately lost afterwards and not encoded in types. This patch enforces the invariants by pattern matching and makes types more precise, avoiding asserts and partial functions such as `head`.
* Enforce invariant of `ListBag` constructor.M Farkas-Dyck2022-10-193-36/+65
|
* Scrub various partiality involving lists (again).M Farkas-Dyck2022-10-1931-157/+184
| | | | Lets us avoid some use of `head` and `tail`, and some panics.
* Disable some SIMD tests on non-X86 architecturessheaf2022-10-192-2/+4
|
* Cmm Lint: relax SIMD register assignment checksheaf2022-10-192-5/+18
| | | | | | | | | | As noted in #22297, SIMD vector registers can be used to store different kinds of values, e.g. xmm1 can be used both to store integer and floating point values. The Cmm type system doesn't properly account for this, so we weaken the Cmm register assignment lint check to only compare widths when comparing a vector type with its allocated vector register.
* Remove SIMD conversionssheaf2022-10-196-71/+74
| | | | | | | | | | | This patch makes it so that packing/unpacking SIMD vectors always uses the right sized types, e.g. unpacking a Word16X4# will give a tuple of Word16#s. As a result, we can get rid of the conversion instructions that were previously required. Fixes #22296
* Add VecSlot for unboxed sums of SIMD vectorsDai2022-10-198-4/+73
| | | | | | | | | This patch adds the missing `VecRep` case to `primRepSlot` function and all the necessary machinery to carry this new `VecSlot` through code generation. This allows programs involving unboxed sums of SIMD vectors to be written and compiled. Fixes #22187
* Add -fsuppress-error-contexts to disable printing error contexts in errorswip/diagnostics-configMatthew Pickering2022-10-189-10/+51
| | | | | | | | | | | | | In many development environments, the source span is the primary means of seeing what an error message relates to, and the In the expression: and In an equation for: clauses are not particularly relevant. However, they can grow to be quite long, which can make the message itself both feel overwhelming and interact badly with limited-space areas. It's simple to implement this flag so we might as well do it and give the user control about how they see their messages. Fixes #21722
* Allow configuration of error message printingMatthew Pickering2022-10-1832-122/+247
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This MR implements the idea of #21731 that the printing of a diagnostic method should be configurable at the printing time. The interface of the `Diagnostic` class is modified from: ``` class Diagnostic a where diagnosticMessage :: a -> DecoratedSDoc diagnosticReason :: a -> DiagnosticReason diagnosticHints :: a -> [GhcHint] ``` to ``` class Diagnostic a where type DiagnosticOpts a defaultDiagnosticOpts :: DiagnosticOpts a diagnosticMessage :: DiagnosticOpts a -> a -> DecoratedSDoc diagnosticReason :: a -> DiagnosticReason diagnosticHints :: a -> [GhcHint] ``` and so each `Diagnostic` can implement their own configuration record which can then be supplied by a client in order to dictate how to print out the error message. At the moment this only allows us to implement #21722 nicely but in future it is more natural to separate the configuration of how much information we put into an error message and how much we decide to print out of it. Updates Haddock submodule