~ubuntu-branches/ubuntu/quantal/libgc/quantal

« back to all changes in this revision

Viewing changes to checksums.c

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Egger
  • Date: 2011-03-02 13:43:18 UTC
  • mfrom: (1.2.5 upstream) (3.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20110302134318-82ful0us5ce82qe8
Tags: 1:7.1-7
* Add ppc64 symbol file (Closes: #615469)
* Add sh4 symbol file (Closes: #614744)
* Add armhf symbol file
* Add powerpcspe symbol file
* Handle sparc64 the same as sparc
* Clear non-arch symbol file to support building on not yet captured
  architectures
* add -pthread to fix build with --no-add-needed

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
# ifdef STUBBORN_ALLOC
51
51
/* Check whether a stubborn object from the given block appears on      */
52
52
/* the appropriate free list.                                           */
53
 
GC_bool GC_on_free_list(h)
 
53
GC_bool GC_on_free_list(struct hblk *h)
54
54
struct hblk *h;
55
55
{
56
 
    register hdr * hhdr = HDR(h);
57
 
    register int sz = hhdr -> hb_sz;
 
56
    hdr * hhdr = HDR(h);
 
57
    int sz = BYTES_TO_WORDS(hhdr -> hb_sz);
58
58
    ptr_t p;
59
59
    
60
 
    if (sz > MAXOBJSZ) return(FALSE);
 
60
    if (sz > MAXOBJWORDS) return(FALSE);
61
61
    for (p = GC_sobjfreelist[sz]; p != 0; p = obj_link(p)) {
62
62
        if (HBLKPTR(p) == h) return(TRUE);
63
63
    }
70
70
int GC_n_clean;
71
71
int GC_n_dirty;
72
72
 
73
 
void GC_update_check_page(h, index)
74
 
struct hblk *h;
75
 
int index;
 
73
void GC_update_check_page(struct hblk *h, int index)
76
74
{
77
75
    page_entry *pe = GC_sums + index;
78
76
    register hdr * hhdr = HDR(h);
83
81
    pe -> new_sum = GC_checksum(h);
84
82
#   if !defined(MSWIN32) && !defined(MSWINCE)
85
83
        if (pe -> new_sum != 0x80000000 && !GC_page_was_ever_dirty(h)) {
86
 
            GC_printf1("GC_page_was_ever_dirty(0x%lx) is wrong\n",
87
 
                       (unsigned long)h);
 
84
            GC_printf("GC_page_was_ever_dirty(%p) is wrong\n", h);
88
85
        }
89
86
#   endif
90
87
    if (GC_page_was_dirty(h)) {
104
101
            /* Set breakpoint here */GC_n_dirty_errors++;
105
102
        }
106
103
#       ifdef STUBBORN_ALLOC
107
 
          if ( hhdr -> hb_map != GC_invalid_map
 
104
          if (!HBLK_IS_FREE(hhdr)
108
105
            && hhdr -> hb_obj_kind == STUBBORN
109
106
            && !GC_page_was_changed(h)
110
107
            && !GC_on_free_list(h)) {
118
115
    pe -> block = h + OFFSET;
119
116
}
120
117
 
121
 
word GC_bytes_in_used_blocks;
 
118
unsigned long GC_bytes_in_used_blocks;
122
119
 
123
120
void GC_add_block(h, dummy)
124
121
struct hblk *h;
125
122
word dummy;
126
123
{
127
 
   register hdr * hhdr = HDR(h);
128
 
   register bytes = WORDS_TO_BYTES(hhdr -> hb_sz);
 
124
   hdr * hhdr = HDR(h);
 
125
   bytes = hhdr -> hb_sz;
129
126
   
130
127
   bytes += HBLKSIZE-1;
131
128
   bytes &= ~(HBLKSIZE-1);
134
131
 
135
132
void GC_check_blocks()
136
133
{
137
 
    word bytes_in_free_blocks = GC_large_free_bytes;
 
134
    unsigned long bytes_in_free_blocks = GC_large_free_bytes;
138
135
    
139
136
    GC_bytes_in_used_blocks = 0;
140
137
    GC_apply_to_all_blocks(GC_add_block, (word)0);
141
 
    GC_printf2("GC_bytes_in_used_blocks = %ld, bytes_in_free_blocks = %ld ",
142
 
                GC_bytes_in_used_blocks, bytes_in_free_blocks);
143
 
    GC_printf1("GC_heapsize = %ld\n", GC_heapsize);
 
138
    GC_printf("GC_bytes_in_used_blocks = %lu, bytes_in_free_blocks = %lu ",
 
139
              GC_bytes_in_used_blocks, bytes_in_free_blocks);
 
140
    GC_printf("GC_heapsize = %lu\n", (unsigned long)GC_heapsize);
144
141
    if (GC_bytes_in_used_blocks + bytes_in_free_blocks != GC_heapsize) {
145
 
        GC_printf0("LOST SOME BLOCKS!!\n");
 
142
        GC_printf("LOST SOME BLOCKS!!\n");
146
143
    }
147
144
}
148
145
 
173
170
        }
174
171
    }
175
172
out:
176
 
    GC_printf2("Checked %lu clean and %lu dirty pages\n",
 
173
    GC_printf("Checked %lu clean and %lu dirty pages\n",
177
174
              (unsigned long) GC_n_clean, (unsigned long) GC_n_dirty);
178
175
    if (GC_n_dirty_errors > 0) {
179
 
        GC_printf1("Found %lu dirty bit errors\n",
180
 
                   (unsigned long)GC_n_dirty_errors);
 
176
        GC_printf("Found %lu dirty bit errors\n",
 
177
                  (unsigned long)GC_n_dirty_errors);
181
178
    }
182
179
    if (GC_n_changed_errors > 0) {
183
 
        GC_printf1("Found %lu changed bit errors\n",
184
 
                   (unsigned long)GC_n_changed_errors);
185
 
        GC_printf0("These may be benign (provoked by nonpointer changes)\n");
 
180
        GC_printf("Found %lu changed bit errors\n",
 
181
                  (unsigned long)GC_n_changed_errors);
 
182
        GC_printf("These may be benign (provoked by nonpointer changes)\n");
186
183
#       ifdef THREADS
187
 
            GC_printf0(
 
184
            GC_printf(
188
185
            "Also expect 1 per thread currently allocating a stubborn obj.\n");
189
186
#       endif
190
187
    }