projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow work units smaller than a block to improve load balancing
[ghc-hetmet.git]
/
rts
/
sm
/
Evac.c
diff --git
a/rts/sm/Evac.c
b/rts/sm/Evac.c
index
ee88175
..
daa6018
100644
(file)
--- a/
rts/sm/Evac.c
+++ b/
rts/sm/Evac.c
@@
-21,6
+21,10
@@
#include "Prelude.h"
#include "LdvProfile.h"
#include "Prelude.h"
#include "LdvProfile.h"
+#if defined(PROF_SPIN) && defined(THREADED_RTS)
+StgWord64 whitehole_spin = 0;
+#endif
+
/* Used to avoid long recursion due to selector thunks
*/
#define MAX_THUNK_SELECTOR_DEPTH 16
/* Used to avoid long recursion due to selector thunks
*/
#define MAX_THUNK_SELECTOR_DEPTH 16
@@
-51,16
+55,15
@@
alloc_for_copy (nat size, step *stp)
}
}
}
}
- ws = &gct->steps[stp->gen_no][stp->no];
+ ws = &gct->steps[stp->abs_no];
+ // this compiles to a single mem access to stp->abs_no only
/* chain a new block onto the to-space for the destination step if
* necessary.
*/
/* chain a new block onto the to-space for the destination step if
* necessary.
*/
-
- ASSERT(ws->todo_free >= ws->todo_bd->free && ws->todo_free <= ws->todo_lim);
to = ws->todo_free;
to = ws->todo_free;
- if (to + size >= ws->todo_lim) {
- to = gc_alloc_todo_block(ws);
+ if (to + size > ws->todo_lim) {
+ to = todo_block_full(size, ws);
}
ws->todo_free = to + size;
ASSERT(ws->todo_free >= ws->todo_bd->free && ws->todo_free <= ws->todo_lim);
}
ws->todo_free = to + size;
ASSERT(ws->todo_free >= ws->todo_bd->free && ws->todo_free <= ws->todo_lim);
@@
-72,10
+75,10
@@
alloc_for_copy (nat size, step *stp)
The evacuate() code
-------------------------------------------------------------------------- */
The evacuate() code
-------------------------------------------------------------------------- */
-#define MINOR_GC
+#define PARALLEL_GC
#include "Evac.c-inc"
#include "Evac.c-inc"
-#undef MINOR_GC
+#undef PARALLEL_GC
#include "Evac.c-inc"
/* -----------------------------------------------------------------------------
#include "Evac.c-inc"
/* -----------------------------------------------------------------------------
@@
-93,8
+96,11
@@
STATIC_INLINE void
evacuate_large(StgPtr p)
{
bdescr *bd = Bdescr(p);
evacuate_large(StgPtr p)
{
bdescr *bd = Bdescr(p);
- step *stp;
+ step *stp, *new_stp;
step_workspace *ws;
step_workspace *ws;
+
+ stp = bd->step;
+ ACQUIRE_SPIN_LOCK(&stp->sync_large_objects);
// object must be at the beginning of the block (or be a ByteArray)
ASSERT(get_itbl((StgClosure *)p)->type == ARR_WORDS ||
// object must be at the beginning of the block (or be a ByteArray)
ASSERT(get_itbl((StgClosure *)p)->type == ARR_WORDS ||
@@
-105,16
+111,14
@@
evacuate_large(StgPtr p)
/* Don't forget to set the gct->failed_to_evac flag if we didn't get
* the desired destination (see comments in evacuate()).
*/
/* Don't forget to set the gct->failed_to_evac flag if we didn't get
* the desired destination (see comments in evacuate()).
*/
- if (bd->step < gct->evac_step) {
- gct->failed_to_evac = rtsTrue;
- TICK_GC_FAILED_PROMOTION();
+ if (stp < gct->evac_step) {
+ gct->failed_to_evac = rtsTrue;
+ TICK_GC_FAILED_PROMOTION();
}
}
+ RELEASE_SPIN_LOCK(&stp->sync_large_objects);
return;
}
return;
}
- stp = bd->step;
-
- ACQUIRE_SPIN_LOCK(&stp->sync_large_objects);
// remove from large_object list
if (bd->u.back) {
bd->u.back->link = bd->link;
// remove from large_object list
if (bd->u.back) {
bd->u.back->link = bd->link;
@@
-124,25
+128,26
@@
evacuate_large(StgPtr p)
if (bd->link) {
bd->link->u.back = bd->u.back;
}
if (bd->link) {
bd->link->u.back = bd->u.back;
}
- RELEASE_SPIN_LOCK(&stp->sync_large_objects);
/* link it on to the evacuated large object list of the destination step
*/
/* link it on to the evacuated large object list of the destination step
*/
- stp = bd->step->to;
- if (stp < gct->evac_step) {
+ new_stp = stp->to;
+ if (new_stp < gct->evac_step) {
if (gct->eager_promotion) {
if (gct->eager_promotion) {
- stp = gct->evac_step;
+ new_stp = gct->evac_step;
} else {
gct->failed_to_evac = rtsTrue;
}
}
} else {
gct->failed_to_evac = rtsTrue;
}
}
- ws = &gct->steps[stp->gen_no][stp->no];
- bd->step = stp;
- bd->gen_no = stp->gen_no;
+ ws = &gct->steps[new_stp->abs_no];
+ bd->flags |= BF_EVACUATED;
+ bd->step = new_stp;
+ bd->gen_no = new_stp->gen_no;
bd->link = ws->todo_large_objects;
ws->todo_large_objects = bd;
bd->link = ws->todo_large_objects;
ws->todo_large_objects = bd;
- bd->flags |= BF_EVACUATED;
+
+ RELEASE_SPIN_LOCK(&stp->sync_large_objects);
}
/* -----------------------------------------------------------------------------
}
/* -----------------------------------------------------------------------------