summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Zonking experimentswip/clean17Matthew Pickering2023-05-056-64/+69
|
* Changes to make :load work with ghci messagesMatthew Pickering2023-05-058-39/+95
|
* Use tmpdirMatthew Pickering2023-05-051-2/+2
|
* Make test cross platformMatthew Pickering2023-05-045-7/+9
|
* rts: Refine memory retention behaviour to account for pinned/compacted objectsMatthew Pickering2023-05-045-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
* Don't return complete HscEnv from upsweepMatthew Pickering2023-05-032-6/+8
| | | | | | | | | | | By returning a complete HscEnv from upsweep the logger (as introduced by withDeferredDiagnostics) was escaping the scope of withDeferredDiagnostics and hence we were losing error messages. This is reminiscent of #20981, which also talks about writing errors into messages after their scope has ended. See #23305 for details.
* withDeferredDiagnostics: When debugIsOn, write landmine into IORef to catch ↵Matthew Pickering2023-05-031-5/+8
| | | | | | | | | | | | | | | | | | use-after-free. Ticket #23305 reports an error where we were attempting to use the logger which was created by withDeferredDiagnostics after its scope had ended. This problem would have been caught by this patch and a validate build: ``` +*** Exception: Use after free +CallStack (from HasCallStack): + error, called at compiler/GHC/Driver/Make.hs:<line>:<column> in <package-id>:GHC.Driver.Make ``` This general issue is tracked by #20981
* Fix behaviour of -keep-tmp-files when used in OPTIONS_GHC pragmaMatthew Pickering2023-05-038-4/+58
| | | | | | | | | | | | | | | | | | | | | | This fixes the behaviour of -keep-tmp-files when used in an OPTIONS_GHC pragma for files with module level scope. Instead of simple not deleting the files, we also need to remove them from the TmpFs so they are not deleted later on when all the other files are deleted. There are additional complications because you also need to remove the directory where these files live from the TmpFs so we don't try to delete those later either. I added two tests. 1. Tests simply that -keep-tmp-files works at all with a single module and --make mode. 2. The other tests that temporary files are deleted for other modules which don't enable -keep-tmp-files. Fixes #23339
* error messages: Don't display ghci specific hints for missing packagesMatthew Pickering2023-05-0323-90/+140
| | | | | | | | | | | | | | | | | | | Tickets like #22884 suggest that it is confusing that GHC used on the command line can suggest options which only work in GHCi. This ticket uses the error message infrastructure to override certain error messages which displayed GHCi specific information so that this information is only showed when using GHCi. The main annoyance is that we mostly want to display errors in the same way as before, but with some additional information. This means that the error rendering code has to be exported from the Iface/Errors/Ppr.hs module. I am unsure about whether the approach taken here is the best or most maintainable solution. Fixes #22884
* Abstract cantFindError and turn Opt_BuildingCabal into a print-time optionMatthew Pickering2023-05-034-49/+56
| | | | | | | | | | | * cantFindError is abstracted so that the parts which mention specific things about ghc/ghci are parameters. The intention being that GHC/GHCi can specify the right values to put here but otherwise display the same error message. * The BuildingCabalPackage argument from GenericMissing is removed and turned into a print-time option. The reason for the error is not dependent on whether `-fbuilding-cabal-package` is passed, so we don't want to store that in the error message.
* Introduce GHCiMessage to wrap GhcMessageMatthew Pickering2023-05-033-6/+50
| | | | | By introducing a wrapped message type we can control how certain messages are printed in GHCi (to add extra information for example)
* Add structured error messages for GHC.Rename.NamesTorsten Schmits2023-04-3074-294/+552
| | | | | | | | | Tracking ticket: #20115 MR: !10336 This converts uses of `mkTcRnUnknownMessage` to newly added constructors of `TcRnMessage`.
* Add the Unsatisfiable classsheaf2023-04-2949-87/+1050
| | | | | | | | | This commit implements GHC proposal #433, adding the Unsatisfiable class to the GHC.TypeError module. This provides an alternative to TypeError for which error reporting is more predictable: we report it when we are reporting unsolved Wanted constraints. Fixes #14983 #16249 #16906 #18310 #20835
* JS: change GHC.JS.Transform.identsS/E/V to take a saturated IR (#23304)Josh Meredith2023-04-272-37/+34
|
* testsuite: wasm32-specific fixesCheng Shao2023-04-2714-22/+62
| | | | This patch includes all wasm32-specific testsuite fixes.
* testsuite: add missing annotations for some testsCheng Shao2023-04-275-8/+17
| | | | | | | This patch adds missing annotations (req_th, req_dynamic_lib_support, req_rts_linker) to some tests. They were discovered when testing wasm32, though it's better to be explicit about what features they require, rather than simply adding when(arch('wasm32'), skip).
* testsuite: add the req_host_target_ghc predicateCheng Shao2023-04-272-0/+20
| | | | | | | This patch adds the req_host_target_ghc predicate to the testsuite to assert the ghc compiler being tested can compile both host/target code. When testing cross GHCs this is not supported yet, but it may change in the future.
* testsuite: add the req_process predicateCheng Shao2023-04-2710-9/+25
| | | | | | This patch adds the req_process predicate to the testsuite to assert the platform has a process model, also marking tests that involve spawning processes as req_process. Also bumps hpc & process submodule.
* testsuite: add the req_ghc_with_threaded_rts predicateCheng Shao2023-04-279-12/+19
| | | | | | | This patch adds the req_ghc_with_threaded_rts predicate to the testsuite to assert the platform has threaded RTS, and mark some tests as req_ghc_with_threaded_rts. Also makes ghc_with_threaded_rts a config field instead of a global variable.
* testsuite: fix permission bits in copy_filesCheng Shao2023-04-272-1/+3
| | | | | | | | When the testsuite driver copy files instead of symlinking them, it should also copy the permission bits, otherwise there'll be permission denied errors. Also, enforce file copying when testing wasm32, since wasmtime doesn't handle host symlinks quite well (https://github.com/bytecodealliance/wasmtime/issues/6227).
* testsuite: exclude ghci ways if no rts linker is presentCheng Shao2023-04-272-1/+11
| | | | | | This patch implements logic to automatically exclude ghci ways when there is no rts linker. It's way better than having to annotate individual test cases.
* testsuite: include target exe extension in heap profile filenamesCheng Shao2023-04-271-5/+6
| | | | | | This patch fixes hp2ps related framework failures when testing the wasm backend by including target exe extension in heap profile filenames.
* testsuite: fix cross prefix strippingCheng Shao2023-04-271-8/+6
| | | | | | | | This patch fixes cross prefix stripping in the testsuite driver. The normalization logic used to only handle prefixes of the triple form <arch>-<vendor>-<os>, now it's relaxed to allow any number of tokens in the prefix tuple, so the cross prefix stripping logic would work when ghc is configured with something like --target=wasm32-wasi.
* ci: additional wasm32 manual jobs in validate pipelinesCheng Shao2023-04-272-2/+126
| | | | | | This patch enables bignum native & unregisterised wasm32 jobs as manual jobs in validate pipelines, which can be useful to prevent breakage when working on wasm32 related patches.
* ci: update ci.sh to actually run the entire testsuite for wasm backendCheng Shao2023-04-271-4/+5
| | | | | For the time being, we still need to use in-tree mode and can't test the bindist yet.
* EPA: Use ExplicitBraces only in HsModuleAlan Zimmerman2023-04-2621-162/+57
| | | | | | | | | !9018 brought in exact print annotations in LayoutInfo for open and close braces at the top level. But it retained them in the HsModule annotations too. Remove the originals, so exact printing uses LayoutInfo
* Refactor GenStgRhs to include the Type in both constructors (#23280, #22576, ↵Josh Meredith2023-04-2627-147/+140
| | | | | | | | | #22364) Carry the actual type of an expression through the PreStgRhs and into GenStgRhs for use in later stages. Currently this is used in the JavaScript backend to fix some tests from the above mentioned issues: EtaExpandLevPoly, RepPolyWrappedVar2, T13822, T14749.
* DmdAnal: Unleash demand signatures of free RULE and unfolding binders (#23208)Sebastian Graf2023-04-2614-356/+469
| | | | | | | | | | | | | | | | | | | | | | | | | | | In #23208 we observed that the demand signature of a binder occuring in a RULE wasn't unleashed, leading to a transitively used binder being discarded as absent. The solution was to use the same code path that we already use for handling exported bindings. See the changes to `Note [Absence analysis for stable unfoldings and RULES]` for more details. I took the chance to factor out the old notion of a `PlusDmdArg` (a pair of a `VarEnv Demand` and a `Divergence`) into `DmdEnv`, which fits nicely into our existing framework. As a result, I had to touch quite a few places in the code. This refactoring exposed a few small bugs around correct handling of bottoming demand environments. As a result, some strictness signatures now mention uniques that weren't there before which caused test output changes to T13143, T19969 and T22112. But these tests compared whole -ddump-simpl listings which is a very fragile thing to begin with. I changed what exactly they test for based on the symptoms in the corresponding issues. There is a single regression in T18894 because we are more conservative around stable unfoldings now. Unfortunately it is not easily fixed; let's wait until there is a concrete motivation before invest more time. Fixes #23208.
* Give more guarntees about ImplicitParams (#23289)Andrei Borzenkov2023-04-254-2/+37
| | | | | | | | | | | | | | | | - Added new section in the GHC user's guide that legends behavior of nested implicit parameter bindings in these two cases: let ?f = 1 in let ?f = 2 in ?f and data T where MkT :: (?f :: Int) => T f :: T -> T -> Int f MkT MkT = ?f - Added new test case to examine this behavior.
* JS: Fix h$base_access implementation (issue 22576)Josh Meredith2023-04-255-7/+11
|
* JS/base: provide implementation for mkdir (issue 22374)Josh Meredith2023-04-255-2/+31
|
* More informative errors for bad imports (#21826)Soham Chowdhury2023-04-2557-237/+474
|
* Add since pragma to Data.Functor.unzipBodigrim2023-04-241-1/+4
|
* hadrian: fix non-ghc program paths passed to testsuite driver when testing ↵Cheng Shao2023-04-241-4/+5
| | | | cross GHC
* compiler: don't install signal handlers when the host platform doesn't have ↵Cheng Shao2023-04-241-0/+8
| | | | | | | | | | signals Previously, large parts of GHC API will transitively invoke withSignalHandlers, which doesn't work on host platforms without signal functionality at all (e.g. wasm32-wasi). By making withSignalHandlers a no-op on those platforms, we can make more parts of GHC API work out of the box when signals aren't supported.
* rts: always build 64-bit atomic opsCheng Shao2023-04-246-71/+36
| | | | | | | | | | This patch does a few things: - Always build 64-bit atomic ops in rts/ghc-prim, even on 32-bit platforms - Remove legacy "64bit" cabal flag of rts package - Fix hs_xchg64 function prototype for 32-bit platforms - Fix AtomicFetch test for wasm32
* testsuite/T20137: Avoid impl.-defined behaviorBen Gamari2023-04-242-14/+14
| | | | | | | | Previously we would cast pointers to uint64_t. However, implementations are allowed to either zero- or sign-extend such casts. Instead cast to uintptr_t to avoid this. Fixes #23247.
* Fix doc typos in libraries/basetocic2023-04-237-9/+9
|
* Implement executablePath for Solaris and make getBaseDir less platform-dependentPHO2023-04-233-19/+50
| | | | | | | | | | Use base-4.17 executablePath when possible, and fall back on getExecutablePath when it's not available. The sole reason why getBaseDir had #ifdef's was apparently that getExecutablePath wasn't reliable, and we could reduce the number of CPP conditionals by making use of executablePath instead. Also export executablePath on js_HOST_ARCH.
* User's guide: DeepSubsumption is implied by Haskell{98,2010}amesgen2023-04-211-0/+2
|
* Minor doc fixesKrzysztof Gogolewski2023-04-215-13/+15
| | | | | | | | | - Add docs/index.html to .gitignore. It is created by ./hadrian/build docs, and it was the only file in Hadrian's templateRules not present in .gitignore. - Mention that MultiWayIf supports non-boolean guards - Remove documentation of optdll - removed in 2007, 763daed95 - Fix markdown syntax
* Testsuite: replace some js_broken/js_skip predicates with req_cSylvain Henry2023-04-215-9/+9
| | | | Using req_c is more precise.
* Fix doc typos in libraries/base/GHCtocic2023-04-216-8/+8
|
* testsuite: Add test for #23071Ben Gamari2023-04-202-0/+6
|
* rts: Initialize Array# header in listThreads#Ben Gamari2023-04-201-0/+1
| | | | | | | Previously the implementation of listThreads# failed to initialize the header of the created array, leading to various nastiness. Fixes #23071
* Implement -jsem: parallelism controlled by semaphoressheaf2023-04-2014-59/+714
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See https://github.com/ghc-proposals/ghc-proposals/pull/540/ for a complete description for the motivation for this feature. The `-jsem` option allows a build tool to pass a semaphore to GHC which GHC can use in order to control how much parallelism it requests. GHC itself acts as a client in the GHC jobserver protocol. ``` GHC Jobserver Protocol ~~~~~~~~~~~~~~~~~~~~~~ This proposal introduces the GHC Jobserver Protocol. This protocol allows a server to dynamically invoke many instances of a client process, while restricting all of those instances to use no more than <n> capabilities. This is achieved by coordination over a system semaphore (either a POSIX semaphore [6]_ in the case of Linux and Darwin, or a Win32 semaphore [7]_ in the case of Windows platforms). There are two kinds of participants in the GHC Jobserver protocol: - The *jobserver* creates a system semaphore with a certain number of available tokens. Each time the jobserver wants to spawn a new jobclient subprocess, it **must** first acquire a single token from the semaphore, before spawning the subprocess. This token **must** be released once the subprocess terminates. Once work is finished, the jobserver **must** destroy the semaphore it created. - A *jobclient* is a subprocess spawned by the jobserver or another jobclient. Each jobclient starts with one available token (its *implicit token*, which was acquired by the parent which spawned it), and can request more tokens through the Jobserver Protocol by waiting on the semaphore. Each time a jobclient wants to spawn a new jobclient subprocess, it **must** pass on a single token to the child jobclient. This token can either be the jobclient's implicit token, or another token which the jobclient acquired from the semaphore. Each jobclient **must** release exactly as many tokens as it has acquired from the semaphore (this does not include the implicit tokens). ``` Build tools such as cabal act as jobservers in the protocol and are responsibile for correctly creating, cleaning up and managing the semaphore. Adds a new submodule (semaphore-compat) for managing and interacting with semaphores in a cross-platform way. Fixes #19349
* Fix doc typo in GHC.Read.readListtocic2023-04-201-2/+2
|
* hadrian: Pass haddock file arguments in a response fileMatthew Pickering2023-04-202-1/+13
| | | | | | | | | | | In !10119 CI was failing on windows because the command line was too long. We can mitigate this by passing the file arguments to haddock in a response file. We can't easily pass all the arguments in a response file because the `+RTS` arguments can't be placed in the response file. Fixes #23273
* Testsuite: don't use obsolescent egrep (#22351)Sylvain Henry2023-04-194-7/+7
| | | | | | | | Recent egrep displays the following message, breaking golden tests: egrep: warning: egrep is obsolescent; using grep -E Switch to using "grep -E" instead
* CI: Disable abi-test-nightlyBryan Richter2023-04-191-0/+3
| | | | See #23269