diff options
author | Simon Marlow <marlowsd@gmail.com> | 2009-12-01 16:03:21 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2009-12-01 16:03:21 +0000 |
commit | 5270423a6afe69f1dc57e5e5a474812182718d40 (patch) | |
tree | 254cc0d910b315c47723a7a7fdd393fffbdee5ea /rts/Threads.c | |
parent | 063b822bb68f84dd9729327bb1765637c25aceb4 (diff) | |
download | haskell-5270423a6afe69f1dc57e5e5a474812182718d40.tar.gz |
Make allocatePinned use local storage, and other refactorings
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.
Diffstat (limited to 'rts/Threads.c')
-rw-r--r-- | rts/Threads.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/rts/Threads.c b/rts/Threads.c index 3b209ea95b..9867c1c50e 100644 --- a/rts/Threads.c +++ b/rts/Threads.c @@ -63,7 +63,7 @@ createThread(Capability *cap, nat size) } size = round_to_mblocks(size); - tso = (StgTSO *)allocateLocal(cap, size); + tso = (StgTSO *)allocate(cap, size); stack_size = size - TSO_STRUCT_SIZEW; TICK_ALLOC_TSO(stack_size, 0); @@ -102,8 +102,8 @@ createThread(Capability *cap, nat size) */ ACQUIRE_LOCK(&sched_mutex); tso->id = next_thread_id++; // while we have the mutex - tso->global_link = g0s0->threads; - g0s0->threads = tso; + tso->global_link = cap->r.rNursery->threads; + cap->r.rNursery->threads = tso; RELEASE_LOCK(&sched_mutex); // ToDo: report the stack size in the event? |