summaryrefslogtreecommitdiff
path: root/libraries/ghc-heap
Commit message (Collapse)AuthorAgeFilesLines
* Implement BoxedRep proposalwip/boxed-repBen Gamari2021-03-072-1/+9
| | | | | | | | | | | | | | | | | | | | | | | This implements the BoxedRep proposal, refactoring the `RuntimeRep` hierarchy from: ```haskell data RuntimeRep = LiftedPtrRep | UnliftedPtrRep | ... ``` to ```haskell data RuntimeRep = BoxedRep Levity | ... data Levity = Lifted | Unlifted ``` Updates binary, haddock submodules. Closes #17526. Metric Increase: T12545
* ghc-heap: Fix profiled buildBen Gamari2021-03-031-2/+2
| | | | | Previously a255b4e38918065ac028789872e53239ac30ae1a failed to update the non-profiling codepath.
* Fix array and cleanup conversion primops (#19026)Sylvain Henry2021-03-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first change makes the array ones use the proper fixed-size types, which also means that just like before, they can be used without explicit conversions with the boxed sized types. (Before, it was Int# / Word# on both sides, now it is fixed sized on both sides). For the second change, don't use "extend" or "narrow" in some of the user-facing primops names for conversions. - Names like `narrowInt32#` are misleading when `Int` is 32-bits. - Names like `extendInt64#` are flat-out wrong when `Int is 32-bits. - `narrow{Int,Word}<N>#` however map a type to itself, and so don't suffer from this problem. They are left as-is. These changes are batched together because Alex happend to use the array ops. We can only use released versions of Alex at this time, sadly, and I don't want to have to have a release thatwon't work for the final GHC 9.2. So by combining these we get all the changes for Alex done at once. Bump hackage state in a few places, and also make that workflow slightly easier for the future. Bump minimum Alex version Bump Cabal, array, bytestring, containers, text, and binary submodules
* Add missing instances to ghc-heap typesMatthew Pickering2021-02-022-8/+8
| | | | | | These instances are useful so that a `GenClosure` form `ghc-heap` can be used as a key in a `Map`. Therefore the order itself is not important but just the fact that there is one.
* Add explicit import lists to Data.List importsOleg Grenrus2021-01-291-1/+1
| | | | | | | | | | | | | Related to a future change in Data.List, https://downloads.haskell.org/ghc/8.10.3/docs/html/users_guide/using-warnings.html?highlight=wcompat#ghc-flag--Wcompat-unqualified-imports Companion pull&merge requests: - https://github.com/judah/haskeline/pull/153 - https://github.com/haskell/containers/pull/762 - https://gitlab.haskell.org/ghc/packages/hpc/-/merge_requests/9 After these the actual change in Data.List should be easy to do.
* ghc-heap: Allow more control about decoding CCS fieldsMatthew Pickering2021-01-225-15/+34
| | | | | | | | We have to be careful not to decode too much, too eagerly, as in ghc-debug this will lead to references to memory locations outside of the currently copied closure. Fixes #19038
* Revert "Implement BoxedRep proposal"Ben Gamari2020-12-152-9/+1
| | | | | | This was inadvertently merged. This reverts commit 6c2eb2232b39ff4720fda0a4a009fb6afbc9dcea.
* Implement BoxedRep proposalAndrew Martin2020-12-142-1/+9
| | | | | | | | | | | | | | | | | | This implements the BoxedRep proposal, refacoring the `RuntimeRep` hierarchy from: ```haskell data RuntimeRep = LiftedPtrRep | UnliftedPtrRep | ... ``` to ```haskell data RuntimeRep = BoxedRep Levity | ... data Levity = Lifted | Unlifted ``` Closes #17526.
* ghc-heap: partial TSO/STACK decodingDavid Eichmann2020-11-2816-4/+998
| | | | | | Co-authored-by: Sven Tennie <sven.tennie@gmail.com> Co-authored-by: Matthew Pickering <matthewtpickering@gmail.com> Co-authored-by: Ben Gamari <bgamari.foss@gmail.com>
* Split Up getClosureDataFromHeapRepMatthew Pickering2020-11-261-9/+18
| | | | | | | | | Motivation 1. Don't enforce the repeated decoding of an info table, when the client can cache it (ghc-debug) 2. Allow the constructor information decoding to be overridden, this casues segfaults in ghc-debug
* Remove special case for GHC.ByteCode.InstrMatthew Pickering2020-11-261-3/+1
| | | | | | | | | This was added in https://github.com/nomeata/ghc-heap-view/commit/34935206e51b9c86902481d84d2f368a6fd93423 GHC.ByteCode.Instr.BreakInfo no longer exists so the special case is dead code. Any check like this can be easily dealt with in client code.
* [Sized Cmm] properly retain sizes.Moritz Angermann2020-11-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces all Word<N> = W<N># Word# and Int<N> = I<N># Int# with Word<N> = W<N># Word<N># and Int<N> = I<N># Int<N>#, thus providing us with properly sized primitives in the codegenerator instead of pretending they are all full machine words. This came up when implementing darwinpcs for arm64. The darwinpcs reqires us to pack function argugments in excess of registers on the stack. While most procedure call standards (pcs) assume arguments are just passed in 8 byte slots; and thus the caller does not know the exact signature to make the call, darwinpcs requires us to adhere to the prototype, and thus have the correct sizes. If we specify CInt in the FFI call, it should correspond to the C int, and not just be Word sized, when it's only half the size. This does change the expected output of T16402 but the new result is no less correct as it eliminates the narrowing (instead of the `and` as was previously done). Bumps the array, bytestring, text, and binary submodules. Co-Authored-By: Ben Gamari <ben@well-typed.com> Metric Increase: T13701 T14697
* ghc-heap: expose decoding from heap representationDavid Eichmann2020-11-101-65/+112
| | | | | | Co-authored-by: Sven Tennie <sven.tennie@gmail.com> Co-authored-by: Matthew Pickering <matthewtpickering@gmail.com> Co-authored-by: Ben Gamari <bgamari.foss@gmail.com>
* Add hie.yaml to ghc-heapSven Tennie2020-08-111-0/+12
| | | | This enables IDE support by haskell-language-server for ghc-heap.
* winio: Add IOPort synchronization primitiveTamar Christina2020-07-151-1/+10
|
* Bump ghc-prim version to 0.7.0Ryan Scott2020-07-021-1/+1
| | | | Fixes #18279. Bumps the `text` submodule.
* Prepare to use run-time tablesNextToCode in compiler exclusivelyJoachim Breitner2020-03-261-2/+2
| | | | | | | Factor out CPP as much as possible to prepare for runtime determinattion. Progress towards #15548
* Update documentation for closureSizePaavo2020-03-131-1/+2
|
* Module hierarchy: ByteCode and Runtime (cf #13009)Sylvain Henry2020-02-121-2/+2
| | | | Update haddock submodule
* Make BCO# liftedBen Gamari2019-12-032-5/+2
| | | | | | | | | In #17424 Simon PJ noted that there is a potentially unsafe occurrence of unsafeCoerce#, coercing from an unlifted to lifted type. However, nowhere in the compiler do we assume that a BCO# is not a thunk. Moreover, in the case of a CAF the result returned by `createBCO` *will* be a thunk (as noted in [Updatable CAF BCOs]). Consequently it seems better to rather make BCO# a lifted type and rename it to BCO.
* Remove redundant 0s in ghc-heap pointer stringsÖmer Sinan Ağacan2019-10-311-3/+1
| | | | | | | | | Before: 0x0000004200c86888 After: 0x42000224f8 This is more concise and consistent with the RTS's printer (which uses %p formatter, and at least on Linux gcc prints the short form) and gdb's pointer formatter.
* Skip ghc_heap_all test in nonmoving waysBen Gamari2019-10-221-1/+2
|
* ghc-heap: Skip heap_all test with debugged RTSBen Gamari2019-10-221-1/+4
| | | | | | | | | | | | | | | | | The debugged RTS initializes the heap with 0xaa, which breaks the (admittedly rather fragile) assumption that uninitialized fields are set to 0x00: ``` Wrong exit code for heap_all(nonmoving)(expected 0 , actual 1 ) Stderr ( heap_all ): heap_all: user error (assertClosuresEq: Closures do not match Expected: FunClosure {info = StgInfoTable {entry = Nothing, ptrs = 0, nptrs = 1, tipe = FUN_0_1, srtlen = 0, code = Nothing}, ptrArgs = [], dataArgs = [0]} Actual: FunClosure {info = StgInfoTable {entry = Nothing, ptrs = 0, nptrs = 1, tipe = FUN_0_1, srtlen = 1032832, code = Nothing}, ptrArgs = [], dataArgs = [12297829382473034410]} CallStack (from HasCallStack): assertClosuresEq, called at heap_all.hs:230:9 in main:Main ) ```
* Switch to cabal-version=3.0 in ghc-heap.cabalAndrey Mokhov2019-10-071-1/+1
|
* Remove unneeded CPP now that GHC 8.6 is the minimumRyan Scott2019-09-253-20/+0
| | | | | | | The minimum required GHC version for bootstrapping is 8.6, so we can get rid of some unneeded `#if `__GLASGOW_HASKELL__` CPP guards, as well as one `MIN_VERSION_ghc_prim(0,5,3)` guard (since GHC 8.6 bundles `ghc-prim-0.5.3`).
* ghc-heap: implement WEAK closure type #16974Adam Sandberg Eriksson2019-07-266-0/+84
|
* ghc-heap: Add closure_size_noopt testBen Gamari2019-06-104-56/+77
| | | | | This adds a new test, only run in the `normal` way, to verify the size of FUNs and PAPs.
* testsuite: Fix and extend closure_size testBen Gamari2019-06-102-12/+84
| | | | | | | | | | | | | This was previously broken in several ways. This is fixed and it also now tests arrays. Unfortunately I was unable to find a way to continue testing PAP and FUN sizes; these simply depend too much upon the behavior of the simplifier. I also tried to extend this to test non-empty arrays as well but unfortunately this was non-trivial as the array card size constant isn't readily available from haskell. Fixes #16531.
* support small arrays and CONSTR_NOCAF in ghc-heapDavid Hewson2019-05-312-0/+16
|
* Use ghc-prim < 0.7, not <= 0.6.1, as upper version boundsRyan Scott2019-04-091-1/+1
| | | | | | | Using `ghc-prim <= 0.6.1` is somewhat dodgy from a PVP point of view, as it makes it awkward to support new minor releases of `ghc-prim`. Let's instead use `< 0.7`, which is the idiomatic way of expressing PVP-compliant upper version bounds.
* Replace git.haskell.org with gitlab.haskell.org (#16196)Yuriy Syrovetskiy2019-04-041-1/+1
|
* Bump ghc-prim's version where neededAlexandre2019-04-011-1/+1
|
* Fix a few broken Trac links [skip ci]Chaitanya Koparkar2019-03-273-3/+3
| | | | This patch only attempts to fix links that don't automatically re-direct to the correct URL.
* Update Wiki URLs to point to GitLabTakenobu Tani2019-03-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This moves all URL references to Trac Wiki to their corresponding GitLab counterparts. This substitution is classified as follows: 1. Automated substitution using sed with Ben's mapping rule [1] Old: ghc.haskell.org/trac/ghc/wiki/XxxYyy... New: gitlab.haskell.org/ghc/ghc/wikis/xxx-yyy... 2. Manual substitution for URLs containing `#` index Old: ghc.haskell.org/trac/ghc/wiki/XxxYyy...#Zzz New: gitlab.haskell.org/ghc/ghc/wikis/xxx-yyy...#zzz 3. Manual substitution for strings starting with `Commentary` Old: Commentary/XxxYyy... New: commentary/xxx-yyy... See also !539 [1]: https://gitlab.haskell.org/bgamari/gitlab-migration/blob/master/wiki-mapping.json
* ghc-heap: Introduce closureSizeBen Gamari2019-03-174-0/+51
| | | | | | This function allows the user to compute the (non-transitive) size of a heap object in words. The "closure" in the name is admittedly confusing but we are stuck with this nomenclature at this point.
* Implement -Wredundant-record-wildcards and -Wunused-record-wildcardsMatthew Pickering2019-02-141-1/+1
| | | | | | | | | -Wredundant-record-wildcards warns when a .. pattern binds no variables. -Wunused-record-wildcards warns when none of the variables bound by a .. pattern are used. These flags are enabled by `-Wall`.
* Fix some broken links (#15733)Fangyi Zhou2018-10-252-2/+2
| | | | | | | | | | | | | | | | Change some URLs from hackage.haskell.org/trac to ghc.haskell.org/trac Test Plan: manually verify links work Reviewers: bgamari, simonmar, mpickering Reviewed By: bgamari, mpickering Subscribers: mpickering, rwbarton, carter GHC Trac Issues: #15733 Differential Revision: https://phabricator.haskell.org/D5257
* ghc-heap: Fix writing closures on big endianPeter Trommler2018-10-151-1/+4
| | | | | | | | | | | | | | | | We need to write the closure type as a HalfWord not an Int. On big endian systems the closure type ends up being zero (the upper word of the Int) making the closure an invalid object. Test Plan: validate (preferably on a big endian system) Reviewers: bgamari, hvr, erikd, simonmar Reviewed By: simonmar Subscribers: rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5212
* NoImplicitPrelude in ghc-boot-th, ghc-boot, ghc-heap, ghciShayne Fletcher2018-09-189-0/+11
| | | | PR: https://github.com/ghc/ghc/pull/184
* Fix endian issues in ghc-heapPeter Trommler2018-07-271-0/+17
| | | | | | | | | | | | | | | | | | | | | | In test heap_all arity and n_args were swapped on big endian systems. Take care of endianness when reading parts of a machine word from a `Word`. This fixes one out of 36 failing tests reported in #15399. Test Plan: validate Reviewers: simonmar, bgamari, hvr, erikd Reviewed By: simonmar Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15399 Differential Revision: https://phabricator.haskell.org/D5001
* Support the GHCi debugger with -fexternal-interpreterSimon Marlow2018-07-163-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * All the tests in tests/ghci.debugger now pass with -fexternal-interpreter. These tests are now run with the ghci-ext way in addition to the normal way so we won't break it in the future. * I removed all the unsafeCoerce# calls from RtClosureInspect. Yay! The main changes are: * New messages: GetClosure and Seq. GetClosure is a remote interface to GHC.Exts.Heap.getClosureData, which required Binary instances for various datatypes. Fortunately this wasn't too painful thanks to DeriveGeneric. * No cheating by unsafeCoercing values when printing them. Now we have to turn the Closure representation back into the native representation when printing Int, Float, Double, Integer and Char. Of these, Integer was the most painful - we now have a dependency on integer-gmp due to needing access to the representation. * Fixed a bug in rts/Heap.c - it was bogusly returning stack content as pointers for an AP_STACK closure. Test Plan: * `cd testsuite/tests/ghci.debugger && make` * validate Reviewers: bgamari, patrickdoc, nomeata, angerman, hvr, erikd, goldfire Subscribers: alpmestan, snowleopard, rwbarton, thomie, carter GHC Trac Issues: #13184 Differential Revision: https://phabricator.haskell.org/D4955
* Rename some mutable closure types for consistencyÖmer Sinan Ağacan2018-06-052-5/+5
| | | | | | | | | | | | | | | | | | | | | | | SMALL_MUT_ARR_PTRS_FROZEN0 -> SMALL_MUT_ARR_PTRS_FROZEN_DIRTY SMALL_MUT_ARR_PTRS_FROZEN -> SMALL_MUT_ARR_PTRS_FROZEN_CLEAN MUT_ARR_PTRS_FROZEN0 -> MUT_ARR_PTRS_FROZEN_DIRTY MUT_ARR_PTRS_FROZEN -> MUT_ARR_PTRS_FROZEN_CLEAN Naming is now consistent with other CLEAR/DIRTY objects (MVAR, MUT_VAR, MUT_ARR_PTRS). (alternatively we could rename MVAR_DIRTY/MVAR_CLEAN etc. to MVAR0/MVAR) Removed a few comments in Scav.c about FROZEN0 being on the mut_list because it's now clear from the closure type. Reviewers: bgamari, simonmar, erikd Reviewed By: simonmar Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4784
* ghc-heap: Add dependency from GHC.Exts.Heap.Closures to InfoTableProfBen Gamari2018-05-301-0/+6
| | | | | | | `ghc -M` currently doesn't properly account for ways when generating dependencies (#15197). This import ensures correct build-ordering between this module and GHC.Exts.Heap.InfoTableProf. Otherwise the profiled build may fail as described in #15197.
* Update repository sub-dir for ghc-heap in ghc-heap.cabal.inAlp Mestanogullari2018-05-301-1/+1
| | | | | | | | | | Reviewers: bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4735
* ghc-prim: Bump versionBen Gamari2018-05-201-1/+1
| | | | | | | | | | | | | unpackClosure#'s behavior and type has changed. This caused a CPP guard in the new ghc-heap package to fail when bootstrapping with GHC 8.4. Test Plan: Validate bootstrapping with GHC 8.4 Reviewers: RyanGlScott Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4716
* Add HeapView functionalityPatrick Dougherty2018-05-2017-0/+1525
This pulls parts of Joachim Breitner's ghc-heap-view library inside GHC. The bits added are the C hooks into the RTS and a basic Haskell wrapper to these C hooks. The main reason for these to be added to GHC proper is that the code needs to be kept in sync with the closure types defined by the RTS. It is expected that the version of HeapView shipped with GHC will always work with that version of GHC and that extra functionality can be layered on top with a library like ghc-heap-view distributed via Hackage. Test Plan: validate Reviewers: simonmar, hvr, nomeata, austin, Phyx, bgamari, erikd Reviewed By: bgamari Subscribers: carter, patrickdoc, tmcgilchrist, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3055