diff options
| author | Dmitry Antipov | 2012-07-18 13:46:07 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-07-18 13:46:07 +0400 |
| commit | 169925ec990b7e22f35eb1e2c25a1b53f49072ff (patch) | |
| tree | 83a85ef3bf725565677c1d9f3b5771f0476df099 /src/alloc.c | |
| parent | 439f7677e90c6f4dd789b07efd46049c1100d9ed (diff) | |
| download | emacs-169925ec990b7e22f35eb1e2c25a1b53f49072ff.tar.gz emacs-169925ec990b7e22f35eb1e2c25a1b53f49072ff.zip | |
Fix sweep_vectors to handle large bool vectors correctly.
* alloc.c (sweep_vectors): Account total_vector_bytes for
bool vectors larger than VBLOCK_BYTES_MAX.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/alloc.c b/src/alloc.c index b891d32d164..0c3f5de6c3e 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -3152,11 +3152,27 @@ sweep_vectors (void) | |||
| 3152 | { | 3152 | { |
| 3153 | VECTOR_UNMARK (vector); | 3153 | VECTOR_UNMARK (vector); |
| 3154 | total_vectors++; | 3154 | total_vectors++; |
| 3155 | /* All pseudovectors are small enough to be allocated from | 3155 | if (vector->header.size & PSEUDOVECTOR_FLAG) |
| 3156 | vector blocks. This code should be redesigned if some | 3156 | { |
| 3157 | pseudovector type grows beyond VBLOCK_BYTES_MAX. */ | 3157 | if (((vector->header.size & PVEC_TYPE_MASK) |
| 3158 | eassert (!(vector->header.size & PSEUDOVECTOR_FLAG)); | 3158 | >> PSEUDOVECTOR_SIZE_BITS) == PVEC_BOOL_VECTOR) |
| 3159 | total_vector_bytes += header_size + vector->header.size * word_size; | 3159 | { |
| 3160 | struct Lisp_Bool_Vector *b | ||
| 3161 | = (struct Lisp_Bool_Vector *) vector; | ||
| 3162 | total_vector_bytes += header_size + sizeof (b->size) | ||
| 3163 | + (b->size + BOOL_VECTOR_BITS_PER_CHAR - 1) | ||
| 3164 | / BOOL_VECTOR_BITS_PER_CHAR; | ||
| 3165 | } | ||
| 3166 | else | ||
| 3167 | /* All other pseudovectors are small enough to be | ||
| 3168 | allocated from vector blocks. This code should | ||
| 3169 | be redesigned if some pseudovector type grows | ||
| 3170 | beyond VBLOCK_BYTES_MAX. */ | ||
| 3171 | abort (); | ||
| 3172 | } | ||
| 3173 | else | ||
| 3174 | total_vector_bytes | ||
| 3175 | += header_size + vector->header.size * word_size; | ||
| 3160 | vprev = &vector->header.next.vector; | 3176 | vprev = &vector->header.next.vector; |
| 3161 | } | 3177 | } |
| 3162 | else | 3178 | else |