projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
FIX compacting GC (bug1010, and other failures)
[ghc-hetmet.git]
/
rts
/
sm
/
GC.c
diff --git
a/rts/sm/GC.c
b/rts/sm/GC.c
index
7a82a6e
..
216d3cb
100644
(file)
--- a/
rts/sm/GC.c
+++ b/
rts/sm/GC.c
@@
-17,8
+17,6
@@
#include "RtsUtils.h"
#include "Apply.h"
#include "OSThreads.h"
#include "RtsUtils.h"
#include "Apply.h"
#include "OSThreads.h"
-#include "Storage.h"
-#include "Stable.h"
#include "LdvProfile.h"
#include "Updates.h"
#include "Stats.h"
#include "LdvProfile.h"
#include "Updates.h"
#include "Stats.h"
@@
-210,8
+208,10
@@
GarbageCollect ( rtsBool force_major_gc )
debugTrace(DEBUG_gc, "starting GC");
#if defined(RTS_USER_SIGNALS)
debugTrace(DEBUG_gc, "starting GC");
#if defined(RTS_USER_SIGNALS)
- // block signals
- blockUserSignals();
+ if (RtsFlags.MiscFlags.install_signal_handlers) {
+ // block signals
+ blockUserSignals();
+ }
#endif
// tell the STM to discard any cached closures its hoping to re-use
#endif
// tell the STM to discard any cached closures its hoping to re-use
@@
-484,10
+484,6
@@
GarbageCollect ( rtsBool force_major_gc )
*/
markStablePtrTable(mark_root);
*/
markStablePtrTable(mark_root);
- /* Mark the root pointer table.
- */
- markRootPtrTable(mark_root);
-
/* -------------------------------------------------------------------------
* Repeatedly scavenge all the areas we know about until there's no
* more scavenging to be done.
/* -------------------------------------------------------------------------
* Repeatedly scavenge all the areas we know about until there's no
* more scavenging to be done.
@@
-655,7
+651,7
@@
GarbageCollect ( rtsBool force_major_gc )
if (g <= N) {
copied -= stp->hp_bd->start + BLOCK_SIZE_W -
stp->hp_bd->free;
if (g <= N) {
copied -= stp->hp_bd->start + BLOCK_SIZE_W -
stp->hp_bd->free;
- scavd_copied -= (P_)(BLOCK_ROUND_UP(stp->scavd_hp)) - stp->scavd_hp;
+ scavd_copied -= stp->scavd_hpLim - stp->scavd_hp;
}
}
}
}
@@
-1020,8
+1016,10
@@
GarbageCollect ( rtsBool force_major_gc )
stat_endGC(allocated, live, copied, scavd_copied, N);
#if defined(RTS_USER_SIGNALS)
stat_endGC(allocated, live, copied, scavd_copied, N);
#if defined(RTS_USER_SIGNALS)
- // unblock signals again
- unblockUserSignals();
+ if (RtsFlags.MiscFlags.install_signal_handlers) {
+ // unblock signals again
+ unblockUserSignals();
+ }
#endif
RELEASE_SM_LOCK;
#endif
RELEASE_SM_LOCK;
@@
-1033,6
+1031,7
@@
GarbageCollect ( rtsBool force_major_gc )
closure if it is alive, or NULL otherwise.
NOTE: Use it before compaction only!
closure if it is alive, or NULL otherwise.
NOTE: Use it before compaction only!
+ It untags and (if needed) retags pointers to closures.
-------------------------------------------------------------------------- */
-------------------------------------------------------------------------- */
@@
-1041,8
+1040,12
@@
isAlive(StgClosure *p)
{
const StgInfoTable *info;
bdescr *bd;
{
const StgInfoTable *info;
bdescr *bd;
+ StgWord tag;
while (1) {
while (1) {
+ /* The tag and the pointer are split, to be merged later when needed. */
+ tag = GET_CLOSURE_TAG(p);
+ p = UNTAG_CLOSURE(p);
ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
info = get_itbl(p);
ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
info = get_itbl(p);
@@
-1054,18
+1057,18
@@
isAlive(StgClosure *p)
// for static closures with an empty SRT or CONSTR_STATIC_NOCAFs.
//
if (!HEAP_ALLOCED(p)) {
// for static closures with an empty SRT or CONSTR_STATIC_NOCAFs.
//
if (!HEAP_ALLOCED(p)) {
- return p;
+ return TAG_CLOSURE(tag,p);
}
// ignore closures in generations that we're not collecting.
bd = Bdescr((P_)p);
if (bd->gen_no > N) {
}
// ignore closures in generations that we're not collecting.
bd = Bdescr((P_)p);
if (bd->gen_no > N) {
- return p;
+ return TAG_CLOSURE(tag,p);
}
// if it's a pointer into to-space, then we're done
if (bd->flags & BF_EVACUATED) {
}
// if it's a pointer into to-space, then we're done
if (bd->flags & BF_EVACUATED) {
- return p;
+ return TAG_CLOSURE(tag,p);
}
// large objects use the evacuated flag
}
// large objects use the evacuated flag
@@
-1075,7
+1078,7
@@
isAlive(StgClosure *p)
// check the mark bit for compacted steps
if ((bd->flags & BF_COMPACTED) && is_marked((P_)p,bd)) {
// check the mark bit for compacted steps
if ((bd->flags & BF_COMPACTED) && is_marked((P_)p,bd)) {
- return p;
+ return TAG_CLOSURE(tag,p);
}
switch (info->type) {
}
switch (info->type) {