summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorDuncan Coutts <duncan@well-typed.com>2011-06-06 10:32:33 +0100
committerDuncan Coutts <duncan@well-typed.com>2011-07-18 16:31:14 +0100
commit5d091088ce94be4c389fa669911d0e842bd08952 (patch)
treeec18221bfe74de9bbfbdded76b923f90630aaae6 /rts
parentddb47a91da7132da2303c60a5aff4e38fb2dcf1a (diff)
downloadhaskell-5d091088ce94be4c389fa669911d0e842bd08952.tar.gz
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.
Diffstat (limited to 'rts')
-rw-r--r--rts/Capability.c1
-rw-r--r--rts/Schedule.c4
-rw-r--r--rts/Sparks.c10
-rw-r--r--rts/Sparks.h2
4 files changed, 5 insertions, 12 deletions
diff --git a/rts/Capability.c b/rts/Capability.c
index 410d3d0a9c..d8c3b2d53c 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 5c94e20126..222220053a 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 26b8199035..6ce2e68094 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 7db60186c3..e381dd540f 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.