src/xdisp.c (single_display_spec_string): Correct a FIXME comment.
[emacs.git] / src / puresize.h
blob8024aa95d3193b217979e3ad984d60d6c1aebd7a
1 /* How much read-only Lisp storage a dumped Emacs needs.
2 Copyright (C) 1993, 2001-2011 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
6 GNU Emacs is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 /* Define PURESIZE, the number of bytes of pure Lisp code to leave space for.
21 At one point, this was defined in config.h, meaning that changing
22 PURESIZE would make Make recompile all of Emacs. But only a few
23 files actually use PURESIZE, so we split it out to its own .h file.
25 Make sure to include this file after config.h, since that tells us
26 whether we are running X windows, which tells us how much pure
27 storage to allocate. */
29 /* First define a measure of the amount of data we have. */
31 /* A system configuration file may set this to request a certain extra
32 amount of storage. This is a lot more update-robust that defining
33 BASE_PURESIZE or even PURESIZE directly. */
34 #ifndef SYSTEM_PURESIZE_EXTRA
35 #define SYSTEM_PURESIZE_EXTRA 0
36 #endif
38 #ifndef SITELOAD_PURESIZE_EXTRA
39 #define SITELOAD_PURESIZE_EXTRA 0
40 #endif
42 #ifndef BASE_PURESIZE
43 #define BASE_PURESIZE (1620000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA)
44 #endif
46 /* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */
47 #ifndef PURESIZE_RATIO
48 #if BITS_PER_EMACS_INT > 32
49 #define PURESIZE_RATIO 10/6 /* Don't surround with `()'. */
50 #else
51 #define PURESIZE_RATIO 1
52 #endif
53 #endif
55 #ifdef ENABLE_CHECKING
56 /* ENABLE_CHECKING somehow increases the purespace used, probably because
57 it tends to cause some macro arguments to be evaluated twice. This is
58 a bug, but it's difficult to track it down. */
59 #define PURESIZE_CHECKING_RATIO 12/10 /* Don't surround with `()'. */
60 #else
61 #define PURESIZE_CHECKING_RATIO 1
62 #endif
64 /* This is the actual size in bytes to allocate. */
65 #ifndef PURESIZE
66 #define PURESIZE (BASE_PURESIZE * PURESIZE_RATIO * PURESIZE_CHECKING_RATIO)
67 #endif
69 /* Signal an error if OBJ is pure. */
70 #define CHECK_IMPURE(obj) \
71 { if (PURE_P (obj)) \
72 pure_write_error (); }
74 extern void pure_write_error (void) NO_RETURN;
76 /* Define PURE_P. */
78 #ifdef VIRT_ADDR_VARIES
79 /* For machines where text and data can go anywhere
80 in virtual memory. */
82 extern EMACS_INT pure[];
84 #define PURE_P(obj) \
85 ((PNTR_COMPARISON_TYPE) XPNTR (obj) < (PNTR_COMPARISON_TYPE) ((char *) pure + PURESIZE) \
86 && (PNTR_COMPARISON_TYPE) XPNTR (obj) >= (PNTR_COMPARISON_TYPE) pure)
88 #else /* not VIRT_ADDR_VARIES */
89 /* When PNTR_COMPARISON_TYPE is not the default (unsigned int). */
91 extern char my_edata[];
93 #define PURE_P(obj) \
94 ((PNTR_COMPARISON_TYPE) XPNTR (obj) < (PNTR_COMPARISON_TYPE) my_edata)
96 #endif /* VIRT_ADDRESS_VARIES */