emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114513: * lisp.h (eassert): Assume that COND is tru


From: Paul Eggert
Subject: [Emacs-diffs] trunk r114513: * lisp.h (eassert): Assume that COND is true when optimizing.
Date: Thu, 03 Oct 2013 16:16:36 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114513
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Thu 2013-10-03 09:16:31 -0700
message:
  * 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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/alloc.c                    alloc.c-20091113204419-o5vbwnq5f7feedwu-252
  src/data.c                     data.c-20091113204419-o5vbwnq5f7feedwu-251
  src/lisp.h                     lisp.h-20091113204419-o5vbwnq5f7feedwu-253
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-10-03 13:55:28 +0000
+++ b/src/ChangeLog     2013-10-03 16:16:31 +0000
@@ -1,5 +1,10 @@
 2013-10-03  Paul Eggert  <address@hidden>
 
+       * 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.

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2013-10-03 04:58:56 +0000
+++ b/src/alloc.c       2013-10-03 16:16:31 +0000
@@ -2023,7 +2023,7 @@
   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 @@
   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 @@
           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

=== modified file 'src/data.c'
--- a/src/data.c        2013-09-24 14:53:49 +0000
+++ b/src/data.c        2013-10-03 16:16:31 +0000
@@ -2966,7 +2966,7 @@
 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 @@
       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 @@
   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 @@
   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);

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2013-10-03 13:55:28 +0000
+++ b/src/lisp.h        2013-10-03 16:16:31 +0000
@@ -108,11 +108,12 @@
 
 /* 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 @@
 
 # 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]