diff options
author | Simon Marlow <marlowsd@gmail.com> | 2008-11-06 11:36:39 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2008-11-06 11:36:39 +0000 |
commit | 2b16fa4791b08b02df8461f3b79d0e44d72d0960 (patch) | |
tree | 53d0bba9254703d7d569e91c0f0f7b19ba8f25f8 /rts/PrimOps.cmm | |
parent | ebfa6fde6d9797ad2434a2af73a4c85b2984e00a (diff) | |
download | haskell-2b16fa4791b08b02df8461f3b79d0e44d72d0960.tar.gz |
Run sparks in batches, instead of creating a new thread for each one
Signficantly reduces the overhead for par, which means that we can
make use of paralellism at a much finer granularity.
Diffstat (limited to 'rts/PrimOps.cmm')
-rw-r--r-- | rts/PrimOps.cmm | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm index e65cbc4a5e..55ada8c45c 100644 --- a/rts/PrimOps.cmm +++ b/rts/PrimOps.cmm @@ -2287,3 +2287,25 @@ getApStackValzh_fast } RET_NP(ok,val); } + +getSparkzh_fast +{ + W_ spark; + +#ifndef THREADED_RTS + RET_NP(0,ghczmprim_GHCziBool_False_closure); +#else + (spark) = foreign "C" tryStealSpark(MyCapability()); + if (spark != 0) { + RET_NP(1,spark); + } else { + (spark) = foreign "C" stealWork (MyCapability()); + if (spark != 0) { + RET_NP(1,spark); + } else { + RET_NP(0,ghczmprim_GHCziBool_False_closure); + + } + } +#endif +} |