Emit various bits of OS process info into the eventlog The process ID, parent process ID, rts name and version The program arguments and environment.
Make the tracing of the startup event more regular Rather than doing it differently for the eventlog and Dtrace cases.
prog_argv and rts_argv now contain *copies* of the args passed to setupRtsFlags(), rather than sharing the memory. Previously if the caller of hs_init() passed in dynamically-allocated memory and then freed it, random crashes could happen later (#5177).
Revert "Add capability sets to the event system. Contains code from Duncan Coutts." This reverts commit 58532eb46041aec8d4cbb48b054cb5b001edb43c. Turns out it didn't work on Windows and it'll need some non-trivial changes to make it work on Windows. We'll get it in later once that's sorted out.
Add capability sets to the event system. Contains code from Duncan Coutts.
Change the way module initialisation is done (#3252, #4417) Previously the code generator generated small code fragments labelled with __stginit_M for each module M, and these performed whatever initialisation was necessary for that module and recursively invoked the initialisation functions for imported modules. This appraoch had drawbacks: - FFI users had to call hs_add_root() to ensure the correct initialisation routines were called. This is a non-standard, and ugly, API. - unless we were using -split-objs, the __stginit dependencies would entail linking the whole transitive closure of modules imported, whether they were actually used or not. In an extreme case (#4387, #4417), a module from GHC might be imported for use in Template Haskell or an annotation, and that would force the whole of GHC to be needlessly linked into the final executable. So now instead we do our initialisation with C functions marked with __attribute__((constructor)), which are automatically invoked at program startup time (or DSO load-time). The C initialisers are emitted into the stub.c file. This means that every time we compile with -prof or -hpc, we now get a stub file, but thanks to #3687 that is now invisible to the user. There are some refactorings in the RTS (particularly for HPC) to handle the fact that initialisers now get run earlier than they did before. The __stginit symbols are still generated, and the hs_add_root() function still exists (but does nothing), for backwards compatibility.
Cleanup sweep and fix a bug in RTS flag processing. This code has accumulated a great deal of cruft over the years, this pass cleans up a lot of the surrounding cruft but leaves the actual argument processing alone - so there's still more that could be done. Bug fixed: - ghc_rts_opts should not be subject to the --rtsopts setting. If the programmer explicitly declares options with ghc_rts_opts, they shouldn't also have to accept command-line RTS options to make them work.
Add a debug check for a non-empty FPU stack on x86 (see #4914)
comment updates
Remove the debugging memory allocator - valgrind does a better job I got fed up with the constant bogus output from the debugging memory allocator in RtsUtils.c. One problem is that we allocate memory in constructors that then isn't tracked, because the debugging allocator hasn't been initialised yet. The bigger problem is that for a given piece of leaking memory it's impossible to find out where it was allocated; however Valgrind gives output like this: ==6967== 8 bytes in 1 blocks are still reachable in loss record 1 of 7 ==6967== at 0x4C284A8: malloc (vg_replace_malloc.c:236) ==6967== by 0x4C28522: realloc (vg_replace_malloc.c:525) ==6967== by 0x6745E9: stgReallocBytes (RtsUtils.c:213) ==6967== by 0x68D812: setHeapAlloced (MBlock.c:91) ==6967== by 0x68D8E2: markHeapAlloced (MBlock.c:116) ==6967== by 0x68DB56: getMBlocks (MBlock.c:240) ==6967== by 0x684F55: alloc_mega_group (BlockAlloc.c:305) ==6967== by 0x6850C8: allocGroup (BlockAlloc.c:358) ==6967== by 0x69484F: allocNursery (Storage.c:390) ==6967== by 0x694ABD: allocNurseries (Storage.c:436) ==6967== by 0x6944F2: initStorage (Storage.c:217) ==6967== by 0x673E3C: hs_init (RtsStartup.c:160) which tells us exactly what the leaking bit of memory is. So I don't think we need our own debugging allocator.
during shutdown, only free the heap if we waited for foreign calls to exit
fix Windows build (GHC.Conc.runHandlers is Unix-only)
Don't Terminate the ticker thread (#3748)
Add some missing getStablePtr()s for CAFs that the RTS refers to A recent patch ("Refactor CoreArity a bit") changed the arity of GHC.Conc.runSparks such that it became a CAF, and the RTS was not explicitly retaining it, which led to a crash when the CAF got GC'd. While fixing this I found a couple of other closures that the RTS refers to which weren't getting the correct CAF treatment.
FIX #2615 (linker scripts in .so files) This patch does not apply to Windows. It only applies to systems with ELF binaries. This is a patch to rts/Linker.c to recognize linker scripts in .so files and find the real target .so shared library for loading.
Expose all EventLog events as DTrace probes - Defines a DTrace provider, called 'HaskellEvent', that provides a probe for every event of the eventlog framework. - In contrast to the original eventlog, the DTrace probes are available in all flavours of the runtime system (DTrace probes have virtually no overhead if not enabled); when -DTRACING is defined both the regular event log as well as DTrace probes can be used. - Currently, Mac OS X only. User-space DTrace probes are implemented differently on Mac OS X than in the original DTrace implementation. Nevertheless, it shouldn't be too hard to enable these probes on other platforms, too. - Documentation is at http://hackage.haskell.org/trac/ghc/wiki/DTrace
Free full_prog_argv at exit, closing a memory leak
Use DLL aware runIO_closure instead of base_GHCziTopHandler_runIO_closure directly
Unify event logging and debug tracing. - tracing facilities are now enabled with -DTRACING, and -DDEBUG additionally enables debug-tracing. -DEVENTLOG has been removed. - -debug now implies -eventlog - events can be printed to stderr instead of being sent to the binary .eventlog file by adding +RTS -v (which is implied by the +RTS -Dx options). - -Dx debug messages can be sent to the binary .eventlog file by adding +RTS -l. This should help debugging by reducing the impact of debug tracing on execution time. - Various debug messages that duplicated the information in events have been removed.
Handle renames from #3310 Also add a panic for resurrecting a thread blocked on an exception, since it should never happen.