* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
-/* This is debugging code intended to verify the results of dirty bit */
-/* computations. Works only in a single threaded environment. */
-/* We assume that stubborn objects are changed only when they are */
-/* enabled for writing. (Certain kinds of writing are actually */
-/* safe under other conditions.) */
-# define NSUMS 10000
+/* This is debugging code intended to verify the results of dirty bit */
+/* computations. Works only in a single threaded environment. */
+/* We assume that stubborn objects are changed only when they are */
+/* enabled for writing. (Certain kinds of writing are actually */
+/* safe under other conditions.) */
+#define NSUMS 10000
+
+#define OFFSET 0x10000
page += GC_page_size - 1;
page &= ~(GC_page_size - 1);
for (i = 0; i < GC_n_faulted; ++i) {
page += GC_page_size - 1;
page &= ~(GC_page_size - 1);
for (i = 0; i < GC_n_faulted; ++i) {
-# ifdef STUBBORN_ALLOC
-/* Check whether a stubborn object from the given block appears on */
-/* the appropriate free list. */
-STATIC GC_bool GC_on_free_list(struct hblk *h)
-{
+#ifdef STUBBORN_ALLOC
+ /* Check whether a stubborn object from the given block appears on */
+ /* the appropriate free list. */
+ STATIC GC_bool GC_on_free_list(struct hblk *h)
+ {
if (sz > MAXOBJWORDS) return(FALSE);
for (p = GC_sobjfreelist[sz]; p != 0; p = obj_link(p)) {
if (HBLKPTR(p) == h) return(TRUE);
}
return(FALSE);
if (sz > MAXOBJWORDS) return(FALSE);
for (p = GC_sobjfreelist[sz]; p != 0; p = obj_link(p)) {
if (HBLKPTR(p) == h) return(TRUE);
}
return(FALSE);
-}
-# endif
-
-int GC_n_dirty_errors;
-int GC_n_faulted_dirty_errors;
-int GC_n_changed_errors;
-int GC_n_clean;
-int GC_n_dirty;
+ }
+#endif
+
+int GC_n_dirty_errors = 0;
+int GC_n_faulted_dirty_errors = 0;
+int GC_n_changed_errors = 0;
+int GC_n_clean = 0;
+int GC_n_dirty = 0;
STATIC void GC_update_check_page(struct hblk *h, int index)
{
page_entry *pe = GC_sums + index;
STATIC void GC_update_check_page(struct hblk *h, int index)
{
page_entry *pe = GC_sums + index;
if (pe -> block != 0 && pe -> block != h + OFFSET) ABORT("goofed");
pe -> old_sum = pe -> new_sum;
pe -> new_sum = GC_checksum(h);
if (pe -> block != 0 && pe -> block != h + OFFSET) ABORT("goofed");
pe -> old_sum = pe -> new_sum;
pe -> new_sum = GC_checksum(h);
- && 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++;
- }
-# ifdef STUBBORN_ALLOC
- if (!HBLK_IS_FREE(hhdr)
- && hhdr -> hb_obj_kind == STUBBORN
- && !GC_page_was_changed(h)
- && !GC_on_free_list(h)) {
- /* if GC_on_free_list(h) then reclaim may have touched it */
- /* without any allocations taking place. */
- /* Set breakpoint here */GC_n_changed_errors++;
- }
-# endif
+ && 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++;
+ }
+# ifdef STUBBORN_ALLOC
+ if (!HBLK_IS_FREE(hhdr)
+ && hhdr -> hb_obj_kind == STUBBORN
+ && !GC_page_was_changed(h)
+ && !GC_on_free_list(h)) {
+ /* if GC_on_free_list(h) then reclaim may have touched it */
+ /* without any allocations taking place. */
+ /* Set breakpoint here */GC_n_changed_errors++;
+ }
+# endif
/*ARGSUSED*/
STATIC void GC_add_block(struct hblk *h, word dummy)
{
hdr * hhdr = HDR(h);
size_t bytes = hhdr -> hb_sz;
/*ARGSUSED*/
STATIC void GC_add_block(struct hblk *h, word dummy)
{
hdr * hhdr = HDR(h);
size_t bytes = hhdr -> hb_sz;
GC_bytes_in_used_blocks = 0;
GC_apply_to_all_blocks(GC_add_block, (word)0);
GC_printf("GC_bytes_in_used_blocks = %lu, bytes_in_free_blocks = %lu ",
GC_bytes_in_used_blocks = 0;
GC_apply_to_all_blocks(GC_add_block, (word)0);
GC_printf("GC_bytes_in_used_blocks = %lu, bytes_in_free_blocks = %lu ",
- (unsigned long)GC_bytes_in_used_blocks,
- (unsigned long)bytes_in_free_blocks);
+ (unsigned long)GC_bytes_in_used_blocks,
+ (unsigned long)bytes_in_free_blocks);
GC_printf("GC_heapsize = %lu\n", (unsigned long)GC_heapsize);
if (GC_bytes_in_used_blocks + bytes_in_free_blocks != GC_heapsize) {
GC_printf("GC_heapsize = %lu\n", (unsigned long)GC_heapsize);
if (GC_bytes_in_used_blocks + bytes_in_free_blocks != GC_heapsize) {
if (GC_n_dirty_errors > 0) {
GC_printf("Found %d dirty bit errors (%d were faulted)\n",
if (GC_n_dirty_errors > 0) {
GC_printf("Found %d dirty bit errors (%d were faulted)\n",
- GC_printf("Found %lu changed bit errors\n",
- (unsigned long)GC_n_changed_errors);
- GC_printf("These may be benign (provoked by nonpointer changes)\n");
-# ifdef THREADS
- GC_printf(
- "Also expect 1 per thread currently allocating a stubborn obj.\n");
-# endif
+ GC_printf("Found %lu changed bit errors\n",
+ (unsigned long)GC_n_changed_errors);
+ GC_printf("These may be benign (provoked by nonpointer changes)\n");
+# ifdef THREADS
+ GC_printf(
+ "Also expect 1 per thread currently allocating a stubborn obj.\n");
+# endif