Commit | Line | Data |
---|---|---|
e772f7cd | 1 | /* How much read-only Lisp storage a dumped Emacs needs. |
ab422c4d | 2 | Copyright (C) 1993, 2001-2013 Free Software Foundation, Inc. |
e772f7cd JB |
3 | |
4 | This file is part of GNU Emacs. | |
5 | ||
b9b1cc14 | 6 | GNU Emacs is free software: you can redistribute it and/or modify |
e772f7cd | 7 | it under the terms of the GNU General Public License as published by |
b9b1cc14 GM |
8 | the Free Software Foundation, either version 3 of the License, or |
9 | (at your option) any later version. | |
e772f7cd JB |
10 | |
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. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
b9b1cc14 | 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
e772f7cd | 18 | |
e4f74c7e | 19 | /* Define PURESIZE, the number of bytes of pure Lisp code to leave space for. |
e772f7cd JB |
20 | |
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 | |
d427b66a | 23 | files actually use PURESIZE, so we split it out to its own .h file. |
e772f7cd | 24 | |
d427b66a JB |
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. */ | |
28 | ||
e4f74c7e RS |
29 | /* First define a measure of the amount of data we have. */ |
30 | ||
87485d6f MW |
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 | |
37 | ||
64aba29c RS |
38 | #ifndef SITELOAD_PURESIZE_EXTRA |
39 | #define SITELOAD_PURESIZE_EXTRA 0 | |
40 | #endif | |
41 | ||
e4f74c7e | 42 | #ifndef BASE_PURESIZE |
c052c554 | 43 | #define BASE_PURESIZE (1700000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) |
d427b66a | 44 | #endif |
e4f74c7e RS |
45 | |
46 | /* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */ | |
47 | #ifndef PURESIZE_RATIO | |
34374650 | 48 | #if EMACS_INT_MAX >> 31 != 0 |
b62b53e8 | 49 | #if PTRDIFF_MAX >> 31 != 0 |
1ec4b7b2 | 50 | #define PURESIZE_RATIO 10 / 6 /* Don't surround with `()'. */ |
e4f74c7e | 51 | #else |
1ec4b7b2 | 52 | #define PURESIZE_RATIO 8 / 6 /* Don't surround with `()'. */ |
b62b53e8 PE |
53 | #endif |
54 | #else | |
e4f74c7e RS |
55 | #define PURESIZE_RATIO 1 |
56 | #endif | |
57 | #endif | |
58 | ||
dbc812e0 SM |
59 | #ifdef ENABLE_CHECKING |
60 | /* ENABLE_CHECKING somehow increases the purespace used, probably because | |
61 | it tends to cause some macro arguments to be evaluated twice. This is | |
62 | a bug, but it's difficult to track it down. */ | |
1ec4b7b2 | 63 | #define PURESIZE_CHECKING_RATIO 12 / 10 /* Don't surround with `()'. */ |
dbc812e0 SM |
64 | #else |
65 | #define PURESIZE_CHECKING_RATIO 1 | |
66 | #endif | |
67 | ||
e4f74c7e RS |
68 | /* This is the actual size in bytes to allocate. */ |
69 | #ifndef PURESIZE | |
dbc812e0 | 70 | #define PURESIZE (BASE_PURESIZE * PURESIZE_RATIO * PURESIZE_CHECKING_RATIO) |
d427b66a | 71 | #endif |
e772f7cd | 72 | |
f75e1ee5 KH |
73 | /* Signal an error if OBJ is pure. */ |
74 | #define CHECK_IMPURE(obj) \ | |
75 | { if (PURE_P (obj)) \ | |
76 | pure_write_error (); } | |
ec5d8db7 | 77 | |
845ca893 | 78 | extern _Noreturn void pure_write_error (void); |
f75e1ee5 KH |
79 | \f |
80 | /* Define PURE_P. */ | |
e772f7cd | 81 | |
f75e1ee5 KH |
82 | extern EMACS_INT pure[]; |
83 | ||
84 | #define PURE_P(obj) \ | |
6a0bf43d | 85 | ((uintptr_t) XPNTR (obj) - (uintptr_t) pure <= PURESIZE) |