aboutsummaryrefslogtreecommitdiffstats
path: root/src/puresize.h
diff options
context:
space:
mode:
authorPaul Eggert2015-10-10 00:17:11 -0700
committerPaul Eggert2015-10-10 00:18:39 -0700
commitbb7c182fdaf8553ffdc9162f322177ae2f7fa0c2 (patch)
tree444b1eef3d424cb5b07396a11bc66fe401d0a1dd /src/puresize.h
parent1196e3fca6f9df107c76438b7d00090d19b13570 (diff)
downloademacs-bb7c182fdaf8553ffdc9162f322177ae2f7fa0c2.tar.gz
emacs-bb7c182fdaf8553ffdc9162f322177ae2f7fa0c2.zip
CHECK_IMPURE and PURE_P speedup
* src/intervals.c (create_root_interval): Do CHECK_IMPURE only for strings; not needed for buffers. Prefer ! STRINGP to BUFFERP, for a tad more speed. * src/puresize.h (CHECK_IMPURE, PURE_P): Now inline functions instead of macros. (PURE_P): Don’t use XPNTR; that is now the caller’s responsibility. All callers changed. (CHECK_IMPURE): New argument PTR, to save us the work of running XPNTR. All callers changed.
Diffstat (limited to 'src/puresize.h')
-rw-r--r--src/puresize.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/puresize.h b/src/puresize.h
index b72fb6c03f9..d0926c65213 100644
--- a/src/puresize.h
+++ b/src/puresize.h
@@ -70,16 +70,21 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
70#define PURESIZE (BASE_PURESIZE * PURESIZE_RATIO * PURESIZE_CHECKING_RATIO) 70#define PURESIZE (BASE_PURESIZE * PURESIZE_RATIO * PURESIZE_CHECKING_RATIO)
71#endif 71#endif
72 72
73/* Signal an error if OBJ is pure. */
74#define CHECK_IMPURE(obj) \
75 { if (PURE_P (obj)) \
76 pure_write_error (obj); }
77
78extern _Noreturn void pure_write_error (Lisp_Object); 73extern _Noreturn void pure_write_error (Lisp_Object);
79
80/* Define PURE_P. */
81 74
82extern EMACS_INT pure[]; 75extern EMACS_INT pure[];
83 76
84#define PURE_P(obj) \ 77/* True if PTR is pure. */
85 ((uintptr_t) XPNTR (obj) - (uintptr_t) pure <= PURESIZE) 78INLINE bool
79PURE_P (void *ptr)
80{
81 return (uintptr_t) (ptr) - (uintptr_t) pure <= PURESIZE;
82}
83
84/* Signal an error if OBJ is pure. PTR is OBJ untagged. */
85INLINE void
86CHECK_IMPURE (Lisp_Object obj, void *ptr)
87{
88 if (PURE_P (ptr))
89 pure_write_error (obj);
90}