(init_alloc_once): Call init_weak_hash_tables.
[bpt/emacs.git] / src / puresize.h
CommitLineData
e772f7cd 1/* How much read-only Lisp storage a dumped Emacs needs.
429ab54e 2 Copyright (C) 1993, 2001, 2002, 2003, 2004, 2005,
8cabe764 3 2006, 2007, 2008 Free Software Foundation, Inc.
e772f7cd
JB
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
684d6f5b 9the Free Software Foundation; either version 3, or (at your option)
e772f7cd
JB
10any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs; see the file COPYING. If not, write to
4fc5845f
LK
19the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20Boston, MA 02110-1301, USA. */
e772f7cd 21
e4f74c7e 22/* Define PURESIZE, the number of bytes of pure Lisp code to leave space for.
e772f7cd
JB
23
24 At one point, this was defined in config.h, meaning that changing
25 PURESIZE would make Make recompile all of Emacs. But only a few
d427b66a 26 files actually use PURESIZE, so we split it out to its own .h file.
e772f7cd 27
d427b66a
JB
28 Make sure to include this file after config.h, since that tells us
29 whether we are running X windows, which tells us how much pure
30 storage to allocate. */
31
e4f74c7e
RS
32/* First define a measure of the amount of data we have. */
33
87485d6f
MW
34/* A system configuration file may set this to request a certain extra
35 amount of storage. This is a lot more update-robust that defining
36 BASE_PURESIZE or even PURESIZE directly. */
37#ifndef SYSTEM_PURESIZE_EXTRA
38#define SYSTEM_PURESIZE_EXTRA 0
39#endif
40
64aba29c
RS
41#ifndef SITELOAD_PURESIZE_EXTRA
42#define SITELOAD_PURESIZE_EXTRA 0
43#endif
44
e4f74c7e 45#ifndef BASE_PURESIZE
dffd9d9a 46#define BASE_PURESIZE (1210000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA)
d427b66a 47#endif
e4f74c7e
RS
48
49/* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */
50#ifndef PURESIZE_RATIO
1b0338f7 51#if BITS_PER_EMACS_INT > 32
6a258a33 52#define PURESIZE_RATIO 10/6 /* Don't surround with `()'. */
e4f74c7e
RS
53#else
54#define PURESIZE_RATIO 1
55#endif
56#endif
57
58/* This is the actual size in bytes to allocate. */
59#ifndef PURESIZE
60#define PURESIZE (BASE_PURESIZE * PURESIZE_RATIO)
d427b66a 61#endif
e772f7cd 62
f75e1ee5
KH
63/* Signal an error if OBJ is pure. */
64#define CHECK_IMPURE(obj) \
65 { if (PURE_P (obj)) \
66 pure_write_error (); }
ec5d8db7 67
404be028 68extern void pure_write_error P_ ((void)) NO_RETURN;
f75e1ee5
KH
69\f
70/* Define PURE_P. */
e772f7cd 71
fec76d43 72#ifdef VIRT_ADDR_VARIES
e39a993c 73/* For machines where text and data can go anywhere
e772f7cd 74 in virtual memory. */
f75e1ee5
KH
75
76extern EMACS_INT pure[];
77
78#define PURE_P(obj) \
79 ((PNTR_COMPARISON_TYPE) XPNTR (obj) < (PNTR_COMPARISON_TYPE) ((char *) pure + PURESIZE) \
80 && (PNTR_COMPARISON_TYPE) XPNTR (obj) >= (PNTR_COMPARISON_TYPE) pure)
e772f7cd
JB
81
82#else /* not VIRT_ADDR_VARIES */
83#ifdef PNTR_COMPARISON_TYPE
f75e1ee5 84/* When PNTR_COMPARISON_TYPE is not the default (unsigned int). */
e772f7cd 85
f75e1ee5
KH
86extern char my_edata[];
87
88#define PURE_P(obj) \
89 ((PNTR_COMPARISON_TYPE) XPNTR (obj) < (PNTR_COMPARISON_TYPE) my_edata)
e772f7cd
JB
90
91#else /* not VIRT_ADDRESS_VARIES, not PNTR_COMPARISON_TYPE */
92
f75e1ee5 93extern char my_edata[];
177c0ea7 94
f75e1ee5
KH
95#define PURE_P(obj) \
96 (XPNTR (obj) < (unsigned int) my_edata)
e772f7cd
JB
97
98#endif /* PNTR_COMPARISON_TYPE */
99#endif /* VIRT_ADDRESS_VARIES */
ab5796a9
MB
100
101/* arch-tag: fd9b0a91-a70e-4729-a75a-6bb4ca1ce14f
102 (do not change this comment) */