diff options
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/alloc.c b/src/alloc.c index 350b668ec61..1eab82d1c2b 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -3254,8 +3254,7 @@ sweep_vectors (void) | |||
| 3254 | 3254 | ||
| 3255 | for (block = vector_blocks; block; block = *bprev) | 3255 | for (block = vector_blocks; block; block = *bprev) |
| 3256 | { | 3256 | { |
| 3257 | bool free_this_block = 0; | 3257 | bool free_this_block = false; |
| 3258 | ptrdiff_t nbytes; | ||
| 3259 | 3258 | ||
| 3260 | for (vector = (struct Lisp_Vector *) block->data; | 3259 | for (vector = (struct Lisp_Vector *) block->data; |
| 3261 | VECTOR_IN_BLOCK (vector, block); vector = next) | 3260 | VECTOR_IN_BLOCK (vector, block); vector = next) |
| @@ -3264,31 +3263,26 @@ sweep_vectors (void) | |||
| 3264 | { | 3263 | { |
| 3265 | VECTOR_UNMARK (vector); | 3264 | VECTOR_UNMARK (vector); |
| 3266 | total_vectors++; | 3265 | total_vectors++; |
| 3267 | nbytes = vector_nbytes (vector); | 3266 | ptrdiff_t nbytes = vector_nbytes (vector); |
| 3268 | total_vector_slots += nbytes / word_size; | 3267 | total_vector_slots += nbytes / word_size; |
| 3269 | next = ADVANCE (vector, nbytes); | 3268 | next = ADVANCE (vector, nbytes); |
| 3270 | } | 3269 | } |
| 3271 | else | 3270 | else |
| 3272 | { | 3271 | { |
| 3273 | ptrdiff_t total_bytes; | 3272 | ptrdiff_t total_bytes = 0; |
| 3274 | |||
| 3275 | cleanup_vector (vector); | ||
| 3276 | nbytes = vector_nbytes (vector); | ||
| 3277 | total_bytes = nbytes; | ||
| 3278 | next = ADVANCE (vector, nbytes); | ||
| 3279 | 3273 | ||
| 3280 | /* While NEXT is not marked, try to coalesce with VECTOR, | 3274 | /* While NEXT is not marked, try to coalesce with VECTOR, |
| 3281 | thus making VECTOR of the largest possible size. */ | 3275 | thus making VECTOR of the largest possible size. */ |
| 3282 | 3276 | ||
| 3283 | while (VECTOR_IN_BLOCK (next, block)) | 3277 | next = vector; |
| 3278 | do | ||
| 3284 | { | 3279 | { |
| 3285 | if (VECTOR_MARKED_P (next)) | ||
| 3286 | break; | ||
| 3287 | cleanup_vector (next); | 3280 | cleanup_vector (next); |
| 3288 | nbytes = vector_nbytes (next); | 3281 | ptrdiff_t nbytes = vector_nbytes (next); |
| 3289 | total_bytes += nbytes; | 3282 | total_bytes += nbytes; |
| 3290 | next = ADVANCE (next, nbytes); | 3283 | next = ADVANCE (next, nbytes); |
| 3291 | } | 3284 | } |
| 3285 | while (VECTOR_IN_BLOCK (next, block) && !VECTOR_MARKED_P (next)); | ||
| 3292 | 3286 | ||
| 3293 | eassert (total_bytes % roundup_size == 0); | 3287 | eassert (total_bytes % roundup_size == 0); |
| 3294 | 3288 | ||
| @@ -3296,7 +3290,7 @@ sweep_vectors (void) | |||
| 3296 | && !VECTOR_IN_BLOCK (next, block)) | 3290 | && !VECTOR_IN_BLOCK (next, block)) |
| 3297 | /* This block should be freed because all of its | 3291 | /* This block should be freed because all of its |
| 3298 | space was coalesced into the only free vector. */ | 3292 | space was coalesced into the only free vector. */ |
| 3299 | free_this_block = 1; | 3293 | free_this_block = true; |
| 3300 | else | 3294 | else |
| 3301 | setup_on_free_list (vector, total_bytes); | 3295 | setup_on_free_list (vector, total_bytes); |
| 3302 | } | 3296 | } |