summaryrefslogtreecommitdiff
path: root/checksums.c
diff options
context:
space:
mode:
authorhboehm <hboehm>2009-06-20 22:24:43 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:45 +0200
commit68ed7473eb69ad894551afe2a78f0cc99af6f82e (patch)
tree52c5bb5d398d21fbac6f9834c1115e730b94747e /checksums.c
parentf4db11bf68b5fa1736f02f6e9b2b1e067fc386f7 (diff)
2009-06-20 Hans Boehm <Hans.Boehm@hp.com>
* allchblk.c (GC_allochblk_nth): Add assertion. * checksums.c: Add GC_record_fault, GC_was_faulted, CC_n_faulted_dirty_errors. (GC_check_dirty): Remove register declarations, print dirty bit errors on faulted pages. * os_dep.c (GC_write_fault_handler): Call GC_record_fault(). * os_dep.c (GC_remove_protection): Compute index correctly.
Diffstat (limited to 'checksums.c')
-rw-r--r--checksums.c47
1 files changed, 41 insertions, 6 deletions
diff --git a/checksums.c b/checksums.c
index 91f3b28..275026d 100644
--- a/checksums.c
+++ b/checksums.c
@@ -34,6 +34,33 @@ typedef struct {
page_entry GC_sums [NSUMS];
+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)
+{
+ word page = (word)h;
+
+ page += GC_page_size - 1;
+ page &= ~(GC_page_size - 1);
+ if (GC_n_faulted >= NSUMS) ABORT("write fault log overflowed");
+ GC_faulted[GC_n_faulted++] = page;
+}
+
+STATIC GC_bool GC_was_faulted(struct hblk *h)
+{
+ size_t i;
+ word page = (word)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;
+ }
+ return FALSE;
+}
+
STATIC word GC_checksum(struct hblk *h)
{
register word *p = (word *)h;
@@ -64,6 +91,7 @@ STATIC GC_bool GC_on_free_list(struct hblk *h)
# 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;
@@ -96,7 +124,9 @@ STATIC void GC_update_check_page(struct hblk *h, int index)
&& 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)
@@ -144,14 +174,15 @@ STATIC void GC_check_blocks(void)
/* Should be called immediately after GC_read_dirty and GC_read_changed. */
void GC_check_dirty(void)
{
- register int index;
- register unsigned i;
- register struct hblk *h;
- register ptr_t start;
+ int index;
+ 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;
@@ -171,8 +202,8 @@ out:
GC_printf("Checked %lu clean and %lu dirty pages\n",
(unsigned long) GC_n_clean, (unsigned long) GC_n_dirty);
if (GC_n_dirty_errors > 0) {
- GC_printf("Found %lu dirty bit errors\n",
- (unsigned long)GC_n_dirty_errors);
+ GC_printf("Found %d dirty bit errors (%d were faulted)\n",
+ GC_n_dirty_errors, GC_n_faulted_dirty_errors);
}
if (GC_n_changed_errors > 0) {
GC_printf("Found %lu changed bit errors\n",
@@ -183,6 +214,10 @@ out:
"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 */
+ }
+ GC_n_faulted = 0;
}
# else