Mercurial > hg > xemacs-beta
diff src/gc.c @ 4934:714f7c9fabb1
make it easier to debug staticpro crashes.
Add functions to print out the variable names saved during calls to
staticpro(), and change the order of enumerating staticpros to start
from 0 to make it easier to get a count to pass to the new functions.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Tue, 19 Jan 2010 01:21:39 -0600 |
parents | 8748a3f7ceb4 |
children | 19a72041c5ed |
line wrap: on
line diff
--- a/src/gc.c Sun Jan 24 22:06:20 2010 -0600 +++ b/src/gc.c Tue Jan 19 01:21:39 2010 -0600 @@ -1,5 +1,6 @@ /* New incremental garbage collector for XEmacs. Copyright (C) 2005 Marcus Crestani. + Copyright (C) 2010 Ben Wing. This file is part of XEmacs. @@ -1624,8 +1625,9 @@ { /* staticpro() */ Lisp_Object **p = Dynarr_begin (staticpros); + Elemcount len = Dynarr_length (staticpros); Elemcount count; - for (count = Dynarr_length (staticpros); count; count--, p++) + for (count = 0; count < len; count++, p++) /* Need to check if the pointer in the staticpro array is not NULL. A gc can occur after variable is added to the staticpro array and _before_ it is correctly initialized. In this case @@ -1636,8 +1638,9 @@ { /* staticpro_nodump() */ Lisp_Object **p = Dynarr_begin (staticpros_nodump); + Elemcount len = Dynarr_length (staticpros_nodump); Elemcount count; - for (count = Dynarr_length (staticpros_nodump); count; count--, p++) + for (count = 0; count < len; count++, p++) /* Need to check if the pointer in the staticpro array is not NULL. A gc can occur after variable is added to the staticpro array and _before_ it is correctly initialized. In this case @@ -1649,9 +1652,10 @@ #ifdef NEW_GC { /* mcpro () */ Lisp_Object *p = Dynarr_begin (mcpros); + Elemcount len = Dynarr_length (mcpros); Elemcount count; - for (count = Dynarr_length (mcpros); count; count--) - mark_object (*p++); + for (count = 0; count < len; count++, p++) + mark_object (*p); } #endif /* NEW_GC */