aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorPaul Eggert2014-04-28 09:59:41 -0700
committerPaul Eggert2014-04-28 09:59:41 -0700
commit9c23779a9d8474af16cfadb1a08d2c05ececcbec (patch)
tree5b4079b064da29fc379838f9f2bcedb7826d312b /src/alloc.c
parent90119853b1306f6792c690a802b4c81f279186dc (diff)
downloademacs-9c23779a9d8474af16cfadb1a08d2c05ececcbec.tar.gz
emacs-9c23779a9d8474af16cfadb1a08d2c05ececcbec.zip
Use bits_word for gcmarkbits.
* alloc.c (struct cons_block, struct float_block): On 64-bit hosts, bits_word is typically a tad more efficient for mark bits than unsigned is, so use bits_word. All uses changed. * lisp.h (BITS_PER_INT): Remove; no longer used.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 32d3333cea8..7159d1fa747 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2332,21 +2332,21 @@ make_formatted_string (char *buf, const char *format, ...)
2332#define FLOAT_BLOCK_SIZE \ 2332#define FLOAT_BLOCK_SIZE \
2333 (((BLOCK_BYTES - sizeof (struct float_block *) \ 2333 (((BLOCK_BYTES - sizeof (struct float_block *) \
2334 /* The compiler might add padding at the end. */ \ 2334 /* The compiler might add padding at the end. */ \
2335 - (sizeof (struct Lisp_Float) - sizeof (int))) * CHAR_BIT) \ 2335 - (sizeof (struct Lisp_Float) - sizeof (bits_word))) * CHAR_BIT) \
2336 / (sizeof (struct Lisp_Float) * CHAR_BIT + 1)) 2336 / (sizeof (struct Lisp_Float) * CHAR_BIT + 1))
2337 2337
2338#define GETMARKBIT(block,n) \ 2338#define GETMARKBIT(block,n) \
2339 (((block)->gcmarkbits[(n) / (sizeof (unsigned) * CHAR_BIT)] \ 2339 (((block)->gcmarkbits[(n) / BITS_PER_BITS_WORD] \
2340 >> ((n) % (sizeof (unsigned) * CHAR_BIT))) \ 2340 >> ((n) % BITS_PER_BITS_WORD)) \
2341 & 1) 2341 & 1)
2342 2342
2343#define SETMARKBIT(block,n) \ 2343#define SETMARKBIT(block,n) \
2344 ((block)->gcmarkbits[(n) / (sizeof (unsigned) * CHAR_BIT)] \ 2344 ((block)->gcmarkbits[(n) / BITS_PER_BITS_WORD] \
2345 |= 1u << ((n) % (sizeof (unsigned) * CHAR_BIT))) 2345 |= (bits_word) 1 << ((n) % BITS_PER_BITS_WORD))
2346 2346
2347#define UNSETMARKBIT(block,n) \ 2347#define UNSETMARKBIT(block,n) \
2348 ((block)->gcmarkbits[(n) / (sizeof (unsigned) * CHAR_BIT)] \ 2348 ((block)->gcmarkbits[(n) / BITS_PER_BITS_WORD] \
2349 &= ~(1u << ((n) % (sizeof (unsigned) * CHAR_BIT)))) 2349 &= ~((bits_word) 1 << ((n) % BITS_PER_BITS_WORD)))
2350 2350
2351#define FLOAT_BLOCK(fptr) \ 2351#define FLOAT_BLOCK(fptr) \
2352 ((struct float_block *) (((uintptr_t) (fptr)) & ~(BLOCK_ALIGN - 1))) 2352 ((struct float_block *) (((uintptr_t) (fptr)) & ~(BLOCK_ALIGN - 1)))
@@ -2358,7 +2358,7 @@ struct float_block
2358{ 2358{
2359 /* Place `floats' at the beginning, to ease up FLOAT_INDEX's job. */ 2359 /* Place `floats' at the beginning, to ease up FLOAT_INDEX's job. */
2360 struct Lisp_Float floats[FLOAT_BLOCK_SIZE]; 2360 struct Lisp_Float floats[FLOAT_BLOCK_SIZE];
2361 unsigned gcmarkbits[1 + FLOAT_BLOCK_SIZE / (sizeof (unsigned) * CHAR_BIT)]; 2361 bits_word gcmarkbits[1 + FLOAT_BLOCK_SIZE / BITS_PER_BITS_WORD];
2362 struct float_block *next; 2362 struct float_block *next;
2363}; 2363};
2364 2364
@@ -2439,7 +2439,7 @@ make_float (double float_value)
2439#define CONS_BLOCK_SIZE \ 2439#define CONS_BLOCK_SIZE \
2440 (((BLOCK_BYTES - sizeof (struct cons_block *) \ 2440 (((BLOCK_BYTES - sizeof (struct cons_block *) \
2441 /* The compiler might add padding at the end. */ \ 2441 /* The compiler might add padding at the end. */ \
2442 - (sizeof (struct Lisp_Cons) - sizeof (int))) * CHAR_BIT) \ 2442 - (sizeof (struct Lisp_Cons) - sizeof (bits_word))) * CHAR_BIT) \
2443 / (sizeof (struct Lisp_Cons) * CHAR_BIT + 1)) 2443 / (sizeof (struct Lisp_Cons) * CHAR_BIT + 1))
2444 2444
2445#define CONS_BLOCK(fptr) \ 2445#define CONS_BLOCK(fptr) \
@@ -2452,7 +2452,7 @@ struct cons_block
2452{ 2452{
2453 /* Place `conses' at the beginning, to ease up CONS_INDEX's job. */ 2453 /* Place `conses' at the beginning, to ease up CONS_INDEX's job. */
2454 struct Lisp_Cons conses[CONS_BLOCK_SIZE]; 2454 struct Lisp_Cons conses[CONS_BLOCK_SIZE];
2455 unsigned gcmarkbits[1 + CONS_BLOCK_SIZE / (sizeof (unsigned) * CHAR_BIT)]; 2455 bits_word gcmarkbits[1 + CONS_BLOCK_SIZE / BITS_PER_BITS_WORD];
2456 struct cons_block *next; 2456 struct cons_block *next;
2457}; 2457};
2458 2458
@@ -6436,27 +6436,27 @@ NO_INLINE /* For better stack traces */
6436static void 6436static void
6437sweep_conses (void) 6437sweep_conses (void)
6438{ 6438{
6439 register struct cons_block *cblk; 6439 struct cons_block *cblk;
6440 struct cons_block **cprev = &cons_block; 6440 struct cons_block **cprev = &cons_block;
6441 register int lim = cons_block_index; 6441 int lim = cons_block_index;
6442 EMACS_INT num_free = 0, num_used = 0; 6442 EMACS_INT num_free = 0, num_used = 0;
6443 6443
6444 cons_free_list = 0; 6444 cons_free_list = 0;
6445 6445
6446 for (cblk = cons_block; cblk; cblk = *cprev) 6446 for (cblk = cons_block; cblk; cblk = *cprev)
6447 { 6447 {
6448 register int i = 0; 6448 int i = 0;
6449 int this_free = 0; 6449 int this_free = 0;
6450 int ilim = (lim + BITS_PER_INT - 1) / BITS_PER_INT; 6450 int ilim = (lim + BITS_PER_BITS_WORD - 1) / BITS_PER_BITS_WORD;
6451 6451
6452 /* Scan the mark bits an int at a time. */ 6452 /* Scan the mark bits an int at a time. */
6453 for (i = 0; i < ilim; i++) 6453 for (i = 0; i < ilim; i++)
6454 { 6454 {
6455 if (cblk->gcmarkbits[i] == -1) 6455 if (cblk->gcmarkbits[i] == BITS_WORD_MAX)
6456 { 6456 {
6457 /* Fast path - all cons cells for this int are marked. */ 6457 /* Fast path - all cons cells for this int are marked. */
6458 cblk->gcmarkbits[i] = 0; 6458 cblk->gcmarkbits[i] = 0;
6459 num_used += BITS_PER_INT; 6459 num_used += BITS_PER_BITS_WORD;
6460 } 6460 }
6461 else 6461 else
6462 { 6462 {
@@ -6464,10 +6464,10 @@ sweep_conses (void)
6464 Find which ones, and free them. */ 6464 Find which ones, and free them. */
6465 int start, pos, stop; 6465 int start, pos, stop;
6466 6466
6467 start = i * BITS_PER_INT; 6467 start = i * BITS_PER_BITS_WORD;
6468 stop = lim - start; 6468 stop = lim - start;
6469 if (stop > BITS_PER_INT) 6469 if (stop > BITS_PER_BITS_WORD)
6470 stop = BITS_PER_INT; 6470 stop = BITS_PER_BITS_WORD;
6471 stop += start; 6471 stop += start;
6472 6472
6473 for (pos = start; pos < stop; pos++) 6473 for (pos = start; pos < stop; pos++)