2010-04-19
2010-04-19 14:01:37 by Martin Stjernholm <mast@lysator.liu.se>
-
03094a38f227a843a528d99fdca7098b4b56eec7
(19 lines)
(+11/-8)
[
Show
| Annotate
]
Branch: 7.9
Some more debug to detect mark queue garbage.
Rev: src/gc.c:1.346
Rev: src/gc.h:1.142
2:
|| This file is part of Pike. For copyright information see COPYRIGHT.
|| Pike is distributed under GPL, LGPL and MPL. See the file COPYING
|| for more information.
- || $Id: gc.c,v 1.345 2010/04/19 13:51:48 mast Exp $
+ || $Id: gc.c,v 1.346 2010/04/19 14:01:36 mast Exp $
*/
#include "global.h"
1703: Inside #if undefined(GC_MARK_DEBUG)
#ifndef GC_MARK_DEBUG
struct pike_queue gc_mark_queue;
+ #define CHECK_MARK_QUEUE_EMPTY() assert (!gc_mark_queue.first)
#else /* GC_MARK_DEBUG */
/* Cut'n'paste from queue.c. */
1727:
struct gc_queue_block *gc_mark_first = NULL, *gc_mark_last = NULL;
+ #define CHECK_MARK_QUEUE_EMPTY() assert (!gc_mark_first)
+
void gc_mark_run_queue()
{
struct gc_queue_block *b;
1763:
struct gc_queue_block *b;
#ifdef PIKE_DEBUG
+ if (Pike_in_gc != GC_PASS_MARK && Pike_in_gc != GC_PASS_ZAP_WEAK)
+ gc_fatal (data, 0, "gc_mark_enqueue() called in invalid gc pass.\n");
if (gc_found_in_type == PIKE_T_UNKNOWN || !gc_found_in)
gc_fatal (data, 0, "gc_mark_enqueue() called outside GC_ENTER.\n");
{
3557:
* follow the same reference several times, e.g. with shared mapping
* data blocks. */
ACCEPT_UNFINISHED_TYPE_FIELDS {
- /* The queue should be empty here. */
- #ifdef GC_MARK_DEBUG
- assert (!gc_mark_first);
- #else
- assert (!gc_mark_queue.first);
- #endif
-
+ CHECK_MARK_QUEUE_EMPTY();
gc_mark_all_arrays();
gc_mark_run_queue();
gc_mark_all_multisets();
3577: Inside #if defined(PIKE_DEBUG)
#ifdef PIKE_DEBUG
if(gc_debug) gc_mark_all_strings();
#endif /* PIKE_DEBUG */
+ CHECK_MARK_QUEUE_EMPTY();
} END_ACCEPT_UNFINISHED_TYPE_FIELDS;
GC_VERBOSE_DO(fprintf(stderr,
3635:
obj_count = delayed_freed;
#endif
Pike_in_gc = GC_PASS_ZAP_WEAK;
+ CHECK_MARK_QUEUE_EMPTY();
/* Zap weak references from external to internal things. That
* occurs when something has both external weak refs and nonweak
* cyclic refs from internal things. */
3643:
gc_zap_ext_weak_refs_in_multisets();
gc_zap_ext_weak_refs_in_objects();
gc_zap_ext_weak_refs_in_programs();
+ CHECK_MARK_QUEUE_EMPTY();
GC_VERBOSE_DO(
fprintf(stderr,
"| zap weak: freed %"PRINTPTRDIFFT"d external weak refs, "