aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schwab1998-04-06 09:04:23 +0000
committerAndreas Schwab1998-04-06 09:04:23 +0000
commit6feef451539bfd40ee1aea706290d734bdda6ff7 (patch)
treee6bd4ef27f1eca0ffcec76b7a4d34d7b2e059e6b
parent6b9c54648884fb28f86129be43fbfff0040e6c0b (diff)
downloademacs-6feef451539bfd40ee1aea706290d734bdda6ff7.tar.gz
emacs-6feef451539bfd40ee1aea706290d734bdda6ff7.zip
(gc_sweep): Avoid using two loop variables counting the
same thing.
-rw-r--r--src/alloc.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/src/alloc.c b/src/alloc.c
index be4c82d0a1e..be221b85c30 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2377,7 +2377,6 @@ gc_sweep ()
2377 for (i = 0; i < lim; i++) 2377 for (i = 0; i < lim; i++)
2378 if (!XMARKBIT (cblk->conses[i].car)) 2378 if (!XMARKBIT (cblk->conses[i].car))
2379 { 2379 {
2380 num_free++;
2381 this_free++; 2380 this_free++;
2382 *(struct Lisp_Cons **)&cblk->conses[i].cdr = cons_free_list; 2381 *(struct Lisp_Cons **)&cblk->conses[i].cdr = cons_free_list;
2383 cons_free_list = &cblk->conses[i]; 2382 cons_free_list = &cblk->conses[i];
@@ -2391,16 +2390,18 @@ gc_sweep ()
2391 /* If this block contains only free conses and we have already 2390 /* If this block contains only free conses and we have already
2392 seen more than two blocks worth of free conses then deallocate 2391 seen more than two blocks worth of free conses then deallocate
2393 this block. */ 2392 this block. */
2394 if (this_free == CONS_BLOCK_SIZE && num_free > 2*CONS_BLOCK_SIZE) 2393 if (this_free == CONS_BLOCK_SIZE && num_free > CONS_BLOCK_SIZE)
2395 { 2394 {
2396 num_free -= CONS_BLOCK_SIZE;
2397 *cprev = cblk->next; 2395 *cprev = cblk->next;
2398 /* Unhook from the free list. */ 2396 /* Unhook from the free list. */
2399 cons_free_list = *(struct Lisp_Cons **) &cblk->conses[0].cdr; 2397 cons_free_list = *(struct Lisp_Cons **) &cblk->conses[0].cdr;
2400 xfree (cblk); 2398 xfree (cblk);
2401 } 2399 }
2402 else 2400 else
2403 cprev = &cblk->next; 2401 {
2402 num_free += this_free;
2403 cprev = &cblk->next;
2404 }
2404 } 2405 }
2405 total_conses = num_used; 2406 total_conses = num_used;
2406 total_free_conses = num_free; 2407 total_free_conses = num_free;
@@ -2423,7 +2424,6 @@ gc_sweep ()
2423 for (i = 0; i < lim; i++) 2424 for (i = 0; i < lim; i++)
2424 if (!XMARKBIT (fblk->floats[i].type)) 2425 if (!XMARKBIT (fblk->floats[i].type))
2425 { 2426 {
2426 num_free++;
2427 this_free++; 2427 this_free++;
2428 *(struct Lisp_Float **)&fblk->floats[i].data = float_free_list; 2428 *(struct Lisp_Float **)&fblk->floats[i].data = float_free_list;
2429 float_free_list = &fblk->floats[i]; 2429 float_free_list = &fblk->floats[i];
@@ -2437,16 +2437,18 @@ gc_sweep ()
2437 /* If this block contains only free floats and we have already 2437 /* If this block contains only free floats and we have already
2438 seen more than two blocks worth of free floats then deallocate 2438 seen more than two blocks worth of free floats then deallocate
2439 this block. */ 2439 this block. */
2440 if (this_free == FLOAT_BLOCK_SIZE && num_free > 2*FLOAT_BLOCK_SIZE) 2440 if (this_free == FLOAT_BLOCK_SIZE && num_free > FLOAT_BLOCK_SIZE)
2441 { 2441 {
2442 num_free -= FLOAT_BLOCK_SIZE;
2443 *fprev = fblk->next; 2442 *fprev = fblk->next;
2444 /* Unhook from the free list. */ 2443 /* Unhook from the free list. */
2445 float_free_list = *(struct Lisp_Float **) &fblk->floats[0].data; 2444 float_free_list = *(struct Lisp_Float **) &fblk->floats[0].data;
2446 xfree (fblk); 2445 xfree (fblk);
2447 } 2446 }
2448 else 2447 else
2449 fprev = &fblk->next; 2448 {
2449 num_free += this_free;
2450 fprev = &fblk->next;
2451 }
2450 } 2452 }
2451 total_floats = num_used; 2453 total_floats = num_used;
2452 total_free_floats = num_free; 2454 total_free_floats = num_free;
@@ -2474,7 +2476,6 @@ gc_sweep ()
2474 { 2476 {
2475 iblk->intervals[i].parent = interval_free_list; 2477 iblk->intervals[i].parent = interval_free_list;
2476 interval_free_list = &iblk->intervals[i]; 2478 interval_free_list = &iblk->intervals[i];
2477 num_free++;
2478 this_free++; 2479 this_free++;
2479 } 2480 }
2480 else 2481 else
@@ -2487,17 +2488,18 @@ gc_sweep ()
2487 /* If this block contains only free intervals and we have already 2488 /* If this block contains only free intervals and we have already
2488 seen more than two blocks worth of free intervals then 2489 seen more than two blocks worth of free intervals then
2489 deallocate this block. */ 2490 deallocate this block. */
2490 if (this_free == INTERVAL_BLOCK_SIZE 2491 if (this_free == INTERVAL_BLOCK_SIZE && num_free > INTERVAL_BLOCK_SIZE)
2491 && num_free > 2*INTERVAL_BLOCK_SIZE)
2492 { 2492 {
2493 num_free -= INTERVAL_BLOCK_SIZE;
2494 *iprev = iblk->next; 2493 *iprev = iblk->next;
2495 /* Unhook from the free list. */ 2494 /* Unhook from the free list. */
2496 interval_free_list = iblk->intervals[0].parent; 2495 interval_free_list = iblk->intervals[0].parent;
2497 xfree (iblk); 2496 xfree (iblk);
2498 } 2497 }
2499 else 2498 else
2500 iprev = &iblk->next; 2499 {
2500 num_free += this_free;
2501 iprev = &iblk->next;
2502 }
2501 } 2503 }
2502 total_intervals = num_used; 2504 total_intervals = num_used;
2503 total_free_intervals = num_free; 2505 total_free_intervals = num_free;
@@ -2522,7 +2524,6 @@ gc_sweep ()
2522 { 2524 {
2523 *(struct Lisp_Symbol **)&sblk->symbols[i].value = symbol_free_list; 2525 *(struct Lisp_Symbol **)&sblk->symbols[i].value = symbol_free_list;
2524 symbol_free_list = &sblk->symbols[i]; 2526 symbol_free_list = &sblk->symbols[i];
2525 num_free++;
2526 this_free++; 2527 this_free++;
2527 } 2528 }
2528 else 2529 else
@@ -2536,16 +2537,18 @@ gc_sweep ()
2536 /* If this block contains only free symbols and we have already 2537 /* If this block contains only free symbols and we have already
2537 seen more than two blocks worth of free symbols then deallocate 2538 seen more than two blocks worth of free symbols then deallocate
2538 this block. */ 2539 this block. */
2539 if (this_free == SYMBOL_BLOCK_SIZE && num_free > 2*SYMBOL_BLOCK_SIZE) 2540 if (this_free == SYMBOL_BLOCK_SIZE && num_free > SYMBOL_BLOCK_SIZE)
2540 { 2541 {
2541 num_free -= SYMBOL_BLOCK_SIZE;
2542 *sprev = sblk->next; 2542 *sprev = sblk->next;
2543 /* Unhook from the free list. */ 2543 /* Unhook from the free list. */
2544 symbol_free_list = *(struct Lisp_Symbol **)&sblk->symbols[0].value; 2544 symbol_free_list = *(struct Lisp_Symbol **)&sblk->symbols[0].value;
2545 xfree (sblk); 2545 xfree (sblk);
2546 } 2546 }
2547 else 2547 else
2548 sprev = &sblk->next; 2548 {
2549 num_free += this_free;
2550 sprev = &sblk->next;
2551 }
2549 } 2552 }
2550 total_symbols = num_used; 2553 total_symbols = num_used;
2551 total_free_symbols = num_free; 2554 total_free_symbols = num_free;
@@ -2608,7 +2611,6 @@ gc_sweep ()
2608 mblk->markers[i].u_marker.type = Lisp_Misc_Free; 2611 mblk->markers[i].u_marker.type = Lisp_Misc_Free;
2609 mblk->markers[i].u_free.chain = marker_free_list; 2612 mblk->markers[i].u_free.chain = marker_free_list;
2610 marker_free_list = &mblk->markers[i]; 2613 marker_free_list = &mblk->markers[i];
2611 num_free++;
2612 this_free++; 2614 this_free++;
2613 } 2615 }
2614 else 2616 else
@@ -2622,16 +2624,18 @@ gc_sweep ()
2622 /* If this block contains only free markers and we have already 2624 /* If this block contains only free markers and we have already
2623 seen more than two blocks worth of free markers then deallocate 2625 seen more than two blocks worth of free markers then deallocate
2624 this block. */ 2626 this block. */
2625 if (this_free == MARKER_BLOCK_SIZE && num_free > 2*MARKER_BLOCK_SIZE) 2627 if (this_free == MARKER_BLOCK_SIZE && num_free > MARKER_BLOCK_SIZE)
2626 { 2628 {
2627 num_free -= MARKER_BLOCK_SIZE;
2628 *mprev = mblk->next; 2629 *mprev = mblk->next;
2629 /* Unhook from the free list. */ 2630 /* Unhook from the free list. */
2630 marker_free_list = mblk->markers[0].u_free.chain; 2631 marker_free_list = mblk->markers[0].u_free.chain;
2631 xfree (mblk); 2632 xfree (mblk);
2632 } 2633 }
2633 else 2634 else
2634 mprev = &mblk->next; 2635 {
2636 num_free += this_free;
2637 mprev = &mblk->next;
2638 }
2635 } 2639 }
2636 2640
2637 total_markers = num_used; 2641 total_markers = num_used;