1. 11 Dec, 2016 1 commit
    • Moritz Angermann's avatar
      Make globals use sharedCAF · c3c70244
      Moritz Angermann authored
      Summary:
      The use of globals is quite painful when multiple rts are loaded, e.g.
      when plugins are loaded, which bring in a second rts. The sharedCAF
      appraoch was employed for the FastStringTable; I've taken the libery
      to extend this to the other globals I could find.
      
      This is a reboot of D2575, that should hopefully not exhibit the same
      windows build issues.
      
      Reviewers: Phyx, simonmar, goldfire, bgamari, austin, hvr, erikd
      
      Reviewed By: Phyx, simonmar, bgamari
      
      Subscribers: mpickering, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2773
      c3c70244
  2. 10 Dec, 2016 2 commits
  3. 09 Dec, 2016 1 commit
  4. 08 Dec, 2016 1 commit
  5. 07 Dec, 2016 4 commits
    • Ben Gamari's avatar
      Don't barf() on failures in loadArchive() · 83d69dca
      Ben Gamari authored
      This patch replaces calls to barf() in loadArchive() with proper
      error handling.
      
      Test Plan: GHC CI
      
      Reviewers: rwbarton, erikd, hvr, austin, simonmar, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Tags: #ghc
      
      Differential Revision: https://phabricator.haskell.org/D2652
      
      GHC Trac Issues: #12388
      83d69dca
    • Ben Gamari's avatar
      rts: Use pthread itimer implementation on Darwin · d70d452a
      Ben Gamari authored
      We want to avoid using SIGALRM whenever possible since we will interrupt
      long-running system calls. See #10840.
      
      Test Plan: Validate on Darwin
      
      Reviewers: austin, erikd, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2796
      
      GHC Trac Issues: #10840
      d70d452a
    • Simon Marlow's avatar
      Fix crashes in hash table scanning with THREADED_RTS · 9043a400
      Simon Marlow authored
      See comments.
      9043a400
    • Simon Marlow's avatar
      Overhaul of Compact Regions (#12455) · 7036fde9
      Simon Marlow authored
      Summary:
      This commit makes various improvements and addresses some issues with
      Compact Regions (aka Compact Normal Forms).
      
      This was the most important thing I wanted to fix.  Compaction
      previously prevented GC from running until it was complete, which
      would be a problem in a multicore setting.  Now, we compact using a
      hand-written Cmm routine that can be interrupted at any point.  When a
      GC is triggered during a sharing-enabled compaction, the GC has to
      traverse and update the hash table, so this hash table is now stored
      in the StgCompactNFData object.
      
      Previously, compaction consisted of a deepseq using the NFData class,
      followed by a traversal in C code to copy the data.  This is now done
      in a single pass with hand-written Cmm (see rts/Compact.cmm). We no
      longer use the NFData instances, instead the Cmm routine evaluates
      components directly as it compacts.
      
      The new compaction is about 50% faster than the old one with no
      sharing, and a little faster on average with sharing (the cost of the
      hash table dominates when we're doing sharing).
      
      Static objects that don't (transitively) refer to any CAFs don't need
      to be copied into the compact region.  In particular this means we
      often avoid copying Char values and small Int values, because these
      are static closures in the runtime.
      
      Each Compact# object can support a single compactAdd# operation at any
      given time, so the Data.Compact library now enforces mutual exclusion
      using an MVar stored in the Compact object.
      
      We now get exceptions rather than killing everything with a barf()
      when we encounter an object that cannot be compacted (a function, or a
      mutable object).  We now also detect pinned objects, which can't be
      compacted either.
      
      The Data.Compact API has been refactored and cleaned up.  A new
      compactSize operation returns the size (in bytes) of the compact
      object.
      
      Most of the documentation is in the Haddock docs for the compact
      library, which I've expanded and improved here.
      
      Various comments in the code have been improved, especially the main
      Note [Compact Normal Forms] in rts/sm/CNF.c.
      
      I've added a few tests, and expanded a few of the tests that were
      there.  We now also run the tests with GHCi, and in a new test way
      that enables sanity checking (+RTS -DS).
      
      There's a benchmark in libraries/compact/tests/compact_bench.hs for
      measuring compaction speed and comparing sharing vs. no sharing.
      
      The field totalDataW in StgCompactNFData was unnecessary.
      
      Test Plan:
      * new unit tests
      * validate
      * tested manually that we can compact Data.Aeson data
      
      Reviewers: gcampax, bgamari, ezyang, austin, niteria, hvr, erikd
      
      Subscribers: thomie, simonpj
      
      Differential Revision: https://phabricator.haskell.org/D2751
      
      GHC Trac Issues: #12455
      7036fde9
  6. 06 Dec, 2016 2 commits
    • Simon Marlow's avatar
      Overhaul GC stats · 24e6594c
      Simon Marlow authored
      Summary:
      Visible API changes:
      
      * The C struct `GCDetails` gives the stats about a single GC.  This is
        passed to the `gcDone()` callback if one is set via the
        RtsConfig. (previously we just passed a collection of values, so this
        is more extensible, at the expense of breaking the existing API)
      
      * `RTSStats` gives cumulative stats since the start of the program,
        and includes the `GCDetails` for the most recent GC.  This struct
        can be obtained via `getRTSStats()` (the old `getGCStats()` has been
        removed, and `getGCStatsEnabled()` has been renamed to
        `getRTSStatsEnabled()`)
      
      Improvements:
      
      * The per-GC stats and cumulative stats are now cleanly separated.
      
      * Inside the RTS we have a top-level `RTSStats` struct to keep all our
        stats in, previously this was just a collection of strangely-named
        variables.  This struct is mostly just copied in `getRTSStats()`, so
        the implementation of that function is a lot shorter.
      
      * Types are more consistent.  We use a uint64_t byte count for all
        memory values, and Time for all time values.
      
      * Names are more consistent.  We use a suffix `_bytes` for all byte
        counts and `_ns` for all time values.
      
      * We now collect information about the amount of memory in large
        objects and compact objects in `GCDetails`. (the latter was the reason
        I started doing this patch but it seems to have ballooned a bit!)
      
      * I fixed a bug in the calculation of the elapsed MUT time, and added
        an ASSERT to stop the calculations going wrong in the future.
      
      For now I kept the Haskell API in `GHC.Stats` the same, by
      impedence-matching with the new API.  We could either break that API
      and make it match the C API more closely, or we could add a new API
      and deprecate the old one.  Opinions welcome.
      
      This stuff is very easy to get wrong, and it's hard to test.  Reviews
      welcome!
      
      Test Plan:
      manual testing
      validate
      
      Reviewers: bgamari, niteria, austin, ezyang, hvr, erikd, rwbarton, Phyx
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2756
      24e6594c
    • Tamar Christina's avatar
      Fix x86 Windows build and testsuite · b82f71b9
      Tamar Christina authored
      Summary:
      Fix issues preventing x86 GHC to build on Windows and
      fix segfault in the testsuite.
      
      Test Plan: ./validate
      
      Reviewers: austin, erikd, simonmar, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: #ghc_windows_task_force, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2789
      b82f71b9
  7. 02 Dec, 2016 1 commit
    • Alexander Vershilov's avatar
      Install toplevel handler inside fork. · 895a131f
      Alexander Vershilov authored
      When rts is forked it doesn't update toplevel handler, so UserInterrupt
      exception is sent to Thread1 that doesn't exist in forked process.
      
      We install toplevel handler when fork so signal will be delivered to the
      new main thread.
      
      Fixes #12903
      
      Reviewers: simonmar, austin, erikd, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2770
      
      GHC Trac Issues: #12903
      895a131f
  8. 01 Dec, 2016 2 commits
  9. 30 Nov, 2016 2 commits
  10. 29 Nov, 2016 5 commits
  11. 28 Nov, 2016 1 commit
  12. 18 Nov, 2016 2 commits
    • Gabor Greif's avatar
      Spelling in comment only · d328abc8
      Gabor Greif authored
      d328abc8
    • Tamar Christina's avatar
      Add missing SMP symbols to RT linker. · 94d1221c
      Tamar Christina authored
      Summary:
      Add some missing symbols that we
      export from the public headers but forgot to include
      in the runtime linker's symbol table.
      
      This is a bit of a unsatifactory patch, since we have a bit of a
      cat and mouse game going. We should find a way to automate this.
      
      But I know of no good solutions at the moment that won't add all
      rts symbols (including those we don't have an extern declaration for.).
      
      So for now, just add the ones reported missing.
      
      Test Plan: inplace/bin/ghc-stage2.exe --interactive
      
      Reviewers: RyanGlScott, austin, erikd, simonmar, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie, #ghc_windows_task_force
      
      Differential Revision: https://phabricator.haskell.org/D2727
      
      GHC Trac Issues: #12846
      94d1221c
  13. 17 Nov, 2016 1 commit
    • Tamar Christina's avatar
      Fix windows validate · b7695867
      Tamar Christina authored
      Summary:
      mark myindex as inline only and hide it from profilers.
      Also prevent this function from being used any other way
      than just for inlining.
      
      Test Plan: ./validate
      
      Reviewers: austin, erikd, simonmar, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie, #ghc_windows_task_force
      
      Differential Revision: https://phabricator.haskell.org/D2715
      b7695867
  14. 16 Nov, 2016 2 commits
    • shlevy's avatar
      Storage.c: Pass a size to sys_icache_invalidate · 0135188f
      shlevy authored
      The previous code passed an end pointer, but the interface takes a size
      instead.
      
      Fixes #12838.
      
      Reviewers: austin, erikd, simonmar, bgamari
      
      Reviewed By: simonmar, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2711
      
      GHC Trac Issues: #12838
      0135188f
    • shlevy's avatar
      Don't use mmap symbols when !RTS_LINKER_USE_MMAP · a637eeb7
      shlevy authored
      Some usages of symbols from sys/mman.h are guarded by
      RTS_LINKER_USE_MMAP by C conditionals, not CPP conditionals. Since those
      branches are dead anyway when !RTS_LINKER_USE_MMAP, we just stub out the
      relevant symbols rather than increasing CPP branching.
      
      Fixes #12839.
      
      Reviewers: simonmar, austin, bgamari, erikd
      
      Reviewed By: simonmar, bgamari, erikd
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2710
      
      GHC Trac Issues: #12839
      a637eeb7
  15. 15 Nov, 2016 1 commit
  16. 14 Nov, 2016 3 commits
    • Sylvain HENRY's avatar
      Skip 64-bit symbol tables · 1b336d90
      Sylvain HENRY authored
      This patch makes the RTS linker skip 64-bit symbol table entries.  See
      https://mail.haskell.org/pipermail/ghc-devs/2016-November/013210.html
      
      Test Plan: validate
      
      Reviewers: austin, erikd, simonmar, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: osa1, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2697
      
      GHC Trac Issues: #12827
      1b336d90
    • Simon Marlow's avatar
      Fix numa001 failure with "too many NUMA nodes" · e0ca7ff3
      Simon Marlow authored
      It seems that recent versions of the Linux kernel are using larger NUMA
      bitmasks; I see 1024 on my laptop running a 4.6.5 kernel.  This causes
      the NUMA tests to fail.  I'm fixing it to only fail if we have that many
      actual *nodes*, rather than failing if the size of the mask is too big.
      e0ca7ff3
    • Simon Marlow's avatar
      Remove CONSTR_STATIC · 55d535da
      Simon Marlow authored
      Summary:
      We currently have two info tables for a constructor
      
      * XXX_con_info: the info table for a heap-resident instance of the
        constructor, It has type CONSTR, or one of the specialised types like
        CONSTR_1_0
      
      * XXX_static_info: the info table for a static instance of this
        constructor, which has type CONSTR_STATIC or CONSTR_STATIC_NOCAF.
      
      I'm getting rid of the latter, and using the `con_info` info table for
      both static and dynamic constructors.  For rationale and more details
      see Note [static constructors] in SMRep.hs.
      
      I also removed these macros: `isSTATIC()`, `ip_STATIC()`,
      `closure_STATIC()`, since they relied on the CONSTR/CONSTR_STATIC
      distinction, and anyway HEAP_ALLOCED() does the same job.
      
      Test Plan: validate
      
      Reviewers: bgamari, simonpj, austin, gcampax, hvr, niteria, erikd
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2690
      
      GHC Trac Issues: #12455
      55d535da
  17. 13 Nov, 2016 1 commit
  18. 12 Nov, 2016 2 commits
  19. 11 Nov, 2016 1 commit
  20. 10 Nov, 2016 2 commits
  21. 06 Nov, 2016 1 commit
    • Tamar Christina's avatar
      Some minor linker cleanups. · 1964d869
      Tamar Christina authored
      Summary:
      Just some cleanups to some oddities I've noticed
      while investigating a linker issue.
      
      Particularly the dll name returned by `findSysDll`
      was decorated. So foo.dll is returned. We make it
      `foo.dll.dll` and later drop one `.dll` when passed to
      `addDll` which expects it without extension, but still
      tries the name *as is* which is why it worked.
      
      This should be slightly faster, since we don't try 4 loads
      before we succeed.
      
      Test Plan: ./validate
      
      Reviewers: austin, hvr, erikd, simonmar, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie, #ghc_windows_task_force
      
      Differential Revision: https://phabricator.haskell.org/D2680
      1964d869
  22. 02 Nov, 2016 2 commits