mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-03 10:31:37 -08:00
* lisp.h (eassert): Assume that COND is true when optimizing.
In other words, take on the behavior of eassert_and_assume. This makes Emacs 0.2% smaller on my platform (Fedora 19, x86-64). (eassert_and_assume): Remove. All uses replaced by eassert.
This commit is contained in:
parent
c9358b45b9
commit
75273afb0d
4 changed files with 19 additions and 19 deletions
|
|
@ -1,5 +1,10 @@
|
|||
2013-10-03 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* lisp.h (eassert): Assume that COND is true when optimizing.
|
||||
In other words, take on the behavior of eassert_and_assume.
|
||||
This makes Emacs 0.2% smaller on my platform (Fedora 19, x86-64).
|
||||
(eassert_and_assume): Remove. All uses replaced by eassert.
|
||||
|
||||
* xdisp.c (Qglyphless_char): Now static.
|
||||
|
||||
Adjust to merge from gnulib.
|
||||
|
|
|
|||
|
|
@ -2023,7 +2023,7 @@ bool_vector_payload_bytes (ptrdiff_t nr_bits,
|
|||
ptrdiff_t exact_needed_bytes;
|
||||
ptrdiff_t needed_bytes;
|
||||
|
||||
eassert_and_assume (nr_bits >= 0);
|
||||
eassert (nr_bits >= 0);
|
||||
|
||||
exact_needed_bytes = ROUNDUP ((size_t) nr_bits, CHAR_BIT) / CHAR_BIT;
|
||||
needed_bytes = ROUNDUP ((size_t) nr_bits, BITS_PER_SIZE_T) / CHAR_BIT;
|
||||
|
|
@ -2060,8 +2060,8 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */)
|
|||
total_payload_bytes = bool_vector_payload_bytes
|
||||
(XFASTINT (length), &exact_payload_bytes);
|
||||
|
||||
eassert_and_assume (exact_payload_bytes <= total_payload_bytes);
|
||||
eassert_and_assume (0 <= exact_payload_bytes);
|
||||
eassert (exact_payload_bytes <= total_payload_bytes);
|
||||
eassert (0 <= exact_payload_bytes);
|
||||
|
||||
needed_elements = ROUNDUP ((size_t) ((bool_header_size - header_size)
|
||||
+ total_payload_bytes),
|
||||
|
|
@ -2816,7 +2816,7 @@ vector_nbytes (struct Lisp_Vector *v)
|
|||
ptrdiff_t payload_bytes =
|
||||
bool_vector_payload_bytes (bv->size, NULL);
|
||||
|
||||
eassert_and_assume (payload_bytes >= 0);
|
||||
eassert (payload_bytes >= 0);
|
||||
size = bool_header_size + ROUNDUP (payload_bytes, word_size);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -2966,7 +2966,7 @@ lowercase l) for small endian machines. */)
|
|||
static size_t
|
||||
bool_vector_spare_mask (ptrdiff_t nr_bits)
|
||||
{
|
||||
eassert_and_assume (nr_bits > 0);
|
||||
eassert (nr_bits > 0);
|
||||
return (((size_t) 1) << (nr_bits % BITS_PER_SIZE_T)) - 1;
|
||||
}
|
||||
|
||||
|
|
@ -3108,7 +3108,7 @@ bool_vector_binop_driver (Lisp_Object op1,
|
|||
nr_bits = min (nr_bits, XBOOL_VECTOR (dest)->size);
|
||||
}
|
||||
|
||||
eassert_and_assume (nr_bits >= 0);
|
||||
eassert (nr_bits >= 0);
|
||||
nr_words = ROUNDUP (nr_bits, BITS_PER_SIZE_T) / BITS_PER_SIZE_T;
|
||||
|
||||
adata = (size_t *) XBOOL_VECTOR (dest)->data;
|
||||
|
|
@ -3275,7 +3275,7 @@ Return the destination vector. */)
|
|||
bdata = (size_t *) XBOOL_VECTOR (b)->data;
|
||||
adata = (size_t *) XBOOL_VECTOR (a)->data;
|
||||
|
||||
eassert_and_assume (nr_bits >= 0);
|
||||
eassert (nr_bits >= 0);
|
||||
|
||||
for (i = 0; i < nr_bits / BITS_PER_SIZE_T; i++)
|
||||
bdata[i] = ~adata[i];
|
||||
|
|
@ -3310,7 +3310,7 @@ A must be a bool vector. B is a generalized bool. */)
|
|||
match = NILP (b) ? (size_t) -1 : 0;
|
||||
adata = (size_t *) XBOOL_VECTOR (a)->data;
|
||||
|
||||
eassert_and_assume (nr_bits >= 0);
|
||||
eassert (nr_bits >= 0);
|
||||
|
||||
for (i = 0; i < nr_bits / BITS_PER_SIZE_T; ++i)
|
||||
count += popcount_size_t (adata[i] ^ match);
|
||||
|
|
|
|||
17
src/lisp.h
17
src/lisp.h
|
|
@ -108,11 +108,12 @@ typedef EMACS_UINT uprintmax_t;
|
|||
|
||||
/* Extra internal type checking? */
|
||||
|
||||
/* Define an Emacs version of 'assert (COND)', since some
|
||||
system-defined 'assert's are flaky. COND should be free of side
|
||||
effects; it may or may not be evaluated. */
|
||||
/* Define an Emacs version of 'assert (COND)'. COND should be free of
|
||||
side effects; it may be evaluated zero or more times. If COND is false,
|
||||
Emacs reliably crashes if ENABLE_CHECKING is defined and behavior
|
||||
is undefined if not. The compiler may assume COND while optimizing. */
|
||||
#ifndef ENABLE_CHECKING
|
||||
# define eassert(X) ((void) (0 && (X))) /* Check that X compiles. */
|
||||
# define eassert(cond) assume (cond)
|
||||
#else /* ENABLE_CHECKING */
|
||||
|
||||
extern _Noreturn void die (const char *, const char *, int);
|
||||
|
|
@ -129,16 +130,10 @@ extern bool suppress_checking EXTERNALLY_VISIBLE;
|
|||
|
||||
# define eassert(cond) \
|
||||
(suppress_checking || (cond) \
|
||||
? (void) 0 \
|
||||
? assume (cond) \
|
||||
: die (# cond, __FILE__, __LINE__))
|
||||
#endif /* ENABLE_CHECKING */
|
||||
|
||||
/* When checking is enabled, identical to eassert. When checking is
|
||||
* disabled, instruct the compiler (when the compiler has such
|
||||
* capability) to assume that cond is true and optimize
|
||||
* accordingly. */
|
||||
#define eassert_and_assume(cond) (eassert (cond), assume (cond))
|
||||
|
||||
|
||||
/* Use the configure flag --enable-check-lisp-object-type to make
|
||||
Lisp_Object use a struct type instead of the default int. The flag
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue