Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/5d091088ce94be4c389fa669911d0e842bd08952

>---------------------------------------------------------------

commit 5d091088ce94be4c389fa669911d0e842bd08952
Author: Duncan Coutts <[email protected]>
Date:   Mon Jun 6 10:32:33 2011 +0100

    Move allocation of spark pools into initCapability
    
    Rather than a separate phase of initSparkPools. It means all the spark
    stuff for a capability is initialisaed at the same time, which is then
    becomes a good place to stick an initial spark trace event.

>---------------------------------------------------------------

 rts/Capability.c |    1 +
 rts/Schedule.c   |    4 ----
 rts/Sparks.c     |   10 +++-------
 rts/Sparks.h     |    2 +-
 4 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/rts/Capability.c b/rts/Capability.c
index 410d3d0..d8c3b2d 100644
--- a/rts/Capability.c
+++ b/rts/Capability.c
@@ -232,6 +232,7 @@ initCapability( Capability *cap, nat i )
     cap->returning_tasks_hd = NULL;
     cap->returning_tasks_tl = NULL;
     cap->inbox              = (Message*)END_TSO_QUEUE;
+    cap->sparks             = allocSparkPool();
     cap->spark_stats.created    = 0;
     cap->spark_stats.dud        = 0;
     cap->spark_stats.overflowed = 0;
diff --git a/rts/Schedule.c b/rts/Schedule.c
index 5c94e20..2222200 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -2010,10 +2010,6 @@ initScheduler(void)
 
   initTaskManager();
 
-#if defined(THREADED_RTS)
-  initSparkPools();
-#endif
-
   RELEASE_LOCK(&sched_mutex);
 
 #if defined(THREADED_RTS)
diff --git a/rts/Sparks.c b/rts/Sparks.c
index 26b8199..6ce2e68 100644
--- a/rts/Sparks.c
+++ b/rts/Sparks.c
@@ -17,14 +17,10 @@
 
 #if defined(THREADED_RTS)
 
-void
-initSparkPools( void )
+SparkPool *
+allocSparkPool( void )
 {
-    /* walk over the capabilities, allocating a spark pool for each one */
-    nat i;
-    for (i = 0; i < n_capabilities; i++) {
-      capabilities[i].sparks = newWSDeque(RtsFlags.ParFlags.maxLocalSparks);
-    }
+    return newWSDeque(RtsFlags.ParFlags.maxLocalSparks);
 }
 
 void
diff --git a/rts/Sparks.h b/rts/Sparks.h
index 7db6018..e381dd5 100644
--- a/rts/Sparks.h
+++ b/rts/Sparks.h
@@ -30,7 +30,7 @@ typedef struct {
 typedef WSDeque SparkPool;
 
 // Initialisation
-void initSparkPools (void);
+SparkPool *allocSparkPool (void);
 
 // Take a spark from the "write" end of the pool.  Can be called
 // by the pool owner only.



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to