------------------------------------------------------------ revno: 117030 author: Paul Eggert committer: Paul Eggert branch nick: trunk timestamp: Mon 2014-04-28 09:59:41 -0700 message: 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. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-04-28 01:29:44 +0000 +++ src/ChangeLog 2014-04-28 16:59:41 +0000 @@ -1,5 +1,11 @@ 2014-04-28 Paul Eggert + 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. + Avoid undefined behavior in signed left shift. This ports to GCC 4.9.0 with -fsanitize=undefined. * alloc.c (bool_vector_fill, SETMARKBIT, UNSETMARKBIT): === modified file 'src/alloc.c' --- src/alloc.c 2014-04-28 01:29:44 +0000 +++ src/alloc.c 2014-04-28 16:59:41 +0000 @@ -2332,21 +2332,21 @@ #define FLOAT_BLOCK_SIZE \ (((BLOCK_BYTES - sizeof (struct float_block *) \ /* The compiler might add padding at the end. */ \ - - (sizeof (struct Lisp_Float) - sizeof (int))) * CHAR_BIT) \ + - (sizeof (struct Lisp_Float) - sizeof (bits_word))) * CHAR_BIT) \ / (sizeof (struct Lisp_Float) * CHAR_BIT + 1)) #define GETMARKBIT(block,n) \ - (((block)->gcmarkbits[(n) / (sizeof (unsigned) * CHAR_BIT)] \ - >> ((n) % (sizeof (unsigned) * CHAR_BIT))) \ + (((block)->gcmarkbits[(n) / BITS_PER_BITS_WORD] \ + >> ((n) % BITS_PER_BITS_WORD)) \ & 1) #define SETMARKBIT(block,n) \ - ((block)->gcmarkbits[(n) / (sizeof (unsigned) * CHAR_BIT)] \ - |= 1u << ((n) % (sizeof (unsigned) * CHAR_BIT))) + ((block)->gcmarkbits[(n) / BITS_PER_BITS_WORD] \ + |= (bits_word) 1 << ((n) % BITS_PER_BITS_WORD)) #define UNSETMARKBIT(block,n) \ - ((block)->gcmarkbits[(n) / (sizeof (unsigned) * CHAR_BIT)] \ - &= ~(1u << ((n) % (sizeof (unsigned) * CHAR_BIT)))) + ((block)->gcmarkbits[(n) / BITS_PER_BITS_WORD] \ + &= ~((bits_word) 1 << ((n) % BITS_PER_BITS_WORD))) #define FLOAT_BLOCK(fptr) \ ((struct float_block *) (((uintptr_t) (fptr)) & ~(BLOCK_ALIGN - 1))) @@ -2358,7 +2358,7 @@ { /* Place `floats' at the beginning, to ease up FLOAT_INDEX's job. */ struct Lisp_Float floats[FLOAT_BLOCK_SIZE]; - unsigned gcmarkbits[1 + FLOAT_BLOCK_SIZE / (sizeof (unsigned) * CHAR_BIT)]; + bits_word gcmarkbits[1 + FLOAT_BLOCK_SIZE / BITS_PER_BITS_WORD]; struct float_block *next; }; @@ -2439,7 +2439,7 @@ #define CONS_BLOCK_SIZE \ (((BLOCK_BYTES - sizeof (struct cons_block *) \ /* The compiler might add padding at the end. */ \ - - (sizeof (struct Lisp_Cons) - sizeof (int))) * CHAR_BIT) \ + - (sizeof (struct Lisp_Cons) - sizeof (bits_word))) * CHAR_BIT) \ / (sizeof (struct Lisp_Cons) * CHAR_BIT + 1)) #define CONS_BLOCK(fptr) \ @@ -2452,7 +2452,7 @@ { /* Place `conses' at the beginning, to ease up CONS_INDEX's job. */ struct Lisp_Cons conses[CONS_BLOCK_SIZE]; - unsigned gcmarkbits[1 + CONS_BLOCK_SIZE / (sizeof (unsigned) * CHAR_BIT)]; + bits_word gcmarkbits[1 + CONS_BLOCK_SIZE / BITS_PER_BITS_WORD]; struct cons_block *next; }; @@ -6436,27 +6436,27 @@ static void sweep_conses (void) { - register struct cons_block *cblk; + struct cons_block *cblk; struct cons_block **cprev = &cons_block; - register int lim = cons_block_index; + int lim = cons_block_index; EMACS_INT num_free = 0, num_used = 0; cons_free_list = 0; for (cblk = cons_block; cblk; cblk = *cprev) { - register int i = 0; + int i = 0; int this_free = 0; - int ilim = (lim + BITS_PER_INT - 1) / BITS_PER_INT; + int ilim = (lim + BITS_PER_BITS_WORD - 1) / BITS_PER_BITS_WORD; /* Scan the mark bits an int at a time. */ for (i = 0; i < ilim; i++) { - if (cblk->gcmarkbits[i] == -1) + if (cblk->gcmarkbits[i] == BITS_WORD_MAX) { /* Fast path - all cons cells for this int are marked. */ cblk->gcmarkbits[i] = 0; - num_used += BITS_PER_INT; + num_used += BITS_PER_BITS_WORD; } else { @@ -6464,10 +6464,10 @@ Find which ones, and free them. */ int start, pos, stop; - start = i * BITS_PER_INT; + start = i * BITS_PER_BITS_WORD; stop = lim - start; - if (stop > BITS_PER_INT) - stop = BITS_PER_INT; + if (stop > BITS_PER_BITS_WORD) + stop = BITS_PER_BITS_WORD; stop += start; for (pos = start; pos < stop; pos++) === modified file 'src/lisp.h' --- src/lisp.h 2014-04-28 01:29:44 +0000 +++ src/lisp.h 2014-04-28 16:59:41 +0000 @@ -115,7 +115,7 @@ }; /* An unsigned integer type representing a fixed-length bit sequence, - suitable for words in a Lisp bool vector. Normally it is size_t + suitable for bool vector words, GC mark bits, etc. Normally it is size_t for speed, but it is unsigned char on weird platforms. */ #if BOOL_VECTOR_BITS_PER_CHAR == CHAR_BIT typedef size_t bits_word; @@ -133,7 +133,6 @@ { BITS_PER_CHAR = CHAR_BIT, BITS_PER_SHORT = CHAR_BIT * sizeof (short), - BITS_PER_INT = CHAR_BIT * sizeof (int), BITS_PER_LONG = CHAR_BIT * sizeof (long int), BITS_PER_EMACS_INT = CHAR_BIT * sizeof (EMACS_INT) }; ------------------------------------------------------------ revno: 117029 committer: Katsumi Yamaoka branch nick: trunk timestamp: Mon 2014-04-28 06:30:39 +0000 message: lisp/gnus/gnus-art.el (gnus-mime-display-attachment-buttons-in-header): Fix custom group diff: === modified file 'lisp/gnus/gnus-art.el' --- lisp/gnus/gnus-art.el 2014-03-23 23:13:36 +0000 +++ lisp/gnus/gnus-art.el 2014-04-28 06:30:39 +0000 @@ -5866,7 +5866,7 @@ of all non-inlinable MIME parts as buttons shown in front of an article. If nil, don't show those extra buttons." :version "24.5" - :group 'gnus-article + :group 'gnus-article-mime :type 'boolean) (defun gnus-mime-display-part (handle)