summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
...
* Restore Eq instance of ImportDeclQualifiedStyleromes2022-07-061-1/+1
| | | | Fixes #21819
* Factor fields of `CoreDoSimplify` into separate data typeJohn Ericson2022-07-053-20/+28
| | | | | This avoids some partiality. The work @mmhat is doing cleaning up and modularizing `Core.Opt` will build on this nicely.
* Ticky:Make json info a separate field.Andreas Klebinger2022-07-041-34/+35
| | | | Fixes #21233
* Refactor ModuleName to L.H.S.Module.Nameromes2022-07-0328-86/+77
| | | | | | | | | | | | | | | ModuleName used to live in GHC.Unit.Module.Name. In this commit, the definition of ModuleName and its associated functions are moved to Language.Haskell.Syntax.Module.Name according to the current plan towards making the AST GHC-independent. The instances for ModuleName for Outputable, Uniquable and Binary were moved to the module in which the class is defined because these instances depend on GHC. The instance of Eq for ModuleName is slightly changed to no longer depend on unique explicitly and instead uses FastString's instance of Eq.
* TTG: Move ImpExp client-independent bits to L.H.S.ImpExpromes2022-07-0325-318/+422
| | | | | | | | | | | Move the GHC-independent definitions from GHC.Hs.ImpExp to Language.Haskell.Syntax.ImpExp with the required TTG extension fields such as to keep the AST independent from GHC. This is progress towards having the haskell-syntax package, as described in #21592 Bumps haddock submodule
* TTG: Move HsModule to L.H.Sromes2022-07-0322-112/+160
| | | | | | | | | Move the definition of HsModule defined in GHC.Hs to Language.Haskell.Syntax with an added TTG parameter and corresponding extension fields. This is progress towards having the haskell-syntax package, as described in #21592
* desugar: Look through ticks when warning about possible literal overflowMatthew Pickering2022-07-012-3/+39
| | | | | | | | | | Enabling `-fhpc` or `-finfo-table-map` would case a tick to end up between the appliation of `neg` to its argument. This defeated the special logic which looks for `NegApp ... (HsOverLit` to warn about possible overflow if a user writes a negative literal (without out NegativeLiterals) in their code. Fixes #21701
* Fix panic with UnliftedFFITypes+CApiFFI (#14624)nineonine2022-07-012-12/+39
| | | | | | | | | | When declaring foreign import using CAPI calling convention, using unlifted unboxed types would result in compiler panic. There was an attempt to fix the situation in #9274, however it only addressed some of the ByteArray cases. This patch fixes other missed cases for all prims that may be used as basic foreign types.
* Remove `CoreOccurAnal` constructor of the `CoreToDo` typeDominik Peteler2022-06-293-4/+0
| | | | | It was dead code since the last occurence in an expression context got removed in 71916e1c018dded2e68d6769a2dbb8777da12664.
* Tiny tweak to `IOPort#` documentation Emily Bourke2022-06-291-1/+1
| | | | | The exclamation mark and bracket don’t seem to make sense here. I’ve looked through the history, and I don’t think they’re deliberate – possibly a copy-and-paste error.
* template-haskell: Bump version to 2.19.0.0Ben Gamari2022-06-281-1/+1
| | | | Bumps text and exceptions submodules due to bounds.
* Cleanup BuiltInSyntax vs UserSyntaxMatthew Pickering2022-06-284-19/+14
| | | | | | | | | | | | There was some confusion about whether FUN/TYPE/One/Many should be BuiltInSyntax or UserSyntax. The answer is certainly UserSyntax as BuiltInSyntax is for things which are directly constructed by the parser rather than going through normal renaming channels. I fixed all the obviously wrong places I could find and added a test for the original bug which was caused by this (#21752) Fixes #21752 #20695 #18302
* Comments only, about join pointsSimon Peyton Jones2022-06-282-3/+38
| | | | | This MR just adds some documentation about why casts destroy join points, following #21716.
* CmmToAsm/AArch64: Sign-extend narrow C argumentsBen Gamari2022-06-281-2/+14
| | | | | | | | The AArch64/Darwin ABI requires that function arguments narrower than 32-bits must be sign-extended by the caller. We neglected to do this, resulting in #20735. Fixes #20735.
* CmmToAsm/AArch64: Re-format argument handling logicBen Gamari2022-06-281-5/+19
| | | | Previously there were very long, hard to parse lines. Fix this.
* -ddump-llvm shouldn't imply -fllvmBen Gamari2022-06-281-1/+1
| | | | | | | | Previously -ddump-llvm would change the backend used, which contrasts with all other dump flags. This is quite surprising and cost me quite a bit of time. Dump flags should not change compiler behavior. Fixes #21776.
* Mark AArch64/Darwin as requiring sign-extensionBen Gamari2022-06-281-0/+5
| | | | | | | Apple's AArch64 ABI requires that the caller sign-extend small integer arguments. Set platformCConvNeedsExtension to reflect this fact. Fixes #21773.
* add levity polymorphism to addrToAny#Naomi Liu2022-06-271-1/+1
|
* Add suggestions for unrecognised pragmas (#21589)Tony Zorman2022-06-275-8/+40
| | | | | | | In case of a misspelled pragma, offer possible corrections as to what the user could have meant. Fixes: https://gitlab.haskell.org/ghc/ghc/-/issues/21589
* Don't mark lambda binders as OtherConAndreas Klebinger2022-06-2722-348/+664
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We used to put OtherCon unfoldings on lambda binders of workers and sometimes also join points/specializations with with the assumption that since the wrapper would force these arguments once we execute the RHS they would indeed be in WHNF. This was wrong for reasons detailed in #21472. So now we purge evaluated unfoldings from *all* lambda binders. This fixes #21472, but at the cost of sometimes not using as efficient a calling convention. It can also change inlining behaviour as some occurances will no longer look like value arguments when they did before. As consequence we also change how we compute CBV information for arguments slightly. We now *always* determine the CBV convention for arguments during tidy. Earlier in the pipeline we merely mark functions as candidates for having their arguments treated as CBV. As before the process is described in the relevant notes: Note [CBV Function Ids] Note [Attaching CBV Marks to ids] Note [Never put `OtherCon` unfoldigns on lambda binders] ------------------------- Metric Decrease: T12425 T13035 T18223 T18223 T18923 MultiLayerModulesTH_OneShot Metric Increase: WWRec -------------------------
* Bump ghc-prim and base versionsBen Gamari2022-06-271-1/+1
| | | | | | | | | To 0.9.0 and 4.17.0 respectively. Bumps array, deepseq, directory, filepath, haskeline, hpc, parsec, stm, terminfo, text, unix, haddock, and hsc2hs submodules. (cherry picked from commit ba47b95122b7b336ce1cc00896a47b584ad24095)
* TagCheck.hs: Properly check if arguments are boxed types.Andreas Klebinger2022-06-222-7/+6
| | | | | | | | | | | For one by mistake I had been checking against the kind of runtime rep instead of the boxity. This uncovered another bug, namely that we tried to generate the checking code before we had associated the function arguments with a register, so this could never have worked to begin with. This fixes #21729 and both of the above issues.
* When specialising, look through floatable ticks.Gergo ERDI2022-06-221-5/+22
| | | | Fixes #21697.
* Break out thNameToGhcNameIO (ref. #21730)Brandon Chinn2022-06-221-3/+26
|
* Use lookupNameCache instead of lookupOrigIOBrandon Chinn2022-06-223-9/+5
|
* Flags to disable local let-floating; -flocal-float-out, ↵Vanessa McHale2022-06-227-8/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -flocal-float-out-top-level CLI flags These flags affect the behaviour of local let floating. If `-flocal-float-out` is disabled (the default) then we disable all local floating. ``` …(let x = let y = e in (a,b) in body)... ===> …(let y = e; x = (a,b) in body)... ``` Further to this, top-level local floating can be disabled on it's own by passing -fno-local-float-out-top-level. ``` x = let y = e in (a,b) ===> y = e; x = (a,b) ``` Note that this is only about local floating, ie, floating two adjacent lets past each other and doesn't say anything about the global floating pass which is controlled by `-fno-float`. Fixes #13663
* Revert "Ticky:Make json info a separate field."Matthew Pickering2022-06-221-35/+34
| | | | | | This reverts commit da5ff10503e683e2148c62e36f8fe2f819328862. This was pushed directly without review.
* Ticky:Make json info a separate field.Andreas Klebinger2022-06-211-34/+35
|
* HsToken for @-patterns and TypeApplications (#19623)Vladislav Zavialov2022-06-2035-106/+143
| | | | One more step towards the new design of EPA.
* Make Outputable instance for InlineSig print the InlineSpecWinston Hartnett2022-06-202-2/+7
| | | | | | Fix ghc/ghc#21739 Squash fix ghc/ghc#21739
* Instantiate top level foralls in partial type signaturesSimon Peyton Jones2022-06-204-80/+122
| | | | | | | | | | | | | | | | | | | | | The main fix for #21667 is the new call to tcInstTypeBnders in tcHsPartialSigType. It was really a simple omission before. I also moved the decision about whether we need to apply the Monomorphism Restriction, from `decideGeneralisationPlan` to `tcPolyInfer`. That removes a flag from the InferGen constructor, which is good. But more importantly, it allows the new function, checkMonomorphismRestriction called from `tcPolyInfer`, to "see" the `Types` involved rather than the `HsTypes`. And that in turn matters because we invoke the MR for partial signatures if none of the partial signatures in the group have any overloading context; and we can't answer that question for HsTypes. See Note [Partial type signatures and the monomorphism restriction] in GHC.Tc.Gen.Bind. This latter is really a pre-existing bug.
* Simplify: Take care with eta reduction in recursive RHSs (#21652)Sebastian Graf2022-06-205-54/+130
| | | | | | | | | | | | | | | | | | | | Similar to the fix to #20836 in CorePrep, we now track the set of enclosing recursive binders in the SimplEnv and SimpleOptEnv. See Note [Eta reduction in recursive RHSs] for details. I also updated Note [Arity robustness] with the insights Simon and I had in a call discussing the issue. Fixes #21652. Unfortunately, we get a 5% ghc/alloc regression in T16577. That is due to additional eta reduction in GHC.Read.choose1 and the resulting ANF-isation of a large list literal at the top-level that didn't happen before (presumably because it was too interesting to float to the top-level). There's not much we can do about that. Metric Increase: T16577
* CorePrep: Don't speculatively evaluate recursive calls (#20836)Sebastian Graf2022-06-203-38/+127
| | | | | | | | | | | In #20836 we have optimised a terminating program into an endless loop, because we speculated the self-recursive call of a recursive DFun. Now we track the set of enclosing recursive binders in CorePrep to prevent speculation of such self-recursive calls. See the updates to Note [Speculative evaluation] for details. Fixes #20836.
* CprAnal: Set signatures of DFuns to topSebastian Graf2022-06-201-6/+7
| | | | | | | | The recursive DFun in the reproducer for #20836 also triggered a bug in CprAnal that is observable in a debug build. The CPR signature of a recursive DFunId was never updated and hence the optimistic arity 0 bottom signature triggered a mismatch with the arity 1 of the binding in WorkWrap. We never miscompiled any code because WW doesn't exploit bottom CPR signatures.
* ncg/aarch64: Fix implementation of IntMulMayOfloBen Gamari2022-06-181-1/+41
| | | | | | | | The code generated for IntMulMayOflo was previously wrong as it depended upon the overflow flag, which the AArch64 MUL instruction does not set. Fix this. Fixes #21624.
* CmmToAsm/AArch64: Fix syntax of OpRegShift operandsBen Gamari2022-06-181-1/+1
| | | | Previously this produced invalid assembly containing a redundant comma.
* CmmToAsm/AArch64: Add SMUL[LH] instructionsBen Gamari2022-06-182-2/+8
| | | | These will be needed to fix #21624.
* replace quadratic nub to fight byte code gen perf explosionTorsten Schmits2022-06-161-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Despite this code having been present in the core-to-bytecode implementation, I have observed it in the wild starting with 9.2, causing enormous slowdown in certain situations. My test case produces the following profiles: Before: ``` total time = 559.77 secs (559766 ticks @ 1000 us, 1 processor) total alloc = 513,985,665,640 bytes (excludes profiling overheads) COST CENTRE MODULE SRC %time %alloc ticks bytes elem_by Data.OldList libraries/base/Data/OldList.hs:429:1-7 67.6 92.9 378282 477447404296 eqInt GHC.Classes libraries/ghc-prim/GHC/Classes.hs:275:8-14 12.4 0.0 69333 32 $c>>= GHC.Data.IOEnv <no location info> 6.9 0.6 38475 3020371232 ``` After: ``` total time = 89.83 secs (89833 ticks @ 1000 us, 1 processor) total alloc = 39,365,306,360 bytes (excludes profiling overheads) COST CENTRE MODULE SRC %time %alloc ticks bytes $c>>= GHC.Data.IOEnv <no location info> 43.6 7.7 39156 3020403424 doCase GHC.StgToByteCode compiler/GHC/StgToByteCode.hs:(805,1)-(1054,53) 2.5 7.4 2246 2920777088 ```
* cmm: Add surface syntax for MO_MulMayOfloBen Gamari2022-06-151-0/+2
|
* CoreToStg.Prep: Get rid of `DynFlags` and `HscEnv`wip/no-dyn-flags-core-cmmJohn Ericson2022-06-156-92/+164
| | | | | | | | | The call sites in `Driver.Main` are duplicative, but this is good, because the next step is to remove `InteractiveContext` from `Core.Lint` into `Core.Lint.Interactive`. Also further clean up `Core.Lint` to use a better configuration record than the one we initially added.
* Use (fixed_lev = True) in mkDataTyConRhsMatthew Craven2022-06-131-1/+1
|
* Fix TcRnPragmaWarning meaninguhbif192022-06-093-25/+25
|
* Remove TcRnUnknownMessage usage from GHC.Rename.Env #20115uhbif192022-06-093-44/+118
|
* Document dataToTag# primopAndreas Klebinger2022-06-091-0/+2
|
* Typecheck remaining ValArgs in rebuildHsAppssheaf2022-06-0911-404/+514
| | | | | | | | | | | | | | | | | This patch refactors hasFixedRuntimeRep_remainingValArgs, renaming it to tcRemainingValArgs. The logic is moved to rebuildHsApps, which ensures consistent behaviour across tcApp and quickLookArg1/tcEValArg. This patch also refactors the treatment of stupid theta for data constructors, changing the place we drop stupid theta arguments from dsConLike to mkDataConRep (now the datacon wrapper drops these arguments). We decided not to implement PHASE 2 of the FixedRuntimeRep plan for these remaining ValArgs. Future directions are outlined on the wiki: https://gitlab.haskell.org/ghc/ghc/-/wikis/Remaining-ValArgs Fixes #21544 and #21650
* Fix a CSE shadowing bug.Andreas Klebinger2022-06-091-30/+94
| | | | | | | | | | | | | | We used to process the rhs of non-recursive bindings and their body using the same env. If we had something like let x = ... x ... this caused trouble because the two xs refer to different binders but we would substitute both for a new binder x2 causing out of scope errors. We now simply use two different envs for the rhs and body in cse_bind. It's all explained in the Note [Separate envs for let rhs and body] Fixes #21685
* Core.Lint: Reduce `DynFlags` and `HscEnv`wip/no-state-core-lintJohn Ericson2022-06-0710-155/+294
| | | | Co-Authored-By: Andre Marianiello <andremarianiello@users.noreply.github.com>
* Ensure floated dictionaries are in scope (again)Simon Peyton Jones2022-06-061-2/+6
| | | | | | | | | | | In the Specialiser, we missed one more call to bringFloatedDictsIntoScope (see #21391). This omission led to #21689. The problem is that the call to `rewriteClassOps` needs to have in scope any dictionaries floated out of the arguments we have just specialised. Easy fix.
* Diagnostics conversions, part 6 (#20116)Aaron Allen2022-06-067-72/+229
| | | | | | Replaces uses of `TcRnUnknownMessage` with proper diagnostics constructors in `GHC.Tc.Gen.Match`, `GHC.Tc.Gen.Pat`, and `GHC.Tc.Gen.Sig`.
* Deprecate TypeInType extensionHaskellMouse2022-06-061-1/+13
| | | | | | | | | | | | | | | | This commit fixes #20312 It deprecates "TypeInType" extension according to the following proposal: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0083-no-type-in-type.rst It has been already implemented. The migration strategy: 1. Disable TypeInType 2. Enable both DataKinds and PolyKinds extensions Metric Decrease: T16875