| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This corrects the `jump islands` calculations for Windows. The code was
incorrectly creating a new entry for every `usage` of a symbol instead
of every used symbol. e.g. if a symbol is used 5 times it used to create
5 jump islands. This is incorrect and not in line with what the `ELF`
and `Mach-O` linkers do. Also since we allocate `n` spaces where `n` is
number of symbols, we would quickly run out of space and abort.
Test Plan: ./validate
Reviewers: simonmar, hvr, erikd, bgamari, austin
Reviewed By: bgamari
Subscribers: thomie, #ghc_windows_task_force
Differential Revision: https://phabricator.haskell.org/D3026
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the `GCC` driver envokes the pipeline a `SPEC` is used to determine
how to configure the compiler and which libraries to pass along.
For Windows/mingw, this specfile is
https://github.com/gcc-mirror/gcc/blob/master/gcc/config/i386/mingw32.h
This expands the list of base DLLs with the ones that GCC always links,
and adds extra sibling dlls of `stdc++` in case it is linked in.
Following D3028 this patch only needs to load the always load only the
top level individual shared libs.
Test Plan: ./validate
Reviewers: RyanGlScott, austin, bgamari, erikd, simonmar
Reviewed By: bgamari
Subscribers: RyanGlScott, thomie, #ghc_windows_task_force
Differential Revision: https://phabricator.haskell.org/D3029
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Fixes (#12636).
- changes all the typecasts to _unsinged long long_ to
have the format specifiers work.
Reviewers: austin, bgamari, erikd, simonmar, Phyx
Reviewed By: erikd, Phyx
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3129
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously this was added only to the RTS's C files (those are the bulk
of it though), but there are C bits in ghc-prim, integer-gmp and base
too.
Followup for #8405, allows the large table of character properties in
base to be stripped when not used.
Test Plan: validate
Reviewers: austin, bgamari, simonmar
Reviewed By: bgamari
Subscribers: thomie, snowleopard
Differential Revision: https://phabricator.haskell.org/D3121
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Here we move the actual report generation logic to
`rts/ProfilerReport.c`. This break is actually quite clean,
void writeCCSReport( FILE *prof_file, CostCentreStack const *ccs,
ProfilerTotals totals );
This is more profiler refactoring in preparation for machine-readable
output.
Test Plan: Validate
Reviewers: austin, erikd, simonmar
Reviewed By: simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3097
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously it was quite difficult to follow the dataflow through this
file due to global mutation and rather non-descriptive types.
This is a cleanup in preparation for factoring out the report-generating
logic, which is itself in preparation for somedayteaching the profiler
to produce more machine-readable reports (JSON perhaps?).
Test Plan: Validate
Reviewers: austin, erikd, simonmar
Reviewed By: simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3096
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This corrects the unwind information for `stg_stop_thread`, which
allows us to unwind back to the C stack after reaching the end of the
STG stack.
Test Plan: Validate
Reviewers: simonmar, austin, erikd
Reviewed By: simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2746
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
And use to mark `stg_stack_underflow_frame`, which we are unable to
determine a caller from.
To simplify parsing at the moment we steal the `return` keyword to
indicate an undefined unwind value. Perhaps this should be revisited.
Reviewers: scpmw, simonmar, austin, erikd
Subscribers: dfeuer, thomie
Differential Revision: https://phabricator.haskell.org/D2738
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As discussed in D1532, Trac Trac #11337, and Trac Trac #11338, the stack
unwinding information produced by GHC is currently quite approximate.
Essentially we assume that register values do not change at all within a
basic block. While this is somewhat true in normal Haskell code, blocks
containing foreign calls often break this assumption. This results in
unreliable call stacks, especially in the code containing foreign calls.
This is worse than it sounds as unreliable unwinding information can at
times result in segmentation faults.
This patch set attempts to improve this situation by tracking unwinding
information with finer granularity. By dispensing with the assumption of
one unwinding table per block, we allow the compiler to accurately
represent the areas surrounding foreign calls.
Towards this end we generalize the representation of unwind information
in the backend in three ways,
* Multiple CmmUnwind nodes can occur per block
* CmmUnwind nodes can now carry unwind information for multiple
registers (while not strictly necessary; this makes emitting
unwinding information a bit more convenient in the compiler)
* The NCG backend is given an opportunity to modify the unwinding
records since it may need to make adjustments due to, for instance,
native calling convention requirements for foreign calls (see
#11353).
This sets the stage for resolving #11337 and #11338.
Test Plan: Validate
Reviewers: scpmw, simonmar, austin, erikd
Subscribers: qnikst, thomie
Differential Revision: https://phabricator.haskell.org/D2741
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[skip ci]
There ware some old file names (.lhs, ...) at comments.
* rts/win32/ThrIOManager.c
- Conc.lhs -> Conc.hs
* rts/PrimOps.cmm
- ByteCodeLink.lhs -> ByteCodeLink.hs
- StgMiscClosures.hc -> StgMiscClosures.cmm
* rts/AutoApply.h
- AutoApply.hc -> AutoApply.cmm
* rts/HeapStackCheck.cmm
- PrimOps.hc -> PrimOps.cmm
* rts/LdvProfile.h
- Updates.hc -> Updates.cmm
* rts/Schedule.c
- StgStartup.hc -> StgStartup.cmm
* rts/Weak.c
- StgMiscClosures.hc -> StgMiscClosures.cmm
Reviewers: bgamari, austin, erikd, simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3075
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch converts the 4 lasting static flags (read from the command
line and unsafely stored in immutable global variables) into dynamic
flags. Most use cases have been converted into reading them from a DynFlags.
In cases for which we don't have easy access to a DynFlags, we read from
'unsafeGlobalDynFlags' that is set at the beginning of each 'runGhc'.
It's not perfect (not thread-safe) but it is still better as we can
set/unset these 4 flags before each run when using GHC API.
Updates haddock submodule.
Rebased and finished by: bgamari
Test Plan: validate
Reviewers: goldfire, erikd, hvr, austin, simonmar, bgamari
Reviewed By: simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2839
GHC Trac Issues: #8440
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Here we add support to GHCi for StaticPointers. This process begins by
adding remote GHCi messages for adding entries to the static pointer
table. We then collect binders needing SPT entries after linking and
send the interpreter a message adding entries with the appropriate
fingerprints.
Test Plan: `make test TEST=StaticPtr`
Reviewers: facundominguez, mboes, simonpj, simonmar, goldfire, austin,
hvr, erikd
Reviewed By: simonpj, simonmar
Subscribers: RyanGlScott, simonpj, thomie
Differential Revision: https://phabricator.haskell.org/D2504
GHC Trac Issues: #12356
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently eventlog data is always written to a file `progname.eventlog`.
This patch introduces the `flushEventLog` field in `RtsConfig` which
allows to customize the writing of eventlog data.
One possible scenario is the ongoing live-profile-monitor effort by
@NCrashed which slurps all eventlog data through `fluchEventLog`.
`flushEventLog` takes a buffer with eventlog data and its size and
returns `false` (0) in case eventlog data could not be procesed.
Reviewers: simonmar, austin, erikd, bgamari
Reviewed By: simonmar, bgamari
Subscribers: qnikst, thomie, NCrashed
Differential Revision: https://phabricator.haskell.org/D2934
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The symbol not found error that is triggered
during lazy-loading was a bit chaotic before.
This reformats it a bit to:
```
ghc-stage2.exe: | E:\...\libLLVMSupport.a: unknown symbol `_ZN4llvm5APIntC1Ejyb'
ghc-stage2.exe: | E:\...\libLLVMCore.a: unknown symbol `_ZN4llvm5APInt14AssignSlowCaseERKS0_'
ghc-stage2.exe: | E:\...\libLLVMCore.a: unknown symbol `_ZN4llvm13ConstantRangeC1ENS_5APIntES1_'
ghc-stage2.exe: | E:\...\libLLVMCore.a: unknown symbol `_ZN4llvm14FoldingSetImplC2Ej'
ghc-stage2.exe: | E:\...\libLLVMCore.a: unknown symbol `_ZN4llvm15LLVMContextImplD1Ev'
ghc-stage2.exe: | E:\...\libLLVMLTO.a: unknown symbol `_ZN4llvm11LLVMContextD1Ev'
ghc-stage2.exe: | E:\...\libLLVMCore.a: unknown symbol `_ZNK4llvm5Value10getContextEv'
ghc-stage2.exe: ^^ Could not load 'LLVMIsMultithreaded', dependency unresolved.
See top entry above.
```
I have also thought about also showing the demangled names, as it may
be useful for the end user.
`libgcc` seems to provide a method for this so we wouldn't need any
extra dependency.
Any thoughts on this or would it not be useful?
Reviewers: austin, erikd, simonmar, bgamari
Reviewed By: bgamari
Subscribers: RyanGlScott, thomie, #ghc_windows_task_force
Differential Revision: https://phabricator.haskell.org/D3027
GHC Trac Issues: #13093, #13113
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This isn't supported, and fatalling with an error is better than
segfaulting later.
Test Plan: validate
Reviewers: JonCoens, austin, erikd, niteria, bgamari
Reviewed By: niteria, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3020
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Clean up the linker code for PE.
1. Stop copying structures from the windows header
and use those that are in the headers. There's no
point in copying them and we got a few types wrong.
2. Replace custom typedef with C99 types. If we're not
going to use the Windows type aliases, at least use
standard ones.
Test Plan: ./validate
Reviewers: simonmar, austin, erikd, bgamari
Reviewed By: simonmar, bgamari
Subscribers: dfeuer, thomie, #ghc_windows_task_force
Differential Revision: https://phabricator.haskell.org/D2944
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Someone committed a new public symbol `purgeObj` again
without adding it to the symbols table.
Test Plan: ./validate
Reviewers: austin, bgamari, simonmar, erikd
Reviewed By: erikd
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2980
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This patch is courtesy of @awson.
Currently, whenever GHC catches a segfault on Windows, it simply reports the
somewhat uninformative message
`Segmentation fault/access violation in generated code`. This patch adds to
the message the type of violation (read/write/dep) and location information,
which should help debugging segfaults in the future.
Fixes #13108.
Test Plan: Build on Windows
Reviewers: austin, erikd, bgamari, simonmar, Phyx
Reviewed By: bgamari, Phyx
Subscribers: awson, thomie, #ghc_windows_task_force
Differential Revision: https://phabricator.haskell.org/D2969
GHC Trac Issues: #13108
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Apparently `sysErrorBelch` doesn't terminate the program anymore making
previously unreachable code now execute. If a dll is not found the error
message we return needs to be a heap value.
Secondly also allow the pattern `lib<name>` to be allowed for finding an
import library with the name `lib<name>.dll.a`.
Test Plan: ./validate, new tests T13082_good and T13082_fail
Reviewers: austin, RyanGlScott, hvr, erikd, simonmar, bgamari
Reviewed By: RyanGlScott, bgamari
Subscribers: thomie, #ghc_windows_task_force
Differential Revision: https://phabricator.haskell.org/D2941
GHC Trac Issues: #13082
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changes heap overflow to throw a HeapOverflow exception instead of
killing the process.
Test Plan: GHC CI
Reviewers: simonmar, austin, hvr, erikd, bgamari
Reviewed By: simonmar, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2790
GHC Trac Issues: #1791
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* In stg_ap_0_fast, if we're evaluating a thunk, the thunk might
evaluate to a function in which case we may have to adjust its CCS.
* The interpreter has its own implementation of stg_ap_0_fast, so we
have to do the same shenanigans with creating empty PAPs and copying
PAPs there.
* GHCi creates Cost Centres as children of CCS_MAIN, which enterFunCCS()
wrongly assumed to imply that they were CAFs. Now we use the is_caf
flag for this, which we have to correctly initialise when we create a
Cost Centre in GHCi.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The Power ISA says the result of a division by zero is undefined. So
ignore stdout on PowerPC 64-bit systems.
Disable ext-interp tests on 64-bit PowerPC. We don't have support for
PowerPC 64-bit ELF in the RTS linker, which is needed for the external
interpreter.
Test Plan: ./validate
Reviewers: austin, simonmar, hvr, erikd, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2782
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: simonmar, erikd, austin, bgamari
Reviewed By: bgamari
Subscribers: gracjan, rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D2881
GHC Trac Issues: #13005
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I forgot to account for BCOs, which have a different layout from
functions. This caused crashes when using profiling with GHCi (via
-fexternal-interpreter -prof), which unfortunately is not tested at all
by validate, even when profiling is enabled. I'm going to add some
testing that would have caught this in a separate patch.
Test Plan:
```
cd nofib/spectral/puzzle && make NoFibWithGHCi=YES
EXTRA_RUNTEST_OPTS='-fexternal-interpreter -prof'
```
New testsuite tests coming in a separate diff.
Reviewers: niteria, austin, erikd, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2868
GHC Trac Issues: #5654
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This code has been broken on 64-bit systems for some time: the length
and timeout arguments of `addIORequest` and `addDelayRequest`,
respectively, were declared as `int`. However, they were passed Haskell
integers from their respective primops. Integer overflow and madness
ensued. This resulted in #7325 and who knows what else.
Also, there were a few left-over `BOOL`s in here which were not passed
to Windows system calls; these were changed to C99 `bool`s.
However, there is still a bit of signedness inconsistency within the
`delay#` call-chain,
* `GHC.Conc.IO.threadDelay` and the `delay#` primop accept `Int`
arguments
* The `delay#` implementation in `PrimOps.cmm` expects the timeout as
a `W_`
* `AsyncIO.c:addDelayRequest` expects an `HsInt` (was `int` prior to
this patch)
* `IOManager.c:AddDelayRequest` expects an `HsInt`` (was `int`)
* The Windows `Sleep` function expects a `DWORD` (which is unsigned)
Test Plan: Validate on Windows
Reviewers: erikd, austin, simonmar, Phyx
Reviewed By: Phyx
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2861
GHC Trac Issues: #7325
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The change does the following:
- Add explicit declaration of exception closures
from base. C backend needs those symbols to be
visible.
- Reorder cmm functions in use order. Again C
backend needs symbol declaration/definition
before use. even for module-local cmm functions.
Fixes the following build failure:
rts_dist_HC rts/dist/build/Compact.o
In file included from /tmp/ghc3348_0/ghc_4.hc:3:0: error:
/tmp/ghc3348_0/ghc_4.hc: In function 'stg_compactAddWithSharingzh':
/tmp/ghc3348_0/ghc_4.hc:27:11: error:
error: 'stg_compactAddWorkerzh' undeclared (first use in this function)
JMP_((W_)&stg_compactAddWorkerzh);
^
...
/tmp/ghc3348_0/ghc_4.hc:230:13: error:
error: 'base_GHCziIOziException_cannotCompactMutable_closure'
undeclared (first use in this function)
R1.w = (W_)&base_GHCziIOziException_cannotCompactMutable_closure;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes some cases of wrong stacks being generated by the profiler.
For background and details on the fix see
`Note [Evaluating functions with profiling]` in `rts/Apply.cmm`.
This does have an impact on allocations for some programs when
profiling. nofib results:
```
k-nucleotide +0.0% +8.8% +11.0% +11.0% 0.0%
puzzle +0.0% +12.5% 0.244 0.246 0.0%
typecheck 0.0% +8.7% +16.1% +16.2% 0.0%
------------------------------------------------------------------------
--------
Min -0.0% -0.0% -34.4% -35.5% -25.0%
Max +0.0% +12.5% +48.9% +49.4% +10.6%
Geometric Mean +0.0% +0.6% +2.0% +1.8% -0.3%
```
But runtimes don't seem to be affected much, and the examples I looked
at were completely legitimate. For example, in puzzle we have this:
```
position :: ItemType -> StateType -> BankType
position Bono = bonoPos
position Edge = edgePos
position Larry = larryPos
position Adam = adamPos
```
where the identifiers on the rhs are all record selectors. Previously
the profiler gave a stack that looked like
```
position
bonoPos
...
```
i.e. `bonoPos` was at the same level of the call stack as `position`,
but now it looks like
```
position
bonoPos
...
```
I used the normaliser from the testsuite to diff the profiling output
from other nofib programs and they all looked better.
Test Plan:
* the broken test passes
* validate
* compiled and ran all of nofib, measured perf, diff'd several .prof
files
Reviewers: niteria, erikd, austin, scpmw, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2804
GHC Trac Issues: #5654, #10007
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Mingw-w64 does a stupid thing. They set the FPU precision to extended
mode by default. The reasoning is that it's for compatibility with GNU
Linux ported libraries. However the problem is this is incompatible with
the standard Windows double precision mode. In fact, if we create a new
OS thread then Windows will reset the FPU to double precision mode. So
we end up with a weird state where the main thread by default has a
different precision than any child threads.
Test Plan: ./validate new test T7289
Reviewers: simonmar, austin, bgamari, erikd
Reviewed By: simonmar
Subscribers: thomie, #ghc_windows_task_force
Differential Revision: https://phabricator.haskell.org/D2819
GHC Trac Issues: #7289
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: ./validate
Reviewers: austin, bgamari, erikd, simonmar
Reviewed By: simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2825
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
Reviewers: bgamari, austin, erikd, simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2818
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: Validate on Windows, ensure that linking works.
Reviewers: Phyx, austin, erikd, simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2817
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was removed in 8dc72f3c33b0e724ddb690c9d494969980c10afd which cleaned up
PosixSource.h. Strangely, this only started breaking for me now.
Test Plan: Validate on Windows
Reviewers: simonmar, erikd, austin, Phyx
Reviewed By: Phyx
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2812
GHC Trac Issues: #12951
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: Validate on Windows.
Reviewers: austin, erikd, simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2798
GHC Trac Issues: #12388
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
See comments.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As described in #12865, newer Linux kernels support both MADV_FREE and
MADV_DONTNEED. Previously a runtime would fail to try MADV_DONTNEED if
MADV_FREE failed (e.g. since the kernel which the image is running on
doesn't support the latter). Now we try MADV_DONTNEED if MADV_FREE
failed to ensure that binaries compiled on a kernel supporting MADV_FREE
don't fail on decommit.
Test Plan: Validate
Reviewers: austin, erikd, simonmar
Reviewed By: simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2780
GHC Trac Issues: #12865
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: Build `p` way
Reviewers: austin, erikd, simonmar
Reviewed By: simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2779
|
|
|
|
|
| |
This reverts commit 6f7ed1e51bf360621a3c2a447045ab3012f68575 due to breakage of
the build on Windows.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This updates the binary dists for windows to GCC 6.2.0 and
binutils 2.27.2 which has fixes required for LLVM.
Test Plan: ./validate
Reviewers: simonmar, erikd, austin, bgamari
Reviewed By: simonmar, bgamari
Subscribers: thomie, #ghc_windows_task_force
Differential Revision: https://phabricator.haskell.org/D2749
GHC Trac Issues: #12871, #8974
|
| |
|