summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* rts: don't return memory to OS on wasm32Cheng Shao2022-11-112-0/+8
| | | | | | This patch makes the storage manager not return any memory on wasm32. The detailed reason is described in Note [Megablock allocator on wasm].
* rts: LibffiAdjustor: adapt to ffi_alloc_prep_closure interface for wasm32Cheng Shao2022-11-111-10/+24
| | | | | | | libffi-wasm32 only supports non-standard libffi closure api via ffi_alloc_prep_closure(). This patch implements ffi_alloc_prep_closure() via standard libffi closure api on other targets, and uses it to implement adjustor functionality.
* rts: Schedule: no FORKPROCESS_PRIMOP_SUPPORTED on wasm32Cheng Shao2022-11-111-1/+1
| | | | | On wasm32 there isn't a process model at all, so no FORKPROCESS_PRIMOP_SUPPORTED.
* rts: RtsSymbols: empty RTS_POSIX_ONLY_SYMBOLS for wasm32Cheng Shao2022-11-111-1/+5
| | | | The default RTS_POSIX_ONLY_SYMBOLS doesn't make sense on wasm32.
* rts: no timer for wasm32Cheng Shao2022-11-112-0/+25
| | | | | | | Due to the lack of threads, on wasm32 there can't be a background timer that periodically resets the context switch flag. This patch disables timer for wasm32, and also makes the scheduler default to -C0 on wasm32 to avoid starving threads.
* rts: RtsStartup: chdir to PWD on wasm32Cheng Shao2022-11-111-0/+11
| | | | | | | | | | | | This patch adds a wasm32-specific behavior to RtsStartup logic. When the PWD environment variable is present, we chdir() to it first. The point is to workaround an issue in wasi-libc: it's currently not possible to specify the initial working directory, it always defaults to / (in the virtual filesystem mapped from some host directory). For some use cases this is sufficient, but there are some other cases (e.g. in the testsuite) where the program needs to access files outside.
* rts: wasm32 placeholder linkerCheng Shao2022-11-113-0/+15
| | | | | | This patch adds minimal placeholder linker logic for wasm32, just enough to unblock compiling rts on wasm32. RTS linker functionality is not properly implemented yet for wasm32.
* rts: checkSuid: don't do it when not HAVE_GETUIDCheng Shao2022-11-111-1/+1
| | | | | When getuid() is not present, don't do checkSuid since it doesn't make sense anyway on that target.
* rts: genericRaise: use exit() instead when not HAVE_RAISECheng Shao2022-11-111-1/+3
| | | | | We check existence of raise() in autoconf, and here, if not HAVE_RAISE, we should use exit() instead in genericRaise.
* rts: IPE.c: don't do mutex stuff when THREADED_RTS is not definedCheng Shao2022-11-111-0/+10
| | | | | This patch adds the missing THREADED_RTS CPP guard to mutex logic in IPE.c.
* rts: use HAVE_GETPID to guard subprocess related logicCheng Shao2022-11-113-2/+20
| | | | | | | We've previously added detection of getpid() in autoconf. This patch uses HAVE_GETPID to guard some subprocess related logic in the RTS. This is required for certain targets like wasm32-wasi, where there isn't a process model at all.
* rts: don't define RTS_USER_SIGNALS when signal.h is not presentCheng Shao2022-11-117-7/+32
| | | | | | | | In the rts, we have a RTS_USER_SIGNALS macro, and most signal-related logic is guarded with RTS_USER_SIGNALS. This patch extends the range of code guarded with RTS_USER_SIGNALS, and define RTS_USER_SIGNALS iff signal.h is actually detected by autoconf. This is required for wasm32-wasi to work, which lacks signals.
* rts: prefer ffi_type_void over FFI_TYPE_VOIDCheng Shao2022-11-111-1/+1
| | | | | | | | This patch uses ffi_type_void instead of FFI_TYPE_VOID in the interpreter code, since the FFI_TYPE_* macros are not available in libffi-wasm32 yet. The libffi public documentation also only mentions the lower-case ffi_type_* symbols, so we should prefer the lower-case API here.
* testsuite: correct sleep() signature in T5611Cheng Shao2022-11-112-4/+6
| | | | | In libc, sleep() returns an integer. The ccall type signature should match the libc definition, otherwise it causes linker error on wasm.
* rts: workaround cmm's improper variadic ccall breaking wasm32 typecheckingCheng Shao2022-11-116-10/+15
| | | | | | | | | | | | | | | | Unlike other targets, wasm requires the function signature of the call site and callee to strictly match. So in Cmm, when we call a C function that actually returns a value, we need to add an _unused local variable to receive it, otherwise type error awaits. An even bigger problem is calling variadic functions like barf() and such. Cmm doesn't support CAPI calling convention yet, so calls to variadic functions just happen to work in some cases with some target's ABI. But again, it doesn't work with wasm. Fortunately, the wasm C ABI lowers varargs to a stack pointer argument, and it can be passed NULL when no other arguments are expected to be passed. So we also add the additional unused NULL arguments to those functions, so to fix wasm, while not affecting behavior on other targets.
* deriveConstants: parse .ll output for wasm32 due to broken nmCheng Shao2022-11-111-2/+21
| | | | | | | This patch makes deriveConstants emit and parse an .ll file when targeting wasm. It's a necessary workaround for broken llvm-nm on wasm, which isn't capable of reporting correct constant values when parsing an object.
* Add support for the wasm32-wasi target tupleCheng Shao2022-11-1116-4/+35
| | | | | | This patch adds the wasm32-wasi tuple support to various places in the tree: autoconf, hadrian, ghc-boot and also the compiler. The codegen logic will come in subsequent commits.
* add new modules for reducibility and WebAssembly translationNorman Ramsey2022-11-115-0/+898
|
* add the two key graph modules from Martin Erwig's FGLNorman Ramsey2022-11-114-0/+1022
| | | | | | | | | | | | | | | | | | | | | | | | | | Martin Erwig's FGL (Functional Graph Library) provides an "inductive" representation of graphs. A general graph has labeled nodes and labeled edges. The key operation on a graph is to decompose it by removing one node, together with the edges that connect the node to the rest of the graph. There is also an inverse composition operation. The decomposition and composition operations make this representation of graphs exceptionally well suited to implement graph algorithms in which the graph is continually changing, as alluded to in #21259. This commit adds `GHC.Data.Graph.Inductive.Graph`, which defines the interface, and `GHC.Data.Graph.Inductive.PatriciaTree`, which provides an implementation. Both modules are taken from `fgl-5.7.0.3` on Hackage, with these changes: - Copyright and license text have been copied into the files themselves, not stored separately. - Some calls to `error` have been replaced with calls to `panic`. - Conditional-compilation support for older versions of GHC, `containers`, and `base` has been removed.
* Fix Cmm symbol kindCheng Shao2022-11-1113-14/+237
|
* hadrian: add targetSupportsThreadedRts flagCheng Shao2022-11-119-18/+39
| | | | | | | | | | | | | | This patch adds a targetSupportsThreadedRts flag to indicate whether the target supports the threaded rts at all, different from existing targetSupportsSMP that checks whether -N is supported by the RTS. All existing flavours have also been updated accordingly to respect this flags. Some targets (e.g. wasm32-wasi) does not support the threaded rts, therefore this flag is needed for the default flavours to work. It makes more sense to have proper autoconf logic to check for threading support, but for the time being, we just set the flag to False iff the target is wasm32.
* hadrian: add -Wwarn only for cross-compiling unixCheng Shao2022-11-111-1/+11
|
* autoconf: check getpid getuid raiseCheng Shao2022-11-111-0/+2
| | | | | This patch adds checks for getpid, getuid and raise in autoconf. These functions are absent in wasm32-wasi and thus needs to be checked.
* Boxity: Handle argument budget of unboxed tuples correctly (#21737)Sebastian Graf2022-11-105-50/+252
| | | | | | | Now Budget roughly tracks the combined width of all arguments after unarisation. See the changes to `Note [Worker argument budgets]`. Fixes #21737.
* WorkWrap: Unboxing unboxed tuples is not always useful (#22388)Sebastian Graf2022-11-104-12/+136
| | | | | | See Note [Unboxing through unboxed tuples]. Fixes #22388.
* Fix DsUselessSpecialiseForClassMethodSelector msgwip/T21851Simon Peyton Jones2022-11-101-1/+1
| | | | | The error message for DsUselessSpecialiseForClassMethodSelector was just wrong (a typo in some earlier work); trivial fix
* Make indexError work betterSimon Peyton Jones2022-11-102-3/+24
| | | | | | | | | | | | | | | The problem here is described at some length in Note [Boxity for bottoming functions] and Note [Reboxed crud for bottoming calls] in GHC.Core.Opt.DmdAnal. This patch adds a SPECIALISE pragma for indexError, which makes it much less vulnerable to the problem described in these Notes. (This came up in another line of work, where a small change made indexError do reboxing (in nofib/spectral/simple/table_sort) that didn't happen before my change. I've opened #22404 to document the fagility.
* Fire RULES in the SpecialiserSimon Peyton Jones2022-11-1017-237/+521
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Specialiser has, for some time, fires class-op RULES in the specialiser itself: see Note [Specialisation modulo dictionary selectors] This MR beefs it up a bit, so that it fires /all/ RULES in the specialiser, not just class-op rules. See Note [Fire rules in the specialiser] The result is a bit more specialisation; see test simplCore/should_compile/T21851_2 This pushed me into a bit of refactoring. I made a new data types GHC.Core.Rules.RuleEnv, which combines - the several source of rules (local, home-package, external) - the orphan-module dependencies in a single record for `getRules` to consult. That drove a bunch of follow-on refactoring, including allowing me to remove cr_visible_orphan_mods from the CoreReader data type. I moved some of the RuleBase/RuleEnv stuff into GHC.Core.Rule. The reorganisation in the Simplifier improve compile times a bit (geom mean -0.1%), but T9961 is an outlier Metric Decrease: T9961
* GHCi tags generation phase 2Hécate Moonlight2022-11-091-1/+1
| | | | see #19884
* Use TcRnDiagnostic in GHC.Tc.TyCl.Instance (#20117)Giles Anderson2022-11-0948-110/+257
| | | | | | | | | | | | The following `TcRnDiagnostic` messages have been introduced: TcRnWarnUnsatisfiedMinimalDefinition TcRnMisplacedInstSig TcRnBadBootFamInstDeclErr TcRnIllegalFamilyInstance TcRnAssocInClassErr TcRnBadFamInstDecl TcRnNotOpenFamily
* Document what Alternative/MonadPlus instances actually doJade Lovelace2022-11-082-8/+26
|
* Add example for (<$)Jade Lovelace2022-11-081-0/+9
|
* Clarify msum/asum documentationJade Lovelace2022-11-081-2/+8
|
* Fix TypeData issues (fixes #22315 and #22332)Ross Paterson2022-11-0828-74/+261
| | | | | | | | | | | | | | | | | | | | | | | | There were two bugs here: 1. Treating type-level constructors as PromotedDataCon doesn't always work, in particular because constructors promoted via DataKinds are called both T and 'T. (Tests T22332a, T22332b, T22315a, T22315b) Fix: guard these cases with isDataKindsPromotedDataCon. 2. Type-level constructors were sent to the code generator, producing things like constructor wrappers. (Tests T22332a, T22332b) Fix: test for them in isDataTyCon. Other changes: * changed the marking of "type data" DataCon's as suggested by SPJ. * added a test TDGADT for a type-level GADT. * comment tweaks * change tcIfaceTyCon to ignore IfaceTyConInfo, so that IfaceTyConInfo is used only for pretty printing, not for typechecking. (SPJ)
* Define `Infinite` list and use where appropriate.M Farkas-Dyck2022-11-0821-89/+300
| | | | | | | | Also add perf test for infinite list fusion. In particular, in `GHC.Core`, often we deal with infinite lists of roles. Also in a few locations we deal with infinite lists of names. Thanks to simonpj for helping to write the Note [Fusion for `Infinite` lists].
* bump llvm upper boundCarter Schonwald2022-11-071-1/+1
|
* Bump haskeline submodulewip/bump-boot-librariesCheng Shao2022-11-061-0/+0
| | | | Includes a fix for wasm support, doesn't impact other targets.
* Bump gmp-tarballs submoduleCheng Shao2022-11-061-0/+0
| | | | Includes a fix for wasm support, doesn't impact other targets.
* Bump ci-images revisionCheng Shao2022-11-061-1/+1
| | | | ci-images has recently been updated, including changes needed for wasm32-wasi CI.
* Bump Win32 submodule to 2.13.4.0Matthew Pickering2022-11-053-2/+2
| | | | Fixes #22098
* Bump unix submodule to 2.8.0.0Matthew Pickering2022-11-055-4/+9
| | | | | | | | | | Also bumps process and ghc-boot bounds on unix. For hadrian, when cross-compiling, we add -Wwarn=unused-imports -Wwarn=unused-top-binds to validation flavour. Further fixes in unix and/or hsc2hs is needed to make it completely free of warnings; for the time being, this change is needed to unblock other cross-compilation related work.
* Minor refactor around FastStringsKrzysztof Gogolewski2022-11-0536-95/+102
| | | | | | | Pass FastStrings to functions directly, to make sure the rule for fsLit "literal" fires. Remove SDoc indirection in GHCi.UI.Tags and GHC.Unit.Module.Graph.
* CI: Allow hadrian-ghc-in-ghci to run in nightliesBryan Richter2022-11-041-1/+4
| | | | | | | Since lint-submods doesn't run in nightlies, hadrian-ghc-in-ghci needs to mark it as "optional" so it can run if the job doesn't exist. Fixes #22396.
* Export pprTrace and friends from GHC.Prelude.Andreas Klebinger2022-11-0369-127/+146
| | | | | Introduces GHC.Prelude.Basic which can be used in modules which are a dependency of the ppr code.
* Fix haddocks for GHC.IORefBodigrim2022-11-031-2/+2
|
* Clarify status of bindings in WholeCoreBindingsMatthew Pickering2022-11-032-5/+5
| | | | | | | | | Gergo points out that these bindings are tidied, rather than prepd as the variable claims. Therefore we update the name of the variable to reflect reality and add a comment to the data type to try to erase any future confusion. Fixes #22307
* git: ignore HIE files.M Farkas-Dyck2022-11-031-0/+2
| | | | Cleans up git status if one sets -fwrite-ide-info in hadrian/ghci.
* Port foundation numeric tests to GHC testsuiteMatthew Pickering2022-11-033-0/+838
| | | | | | | | | | | | | This commit ports the numeric tests which found a regression in GHC-9.4. https://github.com/haskell-foundation/foundation/issues/571 Included in the commit is a simple random number generator and simplified QuickCheck implementation. In future these could be factored out of this standalone file and reused as a general purpose library which could be used for other QuickCheck style tests in the testsuite. See #22282
* gen-dll: Drop itBen Gamari2022-11-035-562/+0
| | | | | | | | | Currently it is only used by the make build system, which is soon to be retired, and it has not built since 41cf758b. We may need to reintroduce it when dynamic-linking support is introduced on Windows, but we will cross that bridge once we get there. Fixes #21753.
* Move Symbol implementation note out of public haddockOleg Grenrus2022-11-021-1/+2
|