Commit 51a1c2a2 authored by simonmar's avatar simonmar

[project @ 2003-02-20 15:39:59 by simonmar]

closureSatisfiesConstraints: check whether the retainer set is valid
before attempting to match it against a constraint.  It might not be
valid if the object is an ex-weak-pointer which was finalized after
the last GC.

MERGE TO STABLE
parent 00227c6a
/* -----------------------------------------------------------------------------
* $Id: ProfHeap.c,v 1.42 2003/01/23 16:39:30 simonmar Exp $
* $Id: ProfHeap.c,v 1.43 2003/02/20 15:39:59 simonmar Exp $
*
* (c) The GHC Team, 1998-2000
*
......@@ -593,12 +593,18 @@ closureSatisfiesConstraints( StgClosure* p )
if (RtsFlags.ProfFlags.retainerSelector) {
RetainerSet *rs;
nat i;
rs = retainerSetOf((StgClosure *)p);
if (rs != NULL) {
for (i = 0; i < rs->num; i++) {
b = strMatchesSelector( rs->element[i]->cc->label,
RtsFlags.ProfFlags.retainerSelector );
if (b) return rtsTrue;
// We must check that the retainer set is valid here. One
// reason it might not be valid is if this closure is a
// a newly deceased weak pointer (i.e. a DEAD_WEAK), since
// these aren't reached by the retainer profiler's traversal.
if (isRetainerSetFieldValid((StgClosure *)p)) {
rs = retainerSetOf((StgClosure *)p);
if (rs != NULL) {
for (i = 0; i < rs->num; i++) {
b = strMatchesSelector( rs->element[i]->cc->label,
RtsFlags.ProfFlags.retainerSelector );
if (b) return rtsTrue;
}
}
}
return rtsFalse;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment