projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New implementation of BLACKHOLEs
[ghc-hetmet.git]
/
rts
/
sm
/
Storage.c
diff --git
a/rts/sm/Storage.c
b/rts/sm/Storage.c
index
1f875a9
..
0234400
100644
(file)
--- a/
rts/sm/Storage.c
+++ b/
rts/sm/Storage.c
@@
-107,7
+107,7
@@
initStorage( void )
* doing something reasonable.
*/
/* We use the NOT_NULL variant or gcc warns that the test is always true */
* doing something reasonable.
*/
/* We use the NOT_NULL variant or gcc warns that the test is always true */
- ASSERT(LOOKS_LIKE_INFO_PTR_NOT_NULL((StgWord)&stg_BLACKHOLE_info));
+ ASSERT(LOOKS_LIKE_INFO_PTR_NOT_NULL((StgWord)&stg_BLOCKING_QUEUE_CLEAN_info));
ASSERT(LOOKS_LIKE_CLOSURE_PTR(&stg_dummy_ret_closure));
ASSERT(!HEAP_ALLOCED(&stg_dummy_ret_closure));
ASSERT(LOOKS_LIKE_CLOSURE_PTR(&stg_dummy_ret_closure));
ASSERT(!HEAP_ALLOCED(&stg_dummy_ret_closure));
@@
-229,13
+229,13
@@
freeStorage (void)
The entry code for every CAF does the following:
The entry code for every CAF does the following:
- - builds a CAF_BLACKHOLE in the heap
- - pushes an update frame pointing to the CAF_BLACKHOLE
+ - builds a BLACKHOLE in the heap
+ - pushes an update frame pointing to the BLACKHOLE
- invokes UPD_CAF(), which:
- calls newCaf, below
- invokes UPD_CAF(), which:
- calls newCaf, below
- - updates the CAF with a static indirection to the CAF_BLACKHOLE
+ - updates the CAF with a static indirection to the BLACKHOLE
- Why do we build a BLACKHOLE in the heap rather than just updating
+ Why do we build an BLACKHOLE in the heap rather than just updating
the thunk directly? It's so that we only need one kind of update
frame - otherwise we'd need a static version of the update frame too.
the thunk directly? It's so that we only need one kind of update
frame - otherwise we'd need a static version of the update frame too.
@@
-268,7
+268,6
@@
freeStorage (void)
void
newCAF(StgRegTable *reg, StgClosure* caf)
{
void
newCAF(StgRegTable *reg, StgClosure* caf)
{
-#ifdef DYNAMIC
if(keepCAFs)
{
// HACK:
if(keepCAFs)
{
// HACK:
@@
-289,7
+288,6
@@
newCAF(StgRegTable *reg, StgClosure* caf)
RELEASE_SM_LOCK;
}
else
RELEASE_SM_LOCK;
}
else
-#endif
{
// Put this CAF on the mutable list for the old generation.
((StgIndStatic *)caf)->saved_info = NULL;
{
// Put this CAF on the mutable list for the old generation.
((StgIndStatic *)caf)->saved_info = NULL;
@@
-297,6
+295,13
@@
newCAF(StgRegTable *reg, StgClosure* caf)
}
}
}
}
+// External API for setting the keepCAFs flag. see #3900.
+void
+setKeepCAFs (void)
+{
+ keepCAFs = 1;
+}
+
// An alternate version of newCaf which is used for dynamically loaded
// object code in GHCi. In this case we want to retain *all* CAFs in
// the object code, because they might be demanded at any time from an
// An alternate version of newCaf which is used for dynamically loaded
// object code in GHCi. In this case we want to retain *all* CAFs in
// the object code, because they might be demanded at any time from an
@@
-614,6
+619,8
@@
allocate (Capability *cap, lnat n)
}
p = bd->free;
bd->free += n;
}
p = bd->free;
bd->free += n;
+
+ IF_DEBUG(sanity, ASSERT(*((StgWord8*)p) == 0xaa));
return p;
}
return p;
}
@@
-692,11
+699,9
@@
void
dirty_MUT_VAR(StgRegTable *reg, StgClosure *p)
{
Capability *cap = regTableToCapability(reg);
dirty_MUT_VAR(StgRegTable *reg, StgClosure *p)
{
Capability *cap = regTableToCapability(reg);
- bdescr *bd;
if (p->header.info == &stg_MUT_VAR_CLEAN_info) {
p->header.info = &stg_MUT_VAR_DIRTY_info;
if (p->header.info == &stg_MUT_VAR_CLEAN_info) {
p->header.info = &stg_MUT_VAR_DIRTY_info;
- bd = Bdescr((StgPtr)p);
- if (bd->gen_no > 0) recordMutableCap(p,cap,bd->gen_no);
+ recordClosureMutated(cap,p);
}
}
}
}
@@
-709,11
+714,9
@@
dirty_MUT_VAR(StgRegTable *reg, StgClosure *p)
void
setTSOLink (Capability *cap, StgTSO *tso, StgTSO *target)
{
void
setTSOLink (Capability *cap, StgTSO *tso, StgTSO *target)
{
- bdescr *bd;
if (tso->dirty == 0 && (tso->flags & TSO_LINK_DIRTY) == 0) {
tso->flags |= TSO_LINK_DIRTY;
if (tso->dirty == 0 && (tso->flags & TSO_LINK_DIRTY) == 0) {
tso->flags |= TSO_LINK_DIRTY;
- bd = Bdescr((StgPtr)tso);
- if (bd->gen_no > 0) recordMutableCap((StgClosure*)tso,cap,bd->gen_no);
+ recordClosureMutated(cap,(StgClosure*)tso);
}
tso->_link = target;
}
}
tso->_link = target;
}
@@
-721,10
+724,8
@@
setTSOLink (Capability *cap, StgTSO *tso, StgTSO *target)
void
dirty_TSO (Capability *cap, StgTSO *tso)
{
void
dirty_TSO (Capability *cap, StgTSO *tso)
{
- bdescr *bd;
if (tso->dirty == 0 && (tso->flags & TSO_LINK_DIRTY) == 0) {
if (tso->dirty == 0 && (tso->flags & TSO_LINK_DIRTY) == 0) {
- bd = Bdescr((StgPtr)tso);
- if (bd->gen_no > 0) recordMutableCap((StgClosure*)tso,cap,bd->gen_no);
+ recordClosureMutated(cap,(StgClosure*)tso);
}
tso->dirty = 1;
}
}
tso->dirty = 1;
}
@@
-740,10
+741,7
@@
dirty_TSO (Capability *cap, StgTSO *tso)
void
dirty_MVAR(StgRegTable *reg, StgClosure *p)
{
void
dirty_MVAR(StgRegTable *reg, StgClosure *p)
{
- Capability *cap = regTableToCapability(reg);
- bdescr *bd;
- bd = Bdescr((StgPtr)p);
- if (bd->gen_no > 0) recordMutableCap(p,cap,bd->gen_no);
+ recordClosureMutated(regTableToCapability(reg),p);
}
/* -----------------------------------------------------------------------------
}
/* -----------------------------------------------------------------------------