From: sof Date: Wed, 15 Sep 1999 13:50:14 +0000 (+0000) Subject: [project @ 1999-09-15 13:50:14 by sof] X-Git-Tag: Approximately_9120_patches~5808 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=74c0717243ec2d533e18d8c1d641c4ecaa28714f;p=ghc-hetmet.git [project @ 1999-09-15 13:50:14 by sof] Code that trundles over stable_ptr_table need to start at index 1, as index 0 is unused (and may contain garbage.) --- diff --git a/ghc/rts/Stable.c b/ghc/rts/Stable.c index e640b27..01982b3 100644 --- a/ghc/rts/Stable.c +++ b/ghc/rts/Stable.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Stable.c,v 1.7 1999/08/04 15:25:33 simonmar Exp $ + * $Id: Stable.c,v 1.8 1999/09/15 13:50:14 sof Exp $ * * (c) The GHC Team, 1998-1999 * @@ -273,9 +273,10 @@ markStablePtrTable(rtsBool full) end_stable_ptr_table = &stable_ptr_table[SPT_size]; - /* Mark all the stable *pointers* (not stable names) + /* Mark all the stable *pointers* (not stable names). + * _starting_ at index 1; index 0 is unused. */ - for (p = stable_ptr_table; p < end_stable_ptr_table; p++) { + for (p = stable_ptr_table+1; p < end_stable_ptr_table; p++) { q = p->addr; /* internal pointers or NULL are free slots */ @@ -330,7 +331,8 @@ gcStablePtrTable(rtsBool full) end_stable_ptr_table = &stable_ptr_table[SPT_size]; - for (p = stable_ptr_table; p < end_stable_ptr_table; p++) { + /* NOTE: _starting_ at index 1; index 0 is unused. */ + for (p = stable_ptr_table + 1; p < end_stable_ptr_table; p++) { /* Update the pointer to the StableName object, if there is one */ if (p->sn_obj != NULL) {