aboutsummaryrefslogtreecommitdiffstats
path: root/src/lisp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lisp.h')
-rw-r--r--src/lisp.h25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/lisp.h b/src/lisp.h
index 43b3ec618f0..bf9db591bd5 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -228,14 +228,12 @@ extern bool suppress_checking EXTERNALLY_VISIBLE;
228 228
229 USE_LSB_TAG not only requires the least 3 bits of pointers returned by 229 USE_LSB_TAG not only requires the least 3 bits of pointers returned by
230 malloc to be 0 but also needs to be able to impose a mult-of-8 alignment 230 malloc to be 0 but also needs to be able to impose a mult-of-8 alignment
231 on the few static Lisp_Objects used: lispsym, all the defsubr, and 231 on the few static Lisp_Objects used, all of which are aligned via
232 the two special buffers buffer_defaults and buffer_local_symbols. */ 232 the GCALIGN macro defined below. */
233 233
234enum Lisp_Bits 234enum Lisp_Bits
235 { 235 {
236 /* 2**GCTYPEBITS. This must be a macro that expands to a literal 236 GCALIGNMENT = 1 << GCTYPEBITS,
237 integer constant, for MSVC. */
238#define GCALIGNMENT 8
239 237
240 /* Number of bits in a Lisp_Object value, not counting the tag. */ 238 /* Number of bits in a Lisp_Object value, not counting the tag. */
241 VALBITS = EMACS_INT_WIDTH - GCTYPEBITS, 239 VALBITS = EMACS_INT_WIDTH - GCTYPEBITS,
@@ -247,10 +245,6 @@ enum Lisp_Bits
247 FIXNUM_BITS = VALBITS + 1 245 FIXNUM_BITS = VALBITS + 1
248 }; 246 };
249 247
250#if GCALIGNMENT != 1 << GCTYPEBITS
251# error "GCALIGNMENT and GCTYPEBITS are inconsistent"
252#endif
253
254/* The maximum value that can be stored in a EMACS_INT, assuming all 248/* The maximum value that can be stored in a EMACS_INT, assuming all
255 bits other than the type bits contribute to a nonnegative signed value. 249 bits other than the type bits contribute to a nonnegative signed value.
256 This can be used in #if, e.g., '#if USE_LSB_TAG' below expands to an 250 This can be used in #if, e.g., '#if USE_LSB_TAG' below expands to an
@@ -277,18 +271,15 @@ DEFINE_GDB_SYMBOL_END (VALMASK)
277error !; 271error !;
278#endif 272#endif
279 273
274/* Declare an object to have an address that is a multiple of
275 GCALIGNMENT. alignas is not suitable here, as it fails if the
276 object's natural alignment exceeds GCALIGNMENT. */
280#ifdef HAVE_STRUCT_ATTRIBUTE_ALIGNED 277#ifdef HAVE_STRUCT_ATTRIBUTE_ALIGNED
281# define GCALIGNED __attribute__ ((aligned (GCALIGNMENT))) 278# define GCALIGNED __attribute__ ((aligned (GCALIGNMENT)))
282#else 279#else
283# define GCALIGNED /* empty */ 280# define GCALIGNED /* empty */
284#endif 281#endif
285 282
286/* A common multiple of the positive integers A and B. Ideally this
287 would be the least common multiple, but there's no way to do that
288 as a constant expression in C, so do the best that we can easily do. */
289#define COMMON_MULTIPLE(a, b) \
290 ((a) % (b) == 0 ? (a) : (b) % (a) == 0 ? (b) : (a) * (b))
291
292/* Some operations are so commonly executed that they are implemented 283/* Some operations are so commonly executed that they are implemented
293 as macros, not functions, because otherwise runtime performance would 284 as macros, not functions, because otherwise runtime performance would
294 suffer too much when compiling with GCC without optimization. 285 suffer too much when compiling with GCC without optimization.
@@ -2946,7 +2937,7 @@ CHECK_NUMBER_CDR (Lisp_Object x)
2946#ifdef _MSC_VER 2937#ifdef _MSC_VER
2947#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ 2938#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
2948 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ 2939 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
2949 static struct Lisp_Subr alignas (GCALIGNMENT) sname = \ 2940 static struct Lisp_Subr GCALIGNED sname = \
2950 { { (PVEC_SUBR << PSEUDOVECTOR_AREA_BITS) \ 2941 { { (PVEC_SUBR << PSEUDOVECTOR_AREA_BITS) \
2951 | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)) }, \ 2942 | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)) }, \
2952 { (Lisp_Object (__cdecl *)(void))fnname }, \ 2943 { (Lisp_Object (__cdecl *)(void))fnname }, \
@@ -2954,7 +2945,7 @@ CHECK_NUMBER_CDR (Lisp_Object x)
2954 Lisp_Object fnname 2945 Lisp_Object fnname
2955#else /* not _MSC_VER */ 2946#else /* not _MSC_VER */
2956#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ 2947#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
2957 static struct Lisp_Subr alignas (GCALIGNMENT) sname = \ 2948 static struct Lisp_Subr GCALIGNED sname = \
2958 { { PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \ 2949 { { PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \
2959 { .a ## maxargs = fnname }, \ 2950 { .a ## maxargs = fnname }, \
2960 minargs, maxargs, lname, intspec, 0}; \ 2951 minargs, maxargs, lname, intspec, 0}; \