This project is mirrored from https://gitlab.haskell.org/ghc/ghc.git. Pull mirroring failed .
Repository mirroring has been paused due to too many failed attempts, and can be resumed by a project maintainer.
Last successful update .
  1. 19 Oct, 2019 2 commits
  2. 18 Oct, 2019 1 commit
  3. 12 Oct, 2019 1 commit
  4. 03 Oct, 2019 1 commit
  5. 01 Sep, 2019 1 commit
  6. 03 Aug, 2019 1 commit
    • Ben Gamari's avatar
      rts: Always truncate output files · 4664bafc
      Ben Gamari authored
      Previously there were numerous places in the RTS where we would fopen
      with the "w" flag string. This is wrong as it will not truncate the
      file. Consequently if we write less data than the previous length of the
      file we will leave garbage at its end.
      
      Fixes #16993.
      4664bafc
  7. 11 Jun, 2019 1 commit
  8. 15 Mar, 2019 1 commit
  9. 30 Jan, 2019 3 commits
    • Zejun Wu's avatar
      Add a RTS option -xp to load PIC object anywhere in address space · e29b1ee7
      Zejun Wu authored
      Summary:
      This re-applies {D5195} with fixes for i386:
      * Fix unused label warnings, see {D5230} or {D5273}
      * Fix a silly bug introduced by moving `#if`
      
      {P190}
      
      Add a RTS option -xp to load PIC object anywhere in address space. We do
      this by relaxing the requirement of <0x80000000 result of
      `mmapForLinker` and implying USE_CONTIGUOUS_MMAP.
      
      We also need to change calls to `ocInit` and `ocGetNames` to avoid
      dangling pointers when the address of `oc->image` is changed by
      `ocAllocateSymbolExtra`.
      
      Test Plan:
      See {D5195}, also test under i386:
      
      ```
      $ uname -a
      Linux watashi-arch32 4.18.5-arch1-1.0-ARCH #1 SMP PREEMPT Tue Aug 28
      20:45:30 CEST 2018 i686 GNU/Linux
      $ cd testsuite/tests/th/ && make test
      ...
      ```
      
      will run `./validate` on stacked diff.
      
      Reviewers: simonmar, bgamari, alpmestan, trommler, hvr, erikd
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5289
      e29b1ee7
    • Ben Gamari's avatar
      Revert "Batch merge" · 172a5933
      Ben Gamari authored
      This reverts commit 76c8fd67.
      172a5933
    • Ben Gamari's avatar
      Batch merge · 76c8fd67
      Ben Gamari authored
      76c8fd67
  10. 16 Jan, 2019 2 commits
  11. 14 Dec, 2018 1 commit
  12. 11 Dec, 2018 1 commit
  13. 02 Nov, 2018 1 commit
  14. 31 Oct, 2018 1 commit
  15. 15 Oct, 2018 1 commit
    • Zejun Wu's avatar
      Add a RTS option -xp to load PIC object anywhere in address space · 104599f3
      Zejun Wu authored
      Add a RTS option -xp to load PIC object anywhere in address space. We do
      this by relaxing the requirement of <0x80000000 result of
      `mmapForLinker` and implying USE_CONTIGUOUS_MMAP.
      
      We also need to change calls to `ocInit` and `ocGetNames` to avoid
      dangling pointers when the address of `oc->image` is changed by
      `ocAllocateSymbolExtra`.
      
      Test Plan:
      ```
      $ uname -a
      Linux localhost 4.18.8-arch1-1-ARCH #1 SMP PREEMPT Sat Sep 15 20:34:48
      UTC 2018 x86_64 GNU/Linux
      $ cat mk/build.mk
      DYNAMIC_GHC_PROGRAMS = NO
      DYNAMIC_BY_DEFAULT = NO
      
      GhcRTSWays += thr_debug
      EXTRA_HC_OPTS += -debug
      WAY_p_HC_OPTS += -fPIC -fexternal-dynamic-refs
      $ inplace/bin/ghc-stage2 --interactive -prof +RTS -xp
      GHCi, version 8.7.20180928: http://www.haskell.org/ghc/  :? for help
      ghc-stage2: R_X86_64_32 relocation out of range:
      ghczmprim_GHCziTypes_ZMZN_closure = 7f690bffab59
      Recompile
      /data/users/watashi/ghc/libraries/ghc-prim/dist-install/build/HSghc-prim
      -0.5.3.o with -fPIC -fexternal-dynamic-refs.
      ghc-stage2: unable to load package `ghc-prim-0.5.3'
      $ strace -f -e open,mmap inplace/bin/ghc-stage2 --interactive -prof
      -fexternal-interpreter  -opti+RTS -opti-xp
      ...
      [pid 1355283]
      open("/data/users/watashi/ghc/libraries/base/dist-install/build/libHSbas
      e-4.12.0.0_p.a", O_RDONLY) = 14
      [pid 1355283] mmap(NULL, 8192, PROT_READ|PROT_WRITE|PROT_EXEC,
      MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6a84842000
      [pid 1355283]
      open("/data/users/watashi/ghc/libraries/base/dist-install/build/libHSbas
      e-4.12.0.0_p.a", O_RDONLY) = 14
      [pid 1355283] mmap(NULL, 8192, PROT_READ|PROT_WRITE|PROT_EXEC,
      MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6a84676000
      ...
      Prelude> System.Posix.Process.getProcessID
      ...
      [pid 1355283]
      open("/data/users/watashi/ghc/libraries/unix/dist-install/build/libHSuni
      x-2.7.2.2_p.a", O_RDONLY) = 14
      [pid 1355283] mmap(NULL, 45056, PROT_READ|PROT_WRITE|PROT_EXEC,
      MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6a67d60000
      [pid 1355283]
      open("/data/users/watashi/ghc/libraries/unix/dist-install/build/libHSuni
      x-2.7.2.2_p.a", O_RDONLY) = 14
      [pid 1355283] mmap(NULL, 57344, PROT_READ|PROT_WRITE|PROT_EXEC,
      MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6a67d52000
      ...
      ```
      
      ```
      $ uname -a
      Darwin watashis-iMac.local 18.0.0 Darwin Kernel Version 18.0.0: Wed Aug
      22 20:13:40 PDT 2018; root:xnu-4903.201.2~1/RELEASE_X86_64 x86_64
      $ mv
      /Users/watashi/gao/ghc/libraries/integer-gmp/dist-install/build/HSintege
      r-gmp-1.0.2.0.o{,._DISABLE_GHC_ISSUE_15105}
      $ inplace/bin/ghc-stage2 --interactive  +RTS -xp
      GHCi, version 8.7.20181003: http://www.haskell.org/ghc/  :? for help
      Prelude> System.Posix.Process.getProcessID
      42791
      Prelude> Data.Set.fromList [1 .. 10]
      fromList [1,2,3,4,5,6,7,8,9,10]
      Prelude>
      Leaving GHCi.
      $ inplace/bin/ghc-stage2 --interactive -prof -fexternal-interpreter
      GHCi, version 8.7.20181003: http://www.haskell.org/ghc/  :? for help
      Prelude> System.Posix.Process.getProcessID
      42806
      Prelude> Data.Set.fromList [1 .. 10]
      fromList [1,2,3,4,5,6,7,8,9,10]
      Prelude>
      Leaving GHCi.
      ```
      
      Also test with something that used to hit the 2Gb limit and it loads
      and runs without problem.
      
      Reviewers: simonmar, bgamari, angerman, Phyx, hvr, erikd
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5195
      104599f3
  16. 21 Aug, 2018 1 commit
  17. 03 May, 2018 1 commit
  18. 01 May, 2018 2 commits
    • Ben Gamari's avatar
      rts: Allow profiling by closure type in prof way · b7b6617a
      Ben Gamari authored
      Previously we inexplicably disabled support for `-hT` profiling in the profiled
      way. Admittedly, there are relatively few cases where one would prefer -hT to
      `-hd`, but the option should nevertheless be available for the sake of
      consistency.
      
      Note that this does mean that there is a bit of an inconsistency in the behavior
      of `-h`: in the profiled way `-h` behaves like `-hc` whereas in the non-profiled
      way it defaults to `-hT`.
      b7b6617a
    • Ben Gamari's avatar
      rts: Add -hT to the rts usage message · 260e23b4
      Ben Gamari authored
      Reviewers: erikd, simonmar
      
      Subscribers: thomie, carter
      
      GHC Trac Issues: #15086
      
      Differential Revision: https://phabricator.haskell.org/D4643
      260e23b4
  19. 31 Mar, 2018 1 commit
    • Tamar Christina's avatar
      Remove MAX_PATH restrictions from RTS, I/O manager and various utilities · 4de585a5
      Tamar Christina authored
      Summary:
      This shims out fopen and sopen so that they use modern APIs under the hood
      along with namespaced paths.
      
      This lifts the MAX_PATH restrictions from Haskell programs and makes the new
      limit ~32k.
      
      There are only some slight caveats that have been documented.
      
      Some utilities have not been upgraded such as lndir, since all these things are
      different cabal packages I have been forced to copy the source in different places
      which is less than ideal. But it's the only way to keep sdist working.
      
      Test Plan: ./validate
      
      Reviewers: hvr, bgamari, erikd, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #10822
      
      Differential Revision: https://phabricator.haskell.org/D4416
      4de585a5
  20. 19 Mar, 2018 1 commit
    • duog's avatar
      rts: Add --internal-counters RTS flag and several counters · 2918abf7
      duog authored
      The existing internal counters:
      * gc_alloc_block_sync
      * whitehole_spin
      * gen[g].sync
      * gen[1].sync
      
      are now not shown in the -s report unless --internal-counters is also passed.
      
      If --internal-counters is passed we now show the counters above, reformatted, as
      well as several other counters. In particular, we now count the yieldThread()
      calls that SpinLocks do as well as their spins.
      
      The added counters are:
      * gc_spin (spin and yield)
      * mut_spin (spin and yield)
      * whitehole_threadPaused (spin only)
      * whitehole_executeMessage (spin only)
      * whitehole_lockClosure (spin only)
      * waitForGcThreadsd (spin and yield)
      
      As well as the following, which are not SpinLock-like things:
      * any_work
      * do_work
      * scav_find_work
      
      See the Note for descriptions of what these counters are.
      
      We add busy_wait_nops in these loops along with the counter increment where it
      was absent.
      
      Old internal counters output:
      ```
      gc_alloc_block_sync: 0
      whitehole_gc_spin: 0
      gen[0].sync: 0
      gen[1].sync: 0
      ```
      
      New internal counters output:
      ```
      Internal Counters:
                                                 Spins        Yields
          gc_alloc_block_sync                      323             0
          gc_spin                              9016713           752
          mut_spin                            57360944         47716
          whitehole_gc                               0           n/a
          whitehole_threadPaused                     0           n/a
          whitehole_executeMessage                   0           n/a
          whitehole_lockClosure                      0             0
          waitForGcThreads                           2           415
          gen[0].sync                                6             0
          gen[1].sync                                1             0
      
          any_work                                2017
          no_work                                 2014
          scav_find_work                          1004
      ```
      
      Test Plan:
      ./validate
      
      Check it builds with #define PROF_SPIN removed from includes/rts/Config.h
      
      Reviewers: bgamari, erikd, simonmar, hvr
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #3553, #9221
      
      Differential Revision: https://phabricator.haskell.org/D4302
      2918abf7
  21. 08 Mar, 2018 1 commit
  22. 02 Mar, 2018 1 commit
  23. 11 Dec, 2017 1 commit
  24. 27 Nov, 2017 1 commit
  25. 16 Nov, 2017 1 commit
    • Simon Marlow's avatar
      Detect overly long GC sync · 2f463873
      Simon Marlow authored
      Summary:
      GC sync is the time between a GC being intiated and all the mutator
      threads finally stopping so that the GC can start. Problems that cause
      the GC sync to be delayed are hard to find and can cause dramatic
      slowdowns for heavily parallel programs.
      
      The new flag --long-gc-sync=<time> helps by emitting a warning and
      calling a user-overridable hook when the GC sync time exceeds the
      specified threshold. A debugger can be used to set a breakpoint when
      this happens and inspect the stacks of threads to find the culprit.
      
      Test Plan:
      ```
      $ ./inplace/bin/ghc-stage2 +RTS --long-gc-sync=0.0000001 -S
          Alloc    Copied     Live     GC     GC      TOT      TOT  Page Flts
          bytes     bytes     bytes   user   elap     user     elap
        1135856     51144    153736  0.000  0.000    0.002    0.002    0    0  (Gen:  0)
        1034760     94704    188752  0.000  0.000    0.002    0.002    0    0  (Gen:  0)
        1038888    134832    228888  0.009  0.009    0.011    0.011    0    0  (Gen:  1)
        1025288     90128    235184  0.000  0.000    0.012    0.012    0    0  (Gen:  0)
        1049088    130080    333984  0.000  0.000    0.013    0.013    0    0  (Gen:  0)
      Warning: waited 0us for GC sync
        1034424     73360    331976  0.000  0.000    0.013    0.013    0    0  (Gen:  0)
      ```
      
      Also tested on a real production problem.
      
      Reviewers: niteria, bgamari, erikd
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D4193
      2f463873
  26. 22 Oct, 2017 1 commit
    • Tamar Christina's avatar
      Add stack traces on crashes on Windows · 99c61e22
      Tamar Christina authored
      Summary:
      This patch adds the ability to generate stack traces on crashes for Windows.
      When running in the interpreter this attempts to use symbol information from
      the interpreter and information we know about the loaded object files to
      resolve addresses to symbols.
      
      When running compiled it doesn't have this information and then defaults
      to using symbol information from PDB files. Which for now means only
      files compiled with ICC or MSVC will show traces compiled.
      
      But I have a future patch that may address this shortcoming.
      
      Also since I don't know how to walk a pure haskell stack, I can for now
      only show the last entry. I'm hoping to figure out how Apply.cmm works to
      be able to walk the stalk and give more entries for pure haskell code.
      
      In GHCi
      
      ```
      $ echo main | inplace/bin/ghc-stage2.exe --interactive ./testsuite/tests/rts/derefnull.hs
      GHCi, version 8.3.20170830: http://www.haskell.org/ghc/  :? for help
      Ok, 1 module loaded.
      Prelude Main>
      Access violation in generated code when reading 0x0
      
       Attempting to reconstruct a stack trace...
      
         Frame        Code address
       * 0x77cde10    0xc370229 E:\..\base\dist-install\build\HSbase-4.10.0.0.o+0x190031
                       (base_ForeignziStorable_zdfStorableInt4_info+0x3f)
      ```
      
      and compiled
      
      ```
      Access violation in generated code when reading 0x0
      
       Attempting to reconstruct a stack trace...
      
         Frame        Code address
       * 0xf0dbd0     0x40bb01 E:\..\rts\derefnull.run\derefnull.exe+0xbb01
      ```
      
      Test Plan: ./validate
      
      Reviewers: austin, hvr, bgamari, erikd, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3913
      99c61e22
  27. 03 Oct, 2017 1 commit
    • Tamar Christina's avatar
      Add ability to produce crash dumps on Windows · ec9ac20d
      Tamar Christina authored
      It's often hard to debug things like segfaults on Windows,
      mostly because gdb isn't always of use and users don't know
      how to effectively use it.
      
      This patch provides a way to create a crash drump by passing
      
      `+RTS --generate-crash-dumps` as an option. If any unhandled
      exception is triggered a dump is made that contains enough
      information to be able to diagnose things successfully.
      
      Currently the created dumps are a bit big because I include
      all registers, code and threads information.
      
      This looks like
      
      ```
      $ testsuite/tests/rts/derefnull.run/derefnull.exe +RTS
      --generate-crash-dumps
      
      Access violation in generated code when reading 0000000000000000
      Crash dump created. Dump written to:
              E:\msys64\tmp\ghc-20170901-220250-11216-16628.dmp
      ```
      
      Test Plan: ./validate
      
      Reviewers: austin, hvr, bgamari, erikd, simonmar
      
      Reviewed By: bgamari, simonmar
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3912
      ec9ac20d
  28. 26 Sep, 2017 3 commits
    • Tamar Christina's avatar
      Switch VEH to VCH and allow disabling of SEH completely. · 1421d87c
      Tamar Christina authored
      Exception handling on Windows is unfortunately a bit complicated.
      But essentially the VEH Handlers we currently have are running too
      early.
      
      This was a problem as it ran so early it also swallowed C++ exceptions
      and other software exceptions which the system could have very well
      recovered from.
      
      So instead we use a sequence of chains to for the exception handlers to
      run as late as possible. You really can't get any later than this.
      
      Please read the comment in the patch for more details.
      
      I'm also providing a switch to allow people to turn off the exception
      handling entirely. In case it does present a problem with their code.
      
      (Reverted and recommitted to fix authorship information)
      
      Test Plan: ./validate
      
      Reviewers: austin, hvr, bgamari, erikd, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13911, #12110
      
      Differential Revision: https://phabricator.haskell.org/D3911
      1421d87c
    • Ben Gamari's avatar
      Revert "Switch VEH to VCH and allow disabling of SEH completely." · 47888fd8
      Ben Gamari authored
      Reverting to fix authorship of commit.
      
      This reverts commit 1825cbdb.
      47888fd8
    • Ben Gamari's avatar
      Switch VEH to VCH and allow disabling of SEH completely. · 1825cbdb
      Ben Gamari authored
      Exception handling on Windows is unfortunately a bit complicated.
      But essentially the VEH Handlers we currently have are running too
      early.
      
      This was a problem as it ran so early it also swallowed C++ exceptions
      and other software exceptions which the system could have very well
      recovered from.
      
      So instead we use a sequence of chains to for the exception handlers to
      run as late as possible. You really can't get any later than this.
      
      Please read the comment in the patch for more details.
      
      I'm also providing a switch to allow people to turn off the exception
      handling entirely. In case it does present a problem with their code.
      
      Test Plan: ./validate
      
      Reviewers: austin, hvr, bgamari, erikd, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13911, #12110
      
      Differential Revision: https://phabricator.haskell.org/D3911
      1825cbdb
  29. 14 Sep, 2017 1 commit
    • niteria's avatar
      [RTS] Make -po work · b6b56dd1
      niteria authored
      db2a6676 added `-po` option, but
      the part that parses it was missing.
      
      Test Plan:
      On a simple file:
      ```
      ./inplace/bin/ghc-stage2 A.hs -prof -main-is A; ./A +RTS -P -potest
      ```
      produced test.prof file and didn't produce A.prof file.
      
      ```
      ./A +RTS -P
      ```
      produced A.prof file
      
      Reviewers: simonmar, bgamari, austin, erikd
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3946
      b6b56dd1
  30. 13 Sep, 2017 1 commit
    • niteria's avatar
      [RTS] Harden against buffer overflow · e62391a7
      niteria authored
      This sprintf is safe thanks to the guarantees on the format strings that
      we pass to it.  Well, almost. The GR_FILENAME_FMT_GUM format would not
      have satisfied them if it was still used.
      
      If someone makes a mistake that's a potential privilege escalation,
      so I think it's reasonable to switch to snprintf to protect against
      that remote possibility.
      
      Test Plan: it builds, CI
      
      Reviewers: simonmar, bgamari, austin, erikd
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3944
      e62391a7
  31. 28 Jul, 2017 1 commit
    • Andreas Klebinger's avatar
      Add rtsopts ignore and ignoreAll. · d75bba85
      Andreas Klebinger authored
      These ignore commandline arguments for ignore and commandline as well as
      GHCRTS arguments for ignoreAll. Passing RTS flags given on the command
      line along to the program by simply skipping processing of these flags
      by the RTS.
      
      This fixes #12870.
      
      Test Plan: ./validate
      
      Reviewers: austin, hvr, bgamari, erikd, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: Phyx, rwbarton, thomie
      
      GHC Trac Issues: #12870
      
      Differential Revision: https://phabricator.haskell.org/D3740
      d75bba85
  32. 27 Jul, 2017 1 commit
    • Andreas Klebinger's avatar
      Initialize hs_init with UTF8 encoded arguments on Windows. · 7af0b906
      Andreas Klebinger authored
      Summary:
      Get utf8 encoded arguments before we call hs_init and use them
      instead of ignoring hs_init arguments. This reduces differing
      behaviour of the RTS between windows and linux and simplifies
      the code involved.
      
      A few testcases were changed to expect the same result on windows
      as on linux after the changes.
      
      This fixes #13940.
      
      Test Plan: ./validate
      
      Reviewers: austin, hvr, bgamari, erikd, simonmar, Phyx
      
      Subscribers: Phyx, rwbarton, thomie
      
      GHC Trac Issues: #13940
      
      Differential Revision: https://phabricator.haskell.org/D3739
      7af0b906
  33. 26 Jun, 2017 1 commit
    • Ben Gamari's avatar
      rts: Always collect stats · 4bd4f561
      Ben Gamari authored
      It seems that 12ad4d41 enabled
      collection by default as its needs stats.allocated_bytes to determine
      whether the program has exceeded its grace limit.
      
      However, enabling stats also enables some potentially expensive times
      checks.  In general GC statistics should be cheap to compute (relative
      to the GC itself), so now we always compute them. This allows us to once
      again disable giveStats by default.
      
      Fixes #13864.
      
      Reviewers: simonmar, austin, erikd
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13864
      
      Differential Revision: https://phabricator.haskell.org/D3669
      4bd4f561