/* -----------------------------------------------------------------------------
- * $Id: Stable.c,v 1.9 1999/10/26 17:15:39 sewardj Exp $
+ * $Id: Stable.c,v 1.11 2000/04/24 22:05:08 panne Exp $
*
* (c) The GHC Team, 1998-1999
*
SPT_size = 0;
}
+/*
+ * get at the real stuff...remove indirections.
+ *
+ * ToDo: move to a better home.
+ */
+static
+StgClosure*
+removeIndirections(StgClosure* p)
+{
+ StgClosure* q = p;
+
+ while (get_itbl(q)->type == IND ||
+ get_itbl(q)->type == IND_STATIC ||
+ get_itbl(q)->type == IND_OLDGEN ||
+ get_itbl(q)->type == IND_PERM ||
+ get_itbl(q)->type == IND_OLDGEN_PERM ) {
+ q = ((StgInd *)q)->indirectee;
+ }
+ return q;
+}
+
StgWord
lookupStableName(StgPtr p)
{
if (stable_ptr_free == NULL) {
enlargeStablePtrTable();
}
-
+
+ /* removing indirections increases the likelihood
+ * of finding a match in the stable name
+ * hash table.
+ */
+ p = (StgPtr)removeIndirections((StgClosure*)p);
+
(void *)sn = lookupHashTable(addrToStableHash,(W_)p);
if (sn != 0) {