/*
* Copyright (c) 1992-1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
#include "private/gc_priv.h"
#ifdef CHECKSUMS
/* This is debugging code intended to verify the results of dirty bit */
/* computations. Works only in a single threaded environment. */
#define NSUMS 10000
#define OFFSET 0x10000
typedef struct {
GC_bool new_valid;
word old_sum;
word new_sum;
struct hblk * block; /* Block to which this refers + OFFSET */
/* to hide it from collector. */
} page_entry;
page_entry GC_sums[NSUMS];
STATIC word GC_faulted[NSUMS] = { 0 };
/* Record of pages on which we saw a write fault. */
if (pe -> block != 0 && pe -> block != h + OFFSET) ABORT("goofed");
pe -> old_sum = pe -> new_sum;
pe -> new_sum = GC_checksum(h);
# if !defined(MSWIN32) && !defined(MSWINCE)
if (pe -> new_sum != 0x80000000 && !GC_page_was_ever_dirty(h)) {
GC_err_printf("GC_page_was_ever_dirty(%p) is wrong\n", (void *)h);
}
# endif
if (GC_page_was_dirty(h)) {
GC_n_dirty++;
} else {
GC_n_clean++;
}
b = h;
while (IS_FORWARDING_ADDR_OR_NIL(hhdr) && hhdr != 0) {
b -= (word)hhdr;
hhdr = HDR(b);
}
if (pe -> new_valid
&& hhdr != 0 && hhdr -> hb_descr != 0 /* may contain pointers */
&& pe -> old_sum != pe -> new_sum) {
if (!GC_page_was_dirty(h) || !GC_page_was_ever_dirty(h)) {
GC_bool was_faulted = GC_was_faulted(h);
/* Set breakpoint here */GC_n_dirty_errors++;
if (was_faulted) GC_n_faulted_dirty_errors++;
}
}
pe -> new_valid = TRUE;
pe -> block = h + OFFSET;
}