summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Properly cast values when writing/reading unboxed sums.wip/fix-ubx-castAndreas Klebinger2022-11-2517-82/+791
| | | | | | | Unboxed sums might store a Int8# value as Int64#. This patch makes sure we keep track of the actual value type. See Note [Casting slot arguments] for the details.
* Print unticked promoted data constructors (#20531)Vladislav Zavialov2022-11-25157-553/+812
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this patch, GHC unconditionally printed ticks before promoted data constructors: ghci> type T = True -- unticked (user-written) ghci> :kind! T T :: Bool = 'True -- ticked (compiler output) After this patch, GHC prints ticks only when necessary: ghci> type F = False -- unticked (user-written) ghci> :kind! F F :: Bool = False -- unticked (compiler output) ghci> data False -- introduce ambiguity ghci> :kind! F F :: Bool = 'False -- ticked by necessity (compiler output) The old behavior can be enabled by -fprint-redundant-promotion-ticks. Summary of changes: * Rename PrintUnqualified to NamePprCtx * Add QueryPromotionTick to it * Consult the GlobalRdrEnv to decide whether to print a tick (see mkPromTick) * Introduce -fprint-redundant-promotion-ticks Co-authored-by: Artyom Kuznetsov <hi@wzrd.ht>
* Review suggestions for assorted fixes to avoid Data.List.{head,tail}sheaf2022-11-252-6/+8
|
* Assorted fixes to avoid Data.List.{head,tail}Bodigrim2022-11-2510-20/+27
|
* rts: fix missing Arena.h symbols in RtsSymbols.cCheng Shao2022-11-241-0/+4
| | | | It was an unfortunate oversight in !8961 and broke devel2 builds.
* Convert diagnostics in GHC.Rename.Expr to proper TcRnMessage (#20115)Andrei Borzenkov2022-11-2429-148/+416
| | | | | | | | | | | | | | | | | | | | Problem: avoid usage of TcRnMessageUnknown Solution: The following `TcRnMessage` messages has been introduced: TcRnNoRebindableSyntaxRecordDot TcRnNoFieldPunsRecordDot TcRnIllegalStaticExpression TcRnIllegalStaticFormInSplice TcRnListComprehensionDuplicateBinding TcRnEmptyStmtsGroup TcRnLastStmtNotExpr TcRnUnexpectedStatementInContext TcRnIllegalTupleSection TcRnIllegalImplicitParameterBindings TcRnSectionWithoutParentheses Co-authored-by: sheaf <sam.derbyshire@gmail.com>
* notes: Fix references to HPT space leak noteMatthew Pickering2022-11-231-5/+9
| | | | | | Updating this note was missed when updating the HPT to the HUG. Fixes #22477
* Check if the SDoc starts with a single quote (#22488)Vladislav Zavialov2022-11-238-17/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes pretty-printing of character literals inside promoted lists and tuples. When we pretty-print a promoted list or tuple whose first element starts with a single quote, we want to add a space between the opening bracket and the element: '[True] -- ok '[ 'True] -- ok '['True] -- not ok If we don't add the space, we accidentally produce a character literal '['. Before this patch, pprSpaceIfPromotedTyCon inspected the type as an AST and tried to guess if it would be rendered with a single quote. However, it missed the case when the inner type was itself a character literal: '[ 'x'] -- ok '['x'] -- not ok Instead of adding this particular case, I opted for a more future-proof solution: check the SDoc directly. This way we can detect if the single quote is actually there instead of trying to predict it from the AST. The new function is called spaceIfSingleQuote.
* Scrub some no-warning pragmas.M Farkas-Dyck2022-11-2360-271/+145
|
* CApiFFI: add ConstPtr for encoding const-qualified pointer return types (#22043)nineonine2022-11-239-5/+62
| | | | | | | | | | | | | Previously, when using `capi` calling convention in foreign declarations, code generator failed to handle const-cualified pointer return types. This resulted in CC toolchain throwing `-Wincompatible-pointer-types-discards-qualifiers` warning. `Foreign.C.Types.ConstPtr` newtype was introduced to handle these cases - special treatment was put in place to generate appropritetly qualified C wrapper that no longer triggers the above mentioned warning. Fixes #22043
* Don't let configure perform trivial substitutions (#21846)Sylvain Henry2022-11-2310-66/+132
| | | | | | | | | | | | | | Hadrian now performs substitutions, especially to generate .cabal files from .cabal.in files. Two benefits: 1. We won't have to re-configure when we modify thing.cabal.in. Hadrian will take care of this for us. 2. It paves the way to allow the same package to be configured differently by Hadrian in the same session. This will be useful to fix #19174: we want to build a stage2 cross-compiler for the host platform and a stage1 compiler for the cross target platform in the same Hadrian session.
* Add documentation on custom Prelude modules (#22228)Lawton Nichols2022-11-231-3/+42
| | | | Specifically, custom Prelude modules that are named `Prelude`.
* Expand Note [Linear types] with the stance on linting linearityArnaud Spiwack2022-11-232-39/+146
| | | | Per the discussion on #22123
* Fix eventlog all optionTeo Camarasu2022-11-231-0/+4
| | | | | | Previously it didn't enable/disable nonmoving_gc and ticky event types Fixes #21813
* utils/unlit: adjust parser to match Report specJonathan Dowland2022-11-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Haskell 2010 Report says that, for Latex-style Literate format, "Program code begins on the first line following a line that begins \begin{code}". (This is unchanged from the 98 Report) However the unlit.c implementation only matches a line that contains "\begin{code}" and nothing else. One consequence of this is that one cannot suffix Latex options to the code environment. I.e., this does not work: \begin{code}[label=foo,caption=Foo Code] Adjust the matcher to conform to the specification from the Report. The Haskell Wiki currently recommends suffixing a '%' to \begin{code} in order to deliberately hide a code block from Haskell. This is bad advice, as it's relying on an implementation quirk rather than specified behaviour. None-the-less, some people have tried to use it, c.f. <https://mail.haskell.org/pipermail/haskell-cafe/2009-September/066780.html> An alternative solution is to define a separate, equivalent Latex environment to "code", that is functionally identical in Latex but ignored by unlit. This should not be a burden: users are required to manually define the code environment anyway, as it is not provided by the Latex verbatim or lstlistings packages usually used for presenting code in documents. Fixes #3549.
* Add unsafePtrEquality# restricted to UnliftedTypesOleg Grenrus2022-11-224-34/+70
|
* hadrian:Set TNTC when running testsuite.Andreas Klebinger2022-11-221-1/+4
|
* Optimize getLevity.Andreas Klebinger2022-11-221-3/+8
| | | | | | | Avoid the intermediate data structures allocated by splitTyConApp. This avoids ~0.5% of allocations for a build using -O2. Fixes #22254
* Reveiew feedback: improve one of the TODO commentsDuncan Coutts2022-11-221-6/+14
| | | | | | The one about the nonsense (const False) test on WinIO for there being any IO or timers pending, leading to unnecessary complication later in the scheduler.
* Pass the Capability *cap explicitly to appendToIOBlockedQueueDuncan Coutts2022-11-223-18/+20
| | | | | | And to insertIntoSleepingQueue. Again, it's a bit cleaner and simpler though not strictly necessary given that these primops are currently only used in the non-threaded RTS.
* Pass the Capability *cap explicitly to awaitEventDuncan Coutts2022-11-224-30/+30
| | | | | | It is currently only used in the non-threaded RTS so it works to use MainCapability, but it's a bit nicer to pass the cap anyway. It's certainly shorter.
* Move the awaitEvent declaration into IOManager.hDuncan Coutts2022-11-225-35/+36
| | | | And add or adjust comments at the use sites of awaitEvent.
* Expand emptyThreadQueues inline for clarityDuncan Coutts2022-11-221-12/+4
| | | | | | | | It was not really adding anything. The name no longer meant anything since those I/O and timeout queues do not belong to the scheuler. In one of the two places it was used, the comments already had to explain what it did, whereas now the code matches the comment nicely.
* Replace EMPTY_{BLOCKED,SLEEPING}_QUEUE macros by functionDuncan Coutts2022-11-223-20/+36
| | | | | | | | | | | These are the macros originaly from Scheduler.h, previously moved to IOManager.h, and now replaced with a single inline function anyPendingTimeoutsOrIO(). We can use a single function since the two macros were always checked together. Note that since anyPendingTimeoutsOrIO is defined for all IO manager cases, including threaded, we do not need to guard its use by cpp #if !defined(THREADED_RTS)
* Move macros for checking for pending IO or timersDuncan Coutts2022-11-223-16/+29
| | | | | | | | | | | from Schedule.h to Schedule.c and IOManager.h This is just moving, the next step will be to rejig them slightly. For the non-threaded RTS the scheduler needs to be able to test for there being pending I/O operation or pending timers. The implementation of these tests should really be considered to be part of the I/O managers and not part of the scheduler.
* Remove the now-unused markSchedulerDuncan Coutts2022-11-225-13/+0
| | | | | The global vars {blocked,sleeping}_queue are now in the Capability and so get marked there via markCapabilityIOManager.
* Move {blocked,sleeping}_queue from scheduler global vars to CapIOManagerDuncan Coutts2022-11-227-64/+80
| | | | | | | | | | | | | | | | | | The blocked_queue_{hd,tl} and the sleeping_queue are currently cooperatively managed between the scheduler and (some but not all of) the non-threaded I/O manager implementations. They lived as global vars with the scheduler, but are poked by I/O primops and the I/O manager backends. This patch is a step on the path towards making the management of I/O or timer blocking belong to the I/O managers and not the scheduler. Specifically, this patch moves the {blocked,sleeping}_queue from being global vars in the scheduler to being members of the CapIOManager struct within each Capability. They are not yet exclusively used by the I/O managers: they are still poked from a couple other places, notably in the scheduler before calling awaitEvent.
* Move APPEND_TO_BLOCKED_QUEUE from cmm to CDuncan Coutts2022-11-224-51/+58
| | | | | | | | | | | | | | The I/O and delay blocking primitives for the non-threaded way currently access the blocked_queue and sleeping_queue directly. We want to move where those queues are to make their ownership clearer: to have them clearly belong to the I/O manager impls rather than to the scheduler. Ultimately we will want to change their representation too. It's inconvenient to do that if these queues are accessed directly from cmm code. So as a first step, replace the APPEND_TO_BLOCKED_QUEUE with a C version appendToIOBlockedQueue(), and replace the open-coded sleeping_queue insertion with insertIntoSleepingQueue().
* Add hook markCapabilityIOManagerDuncan Coutts2022-11-223-0/+17
| | | | | | | To allow I/O managers to have GC roots in the Capability, within the CapIOManager structure. Not yet used in this patch.
* Introduce CapIOManager as the per-cap I/O mangager stateDuncan Coutts2022-11-225-12/+60
| | | | | | | | | | | | | | | Rather than each I/O manager adding things into the Capability structure ad-hoc, we should have a common CapIOManager iomgr member of the Capability structure, with a common interface to initialise etc. The content of the CapIOManager struct will be defined differently for each I/O manager implementation. Eventually we should be able to have the CapIOManager be opaque to the rest of the RTS, and known just to the I/O manager implementation. We plan for that by making the Capability contain a pointer to the CapIOManager rather than containing the structure directly. Initially just move the Unix threaded I/O manager's control FD.
* Add since pragmas for c_interruptible_open and hostIsThreadedBodigrim2022-11-201-0/+10
|
* Buglet in GHC.Tc.Module.checkBootTyConSimon Peyton Jones2022-11-201-2/+6
| | | | | | | | This lurking bug used the wrong function to compare two types in GHC.Tc.Module.checkBootTyCon It's hard to trigger the bug, which only came up during !9343, so there's no regression test in this MR.
* Extend documentation for Data.IORefBodigrim2022-11-202-16/+63
|
* PPC NCG: Fix generating assembler codePeter Trommler2022-11-191-6/+4
| | | | Fixes #22479
* Be more careful when reporting unbound RULE bindersSimon Peyton Jones2022-11-197-32/+88
| | | | | | See Note [Variables unbound on the LHS] in GHC.HsToCore.Binds. Fixes #22471.
* Make T21839c's ghc/max threshold more forgivingSebastian Graf2022-11-191-1/+2
|
* Simplifier: Consider `seq` as a `BoringCtxt` (#22317)Sebastian Graf2022-11-196-17/+359
| | | | | | See `Note [Seq is boring]` for the rationale. Fixes #22317.
* Make OpaqueNo* tests less noisy to unrelated changesSebastian Graf2022-11-191-8/+8
|
* Give better errors for code corrupted by Unicode smart quotes (#21843)Lawton Nichols2022-11-1917-16/+146
| | | | | | Previously, we emitted a generic and potentially confusing error during lexical analysis on programs containing smart quotes (“/”/‘/’). This commit adds smart quote-aware lexer errors.
* Misc cleanupKrzysztof Gogolewski2022-11-1623-68/+56
| | | | | | | * Replace catMaybes . map f with mapMaybe f * Use concatFS to concatenate multiple FastStrings * Fix documentation of -exclude-module * Cleanup getIgnoreCount in GHCi.UI
* base: make Foreign.Marshal.Pool use RTS internal arena for allocationCheng Shao2022-11-163-30/+32
| | | | | | | | | | | | | | | | | | `Foreign.Marshal.Pool` used to call `malloc` once for each allocation request. Each `Pool` maintained a list of allocated pointers, and traverses the list to `free` each one of those pointers. The extra O(n) overhead is apparently bad for a `Pool` that serves a lot of small allocation requests. This patch uses the RTS internal arena to implement `Pool`, with these benefits: - Gets rid of the extra O(n) overhead. - The RTS arena is simply a bump allocator backed by the block allocator, each allocation request is likely faster than a libc `malloc` call. Closes #14762 #18338.
* Fix capitalization in haddock for TestEqualityBodigrim2022-11-151-3/+3
|
* configure: Don't check for an unsupported version of LLVMARATA Mizuki2022-11-151-1/+1
| | | | | | The upper bound is not inclusive. Fixes #22449
* Fix :i Constraint printing "type Constraint = Constraint"Krzysztof Gogolewski2022-11-144-6/+14
| | | | | | | Since Constraint became a synonym for CONSTRAINT 'LiftedRep, we need the same code for handling printing as for the synonym Type = TYPE 'LiftedRep. This addresses the same bug as #18594, so I'm reusing the test.
* Expand on the need to clone local binders.Andreas Klebinger2022-11-142-0/+18
| | | | Fixes #22402.
* Implement UNPACK support for sum types.Madeline Haraj2022-11-1422-58/+507
| | | | | | | This is based on osa's unpack_sums PR from ages past. The meat of the patch is implemented in dataConArgUnpackSum and described in Note [UNPACK for sum types].
* testsuite: Improve output from tests which have failing pre_cmdMatthew Pickering2022-11-141-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two changes: * If a pre_cmd fails, then don't attempt to run the test. * If a pre_cmd fails, then print the stdout and stderr from running that command (which hopefully has a nice error message). For example: ``` =====> 1 of 1 [0, 0, 0] *** framework failure for test-defaulting-plugin(normal) pre_cmd failed: 2 ** pre_cmd was "$MAKE -s --no-print-directory -C defaulting-plugin package.test-defaulting-plugin TOP={top}". stdout: stderr: DefaultLifted.hs:19:13: error: [GHC-76037] Not in scope: type constructor or class ‘Typ’ Suggested fix: Perhaps use one of these: ‘Type’ (imported from GHC.Tc.Utils.TcType), data constructor ‘Type’ (imported from GHC.Plugins) | 19 | instance Eq Typ where | ^^^ make: *** [Makefile:17: package.test-defaulting-plugin] Error 1 Performance Metrics (test environment: local): ``` Fixes #22329
* testsuite: Add tests for T22347Matthew Pickering2022-11-143-0/+42
| | | | | | | These are fixed in recent versions but might as well add regression tests. See #22347
* eventlog: Ensure that IPE output contains actual info table pointersBen Gamari2022-11-142-1/+5
| | | | | | | | | The refactoring in 866c736e introduced a rather subtle change in the semantics of the IPE eventlog output, changing the eventlog field from encoding info table pointers to "TNTC pointers" (which point to entry code when tables-next-to-code is enabled). Fix this. Fixes #22452.
* Fix a trivial typo in dataConNonlinearTypewip/T22416Simon Peyton Jones2022-11-126-8/+53
| | | | Fixes #22416