| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Merge backend-hacking-branch onto HEAD. Yay!
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
FIRST_BLOCK_OFF: more parens (for prec table illiterates like me)
|
|
|
|
| |
wibble - move LARGE_OBJECT_THRESHOLD from Constants.h to Block.h, as it's defined in terms of Block.h defines
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
- misc changes to support DLLs
- StgNat* --> StgWord*
|
|
|
|
| |
Copyright police.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
Move 4.01 onto the main trunk.
|