summaryrefslogtreecommitdiff
path: root/rts/RtsAPI.c
Commit message (Collapse)AuthorAgeFilesLines
* Revert "rts: add Emacs 'Local Variables' to every .c file"Simon Marlow2014-09-291-8/+0
| | | | This reverts commit 39b5c1cbd8950755de400933cecca7b8deb4ffcd.
* rts: detabify/dewhitespace RtsAPI.cAustin Seipp2014-08-201-13/+13
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* rts: add Emacs 'Local Variables' to every .c fileAustin Seipp2014-07-281-0/+8
| | | | | | | | This will hopefully help ensure some basic consistency in the forward by overriding buffer variables. In particular, it sets the wrap length, the offset to 4, and turns off tabs. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Add hs_thread_done() (#8124)Simon Marlow2014-02-271-0/+6
| | | | See documentation for details.
* Remove superfluous #ifdef from Takano's patch.Austin Seipp2013-11-021-2/+0
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* rts_apply uses CCS_MAIN rather than CCS_SYSTEM (#7753)Takano Akio2013-11-021-1/+6
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* rts_checkSchedStatus: exit the thread, not the process, when InterruptedSimon Marlow2013-05-101-1/+10
| | | | | | | | | This means that when the process is shutting down, if we have calls to foreign exports in progress, they get forcibly terminated as before, but now they only shut down the calling thread rather than the whole process (with -threaded). This came up in a discussion started by Akio Takano on ghc-users.
* Lots of nat -> StgWord changesSimon Marlow2012-09-071-3/+3
|
* Emit the task-tracking eventsDuncan Coutts2012-07-101-0/+15
| | | | | | | | | | | | Based on initial patches by Mikolaj Konarski <mikolaj@well-typed.com> Use the new task tracing functions traceTaskCreate/Migrate/Delete. There are two key places. One is for worker tasks which have a relatively simple life cycle. Worker tasks are created and deleted by the RTS. The other case is bound tasks which are either created by the RTS, or appear as foreign C threads making calls into the RTS. For bound threads we do the tracing in rts_lock/unlock, which actually covers both threads coming in from outside, and also bound threads made by the RTS.
* Make forkProcess work with +RTS -NSimon Marlow2011-12-061-30/+34
| | | | | | | | | | | | | | | | | | | | | | Consider this experimental for the time being. There are a lot of things that could go wrong, but I've verified that at least it works on the test cases we have. I also did some API cleanups while I was here. Previously we had: Capability * rts_eval (Capability *cap, HaskellObj p, /*out*/HaskellObj *ret); but this API is particularly error-prone: if you forget to discard the Capability * you passed in and use the return value instead, then you're in for subtle bugs with +RTS -N later on. So I changed all these functions to this form: void rts_eval (/* inout */ Capability **cap, /* in */ HaskellObj p, /* out */ HaskellObj *ret) It's much harder to use this version incorrectly, because you have to pass the Capability in by reference.
* Implement stack chunks and separate TSO/STACK objectsSimon Marlow2010-12-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes two changes to the way stacks are managed: 1. The stack is now stored in a separate object from the TSO. This means that it is easier to replace the stack object for a thread when the stack overflows or underflows; we don't have to leave behind the old TSO as an indirection any more. Consequently, we can remove ThreadRelocated and deRefTSO(), which were a pain. This is obviously the right thing, but the last time I tried to do it it made performance worse. This time I seem to have cracked it. 2. Stacks are now represented as a chain of chunks, rather than a single monolithic object. The big advantage here is that individual chunks are marked clean or dirty according to whether they contain pointers to the young generation, and the GC can avoid traversing clean stack chunks during a young-generation collection. This means that programs with deep stacks will see a big saving in GC overhead when using the default GC settings. A secondary advantage is that there is much less copying involved as the stack grows. Programs that quickly grow a deep stack will see big improvements. In some ways the implementation is simpler, as nothing special needs to be done to reclaim stack as the stack shrinks (the GC just recovers the dead stack chunks). On the other hand, we have to manage stack underflow between chunks, so there's a new stack frame (UNDERFLOW_FRAME), and we now have separate TSO and STACK objects. The total amount of code is probably about the same as before. There are new RTS flags: -ki<size> Sets the initial thread stack size (default 1k) Egs: -ki4k -ki2m -kc<size> Sets the stack chunk size (default 32k) -kb<size> Sets the stack chunk buffer size (default 1k) -ki was previously called just -k, and the old name is still accepted for backwards compatibility. These new options are documented.
* remove unnecessary stg_noForceIO (#3508)Simon Marlow2010-09-241-1/+0
|
* Fix crash in nested callbacks (#4038)Simon Marlow2010-05-071-2/+2
| | | | | Broken by "Split part of the Task struct into a separate struct InCall".
* Make the running_finalizers flag task-localSimon Marlow2010-05-051-3/+3
| | | | | Fixes a bug reported by Lennart Augustsson, whereby we could get an incorrect error from the RTS about re-entry from a finalizer,
* Fix typo in error message (#3848)Simon Marlow2010-01-301-1/+1
|
* Make allocatePinned use local storage, and other refactoringsSimon Marlow2009-12-011-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | This is a batch of refactoring to remove some of the GC's global state, as we move towards CPU-local GC. - allocateLocal() now allocates large objects into the local nursery, rather than taking a global lock and allocating then in gen 0 step 0. - allocatePinned() was still allocating from global storage and taking a lock each time, now it uses local storage. (mallocForeignPtrBytes should be faster with -threaded). - We had a gen 0 step 0, distinct from the nurseries, which are stored in a separate nurseries[] array. This is slightly strange. I removed the g0s0 global that pointed to gen 0 step 0, and removed all uses of it. I think now we don't use gen 0 step 0 at all, except possibly when there is only one generation. Possibly more tidying up is needed here. - I removed the global allocate() function, and renamed allocateLocal() to allocate(). - the alloc_blocks global is gone. MAYBE_GC() and doYouWantToGC() now check the local nursery only.
* Detect C finalizer callbacks in rts_lock() instead of schedule()Simon Marlow2009-08-191-0/+9
| | | | | Otherwise, finalizer callbacks cause a deadlock in the threaded RTS (including GHCi)
* RTS tidyup sweep, first phaseSimon Marlow2009-08-021-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first phase of this tidyup is focussed on the header files, and in particular making sure we are exposinng publicly exactly what we need to, and no more. - Rts.h now includes everything that the RTS exposes publicly, rather than a random subset of it. - Most of the public header files have moved into subdirectories, and many of them have been renamed. But clients should not need to include any of the other headers directly, just #include the main public headers: Rts.h, HsFFI.h, RtsAPI.h. - All the headers needed for via-C compilation have moved into the stg subdirectory, which is self-contained. Most of the headers for the rest of the RTS APIs have moved into the rts subdirectory. - I left MachDeps.h where it is, because it is so widely used in Haskell code. - I left a deprecated stub for RtsFlags.h in place. The flag structures are now exposed by Rts.h. - Various internal APIs are no longer exposed by public header files. - Various bits of dead code and declarations have been removed - More gcc warnings are turned on, and the RTS code is more warning-clean. - More source files #include "PosixSource.h", and hence only use standard POSIX (1003.1c-1995) interfaces. There is a lot more tidying up still to do, this is just the first pass. I also intend to standardise the names for external RTS APIs (e.g use the rts_ prefix consistently), and declare the internal APIs as hidden for shared libraries.
* replace sparc-specific Int64 code with calls to platform-independent macrosSimon Marlow2009-07-271-116/+4
|
* Remove old GUM/GranSim codeSimon Marlow2009-06-021-12/+0
|
* Fix #3236: emit a helpful error message when the RTS has not been initialisedSimon Marlow2009-05-181-6/+0
|
* SPARC: Fix ffi019 split load/store of HsInt64 into two parts to respect ↵Ben.Lippmeier@anu.edu.au2009-03-311-0/+51
| | | | alignment constraints
* SPARC NCG: When getting a 64 bit word, promote halves to 64 bit before shiftingBen.Lippmeier@anu.edu.au2009-03-301-1/+1
|
* SPARC NCG: Also do misaligned reads (this time for sure!)Ben.Lippmeier@anu.edu.au2009-01-221-8/+8
|
* SPARC NCG: Also do misaligned readsBen.Lippmeier@anu.edu.au2009-01-211-0/+25
|
* SPARC NCG: Add a SPARC version of rts_mkInt64 that handles misaligned ↵Ben.Lippmeier@anu.edu.au2009-01-211-0/+28
| | | | closure payloads.
* Fix some more shutdown racesSimon Marlow2008-11-191-8/+10
| | | | | | | There were races between workerTaskStop() and freeTaskManager(): we need to be sure that all Tasks have exited properly before we start tearing things down. This isn't completely straighforward, see comments for details.
* fix #2594: we were erroneously applying masks, as the reporter suggestedSimon Marlow2008-09-301-3/+3
| | | | | | My guess is that this is left over from when we represented Int8 and friends as zero-extended rather than sign-extended. It's amazing it hasn't been noticed earlier.
* rts_evalStableIO: start the new thread in blocked modeSimon Marlow2008-07-091-0/+3
|
* Pointer TaggingSimon Marlow2007-07-271-17/+21
| | | | | | | | | | | | | | | | | | | | | | This patch implements pointer tagging as per our ICFP'07 paper "Faster laziness using dynamic pointer tagging". It improves performance by 10-15% for most workloads, including GHC itself. The original patches were by Alexey Rodriguez Yakushev <mrchebas@gmail.com>, with additions and improvements by me. I've re-recorded the development as a single patch. The basic idea is this: we use the low 2 bits of a pointer to a heap object (3 bits on a 64-bit architecture) to encode some information about the object pointed to. For a constructor, we encode the "tag" of the constructor (e.g. True vs. False), for a function closure its arity. This enables some decisions to be made without dereferencing the pointer, which speeds up some common operations. In particular it enables us to avoid costly indirect jumps in many cases. More information in the commentary: http://hackage.haskell.org/trac/ghc/wiki/Commentary/Rts/HaskellExecution/PointerTagging
* remove unused includes, now that Storage.h & Stable.h are included by Rts.hSimon Marlow2006-11-151-1/+0
|
* Split GC.c, and move storage manager into sm/ directorySimon Marlow2006-10-241-0/+1
| | | | | | | | | | | | | | | | | In preparation for parallel GC, split up the monolithic GC.c file into smaller parts. Also in this patch (and difficult to separate, unfortunatley): - Don't include Stable.h in Rts.h, instead just include it where necessary. - consistently use STATIC_INLINE in source files, and INLINE_HEADER in header files. STATIC_INLINE is now turned off when DEBUG is on, to make debugging easier. - The GC no longer takes the get_roots function as an argument. We weren't making use of this generalisation.
* Reorganisation of the source treeSimon Marlow2006-04-071-0/+597
Most of the other users of the fptools build system have migrated to Cabal, and with the move to darcs we can now flatten the source tree without losing history, so here goes. The main change is that the ghc/ subdir is gone, and most of what it contained is now at the top level. The build system now makes no pretense at being multi-project, it is just the GHC build system. No doubt this will break many things, and there will be a period of instability while we fix the dependencies. A straightforward build should work, but I haven't yet fixed binary/source distributions. Changes to the Building Guide will follow, too.