2006-03-10
2006-03-10 06:58:03 by Martin Stjernholm <mast@lysator.liu.se>
-
28d6b7f1bfd0e612b83726a8ea343b1cf1cbbc92
(30 lines)
(+22/-8)
[
Show
| Annotate
]
Branch: 7.9
Another go at that pesky bug when reallocating multiset_data blocks inside
the gc.
Rev: src/gc.c:1.275
Rev: src/gc.h:1.121
Rev: src/multiset.c:1.100
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.274 2006/02/28 13:47:57 mast Exp $
+ || $Id: gc.c,v 1.275 2006/03/10 06:58:03 mast Exp $
*/
#include "global.h"
2014:
int gc_mark(void *a)
{
- struct marker *m = get_marker(debug_malloc_pass(a));
+ struct marker *m;
#ifdef PIKE_DEBUG
-
+ if (Pike_in_gc == GC_PASS_ZAP_WEAK && !find_marker (a))
+ gc_fatal (a, 0, "gc_mark() called for for thing without marker "
+ "in zap weak pass.\n");
+ #endif
+
+ m = get_marker (a);
+
+ #ifdef PIKE_DEBUG
if (gc_is_watching && m && m->flags & GC_WATCHED) {
/* This is useful to set breakpoints on. */
gc_watched_found (m, "gc_mark()");
2040: Inside #if defined(PIKE_DEBUG)
gc_fatal(a, 0, "gc_mark() called for thing in zap weak pass "
"that wasn't marked before.\n");
#endif
- if (m->flags & GC_FREE_VISITED)
+ if (m->flags & GC_FREE_VISITED) {
+ debug_malloc_touch (a);
return 0;
-
+ }
else {
-
+ debug_malloc_touch (a);
m->flags |= GC_FREE_VISITED;
return 1;
}
}
else if (m->flags & GC_MARKED) {
-
+ debug_malloc_touch (a);
#ifdef PIKE_DEBUG
if (m->weak_refs != 0)
gc_fatal(a, 0, "weak_refs changed in marker already visited by gc_mark().\n");
2056:
return 0;
}
else {
+ debug_malloc_touch (a);
if (m->weak_refs) {
gc_ext_weak_refs -= m->weak_refs;
m->weak_refs = 0;
2068:
void gc_move_marker (void *old, void *new)
{
- struct marker *m = get_marker (old);
+ struct marker *m = find_marker (old);
#ifdef PIKE_DEBUG
- if (!old) Pike_fatal("Got null pointer in old.\n");
- if (!new) Pike_fatal("Got null pointer in new.\n");
+ if (!Pike_in_gc || Pike_in_gc >= GC_PASS_FREE)
+ Pike_fatal ("gc move mark attempted in invalid pass.\n");
+ if (!old) Pike_fatal ("Got null pointer in old.\n");
+ if (!new) Pike_fatal ("Got null pointer in new.\n");
if (!m) Pike_fatal ("Have no marker for old block %p.\n", old);
if (find_marker (new))
Pike_fatal ("New block %p already got a marker.\n", new);
- if (!Pike_in_gc || Pike_in_gc >= GC_PASS_FREE)
- Pike_fatal ("gc move mark attempted in invalid pass.\n");
+
#endif
move_marker (m, debug_malloc_pass (new));