summaryrefslogtreecommitdiff
path: root/ghc/includes/Block.h
Commit message (Collapse)AuthorAgeFilesLines
* Reorganisation of the source treeSimon Marlow2006-04-071-202/+0
| | | | | | | | | | | | | | | 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.
* [project @ 2005-10-21 14:02:17 by simonmar]simonmar2005-10-211-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Big re-hash of the threaded/SMP runtime This is a significant reworking of the threaded and SMP parts of the runtime. There are two overall goals here: - To push down the scheduler lock, reducing contention and allowing more parts of the system to run without locks. In particular, the scheduler does not require a lock any more in the common case. - To improve affinity, so that running Haskell threads stick to the same OS threads as much as possible. At this point we have the basic structure working, but there are some pieces missing. I believe it's reasonably stable - the important parts of the testsuite pass in all the (normal,threaded,SMP) ways. In more detail: - Each capability now has a run queue, instead of one global run queue. The Capability and Task APIs have been completely rewritten; see Capability.h and Task.h for the details. - Each capability has its own pool of worker Tasks. Hence, Haskell threads on a Capability's run queue will run on the same worker Task(s). As long as the OS is doing something reasonable, this should mean they usually stick to the same CPU. Another way to look at this is that we're assuming each Capability is associated with a fixed CPU. - What used to be StgMainThread is now part of the Task structure. Every OS thread in the runtime has an associated Task, and it can ask for its current Task at any time with myTask(). - removed RTS_SUPPORTS_THREADS symbol, use THREADED_RTS instead (it is now defined for SMP too). - The RtsAPI has had to change; we must explicitly pass a Capability around now. The previous interface assumed some global state. SchedAPI has also changed a lot. - The OSThreads API now supports thread-local storage, used to implement myTask(), although it could be done more efficiently using gcc's __thread extension when available. - I've moved some POSIX-specific stuff into the posix subdirectory, moving in the direction of separating out platform-specific implementations. - lots of lock-debugging and assertions in the runtime. In particular, when DEBUG is on, we catch multiple ACQUIRE_LOCK()s, and there is also an ASSERT_LOCK_HELD() call. What's missing so far: - I have almost certainly broken the Win32 build, will fix soon. - any kind of thread migration or load balancing. This is high up the agenda, though. - various performance tweaks to do - throwTo and forkProcess still do not work in SMP mode
* [project @ 2005-06-13 12:29:48 by simonmar]simonmar2005-06-131-0/+2
| | | | | | | | | | | | Block allocator performance fix: instead of keeping the free list ordered, keep it doubly-linked, and introduce a new flag BF_FREE so we can tell when a block is free. We can still coalesce blocks on the free list because block descriptors are kept consecutively in memory, so we can tell based on the BF_FREE flag whether to coalesce with the next higher/lower blocks when freeing a block. This (almost) make freeChain O(n) rather than O(n^2), and has been reported to help a lot when dealing with very large heaps.
* [project @ 2005-04-12 09:04:23 by simonmar]simonmar2005-04-121-1/+1
| | | | | | | | | Per-task nurseries for SMP. This was kind-of implemented before, but it's much cleaner now. There is now one *step* per capability, so we have somewhere to hang the block count. So for SMP, there are simply multiple instances of generation 0 step 0. The rNursery entry in the register table now points to the step rather than the head block of the nurersy.
* [project @ 2005-03-27 13:41:13 by panne]panne2005-03-271-2/+1
| | | | | | | | | | * Some preprocessors don't like the C99/C++ '//' comments after a directive, so use '/* */' instead. For consistency, a lot of '//' in the include files were converted, too. * UnDOSified libraries/base/cbits/runProcess.c. * My favourite sport: Killed $Id$s.
* [project @ 2005-02-10 13:01:52 by simonmar]simonmar2005-02-101-3/+36
| | | | | | | | | | | | | | | | | | | | | | | GC changes: instead of threading old-generation mutable lists through objects in the heap, keep it in a separate flat array. This has some advantages: - the IND_OLDGEN object is now only 2 words, so the minimum size of a THUNK is now 2 words instead of 3. This saves some amount of allocation (about 2% on average according to my measurements), and is more friendly to the cache by squashing objects together more. - keeping the mutable list separate from the IND object will be necessary for our multiprocessor implementation. - removing the mut_link field makes the layout of some objects more uniform, leading to less complexity and special cases. - I also unified the two mutable lists (mut_once_list and mut_list) into a single mutable list, which lead to more simplifications in the GC.
* [project @ 2004-08-13 13:04:50 by simonmar]simonmar2004-08-131-8/+36
| | | | Merge backend-hacking-branch onto HEAD. Yay!
* [project @ 2003-11-26 12:14:26 by simonmar]simonmar2003-11-261-1/+6
| | | | | Fix a rare bug in compacting GC, related to eval_thunk_selector(). This might be the cause of the "Closure type 0" bug in SourceForge.
* [project @ 2003-11-12 17:27:00 by sof]sof2003-11-121-2/+2
| | | | | | | | | | | | Tidy up a couple of unportable coding issues: - conditionally use empty structs. - use GNU attributes only if supported. - 'long long' usage - use of 'inline' in declarations and definitions. Upshot of these changes is that MSVC is now capable of compiling the non-.hc portions of the RTS.
* [project @ 2003-09-23 15:38:35 by simonmar]simonmar2003-09-231-1/+2
| | | | | | | | | | | Add a BF_PINNED block flag, and attach it to blocks containing pinned objects (in addition to the usual BF_LARGE). In heapCensus, we now ignore blocks containing pinned objects, because they might contain gaps, and in any case it isn't clear that we want to include the whole block in a heap census, because much of it might well be dead. Ignoring it isn't right either, though, so this patch just fixes the crash and leaves a ToDo.
* [project @ 2003-03-28 15:13:52 by sof]sof2003-03-281-2/+2
| | | | FIRST_BLOCK_OFF: more parens (for prec table illiterates like me)
* [project @ 2003-03-25 16:19:55 by sof]sof2003-03-251-1/+6
| | | | wibble - move LARGE_OBJECT_THRESHOLD from Constants.h to Block.h, as it's defined in terms of Block.h defines
* [project @ 2002-12-11 15:36:20 by simonmar]simonmar2002-12-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge the eval-apply-branch on to the HEAD ------------------------------------------ This is a change to GHC's evaluation model in order to ultimately make GHC more portable and to reduce complexity in some areas. At some point we'll update the commentary to describe the new state of the RTS. Pending that, the highlights of this change are: - No more Su. The Su register is gone, update frames are one word smaller. - Slow-entry points and arg checks are gone. Unknown function calls are handled by automatically-generated RTS entry points (AutoApply.hc, generated by the program in utils/genapply). - The stack layout is stricter: there are no "pending arguments" on the stack any more, the stack is always strictly a sequence of stack frames. This means that there's no need for LOOKS_LIKE_GHC_INFO() or LOOKS_LIKE_STATIC_CLOSURE() any more, and GHC doesn't need to know how to find the boundary between the text and data segments (BIG WIN!). - A couple of nasty hacks in the mangler caused by the neet to identify closure ptrs vs. info tables have gone away. - Info tables are a bit more complicated. See InfoTables.h for the details. - As a side effect, GHCi can now deal with polymorphic seq. Some bugs in GHCi which affected primitives and unboxed tuples are now fixed. - Binary sizes are reduced by about 7% on x86. Performance is roughly similar, some programs get faster while some get slower. I've seen GHCi perform worse on some examples, but haven't investigated further yet (GHCi performance *should* be about the same or better in theory). - Internally the code generator is rather better organised. I've moved info-table generation from the NCG into the main codeGen where it is shared with the C back-end; info tables are now emitted as arrays of words in both back-ends. The NCG is one step closer to being able to support profiling. This has all been fairly thoroughly tested, but no doubt I've messed up the commit in some way.
* [project @ 2001-10-03 13:57:42 by simonmar]simonmar2001-10-031-1/+3
| | | | | | | | | | | | | | | | Tidy up ghc/includes/Constants and related things. Now all the constants that the compiler needs to know, such as header size, update frame size, info table size and so on are generated automatically into a header file, DeriviedConstants.h, by a small C program in the same way as NativeDefs.h. The C code in the RTS is expected to use sizeof() directly (it already does). Also tidied up the constants in MachDeps.h - all the constants representing the sizes of various types are named SIZEOF_<foo>, to match the constants defined in config.h. PrelStorable.lhs now doesn't contain any special knowledge about GHC's conventions as regards the size of certain types, this is all in MachDeps.h.
* [project @ 2001-07-23 17:23:19 by simonmar]simonmar2001-07-231-3/+9
| | | | | | | | | | | | | | | | | Add a compacting garbage collector. It isn't enabled by default, as there are still a couple of problems: there's a fallback case I haven't implemented yet which means it will occasionally bomb out, and speed-wise it's quite a bit slower than the copying collector (about 1.8x slower). Until I can make it go faster, it'll only be useful when you're actually running low on real memory. '+RTS -c' to enable it. Oh, and I cleaned up a few things in the RTS while I was there, and fixed one or two possibly real bugs in the existing GC.
* [project @ 2001-07-23 10:47:16 by simonmar]simonmar2001-07-231-2/+2
| | | | | | | | | | | | Small changes to improve GC performance slightly: - store the generation *number* in the block descriptor rather than a pointer to the generation structure, since the most common operation is to pull out the generation number, and it's one less indirection this way. - cache the generation number in the step structure too, which avoids an extra indirection in several places.
* [project @ 2000-04-05 14:26:31 by panne]panne2000-04-051-2/+2
| | | | | | Changed a bunch of `#endif FOO' to `#endif /* FOO */', the former is not strictly ANSI (don't know if the latter is, but `gcc -Wall -ansi -pedantic' is silent then).
* [project @ 1999-11-09 15:46:49 by simonmar]simonmar1999-11-091-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | A slew of SMP-related changes. - New locking scheme for thunks: we now check whether the thunk being entered is in our private allocation area, and if so we don't lock it. Well, that's the upshot. In practice it's a lot more fiddly than that. - I/O blocking is handled a bit more sanely now (but still not properly, methinks) - deadlock detection is back - remove old pre-SMP scheduler code - revamp the timing code. We actually get reasonable-looking timing info for SMP programs now. - fix a bug in the garbage collector to do with IND_OLDGENs appearing on the mutable list of the old generation. - move BDescr() function from rts/BlockAlloc.h to includes/Block.h. - move struct generation and struct step into includes/StgStorage.h (sigh) - add UPD_IND_NOLOCK for updating with an indirection where locking the black hole is not required.
* [project @ 1999-03-02 19:44:07 by sof]sof1999-03-021-5/+5
| | | | | - misc changes to support DLLs - StgNat* --> StgWord*
* [project @ 1999-02-05 16:02:18 by simonm]simonm1999-02-051-1/+3
| | | | Copyright police.
* [project @ 1999-01-13 17:25:37 by simonm]simonm1999-01-131-5/+6
| | | | | | | | | | | | | | | | | Added a generational garbage collector. The collector is reliable but fairly untuned as yet. It works with an arbitrary number of generations: use +RTS -G<gens> to change the number of generations used (default 2). Stats: +RTS -Sstderr is quite useful, but to really see what's going on compile the RTS with -DDEBUG and use +RTS -D32. ARR_PTRS removed - it wasn't used anywhere. Sanity checking improved: - free blocks are now spammed when sanity checking is turned on - a check for leaking blocks is performed after each GC.
* [project @ 1998-12-02 13:17:09 by simonm]simonm1998-12-021-0/+100
Move 4.01 onto the main trunk.