summaryrefslogtreecommitdiff
path: root/checksums.c
diff options
context:
space:
mode:
authorivmai <ivmai>2009-09-16 16:43:37 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:46 +0200
commitdb2565100a193fa71336be2951b342ef7596f828 (patch)
tree4214eb726e4912fa34628655dc41ae247213caf8 /checksums.c
parentd70b0280af3c3d53e2a794b26aa7a3127943b8c3 (diff)
2009-09-16 Ivan Maidanski <ivmai@mail.ru>
* ChangeLog: Remove trailing spaces at EOLn; insert blank lines where missed. * doc/README: Expand all tabs to spaces; remove trailing spaces at EOLn; remove multiple trailing blank lines. * doc/README.autoconf: Ditto. * doc/README.DGUX386: Ditto. * doc/README.environment: Ditto. * doc/README.macros: Ditto. * doc/README.win32: Ditto. * tests/test.c: Ditto. * tests/test_cpp.cc: Ditto. * backgraph.c: Ditto. * blacklst.c: Ditto. * checksums.c: Ditto. * darwin_stop_world.c: Ditto. * dbg_mlc.c: Ditto. * dyn_load.c: Ditto. * finalize.c: Ditto. * gc_dlopen.c: Ditto. * gcj_mlc.c: Ditto. * headers.c: Ditto. * mach_dep.c: Ditto. * malloc.c: Ditto. * mallocx.c: Ditto. * new_hblk.c: Ditto. * obj_map.c: Ditto. * ptr_chck.c: Ditto. * real_malloc.c: Ditto. * reclaim.c: Ditto. * stubborn.c: Ditto. * thread_local_alloc.c: Ditto. * typd_mlc.c: Ditto. * gc_cpp.cc: Ditto. * include/gc_allocator.h: Ditto. * include/gc_backptr.h: Ditto. * include/gc_config_macros.h: Ditto. * include/gc_cpp.h: Ditto. * include/gc_gcj.h: Ditto. * include/gc_inline.h: Ditto. * include/gc_mark.h: Ditto. * include/gc_pthread_redirects.h: Ditto. * include/gc_typed.h: Ditto. * include/gc_version.h: Ditto. * include/javaxfc.h: Ditto. * include/new_gc_alloc.h: Ditto. * include/private/darwin_semaphore.h: Ditto. * include/private/dbg_mlc.h: Ditto. * include/private/gc_hdrs.h: Ditto. * include/private/gc_locks.h: Ditto. * include/private/gc_pmark.h: Ditto. * include/private/gcconfig.h: Ditto. * include/private/pthread_support.h: Ditto. * include/private/thread_local_alloc.h: Ditto. * darwin_stop_world.c: Add copyright header. * include/gc_backptr.h: Ditto. * include/gc_config_macros.h: Ditto. * include/gc_pthread_redirects.h: Ditto. * include/gc_version.h: Ditto. * include/javaxfc.h: Ditto. * include/private/darwin_semaphore.h: Ditto. * include/private/pthread_support.h: Ditto. * gc_cpp.cc: Make copyright header uniform across the package. * include/gc_cpp.h: Ditto.
Diffstat (limited to 'checksums.c')
-rw-r--r--checksums.c120
1 files changed, 60 insertions, 60 deletions
diff --git a/checksums.c b/checksums.c
index 6e1df9c..c0a2fa2 100644
--- a/checksums.c
+++ b/checksums.c
@@ -16,27 +16,27 @@
# ifdef CHECKSUMS
-/* 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.) */
+/* 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
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. */
+ 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]; /* Record of pages on which we saw a write */
- /* fault. */
+STATIC word GC_faulted[NSUMS]; /* Record of pages on which we saw a write */
+ /* fault. */
STATIC size_t GC_n_faulted = 0;
void GC_record_fault(struct hblk * h)
@@ -57,7 +57,7 @@ STATIC GC_bool GC_was_faulted(struct hblk *h)
page += GC_page_size - 1;
page &= ~(GC_page_size - 1);
for (i = 0; i < GC_n_faulted; ++i) {
- if (GC_faulted[i] == page) return TRUE;
+ if (GC_faulted[i] == page) return TRUE;
}
return FALSE;
}
@@ -67,7 +67,7 @@ STATIC word GC_checksum(struct hblk *h)
register word *p = (word *)h;
register word *lim = (word *)(h+1);
register word result = 0;
-
+
while (p < lim) {
result += *p++;
}
@@ -75,14 +75,14 @@ STATIC word GC_checksum(struct hblk *h)
}
# ifdef STUBBORN_ALLOC
-/* Check whether a stubborn object from the given block appears on */
-/* the appropriate free list. */
+/* 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)
{
hdr * hhdr = HDR(h);
size_t sz = BYTES_TO_WORDS(hhdr -> hb_sz);
ptr_t p;
-
+
if (sz > MAXOBJWORDS) return(FALSE);
for (p = GC_sobjfreelist[sz]; p != 0; p = obj_link(p)) {
if (HBLKPTR(p) == h) return(TRUE);
@@ -90,7 +90,7 @@ STATIC GC_bool GC_on_free_list(struct hblk *h)
return(FALSE);
}
# endif
-
+
int GC_n_dirty_errors;
int GC_n_faulted_dirty_errors;
int GC_n_changed_errors;
@@ -102,7 +102,7 @@ STATIC void GC_update_check_page(struct hblk *h, int index)
page_entry *pe = GC_sums + index;
register hdr * hhdr = HDR(h);
struct hblk *b;
-
+
if (pe -> block != 0 && pe -> block != h + OFFSET) ABORT("goofed");
pe -> old_sum = pe -> new_sum;
pe -> new_sum = GC_checksum(h);
@@ -112,33 +112,33 @@ STATIC void GC_update_check_page(struct hblk *h, int index)
}
# endif
if (GC_page_was_dirty(h)) {
- GC_n_dirty++;
+ GC_n_dirty++;
} else {
- GC_n_clean++;
+ GC_n_clean++;
}
b = h;
while (IS_FORWARDING_ADDR_OR_NIL(hhdr) && hhdr != 0) {
- b -= (word)hhdr;
- hhdr = HDR(b);
+ 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++;
- }
-# 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
}
pe -> new_valid = TRUE;
pe -> block = h + OFFSET;
@@ -151,7 +151,7 @@ STATIC void GC_add_block(struct hblk *h, word dummy)
{
hdr * hhdr = HDR(h);
size_t bytes = hhdr -> hb_sz;
-
+
bytes += HBLKSIZE-1;
bytes &= ~(HBLKSIZE-1);
GC_bytes_in_used_blocks += bytes;
@@ -160,15 +160,15 @@ STATIC void GC_add_block(struct hblk *h, word dummy)
STATIC void GC_check_blocks(void)
{
word bytes_in_free_blocks = GC_large_free_bytes;
-
+
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("LOST SOME BLOCKS!!\n");
+ GC_printf("LOST SOME BLOCKS!!\n");
}
}
@@ -179,18 +179,18 @@ void GC_check_dirty(void)
unsigned i;
struct hblk *h;
ptr_t start;
-
+
GC_check_blocks();
-
+
GC_n_dirty_errors = 0;
GC_n_faulted_dirty_errors = 0;
GC_n_changed_errors = 0;
GC_n_clean = 0;
GC_n_dirty = 0;
-
+
index = 0;
for (i = 0; i < GC_n_heap_sects; i++) {
- start = GC_heap_sects[i].hs_start;
+ start = GC_heap_sects[i].hs_start;
for (h = (struct hblk *)start;
h < (struct hblk *)(start + GC_heap_sects[i].hs_bytes);
h++) {
@@ -201,19 +201,19 @@ void GC_check_dirty(void)
}
out:
GC_printf("Checked %lu clean and %lu dirty pages\n",
- (unsigned long) GC_n_clean, (unsigned long) GC_n_dirty);
+ (unsigned long) GC_n_clean, (unsigned long) GC_n_dirty);
if (GC_n_dirty_errors > 0) {
GC_printf("Found %d dirty bit errors (%d were faulted)\n",
- GC_n_dirty_errors, GC_n_faulted_dirty_errors);
+ GC_n_dirty_errors, GC_n_faulted_dirty_errors);
}
if (GC_n_changed_errors > 0) {
- 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
}
for (i = 0; i < GC_n_faulted; ++i) {
GC_faulted[i] = 0; /* Don't expose block pointers to GC */
@@ -224,7 +224,7 @@ out:
# else
extern int GC_quiet;
- /* ANSI C doesn't allow translation units to be empty. */
- /* So we guarantee this one is nonempty. */
+ /* ANSI C doesn't allow translation units to be empty. */
+ /* So we guarantee this one is nonempty. */
# endif /* CHECKSUMS */