aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPip Cet2021-05-16 15:44:26 +0200
committerStefan Monnier2022-07-01 18:59:35 -0400
commitb6a526361b57f8d9f6d5078ccd97832d0a1fb036 (patch)
tree0c752a1c74920a2b731bb2e3c2ff6623be240a72
parent3daf833ff3f3e99b44731808cb197c0912649997 (diff)
downloademacs-scratch/no-purespace-old.tar.gz
emacs-scratch/no-purespace-old.zip
Remove purespace and ancillary codescratch/no-purespace-old
Now that purespace is not used any more, remove it, along with the functions used to allocate into it. Use equivalent functions allocating into the normal heap. Remove calls to PURE_P since they always return false. * src/puresize.h: Delete file. * src/alloc.c: Don't include `puresize.h` any more. (pure, purebeg, pure_size, pure_bytes_used_before_overflow) (pure_bytes_used_lisp, pure_bytes_used_non_lisp, symbol_block_pinned) (pinned_objects): Delete vars. (PUREBEG): Delete macro. (pointer_align): Move after definition of USE_ALIGNED_ALLOC and only define it if USE_ALIGNED_ALLOC is not used. (cons_listn): Remove `cons` arg, hardcode `Fcons` instead. (pure_listn, pure_alloc, check_pure_size, make_pure_string) (make_pure_c_string, pure_cons): Delete functions. (init_symbol): Don't set `pinned` any more. (mark_pinned_objects, mark_pinned_symbols): Delete functions. (garbage_collect): Don't call them any more. (init_alloc_once_for_pdumper): Don't initialize purebeg and pure_size. * src/print.c (print_object) <PVEC_HASH_TABLE>: Don't print `purecopy`. * src/pdumper.c (dump_symbol, dump_hash_table): Update sig hash. (dump_symbol): Don't dump `pinned`. (dump_hash_table): Don't dump `purecopy`. * src/lread.c (readevalloop, read_internal_start): Adjust call to `make_hash_table`. (read0, intern_c_string_1, define_symbol, Fintern): Don't purify symbol names. (string): Avoid `pure_cons` and `build_pure_c_string`. * src/lisp.h (struct Lisp_Symbol): Remove `pinned` field. (struct Lisp_Hash_Table): Remove `purecopy` field. (check_pure_size, pure_listn, pure_list, make_pure_string) (make_pure_c_string, pure_cons): Remove prototypes. (build_pure_c_string): Delete function. * src/keymap.c: Don't include `puresize.h` any more. (Fmake_sparse_keymap): Don't purecopy the menu name. (Fset_keymap_parent, store_in_keymap): Don't `CHECK_IMPURE` any more. (syms_of_keymap): Avoid `pure_cons` and `build_pure_c_string`. * src/intervals.c: Don't include `puresize.h` any more. (create_root_interval): Don't `CHECK_IMPURE` any more. * src/fns.c: Don't include `puresize.h` any more. (Ffillarray, Fclear_string): Don't `CHECK_IMPURE` any more. (make_hash_table): Remove `purecopy` arg. (Fmake_hash_table): Remove `:purecopy` keyword argument. * src/eval.c (Finternal__define_uninitialized_variable): Don't purecopy the doc any more. (Fdefconst_1): Don't purecopy the initvalue any more. (Fautoload): Get rid of hack needed when we used hash-consing. (syms_of_eval): Avoid `build_pure_c_string`. * src/emacs.c: Don't include `puresize.h` any more. (Fdump_emacs): Don't `check_pure_size`. * src/doc.c (Fsnarf_documentation): Don't purecopy the build files. * src/deps.mk: Remove puresize.h. * src/data.c: Don't include `puresize.h` any more. (pure_write_error): Delete function. (Fsetcar, Fsetcdr): Don't `CHECK_IMPURE` any more. (Fdefalias): Don't purecopy the definition any more. (Faset): Don't `CHECK_IMPURE` any more. (syms_of_data): Avoid `pure_cons` and `build_pure_c_string`. * src/conf_post.h (SYSTEM_PURESIZE_EXTRA): Delete macro. * src/comp.c: Don't include `puresize.h` any more. (helper_link_table): Remove `pure_write_error`. (define_CHECK_IMPURE): Delete function. (maybe_defer_native_compilation, syms_of_comp): Avoid `build_pure_c_string`. * src/category.c (hash_get_category_set): Update call to `make_hash_table`. (Fdefine_category): Don't purecopy the docstring any more. * src/bytecode.c: Don't include `puresize.h` any more. (Bsetcar, Bsetcdr): Don't `CHECK_IMPURE` any more. * doc/lispref/internals.texi (Pure Storage): Delete section. (Garbage Collection): Remove note about purespace overflow. * src/xfaces.c (syms_of_xfaces): * src/emacs-module.c (syms_of_module): * src/frame.c (make_frame, make_initial_frame): * src/fileio.c (syms_of_fileio): * src/image.c (xpm_make_color_table_h): * src/process.c (ADD_SUBFEATURE, syms_of_process): * src/profiler.c (make_log): * src/json.c (define_error): * src/xterm.c (syms_of_xterm): * src/xfns.c (syms_of_xfns): * src/xdisp.c (syms_of_xdisp): * src/w32fns.c (syms_of_w32fns): * src/syntax.c (syms_of_syntax): * src/sqlite.c (syms_of_sqlite): * src/search.c (syms_of_search): * src/keyboard.c (syms_of_keyboard): * src/fontset.c (syms_of_fontset): * src/dbusbind.c (syms_of_dbusbind): * src/coding.c (syms_of_coding): * src/callint.c (syms_of_callint): * src/buffer.c (init_buffer_once, syms_of_buffer): Avoid `build_pure_c_string`, `Fpurecopy`, `pure_cons`, and `pure_list`, and adjust calls to `make_hash_table`.
-rw-r--r--doc/lispref/elisp.texi1
-rw-r--r--doc/lispref/internals.texi73
-rw-r--r--doc/lispref/symbols.texi3
-rw-r--r--src/alloc.c274
-rw-r--r--src/buffer.c16
-rw-r--r--src/bytecode.c3
-rw-r--r--src/callint.c8
-rw-r--r--src/category.c4
-rw-r--r--src/coding.c18
-rw-r--r--src/comp.c72
-rw-r--r--src/conf_post.h33
-rw-r--r--src/data.c37
-rw-r--r--src/dbusbind.c4
-rw-r--r--src/deps.mk10
-rw-r--r--src/doc.c3
-rw-r--r--src/emacs-module.c28
-rw-r--r--src/emacs.c3
-rw-r--r--src/eval.c12
-rw-r--r--src/fileio.c28
-rw-r--r--src/fns.c33
-rw-r--r--src/fontset.c4
-rw-r--r--src/frame.c4
-rw-r--r--src/image.c2
-rw-r--r--src/intervals.c2
-rw-r--r--src/json.c4
-rw-r--r--src/keyboard.c6
-rw-r--r--src/keymap.c35
-rw-r--r--src/lisp.h26
-rw-r--r--src/lread.c76
-rw-r--r--src/pdumper.c6
-rw-r--r--src/print.c3
-rw-r--r--src/process.c4
-rw-r--r--src/profiler.c2
-rw-r--r--src/puresize.h115
-rw-r--r--src/search.c12
-rw-r--r--src/sqlite.c4
-rw-r--r--src/syntax.c4
-rw-r--r--src/w32fns.c4
-rw-r--r--src/xdisp.c16
-rw-r--r--src/xfaces.c4
-rw-r--r--src/xfns.c9
-rw-r--r--src/xterm.c4
42 files changed, 211 insertions, 798 deletions
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index a3d1d804086..e04966edf41 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -1626,7 +1626,6 @@ Tips and Conventions
1626GNU Emacs Internals 1626GNU Emacs Internals
1627 1627
1628* Building Emacs:: How the dumped Emacs is made. 1628* Building Emacs:: How the dumped Emacs is made.
1629* Pure Storage:: Kludge to make preloaded Lisp functions shareable.
1630* Garbage Collection:: Reclaiming space for Lisp objects no longer used. 1629* Garbage Collection:: Reclaiming space for Lisp objects no longer used.
1631* Stack-allocated Objects:: Temporary conses and strings on C stack. 1630* Stack-allocated Objects:: Temporary conses and strings on C stack.
1632* Memory Usage:: Info about total size of Lisp objects made so far. 1631* Memory Usage:: Info about total size of Lisp objects made so far.
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index 8d2089bad8b..25dd2df906d 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -12,7 +12,6 @@ internal aspects of GNU Emacs that may be of interest to C programmers.
12 12
13@menu 13@menu
14* Building Emacs:: How the dumped Emacs is made. 14* Building Emacs:: How the dumped Emacs is made.
15* Pure Storage:: Kludge to make preloaded Lisp functions shareable.
16* Garbage Collection:: Reclaiming space for Lisp objects no longer used. 15* Garbage Collection:: Reclaiming space for Lisp objects no longer used.
17* Stack-allocated Objects:: Temporary conses and strings on C stack. 16* Stack-allocated Objects:: Temporary conses and strings on C stack.
18* Memory Usage:: Info about total size of Lisp objects made so far. 17* Memory Usage:: Info about total size of Lisp objects made so far.
@@ -251,71 +250,6 @@ If the current session was not restored from a dump file, the
251value is nil. 250value is nil.
252@end defun 251@end defun
253 252
254@node Pure Storage
255@section Pure Storage
256@cindex pure storage
257
258 Emacs Lisp uses two kinds of storage for user-created Lisp objects:
259@dfn{normal storage} and @dfn{pure storage}. Normal storage is where
260all the new data created during an Emacs session are kept
261(@pxref{Garbage Collection}). Pure storage is used for certain data
262in the preloaded standard Lisp files---data that should never change
263during actual use of Emacs.
264
265 Pure storage is allocated only while @command{temacs} is loading the
266standard preloaded Lisp libraries. In the file @file{emacs}, it is
267marked as read-only (on operating systems that permit this), so that
268the memory space can be shared by all the Emacs jobs running on the
269machine at once. Pure storage is not expandable; a fixed amount is
270allocated when Emacs is compiled, and if that is not sufficient for
271the preloaded libraries, @file{temacs} allocates dynamic memory for
272the part that didn't fit. If Emacs will be dumped using the
273@code{pdump} method (@pxref{Building Emacs}), the pure-space overflow
274is of no special importance (it just means some of the preloaded stuff
275cannot be shared with other Emacs jobs). However, if Emacs will be
276dumped using the now obsolete @code{unexec} method, the resulting
277image will work, but garbage collection (@pxref{Garbage Collection})
278is disabled in this situation, causing a memory leak. Such an
279overflow normally won't happen unless you try to preload additional
280libraries or add features to the standard ones. Emacs will display a
281warning about the overflow when it starts, if it was dumped using
282@code{unexec}. If this happens, you should increase the compilation
283parameter @code{SYSTEM_PURESIZE_EXTRA} in the file
284@file{src/puresize.h} and rebuild Emacs.
285
286@defun purecopy object
287This function makes a copy in pure storage of @var{object}, and returns
288it. It copies a string by simply making a new string with the same
289characters, but without text properties, in pure storage. It
290recursively copies the contents of vectors and cons cells. It does
291not make copies of other objects such as symbols, but just returns
292them unchanged. It signals an error if asked to copy markers.
293
294This function is a no-op except while Emacs is being built and dumped;
295it is usually called only in preloaded Lisp files.
296@end defun
297
298@defvar pure-bytes-used
299The value of this variable is the number of bytes of pure storage
300allocated so far. Typically, in a dumped Emacs, this number is very
301close to the total amount of pure storage available---if it were not,
302we would preallocate less.
303@end defvar
304
305@defvar purify-flag
306This variable determines whether @code{defun} should make a copy of the
307function definition in pure storage. If it is non-@code{nil}, then the
308function definition is copied into pure storage.
309
310This flag is @code{t} while loading all of the basic functions for
311building Emacs initially (allowing those functions to be shareable and
312non-collectible). Dumping Emacs as an executable always writes
313@code{nil} in this variable, regardless of the value it actually has
314before and after dumping.
315
316You should not change this flag in a running Emacs.
317@end defvar
318
319@node Garbage Collection 253@node Garbage Collection
320@section Garbage Collection 254@section Garbage Collection
321 255
@@ -526,12 +460,6 @@ Total heap size, in @var{unit-size} units.
526@item free-size 460@item free-size
527Heap space which is not currently used, in @var{unit-size} units. 461Heap space which is not currently used, in @var{unit-size} units.
528@end table 462@end table
529
530If there was overflow in pure space (@pxref{Pure Storage}), and Emacs
531was dumped using the (now obsolete) @code{unexec} method
532(@pxref{Building Emacs}), then @code{garbage-collect} returns
533@code{nil}, because a real garbage collection cannot be done in that
534case.
535@end deffn 463@end deffn
536 464
537@defopt garbage-collection-messages 465@defopt garbage-collection-messages
@@ -950,7 +878,6 @@ improves user experience.
950the variables are never written once Emacs is dumped. These variables 878the variables are never written once Emacs is dumped. These variables
951with initializers are allocated in an area of memory that becomes 879with initializers are allocated in an area of memory that becomes
952read-only (on certain operating systems) as a result of dumping Emacs. 880read-only (on certain operating systems) as a result of dumping Emacs.
953@xref{Pure Storage}.
954 881
955@cindex @code{defsubr}, Lisp symbol for a primitive 882@cindex @code{defsubr}, Lisp symbol for a primitive
956 Defining the C function is not enough to make a Lisp primitive 883 Defining the C function is not enough to make a Lisp primitive
diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi
index 336fa9c9182..0e53fbdf205 100644
--- a/doc/lispref/symbols.texi
+++ b/doc/lispref/symbols.texi
@@ -596,8 +596,7 @@ modes. @xref{Setting Hooks}.
596If the value is non-@code{nil}, the named function is considered to be 596If the value is non-@code{nil}, the named function is considered to be
597pure (@pxref{What Is a Function}). Calls with constant arguments can 597pure (@pxref{What Is a Function}). Calls with constant arguments can
598be evaluated at compile time. This may shift run time errors to 598be evaluated at compile time. This may shift run time errors to
599compile time. Not to be confused with pure storage (@pxref{Pure 599compile time.
600Storage}).
601 600
602@item risky-local-variable 601@item risky-local-variable
603If the value is non-@code{nil}, the named variable is considered risky 602If the value is non-@code{nil}, the named variable is considered risky
diff --git a/src/alloc.c b/src/alloc.c
index 522547661a5..62d82664ac6 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -34,7 +34,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
34#include "bignum.h" 34#include "bignum.h"
35#include "dispextern.h" 35#include "dispextern.h"
36#include "intervals.h" 36#include "intervals.h"
37#include "puresize.h"
38#include "sheap.h" 37#include "sheap.h"
39#include "sysstdio.h" 38#include "sysstdio.h"
40#include "systime.h" 39#include "systime.h"
@@ -334,33 +333,6 @@ static char *spare_memory[7];
334 333
335#define SPARE_MEMORY (1 << 14) 334#define SPARE_MEMORY (1 << 14)
336 335
337/* Initialize it to a nonzero value to force it into data space
338 (rather than bss space). That way unexec will remap it into text
339 space (pure), on some systems. We have not implemented the
340 remapping on more recent systems because this is less important
341 nowadays than in the days of small memories and timesharing. */
342
343EMACS_INT pure[(PURESIZE + sizeof (EMACS_INT) - 1) / sizeof (EMACS_INT)] = {1,};
344#define PUREBEG (char *) pure
345
346/* Pointer to the pure area, and its size. */
347
348static char *purebeg;
349static ptrdiff_t pure_size;
350
351/* Number of bytes of pure storage used before pure storage overflowed.
352 If this is non-zero, this implies that an overflow occurred. */
353
354static ptrdiff_t pure_bytes_used_before_overflow;
355
356/* Index in pure at which next pure Lisp object will be allocated.. */
357
358static ptrdiff_t pure_bytes_used_lisp;
359
360/* Number of bytes allocated for non-Lisp objects in pure storage. */
361
362static ptrdiff_t pure_bytes_used_non_lisp;
363
364/* If positive, garbage collection is inhibited. Otherwise, zero. */ 336/* If positive, garbage collection is inhibited. Otherwise, zero. */
365 337
366static intptr_t garbage_collection_inhibited; 338static intptr_t garbage_collection_inhibited;
@@ -561,16 +533,6 @@ Lisp_Object const *staticvec[NSTATICS]
561 533
562int staticidx; 534int staticidx;
563 535
564static void *pure_alloc (size_t, int);
565
566/* Return PTR rounded up to the next multiple of ALIGNMENT. */
567
568static void *
569pointer_align (void *ptr, int alignment)
570{
571 return (void *) ROUNDUP ((uintptr_t) ptr, alignment);
572}
573
574/* Extract the pointer hidden within O. */ 536/* Extract the pointer hidden within O. */
575 537
576static ATTRIBUTE_NO_SANITIZE_UNDEFINED void * 538static ATTRIBUTE_NO_SANITIZE_UNDEFINED void *
@@ -1152,6 +1114,16 @@ struct ablocks
1152 (1 & (intptr_t) ABLOCKS_BUSY (abase) ? abase : ((void **) (abase))[-1]) 1114 (1 & (intptr_t) ABLOCKS_BUSY (abase) ? abase : ((void **) (abase))[-1])
1153#endif 1115#endif
1154 1116
1117/* Return PTR rounded up to the next multiple of ALIGNMENT. */
1118
1119#ifndef USE_ALIGNED_ALLOC
1120static void *
1121pointer_align (void *ptr, int alignment)
1122{
1123 return (void *) ROUNDUP ((uintptr_t) ptr, alignment);
1124}
1125#endif
1126
1155/* The list of free ablock. */ 1127/* The list of free ablock. */
1156static struct ablock *free_ablock; 1128static struct ablock *free_ablock;
1157 1129
@@ -1714,7 +1686,7 @@ string_bytes (struct Lisp_String *s)
1714 ptrdiff_t nbytes = 1686 ptrdiff_t nbytes =
1715 (s->u.s.size_byte < 0 ? s->u.s.size & ~ARRAY_MARK_FLAG : s->u.s.size_byte); 1687 (s->u.s.size_byte < 0 ? s->u.s.size & ~ARRAY_MARK_FLAG : s->u.s.size_byte);
1716 1688
1717 if (!PURE_P (s) && !pdumper_object_p (s) && s->u.s.data 1689 if (!pdumper_object_p (s) && s->u.s.data
1718 && nbytes != SDATA_NBYTES (SDATA_OF_STRING (s))) 1690 && nbytes != SDATA_NBYTES (SDATA_OF_STRING (s)))
1719 emacs_abort (); 1691 emacs_abort ();
1720 return nbytes; 1692 return nbytes;
@@ -2529,7 +2501,7 @@ pin_string (Lisp_Object string)
2529 unsigned char *data = s->u.s.data; 2501 unsigned char *data = s->u.s.data;
2530 2502
2531 if (!(size > LARGE_STRING_BYTES 2503 if (!(size > LARGE_STRING_BYTES
2532 || PURE_P (data) || pdumper_object_p (data) 2504 || pdumper_object_p (data)
2533 || s->u.s.size_byte == -3)) 2505 || s->u.s.size_byte == -3))
2534 { 2506 {
2535 eassert (s->u.s.size_byte == -1); 2507 eassert (s->u.s.size_byte == -1);
@@ -2789,17 +2761,16 @@ list5 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4,
2789} 2761}
2790 2762
2791/* Make a list of COUNT Lisp_Objects, where ARG is the first one. 2763/* Make a list of COUNT Lisp_Objects, where ARG is the first one.
2792 Use CONS to construct the pairs. AP has any remaining args. */ 2764 AP has any remaining args. */
2793static Lisp_Object 2765static Lisp_Object
2794cons_listn (ptrdiff_t count, Lisp_Object arg, 2766cons_listn (ptrdiff_t count, Lisp_Object arg, va_list ap)
2795 Lisp_Object (*cons) (Lisp_Object, Lisp_Object), va_list ap)
2796{ 2767{
2797 eassume (0 < count); 2768 eassume (0 < count);
2798 Lisp_Object val = cons (arg, Qnil); 2769 Lisp_Object val = Fcons (arg, Qnil);
2799 Lisp_Object tail = val; 2770 Lisp_Object tail = val;
2800 for (ptrdiff_t i = 1; i < count; i++) 2771 for (ptrdiff_t i = 1; i < count; i++)
2801 { 2772 {
2802 Lisp_Object elem = cons (va_arg (ap, Lisp_Object), Qnil); 2773 Lisp_Object elem = Fcons (va_arg (ap, Lisp_Object), Qnil);
2803 XSETCDR (tail, elem); 2774 XSETCDR (tail, elem);
2804 tail = elem; 2775 tail = elem;
2805 } 2776 }
@@ -2812,18 +2783,7 @@ listn (ptrdiff_t count, Lisp_Object arg1, ...)
2812{ 2783{
2813 va_list ap; 2784 va_list ap;
2814 va_start (ap, arg1); 2785 va_start (ap, arg1);
2815 Lisp_Object val = cons_listn (count, arg1, Fcons, ap); 2786 Lisp_Object val = cons_listn (count, arg1, ap);
2816 va_end (ap);
2817 return val;
2818}
2819
2820/* Make a pure list of COUNT Lisp_Objects, where ARG1 is the first one. */
2821Lisp_Object
2822pure_listn (ptrdiff_t count, Lisp_Object arg1, ...)
2823{
2824 va_list ap;
2825 va_start (ap, arg1);
2826 Lisp_Object val = cons_listn (count, arg1, pure_cons, ap);
2827 va_end (ap); 2787 va_end (ap);
2828 return val; 2788 return val;
2829} 2789}
@@ -2989,7 +2949,7 @@ static struct Lisp_Vector *vector_free_lists[VECTOR_MAX_FREE_LIST_INDEX];
2989 2949
2990static struct large_vector *large_vectors; 2950static struct large_vector *large_vectors;
2991 2951
2992/* The only vector with 0 slots, allocated from pure space. */ 2952/* The only vector with 0 slots. */
2993 2953
2994Lisp_Object zero_vector; 2954Lisp_Object zero_vector;
2995 2955
@@ -3628,13 +3588,6 @@ struct symbol_block
3628 3588
3629static struct symbol_block *symbol_block; 3589static struct symbol_block *symbol_block;
3630static int symbol_block_index = SYMBOL_BLOCK_SIZE; 3590static int symbol_block_index = SYMBOL_BLOCK_SIZE;
3631/* Pointer to the first symbol_block that contains pinned symbols.
3632 Tests for 24.4 showed that at dump-time, Emacs contains about 15K symbols,
3633 10K of which are pinned (and all but 250 of them are interned in obarray),
3634 whereas a "typical session" has in the order of 30K symbols.
3635 `symbol_block_pinned' lets mark_pinned_symbols scan only 15K symbols rather
3636 than 30K to find the 10K symbols we need to mark. */
3637static struct symbol_block *symbol_block_pinned;
3638 3591
3639/* List of free symbols. */ 3592/* List of free symbols. */
3640 3593
@@ -3660,7 +3613,6 @@ init_symbol (Lisp_Object val, Lisp_Object name)
3660 p->u.s.interned = SYMBOL_UNINTERNED; 3613 p->u.s.interned = SYMBOL_UNINTERNED;
3661 p->u.s.trapped_write = SYMBOL_UNTRAPPED_WRITE; 3614 p->u.s.trapped_write = SYMBOL_UNTRAPPED_WRITE;
3662 p->u.s.declared_special = false; 3615 p->u.s.declared_special = false;
3663 p->u.s.pinned = false;
3664} 3616}
3665 3617
3666DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0, 3618DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0,
@@ -5268,8 +5220,6 @@ valid_lisp_object_p (Lisp_Object obj)
5268 return 1; 5220 return 1;
5269 5221
5270 void *p = XPNTR (obj); 5222 void *p = XPNTR (obj);
5271 if (PURE_P (p))
5272 return 1;
5273 5223
5274 if (BARE_SYMBOL_P (obj) && c_symbol_p (p)) 5224 if (BARE_SYMBOL_P (obj) && c_symbol_p (p))
5275 return ((char *) p - (char *) lispsym) % sizeof lispsym[0] == 0; 5225 return ((char *) p - (char *) lispsym) % sizeof lispsym[0] == 0;
@@ -5325,121 +5275,8 @@ valid_lisp_object_p (Lisp_Object obj)
5325 return 0; 5275 return 0;
5326} 5276}
5327 5277
5328/***********************************************************************
5329 Pure Storage Management
5330 ***********************************************************************/
5331
5332/* Allocate room for SIZE bytes from pure Lisp storage and return a
5333 pointer to it. TYPE is the Lisp type for which the memory is
5334 allocated. TYPE < 0 means it's not used for a Lisp object,
5335 and that the result should have an alignment of -TYPE.
5336
5337 The bytes are initially zero.
5338
5339 If pure space is exhausted, allocate space from the heap. This is
5340 merely an expedient to let Emacs warn that pure space was exhausted
5341 and that Emacs should be rebuilt with a larger pure space. */
5342
5343static void *
5344pure_alloc (size_t size, int type)
5345{
5346 void *result;
5347
5348 again:
5349 if (type >= 0)
5350 {
5351 /* Allocate space for a Lisp object from the beginning of the free
5352 space with taking account of alignment. */
5353 result = pointer_align (purebeg + pure_bytes_used_lisp, LISP_ALIGNMENT);
5354 pure_bytes_used_lisp = ((char *)result - (char *)purebeg) + size;
5355 }
5356 else
5357 {
5358 /* Allocate space for a non-Lisp object from the end of the free
5359 space. */
5360 ptrdiff_t unaligned_non_lisp = pure_bytes_used_non_lisp + size;
5361 char *unaligned = purebeg + pure_size - unaligned_non_lisp;
5362 int decr = (intptr_t) unaligned & (-1 - type);
5363 pure_bytes_used_non_lisp = unaligned_non_lisp + decr;
5364 result = unaligned - decr;
5365 }
5366 pure_bytes_used = pure_bytes_used_lisp + pure_bytes_used_non_lisp;
5367
5368 if (pure_bytes_used <= pure_size)
5369 return result;
5370
5371 /* Don't allocate a large amount here,
5372 because it might get mmap'd and then its address
5373 might not be usable. */
5374 int small_amount = 10000;
5375 eassert (size <= small_amount - LISP_ALIGNMENT);
5376 purebeg = xzalloc (small_amount);
5377 pure_size = small_amount;
5378 pure_bytes_used_before_overflow += pure_bytes_used - size;
5379 pure_bytes_used = 0;
5380 pure_bytes_used_lisp = pure_bytes_used_non_lisp = 0;
5381
5382 /* Can't GC if pure storage overflowed because we can't determine
5383 if something is a pure object or not. */
5384 garbage_collection_inhibited++;
5385 goto again;
5386}
5387
5388
5389#ifdef HAVE_UNEXEC
5390
5391/* Print a warning if PURESIZE is too small. */
5392
5393void
5394check_pure_size (void)
5395{
5396 if (pure_bytes_used_before_overflow)
5397 message (("emacs:0:Pure Lisp storage overflow (approx. %"pI"d"
5398 " bytes needed)"),
5399 pure_bytes_used + pure_bytes_used_before_overflow);
5400}
5401#endif
5402
5403
5404/* Return a string allocated in pure space. DATA is a buffer holding
5405 NCHARS characters, and NBYTES bytes of string data. MULTIBYTE
5406 means make the result string multibyte.
5407
5408 Must get an error if pure storage is full, since if it cannot hold
5409 a large string it may be able to hold conses that point to that
5410 string; then the string is not protected from gc. */
5411
5412Lisp_Object
5413make_pure_string (const char *data,
5414 ptrdiff_t nchars, ptrdiff_t nbytes, bool multibyte)
5415{
5416 if (multibyte)
5417 return make_multibyte_string (data, nchars, nbytes);
5418 else
5419 return make_unibyte_string (data, nchars);
5420}
5421
5422/* Return a string allocated in pure space. Do not
5423 allocate the string data, just point to DATA. */
5424
5425Lisp_Object
5426make_pure_c_string (const char *data, ptrdiff_t nchars)
5427{
5428 return make_unibyte_string (data, nchars);
5429}
5430
5431static Lisp_Object purecopy (Lisp_Object obj); 5278static Lisp_Object purecopy (Lisp_Object obj);
5432 5279
5433/* Return a cons allocated from pure space. Give it pure copies
5434 of CAR as car and CDR as cdr. */
5435
5436Lisp_Object
5437pure_cons (Lisp_Object car, Lisp_Object cdr)
5438{
5439 return Fcons (car, cdr);
5440}
5441
5442
5443DEFUN ("purecopy", Fpurecopy, Spurecopy, 1, 1, 0, 5280DEFUN ("purecopy", Fpurecopy, Spurecopy, 1, 1, 0,
5444 doc: /* Make a copy of object OBJ in pure storage. 5281 doc: /* Make a copy of object OBJ in pure storage.
5445Recursively copies contents of vectors and cons cells. 5282Recursively copies contents of vectors and cons cells.
@@ -5455,19 +5292,10 @@ Does not copy symbols. Copies strings without text properties. */)
5455 return purecopy (obj); 5292 return purecopy (obj);
5456} 5293}
5457 5294
5458/* Pinned objects are marked before every GC cycle. */
5459static struct pinned_object
5460{
5461 Lisp_Object object;
5462 struct pinned_object *next;
5463} *pinned_objects;
5464
5465static Lisp_Object 5295static Lisp_Object
5466purecopy (Lisp_Object obj) 5296purecopy (Lisp_Object obj)
5467{ 5297{
5468 if (FIXNUMP (obj) 5298 if (FIXNUMP (obj) || SUBRP (obj))
5469 || (! SYMBOLP (obj) && PURE_P (XPNTR (obj)))
5470 || SUBRP (obj))
5471 return obj; /* Already pure. */ 5299 return obj; /* Already pure. */
5472 5300
5473 if (HASH_TABLE_P (Vpurify_flag)) /* Hash consing. */ 5301 if (HASH_TABLE_P (Vpurify_flag)) /* Hash consing. */
@@ -5475,12 +5303,12 @@ purecopy (Lisp_Object obj)
5475 Lisp_Object tmp = Fgethash (obj, Vpurify_flag, Qnil); 5303 Lisp_Object tmp = Fgethash (obj, Vpurify_flag, Qnil);
5476 if (!NILP (tmp)) 5304 if (!NILP (tmp))
5477 return tmp; 5305 return tmp;
5306 Fputhash (obj, obj, Vpurify_flag);
5478 } 5307 }
5479 5308
5480 return obj; 5309 return obj;
5481} 5310}
5482 5311
5483
5484 5312
5485/*********************************************************************** 5313/***********************************************************************
5486 Protection from GC 5314 Protection from GC
@@ -5672,31 +5500,6 @@ compact_undo_list (Lisp_Object list)
5672} 5500}
5673 5501
5674static void 5502static void
5675mark_pinned_objects (void)
5676{
5677 for (struct pinned_object *pobj = pinned_objects; pobj; pobj = pobj->next)
5678 mark_object (pobj->object);
5679}
5680
5681static void
5682mark_pinned_symbols (void)
5683{
5684 struct symbol_block *sblk;
5685 int lim = (symbol_block_pinned == symbol_block
5686 ? symbol_block_index : SYMBOL_BLOCK_SIZE);
5687
5688 for (sblk = symbol_block_pinned; sblk; sblk = sblk->next)
5689 {
5690 struct Lisp_Symbol *sym = sblk->symbols, *end = sym + lim;
5691 for (; sym < end; ++sym)
5692 if (sym->u.s.pinned)
5693 mark_object (make_lisp_symbol (sym));
5694
5695 lim = SYMBOL_BLOCK_SIZE;
5696 }
5697}
5698
5699static void
5700visit_vectorlike_root (struct gc_root_visitor visitor, 5503visit_vectorlike_root (struct gc_root_visitor visitor,
5701 struct Lisp_Vector *ptr, 5504 struct Lisp_Vector *ptr,
5702 enum gc_root_type type) 5505 enum gc_root_type type)
@@ -5960,8 +5763,6 @@ garbage_collect (void)
5960 struct gc_root_visitor visitor = { .visit = mark_object_root_visitor }; 5763 struct gc_root_visitor visitor = { .visit = mark_object_root_visitor };
5961 visit_static_gc_roots (visitor); 5764 visit_static_gc_roots (visitor);
5962 5765
5963 mark_pinned_objects ();
5964 mark_pinned_symbols ();
5965 mark_lread (); 5766 mark_lread ();
5966 mark_terminals (); 5767 mark_terminals ();
5967 mark_kboards (); 5768 mark_kboards ();
@@ -6088,10 +5889,6 @@ where each entry has the form (NAME SIZE USED FREE), where:
6088 keeps around for future allocations (maybe because it does not know how 5889 keeps around for future allocations (maybe because it does not know how
6089 to return them to the OS). 5890 to return them to the OS).
6090 5891
6091However, if there was overflow in pure space, and Emacs was dumped
6092using the \"unexec\" method, `garbage-collect' returns nil, because
6093real GC can't be done.
6094
6095Note that calling this function does not guarantee that absolutely all 5892Note that calling this function does not guarantee that absolutely all
6096unreachable objects will be garbage-collected. Emacs uses a 5893unreachable objects will be garbage-collected. Emacs uses a
6097mark-and-sweep garbage collector, but is conservative when it comes to 5894mark-and-sweep garbage collector, but is conservative when it comes to
@@ -6519,8 +6316,6 @@ process_mark_stack (ptrdiff_t base_sp)
6519 Lisp_Object obj = mark_stack_pop (); 6316 Lisp_Object obj = mark_stack_pop ();
6520 mark_obj: ; 6317 mark_obj: ;
6521 void *po = XPNTR (obj); 6318 void *po = XPNTR (obj);
6522 if (PURE_P (po))
6523 continue;
6524 6319
6525#if GC_REMEMBER_LAST_MARKED 6320#if GC_REMEMBER_LAST_MARKED
6526 last_marked[last_marked_index++] = obj; 6321 last_marked[last_marked_index++] = obj;
@@ -6746,8 +6541,7 @@ process_mark_stack (ptrdiff_t base_sp)
6746 break; 6541 break;
6747 default: emacs_abort (); 6542 default: emacs_abort ();
6748 } 6543 }
6749 if (!PURE_P (XSTRING (ptr->u.s.name))) 6544 set_string_marked (XSTRING (ptr->u.s.name));
6750 set_string_marked (XSTRING (ptr->u.s.name));
6751 mark_interval_tree (string_intervals (ptr->u.s.name)); 6545 mark_interval_tree (string_intervals (ptr->u.s.name));
6752 /* Inner loop to mark next symbol in this bucket, if any. */ 6546 /* Inner loop to mark next symbol in this bucket, if any. */
6753 po = ptr = ptr->u.s.next; 6547 po = ptr = ptr->u.s.next;
@@ -6881,7 +6675,7 @@ survives_gc_p (Lisp_Object obj)
6881 emacs_abort (); 6675 emacs_abort ();
6882 } 6676 }
6883 6677
6884 return survives_p || PURE_P (XPNTR (obj)); 6678 return survives_p;
6885} 6679}
6886 6680
6887 6681
@@ -7482,7 +7276,7 @@ init_alloc_once (void)
7482{ 7276{
7483 gc_cons_threshold = GC_DEFAULT_THRESHOLD; 7277 gc_cons_threshold = GC_DEFAULT_THRESHOLD;
7484 /* Even though Qt's contents are not set up, its address is known. */ 7278 /* Even though Qt's contents are not set up, its address is known. */
7485 Vpurify_flag = Qt; 7279 Vpurify_flag = Qt; /* FIXME: Redundant with setting in lread.c. */
7486 7280
7487 PDUMPER_REMEMBER_SCALAR (buffer_defaults.header); 7281 PDUMPER_REMEMBER_SCALAR (buffer_defaults.header);
7488 PDUMPER_REMEMBER_SCALAR (buffer_local_symbols.header); 7282 PDUMPER_REMEMBER_SCALAR (buffer_local_symbols.header);
@@ -7501,8 +7295,6 @@ init_alloc_once (void)
7501static void 7295static void
7502init_alloc_once_for_pdumper (void) 7296init_alloc_once_for_pdumper (void)
7503{ 7297{
7504 purebeg = PUREBEG;
7505 pure_size = PURESIZE;
7506 mem_init (); 7298 mem_init ();
7507 7299
7508#ifdef DOUG_LEA_MALLOC 7300#ifdef DOUG_LEA_MALLOC
@@ -7546,7 +7338,7 @@ If this portion is smaller than `gc-cons-threshold', this is ignored. */);
7546 Vgc_cons_percentage = make_float (0.1); 7338 Vgc_cons_percentage = make_float (0.1);
7547 7339
7548 DEFVAR_INT ("pure-bytes-used", pure_bytes_used, 7340 DEFVAR_INT ("pure-bytes-used", pure_bytes_used,
7549 doc: /* Number of bytes of shareable Lisp data allocated so far. */); 7341 doc: /* No longer used. */);
7550 7342
7551 DEFVAR_INT ("cons-cells-consed", cons_cells_consed, 7343 DEFVAR_INT ("cons-cells-consed", cons_cells_consed,
7552 doc: /* Number of cons cells that have been consed so far. */); 7344 doc: /* Number of cons cells that have been consed so far. */);
@@ -7572,9 +7364,13 @@ If this portion is smaller than `gc-cons-threshold', this is ignored. */);
7572 7364
7573 DEFVAR_LISP ("purify-flag", Vpurify_flag, 7365 DEFVAR_LISP ("purify-flag", Vpurify_flag,
7574 doc: /* Non-nil means loading Lisp code in order to dump an executable. 7366 doc: /* Non-nil means loading Lisp code in order to dump an executable.
7575This means that certain objects should be allocated in shared (pure) space. 7367This used to mean that certain objects should be allocated in shared (pure)
7576It can also be set to a hash-table, in which case this table is used to 7368space. It can also be set to a hash-table, in which case this table is used
7577do hash-consing of the objects allocated to pure space. */); 7369to do hash-consing of the objects allocated to pure space.
7370The hash-consing may still apply, but objects are not allocated in purespace
7371any more.
7372This flag is still used in a few places not to decide where objects are
7373allocated but to know if we're in the preload phase of Emacs's build. */);
7578 7374
7579 DEFVAR_BOOL ("garbage-collection-messages", garbage_collection_messages, 7375 DEFVAR_BOOL ("garbage-collection-messages", garbage_collection_messages,
7580 doc: /* Non-nil means display messages at start and end of garbage collection. */); 7376 doc: /* Non-nil means display messages at start and end of garbage collection. */);
@@ -7590,10 +7386,10 @@ do hash-consing of the objects allocated to pure space. */);
7590 /* We build this in advance because if we wait until we need it, we might 7386 /* We build this in advance because if we wait until we need it, we might
7591 not be able to allocate the memory to hold it. */ 7387 not be able to allocate the memory to hold it. */
7592 Vmemory_signal_data 7388 Vmemory_signal_data
7593 = pure_list (Qerror, 7389 = list (Qerror,
7594 build_pure_c_string ("Memory exhausted--use" 7390 build_string ("Memory exhausted--use"
7595 " M-x save-some-buffers then" 7391 " M-x save-some-buffers then"
7596 " exit and restart Emacs")); 7392 " exit and restart Emacs"));
7597 7393
7598 DEFVAR_LISP ("memory-full", Vmemory_full, 7394 DEFVAR_LISP ("memory-full", Vmemory_full,
7599 doc: /* Non-nil means Emacs cannot get much more Lisp memory. */); 7395 doc: /* Non-nil means Emacs cannot get much more Lisp memory. */);
diff --git a/src/buffer.c b/src/buffer.c
index 509ce51b55e..834a4a03b5b 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5308,8 +5308,8 @@ init_buffer_once (void)
5308 set_buffer_intervals (&buffer_defaults, NULL); 5308 set_buffer_intervals (&buffer_defaults, NULL);
5309 set_buffer_intervals (&buffer_local_symbols, NULL); 5309 set_buffer_intervals (&buffer_local_symbols, NULL);
5310 /* This is not strictly necessary, but let's make them initialized. */ 5310 /* This is not strictly necessary, but let's make them initialized. */
5311 bset_name (&buffer_defaults, build_pure_c_string (" *buffer-defaults*")); 5311 bset_name (&buffer_defaults, build_string (" *buffer-defaults*"));
5312 bset_name (&buffer_local_symbols, build_pure_c_string (" *buffer-local-symbols*")); 5312 bset_name (&buffer_local_symbols, build_string (" *buffer-local-symbols*"));
5313 BUFFER_PVEC_INIT (&buffer_defaults); 5313 BUFFER_PVEC_INIT (&buffer_defaults);
5314 BUFFER_PVEC_INIT (&buffer_local_symbols); 5314 BUFFER_PVEC_INIT (&buffer_local_symbols);
5315 5315
@@ -5317,7 +5317,7 @@ init_buffer_once (void)
5317 /* Must do these before making the first buffer! */ 5317 /* Must do these before making the first buffer! */
5318 5318
5319 /* real setup is done in bindings.el */ 5319 /* real setup is done in bindings.el */
5320 bset_mode_line_format (&buffer_defaults, build_pure_c_string ("%-")); 5320 bset_mode_line_format (&buffer_defaults, build_string ("%-"));
5321 bset_header_line_format (&buffer_defaults, Qnil); 5321 bset_header_line_format (&buffer_defaults, Qnil);
5322 bset_tab_line_format (&buffer_defaults, Qnil); 5322 bset_tab_line_format (&buffer_defaults, Qnil);
5323 bset_abbrev_mode (&buffer_defaults, Qnil); 5323 bset_abbrev_mode (&buffer_defaults, Qnil);
@@ -5384,7 +5384,7 @@ init_buffer_once (void)
5384 current_buffer = 0; 5384 current_buffer = 0;
5385 pdumper_remember_lv_ptr_raw (&current_buffer, Lisp_Vectorlike); 5385 pdumper_remember_lv_ptr_raw (&current_buffer, Lisp_Vectorlike);
5386 5386
5387 QSFundamental = build_pure_c_string ("Fundamental"); 5387 QSFundamental = build_string ("Fundamental");
5388 5388
5389 DEFSYM (Qfundamental_mode, "fundamental-mode"); 5389 DEFSYM (Qfundamental_mode, "fundamental-mode");
5390 bset_major_mode (&buffer_defaults, Qfundamental_mode); 5390 bset_major_mode (&buffer_defaults, Qfundamental_mode);
@@ -5398,10 +5398,10 @@ init_buffer_once (void)
5398 5398
5399 /* Super-magic invisible buffer. */ 5399 /* Super-magic invisible buffer. */
5400 Vprin1_to_string_buffer = 5400 Vprin1_to_string_buffer =
5401 Fget_buffer_create (build_pure_c_string (" prin1"), Qt); 5401 Fget_buffer_create (build_string (" prin1"), Qt);
5402 Vbuffer_alist = Qnil; 5402 Vbuffer_alist = Qnil;
5403 5403
5404 Fset_buffer (Fget_buffer_create (build_pure_c_string ("*scratch*"), Qnil)); 5404 Fset_buffer (Fget_buffer_create (build_string ("*scratch*"), Qnil));
5405 5405
5406 inhibit_modification_hooks = 0; 5406 inhibit_modification_hooks = 0;
5407} 5407}
@@ -5584,9 +5584,9 @@ syms_of_buffer (void)
5584 Qoverwrite_mode_binary)); 5584 Qoverwrite_mode_binary));
5585 5585
5586 Fput (Qprotected_field, Qerror_conditions, 5586 Fput (Qprotected_field, Qerror_conditions,
5587 pure_list (Qprotected_field, Qerror)); 5587 list (Qprotected_field, Qerror));
5588 Fput (Qprotected_field, Qerror_message, 5588 Fput (Qprotected_field, Qerror_message,
5589 build_pure_c_string ("Attempt to modify a protected field")); 5589 build_string ("Attempt to modify a protected field"));
5590 5590
5591 DEFSYM (Qclone_indirect_buffer_hook, "clone-indirect-buffer-hook"); 5591 DEFSYM (Qclone_indirect_buffer_hook, "clone-indirect-buffer-hook");
5592 5592
diff --git a/src/bytecode.c b/src/bytecode.c
index d75767bb0c5..3be5e8a3162 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -27,7 +27,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
27#include "keyboard.h" 27#include "keyboard.h"
28#include "syntax.h" 28#include "syntax.h"
29#include "window.h" 29#include "window.h"
30#include "puresize.h"
31 30
32/* Work around GCC bug 54561. */ 31/* Work around GCC bug 54561. */
33#if GNUC_PREREQ (4, 3, 0) 32#if GNUC_PREREQ (4, 3, 0)
@@ -1582,7 +1581,6 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template,
1582 Lisp_Object newval = POP; 1581 Lisp_Object newval = POP;
1583 Lisp_Object cell = TOP; 1582 Lisp_Object cell = TOP;
1584 CHECK_CONS (cell); 1583 CHECK_CONS (cell);
1585 CHECK_IMPURE (cell, XCONS (cell));
1586 XSETCAR (cell, newval); 1584 XSETCAR (cell, newval);
1587 TOP = newval; 1585 TOP = newval;
1588 NEXT; 1586 NEXT;
@@ -1593,7 +1591,6 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template,
1593 Lisp_Object newval = POP; 1591 Lisp_Object newval = POP;
1594 Lisp_Object cell = TOP; 1592 Lisp_Object cell = TOP;
1595 CHECK_CONS (cell); 1593 CHECK_CONS (cell);
1596 CHECK_IMPURE (cell, XCONS (cell));
1597 XSETCDR (cell, newval); 1594 XSETCDR (cell, newval);
1598 TOP = newval; 1595 TOP = newval;
1599 NEXT; 1596 NEXT;
diff --git a/src/callint.c b/src/callint.c
index ffa3b231eb5..7c2ce1b9e5e 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -862,10 +862,10 @@ syms_of_callint (void)
862 callint_message = Qnil; 862 callint_message = Qnil;
863 staticpro (&callint_message); 863 staticpro (&callint_message);
864 864
865 preserved_fns = pure_list (intern_c_string ("region-beginning"), 865 preserved_fns = list (intern_c_string ("region-beginning"),
866 intern_c_string ("region-end"), 866 intern_c_string ("region-end"),
867 intern_c_string ("point"), 867 intern_c_string ("point"),
868 intern_c_string ("mark")); 868 intern_c_string ("mark"));
869 staticpro (&preserved_fns); 869 staticpro (&preserved_fns);
870 870
871 DEFSYM (Qlist, "list"); 871 DEFSYM (Qlist, "list");
diff --git a/src/category.c b/src/category.c
index bedde0de45e..198b7f6f5ba 100644
--- a/src/category.c
+++ b/src/category.c
@@ -53,7 +53,7 @@ hash_get_category_set (Lisp_Object table, Lisp_Object category_set)
53 (table, 1, 53 (table, 1,
54 make_hash_table (hashtest_equal, DEFAULT_HASH_SIZE, 54 make_hash_table (hashtest_equal, DEFAULT_HASH_SIZE,
55 DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD, 55 DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD,
56 Qnil, false)); 56 Qnil));
57 struct Lisp_Hash_Table *h = XHASH_TABLE (XCHAR_TABLE (table)->extras[1]); 57 struct Lisp_Hash_Table *h = XHASH_TABLE (XCHAR_TABLE (table)->extras[1]);
58 Lisp_Object hash; 58 Lisp_Object hash;
59 ptrdiff_t i = hash_lookup (h, category_set, &hash); 59 ptrdiff_t i = hash_lookup (h, category_set, &hash);
@@ -120,8 +120,6 @@ the current buffer's category table. */)
120 120
121 if (!NILP (CATEGORY_DOCSTRING (table, XFIXNAT (category)))) 121 if (!NILP (CATEGORY_DOCSTRING (table, XFIXNAT (category))))
122 error ("Category `%c' is already defined", (int) XFIXNAT (category)); 122 error ("Category `%c' is already defined", (int) XFIXNAT (category));
123 if (!NILP (Vpurify_flag))
124 docstring = Fpurecopy (docstring);
125 SET_CATEGORY_DOCSTRING (table, XFIXNAT (category), docstring); 123 SET_CATEGORY_DOCSTRING (table, XFIXNAT (category), docstring);
126 124
127 return Qnil; 125 return Qnil;
diff --git a/src/coding.c b/src/coding.c
index 3fb4f148b1c..a4087b68343 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -11682,7 +11682,7 @@ syms_of_coding (void)
11682 Vcode_conversion_reused_workbuf = Qnil; 11682 Vcode_conversion_reused_workbuf = Qnil;
11683 11683
11684 staticpro (&Vcode_conversion_workbuf_name); 11684 staticpro (&Vcode_conversion_workbuf_name);
11685 Vcode_conversion_workbuf_name = build_pure_c_string (" *code-conversion-work*"); 11685 Vcode_conversion_workbuf_name = build_string (" *code-conversion-work*");
11686 11686
11687 reused_workbuf_in_use = false; 11687 reused_workbuf_in_use = false;
11688 PDUMPER_REMEMBER_SCALAR (reused_workbuf_in_use); 11688 PDUMPER_REMEMBER_SCALAR (reused_workbuf_in_use);
@@ -11746,9 +11746,9 @@ syms_of_coding (void)
11746 /* Error signaled when there's a problem with detecting a coding system. */ 11746 /* Error signaled when there's a problem with detecting a coding system. */
11747 DEFSYM (Qcoding_system_error, "coding-system-error"); 11747 DEFSYM (Qcoding_system_error, "coding-system-error");
11748 Fput (Qcoding_system_error, Qerror_conditions, 11748 Fput (Qcoding_system_error, Qerror_conditions,
11749 pure_list (Qcoding_system_error, Qerror)); 11749 list (Qcoding_system_error, Qerror));
11750 Fput (Qcoding_system_error, Qerror_message, 11750 Fput (Qcoding_system_error, Qerror_message,
11751 build_pure_c_string ("Invalid coding system")); 11751 build_string ("Invalid coding system"));
11752 11752
11753 DEFSYM (Qtranslation_table, "translation-table"); 11753 DEFSYM (Qtranslation_table, "translation-table");
11754 Fput (Qtranslation_table, Qchar_table_extra_slots, make_fixnum (2)); 11754 Fput (Qtranslation_table, Qchar_table_extra_slots, make_fixnum (2));
@@ -12023,22 +12023,22 @@ encoding standard output and error streams. */);
12023 DEFVAR_LISP ("eol-mnemonic-unix", eol_mnemonic_unix, 12023 DEFVAR_LISP ("eol-mnemonic-unix", eol_mnemonic_unix,
12024 doc: /* 12024 doc: /*
12025String displayed in mode line for UNIX-like (LF) end-of-line format. */); 12025String displayed in mode line for UNIX-like (LF) end-of-line format. */);
12026 eol_mnemonic_unix = build_pure_c_string (":"); 12026 eol_mnemonic_unix = build_string (":");
12027 12027
12028 DEFVAR_LISP ("eol-mnemonic-dos", eol_mnemonic_dos, 12028 DEFVAR_LISP ("eol-mnemonic-dos", eol_mnemonic_dos,
12029 doc: /* 12029 doc: /*
12030String displayed in mode line for DOS-like (CRLF) end-of-line format. */); 12030String displayed in mode line for DOS-like (CRLF) end-of-line format. */);
12031 eol_mnemonic_dos = build_pure_c_string ("\\"); 12031 eol_mnemonic_dos = build_string ("\\");
12032 12032
12033 DEFVAR_LISP ("eol-mnemonic-mac", eol_mnemonic_mac, 12033 DEFVAR_LISP ("eol-mnemonic-mac", eol_mnemonic_mac,
12034 doc: /* 12034 doc: /*
12035String displayed in mode line for MAC-like (CR) end-of-line format. */); 12035String displayed in mode line for MAC-like (CR) end-of-line format. */);
12036 eol_mnemonic_mac = build_pure_c_string ("/"); 12036 eol_mnemonic_mac = build_string ("/");
12037 12037
12038 DEFVAR_LISP ("eol-mnemonic-undecided", eol_mnemonic_undecided, 12038 DEFVAR_LISP ("eol-mnemonic-undecided", eol_mnemonic_undecided,
12039 doc: /* 12039 doc: /*
12040String displayed in mode line when end-of-line format is not yet determined. */); 12040String displayed in mode line when end-of-line format is not yet determined. */);
12041 eol_mnemonic_undecided = build_pure_c_string (":"); 12041 eol_mnemonic_undecided = build_string (":");
12042 12042
12043 DEFVAR_LISP ("enable-character-translation", Venable_character_translation, 12043 DEFVAR_LISP ("enable-character-translation", Venable_character_translation,
12044 doc: /* 12044 doc: /*
@@ -12178,7 +12178,7 @@ internal character representation. */);
12178 intern_c_string (":for-unibyte"), 12178 intern_c_string (":for-unibyte"),
12179 args[coding_arg_for_unibyte] = Qt, 12179 args[coding_arg_for_unibyte] = Qt,
12180 intern_c_string (":docstring"), 12180 intern_c_string (":docstring"),
12181 (build_pure_c_string 12181 (build_string
12182 ("Do no conversion.\n" 12182 ("Do no conversion.\n"
12183 "\n" 12183 "\n"
12184 "When you visit a file with this coding, the file is read into a\n" 12184 "When you visit a file with this coding, the file is read into a\n"
@@ -12198,7 +12198,7 @@ internal character representation. */);
12198 plist[8] = intern_c_string (":charset-list"); 12198 plist[8] = intern_c_string (":charset-list");
12199 plist[9] = args[coding_arg_charset_list] = list1 (Qascii); 12199 plist[9] = args[coding_arg_charset_list] = list1 (Qascii);
12200 plist[11] = args[coding_arg_for_unibyte] = Qnil; 12200 plist[11] = args[coding_arg_for_unibyte] = Qnil;
12201 plist[13] = build_pure_c_string ("No conversion on encoding, " 12201 plist[13] = build_string ("No conversion on encoding, "
12202 "automatic conversion on decoding."); 12202 "automatic conversion on decoding.");
12203 plist[15] = args[coding_arg_eol_type] = Qnil; 12203 plist[15] = args[coding_arg_eol_type] = Qnil;
12204 args[coding_arg_plist] = CALLMANY (Flist, plist); 12204 args[coding_arg_plist] = CALLMANY (Flist, plist);
diff --git a/src/comp.c b/src/comp.c
index 0c78e60fc43..520b846a090 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -31,7 +31,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
31#include <libgccjit.h> 31#include <libgccjit.h>
32#include <epaths.h> 32#include <epaths.h>
33 33
34#include "puresize.h"
35#include "window.h" 34#include "window.h"
36#include "dynlib.h" 35#include "dynlib.h"
37#include "buffer.h" 36#include "buffer.h"
@@ -676,7 +675,6 @@ helper_GET_SYMBOL_WITH_POSITION (Lisp_Object);
676static void *helper_link_table[] = 675static void *helper_link_table[] =
677 { wrong_type_argument, 676 { wrong_type_argument,
678 helper_PSEUDOVECTOR_TYPEP_XUNTAG, 677 helper_PSEUDOVECTOR_TYPEP_XUNTAG,
679 pure_write_error,
680 push_handler, 678 push_handler,
681 record_unwind_protect_excursion, 679 record_unwind_protect_excursion,
682 helper_unbind_n, 680 helper_unbind_n,
@@ -3946,52 +3944,6 @@ static void define_SYMBOL_WITH_POS_SYM (void)
3946} 3944}
3947 3945
3948static void 3946static void
3949define_CHECK_IMPURE (void)
3950{
3951 gcc_jit_param *param[] =
3952 { gcc_jit_context_new_param (comp.ctxt,
3953 NULL,
3954 comp.lisp_obj_type,
3955 "obj"),
3956 gcc_jit_context_new_param (comp.ctxt,
3957 NULL,
3958 comp.void_ptr_type,
3959 "ptr") };
3960 comp.check_impure =
3961 gcc_jit_context_new_function (comp.ctxt, NULL,
3962 GCC_JIT_FUNCTION_INTERNAL,
3963 comp.void_type,
3964 "CHECK_IMPURE",
3965 2,
3966 param,
3967 0);
3968
3969 DECL_BLOCK (entry_block, comp.check_impure);
3970 DECL_BLOCK (err_block, comp.check_impure);
3971 DECL_BLOCK (ok_block, comp.check_impure);
3972
3973 comp.block = entry_block;
3974 comp.func = comp.check_impure;
3975
3976 emit_cond_jump (emit_PURE_P (gcc_jit_param_as_rvalue (param[0])), /* FIXME */
3977 err_block,
3978 ok_block);
3979 gcc_jit_block_end_with_void_return (ok_block, NULL);
3980
3981 gcc_jit_rvalue *pure_write_error_arg =
3982 gcc_jit_param_as_rvalue (param[0]);
3983
3984 comp.block = err_block;
3985 gcc_jit_block_add_eval (comp.block,
3986 NULL,
3987 emit_call (intern_c_string ("pure_write_error"),
3988 comp.void_type, 1,&pure_write_error_arg,
3989 false));
3990
3991 gcc_jit_block_end_with_void_return (err_block, NULL);
3992}
3993
3994static void
3995define_maybe_gc_or_quit (void) 3947define_maybe_gc_or_quit (void)
3996{ 3948{
3997 3949
@@ -5114,10 +5066,10 @@ maybe_defer_native_compilation (Lisp_Object function_name,
5114 5066
5115 Lisp_Object src = 5067 Lisp_Object src =
5116 concat2 (CALL1I (file-name-sans-extension, Vload_true_file_name), 5068 concat2 (CALL1I (file-name-sans-extension, Vload_true_file_name),
5117 build_pure_c_string (".el")); 5069 build_string (".el"));
5118 if (NILP (Ffile_exists_p (src))) 5070 if (NILP (Ffile_exists_p (src)))
5119 { 5071 {
5120 src = concat2 (src, build_pure_c_string (".gz")); 5072 src = concat2 (src, build_string (".gz"));
5121 if (NILP (Ffile_exists_p (src))) 5073 if (NILP (Ffile_exists_p (src)))
5122 return; 5074 return;
5123 } 5075 }
@@ -5317,10 +5269,6 @@ load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump,
5317 comp_u->data_vec = load_static_obj (comp_u, TEXT_DATA_RELOC_SYM); 5269 comp_u->data_vec = load_static_obj (comp_u, TEXT_DATA_RELOC_SYM);
5318 comp_u->data_impure_vec = 5270 comp_u->data_impure_vec =
5319 load_static_obj (comp_u, TEXT_DATA_RELOC_IMPURE_SYM); 5271 load_static_obj (comp_u, TEXT_DATA_RELOC_IMPURE_SYM);
5320
5321 if (!NILP (Vpurify_flag))
5322 /* Non impure can be copied into pure space. */
5323 comp_u->data_vec = Fpurecopy (comp_u->data_vec);
5324 } 5272 }
5325 5273
5326 EMACS_INT d_vec_len = XFIXNUM (Flength (comp_u->data_vec)); 5274 EMACS_INT d_vec_len = XFIXNUM (Flength (comp_u->data_vec));
@@ -5690,40 +5638,40 @@ compiled one. */);
5690 Fput (Qnative_compiler_error, Qerror_conditions, 5638 Fput (Qnative_compiler_error, Qerror_conditions,
5691 pure_list (Qnative_compiler_error, Qerror)); 5639 pure_list (Qnative_compiler_error, Qerror));
5692 Fput (Qnative_compiler_error, Qerror_message, 5640 Fput (Qnative_compiler_error, Qerror_message,
5693 build_pure_c_string ("Native compiler error")); 5641 build_string ("Native compiler error"));
5694 5642
5695 DEFSYM (Qnative_ice, "native-ice"); 5643 DEFSYM (Qnative_ice, "native-ice");
5696 Fput (Qnative_ice, Qerror_conditions, 5644 Fput (Qnative_ice, Qerror_conditions,
5697 pure_list (Qnative_ice, Qnative_compiler_error, Qerror)); 5645 pure_list (Qnative_ice, Qnative_compiler_error, Qerror));
5698 Fput (Qnative_ice, Qerror_message, 5646 Fput (Qnative_ice, Qerror_message,
5699 build_pure_c_string ("Internal native compiler error")); 5647 build_string ("Internal native compiler error"));
5700 5648
5701 /* By the load machinery. */ 5649 /* By the load machinery. */
5702 DEFSYM (Qnative_lisp_load_failed, "native-lisp-load-failed"); 5650 DEFSYM (Qnative_lisp_load_failed, "native-lisp-load-failed");
5703 Fput (Qnative_lisp_load_failed, Qerror_conditions, 5651 Fput (Qnative_lisp_load_failed, Qerror_conditions,
5704 pure_list (Qnative_lisp_load_failed, Qerror)); 5652 pure_list (Qnative_lisp_load_failed, Qerror));
5705 Fput (Qnative_lisp_load_failed, Qerror_message, 5653 Fput (Qnative_lisp_load_failed, Qerror_message,
5706 build_pure_c_string ("Native elisp load failed")); 5654 build_string ("Native elisp load failed"));
5707 5655
5708 DEFSYM (Qnative_lisp_wrong_reloc, "native-lisp-wrong-reloc"); 5656 DEFSYM (Qnative_lisp_wrong_reloc, "native-lisp-wrong-reloc");
5709 Fput (Qnative_lisp_wrong_reloc, Qerror_conditions, 5657 Fput (Qnative_lisp_wrong_reloc, Qerror_conditions,
5710 pure_list (Qnative_lisp_wrong_reloc, Qnative_lisp_load_failed, Qerror)); 5658 pure_list (Qnative_lisp_wrong_reloc, Qnative_lisp_load_failed, Qerror));
5711 Fput (Qnative_lisp_wrong_reloc, Qerror_message, 5659 Fput (Qnative_lisp_wrong_reloc, Qerror_message,
5712 build_pure_c_string ("Primitive redefined or wrong relocation")); 5660 build_string ("Primitive redefined or wrong relocation"));
5713 5661
5714 DEFSYM (Qwrong_register_subr_call, "wrong-register-subr-call"); 5662 DEFSYM (Qwrong_register_subr_call, "wrong-register-subr-call");
5715 Fput (Qwrong_register_subr_call, Qerror_conditions, 5663 Fput (Qwrong_register_subr_call, Qerror_conditions,
5716 pure_list (Qwrong_register_subr_call, Qnative_lisp_load_failed, Qerror)); 5664 pure_list (Qwrong_register_subr_call, Qnative_lisp_load_failed, Qerror));
5717 Fput (Qwrong_register_subr_call, Qerror_message, 5665 Fput (Qwrong_register_subr_call, Qerror_message,
5718 build_pure_c_string ("comp--register-subr can only be called during " 5666 build_string ("comp--register-subr can only be called during "
5719 "native lisp load phase.")); 5667 "native lisp load phase."));
5720 5668
5721 DEFSYM (Qnative_lisp_file_inconsistent, "native-lisp-file-inconsistent"); 5669 DEFSYM (Qnative_lisp_file_inconsistent, "native-lisp-file-inconsistent");
5722 Fput (Qnative_lisp_file_inconsistent, Qerror_conditions, 5670 Fput (Qnative_lisp_file_inconsistent, Qerror_conditions,
5723 pure_list (Qnative_lisp_file_inconsistent, Qnative_lisp_load_failed, Qerror)); 5671 pure_list (Qnative_lisp_file_inconsistent, Qnative_lisp_load_failed, Qerror));
5724 Fput (Qnative_lisp_file_inconsistent, Qerror_message, 5672 Fput (Qnative_lisp_file_inconsistent, Qerror_message,
5725 build_pure_c_string ("eln file inconsistent with current runtime " 5673 build_string ("eln file inconsistent with current runtime "
5726 "configuration, please recompile")); 5674 "configuration, please recompile"));
5727 5675
5728 defsubr (&Scomp__subr_signature); 5676 defsubr (&Scomp__subr_signature);
5729 defsubr (&Scomp_el_to_eln_rel_filename); 5677 defsubr (&Scomp_el_to_eln_rel_filename);
diff --git a/src/conf_post.h b/src/conf_post.h
index 6ecebf36ab9..ab08cc63bb0 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -210,41 +210,8 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
210 210
211/* DATA_START is needed by vm-limit.c and unexcoff.c. */ 211/* DATA_START is needed by vm-limit.c and unexcoff.c. */
212#define DATA_START (&etext + 1) 212#define DATA_START (&etext + 1)
213
214/* Define one of these for easier conditionals. */
215#ifdef HAVE_X_WINDOWS
216/* We need a little extra space, see ../../lisp/loadup.el and the
217 commentary below, in the non-X branch. The 140KB number was
218 measured on GNU/Linux and on MS-Windows. */
219#define SYSTEM_PURESIZE_EXTRA (-170000+140000)
220#else
221/* We need a little extra space, see ../../lisp/loadup.el.
222 As of 20091024, DOS-specific files use up 62KB of pure space. But
223 overall, we end up wasting 130KB of pure space, because
224 BASE_PURESIZE starts at 1.47MB, while we need only 1.3MB (including
225 non-DOS specific files and load history; the latter is about 55K,
226 but depends on the depth of the top-level Emacs directory in the
227 directory tree). Given the unknown policy of different DPMI
228 hosts regarding loading of untouched pages, I'm not going to risk
229 enlarging Emacs footprint by another 100+ KBytes. */
230#define SYSTEM_PURESIZE_EXTRA (-170000+90000)
231#endif
232#endif /* MSDOS */ 213#endif /* MSDOS */
233 214
234/* macOS / GNUstep need a bit more pure memory. Of the existing knobs,
235 SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */
236#ifdef HAVE_NS
237#if defined NS_IMPL_GNUSTEP
238# define SYSTEM_PURESIZE_EXTRA 30000
239#elif defined DARWIN_OS
240# define SYSTEM_PURESIZE_EXTRA 200000
241#endif
242#endif
243
244#ifdef CYGWIN
245#define SYSTEM_PURESIZE_EXTRA 50000
246#endif
247
248#if defined HAVE_NTGUI && !defined DebPrint 215#if defined HAVE_NTGUI && !defined DebPrint
249# ifdef EMACSDEBUG 216# ifdef EMACSDEBUG
250extern void _DebPrint (const char *fmt, ...); 217extern void _DebPrint (const char *fmt, ...);
diff --git a/src/data.c b/src/data.c
index 1dbec4687b8..69ed68782b0 100644
--- a/src/data.c
+++ b/src/data.c
@@ -30,7 +30,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
30 30
31#include "lisp.h" 31#include "lisp.h"
32#include "bignum.h" 32#include "bignum.h"
33#include "puresize.h"
34#include "character.h" 33#include "character.h"
35#include "buffer.h" 34#include "buffer.h"
36#include "keyboard.h" 35#include "keyboard.h"
@@ -144,12 +143,6 @@ wrong_type_argument (Lisp_Object predicate, Lisp_Object value)
144} 143}
145 144
146void 145void
147pure_write_error (Lisp_Object obj)
148{
149 xsignal2 (Qerror, build_string ("Attempt to modify read-only object"), obj);
150}
151
152void
153args_out_of_range (Lisp_Object a1, Lisp_Object a2) 146args_out_of_range (Lisp_Object a1, Lisp_Object a2)
154{ 147{
155 xsignal2 (Qargs_out_of_range, a1, a2); 148 xsignal2 (Qargs_out_of_range, a1, a2);
@@ -645,7 +638,6 @@ DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0,
645 (register Lisp_Object cell, Lisp_Object newcar) 638 (register Lisp_Object cell, Lisp_Object newcar)
646{ 639{
647 CHECK_CONS (cell); 640 CHECK_CONS (cell);
648 CHECK_IMPURE (cell, XCONS (cell));
649 XSETCAR (cell, newcar); 641 XSETCAR (cell, newcar);
650 return newcar; 642 return newcar;
651} 643}
@@ -655,7 +647,6 @@ DEFUN ("setcdr", Fsetcdr, Ssetcdr, 2, 2, 0,
655 (register Lisp_Object cell, Lisp_Object newcdr) 647 (register Lisp_Object cell, Lisp_Object newcdr)
656{ 648{
657 CHECK_CONS (cell); 649 CHECK_CONS (cell);
658 CHECK_IMPURE (cell, XCONS (cell));
659 XSETCDR (cell, newcdr); 650 XSETCDR (cell, newcdr);
660 return newcdr; 651 return newcdr;
661} 652}
@@ -943,10 +934,6 @@ The return value is undefined. */)
943 (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring) 934 (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring)
944{ 935{
945 CHECK_SYMBOL (symbol); 936 CHECK_SYMBOL (symbol);
946 if (!NILP (Vpurify_flag)
947 /* If `definition' is a keymap, immutable (and copying) is wrong. */
948 && !KEYMAPP (definition))
949 definition = Fpurecopy (definition);
950 937
951 defalias (symbol, definition); 938 defalias (symbol, definition);
952 939
@@ -2590,7 +2577,6 @@ bool-vector. IDX starts at 0. */)
2590 2577
2591 if (VECTORP (array)) 2578 if (VECTORP (array))
2592 { 2579 {
2593 CHECK_IMPURE (array, XVECTOR (array));
2594 if (idxval < 0 || idxval >= ASIZE (array)) 2580 if (idxval < 0 || idxval >= ASIZE (array))
2595 args_out_of_range (array, idx); 2581 args_out_of_range (array, idx);
2596 ASET (array, idxval, newelt); 2582 ASET (array, idxval, newelt);
@@ -2614,7 +2600,6 @@ bool-vector. IDX starts at 0. */)
2614 } 2600 }
2615 else /* STRINGP */ 2601 else /* STRINGP */
2616 { 2602 {
2617 CHECK_IMPURE (array, XSTRING (array));
2618 if (idxval < 0 || idxval >= SCHARS (array)) 2603 if (idxval < 0 || idxval >= SCHARS (array))
2619 args_out_of_range (array, idx); 2604 args_out_of_range (array, idx);
2620 CHECK_CHARACTER (newelt); 2605 CHECK_CHARACTER (newelt);
@@ -4143,7 +4128,7 @@ syms_of_data (void)
4143 4128
4144 DEFSYM (Qcdr, "cdr"); 4129 DEFSYM (Qcdr, "cdr");
4145 4130
4146 error_tail = pure_cons (Qerror, Qnil); 4131 error_tail = Fcons (Qerror, Qnil);
4147 4132
4148 /* ERROR is used as a signaler for random errors for which nothing else is 4133 /* ERROR is used as a signaler for random errors for which nothing else is
4149 right. */ 4134 right. */
@@ -4151,14 +4136,14 @@ syms_of_data (void)
4151 Fput (Qerror, Qerror_conditions, 4136 Fput (Qerror, Qerror_conditions,
4152 error_tail); 4137 error_tail);
4153 Fput (Qerror, Qerror_message, 4138 Fput (Qerror, Qerror_message,
4154 build_pure_c_string ("error")); 4139 build_string ("error"));
4155 4140
4156#define PUT_ERROR(sym, tail, msg) \ 4141#define PUT_ERROR(sym, tail, msg) \
4157 Fput (sym, Qerror_conditions, pure_cons (sym, tail)); \ 4142 Fput (sym, Qerror_conditions, Fcons (sym, tail)); \
4158 Fput (sym, Qerror_message, build_pure_c_string (msg)) 4143 Fput (sym, Qerror_message, build_string (msg))
4159 4144
4160 PUT_ERROR (Qquit, Qnil, "Quit"); 4145 PUT_ERROR (Qquit, Qnil, "Quit");
4161 PUT_ERROR (Qminibuffer_quit, pure_cons (Qquit, Qnil), "Quit"); 4146 PUT_ERROR (Qminibuffer_quit, Fcons (Qquit, Qnil), "Quit");
4162 4147
4163 PUT_ERROR (Quser_error, error_tail, ""); 4148 PUT_ERROR (Quser_error, error_tail, "");
4164 PUT_ERROR (Qwrong_length_argument, error_tail, "Wrong length argument"); 4149 PUT_ERROR (Qwrong_length_argument, error_tail, "Wrong length argument");
@@ -4184,14 +4169,14 @@ syms_of_data (void)
4184 PUT_ERROR (Qno_catch, error_tail, "No catch for tag"); 4169 PUT_ERROR (Qno_catch, error_tail, "No catch for tag");
4185 PUT_ERROR (Qend_of_file, error_tail, "End of file during parsing"); 4170 PUT_ERROR (Qend_of_file, error_tail, "End of file during parsing");
4186 4171
4187 arith_tail = pure_cons (Qarith_error, error_tail); 4172 arith_tail = Fcons (Qarith_error, error_tail);
4188 Fput (Qarith_error, Qerror_conditions, arith_tail); 4173 Fput (Qarith_error, Qerror_conditions, arith_tail);
4189 Fput (Qarith_error, Qerror_message, build_pure_c_string ("Arithmetic error")); 4174 Fput (Qarith_error, Qerror_message, build_string ("Arithmetic error"));
4190 4175
4191 PUT_ERROR (Qbeginning_of_buffer, error_tail, "Beginning of buffer"); 4176 PUT_ERROR (Qbeginning_of_buffer, error_tail, "Beginning of buffer");
4192 PUT_ERROR (Qend_of_buffer, error_tail, "End of buffer"); 4177 PUT_ERROR (Qend_of_buffer, error_tail, "End of buffer");
4193 PUT_ERROR (Qbuffer_read_only, error_tail, "Buffer is read-only"); 4178 PUT_ERROR (Qbuffer_read_only, error_tail, "Buffer is read-only");
4194 PUT_ERROR (Qtext_read_only, pure_cons (Qbuffer_read_only, error_tail), 4179 PUT_ERROR (Qtext_read_only, Fcons (Qbuffer_read_only, error_tail),
4195 "Text is read-only"); 4180 "Text is read-only");
4196 PUT_ERROR (Qinhibited_interaction, error_tail, 4181 PUT_ERROR (Qinhibited_interaction, error_tail,
4197 "User interaction while inhibited"); 4182 "User interaction while inhibited");
@@ -4214,10 +4199,10 @@ syms_of_data (void)
4214 PUT_ERROR (Qunderflow_error, Fcons (Qrange_error, arith_tail), 4199 PUT_ERROR (Qunderflow_error, Fcons (Qrange_error, arith_tail),
4215 "Arithmetic underflow error"); 4200 "Arithmetic underflow error");
4216 4201
4217 recursion_tail = pure_cons (Qrecursion_error, error_tail); 4202 recursion_tail = Fcons (Qrecursion_error, error_tail);
4218 Fput (Qrecursion_error, Qerror_conditions, recursion_tail); 4203 Fput (Qrecursion_error, Qerror_conditions, recursion_tail);
4219 Fput (Qrecursion_error, Qerror_message, build_pure_c_string 4204 Fput (Qrecursion_error, Qerror_message,
4220 ("Excessive recursive calling error")); 4205 build_string ("Excessive recursive calling error"));
4221 4206
4222 PUT_ERROR (Qexcessive_variable_binding, recursion_tail, 4207 PUT_ERROR (Qexcessive_variable_binding, recursion_tail,
4223 "Variable binding depth exceeds max-specpdl-size"); 4208 "Variable binding depth exceeds max-specpdl-size");
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 943a4aff8e7..0bc2a74f37f 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -1869,7 +1869,7 @@ syms_of_dbusbind (void)
1869 Fput (Qdbus_error, Qerror_conditions, 1869 Fput (Qdbus_error, Qerror_conditions,
1870 list2 (Qdbus_error, Qerror)); 1870 list2 (Qdbus_error, Qerror));
1871 Fput (Qdbus_error, Qerror_message, 1871 Fput (Qdbus_error, Qerror_message,
1872 build_pure_c_string ("D-Bus error")); 1872 build_string ("D-Bus error"));
1873 1873
1874 /* Lisp symbols of the system and session buses. */ 1874 /* Lisp symbols of the system and session buses. */
1875 DEFSYM (QCsystem, ":system"); 1875 DEFSYM (QCsystem, ":system");
@@ -1912,7 +1912,7 @@ syms_of_dbusbind (void)
1912 Vdbus_compiled_version, 1912 Vdbus_compiled_version,
1913 doc: /* The version of D-Bus Emacs is compiled against. */); 1913 doc: /* The version of D-Bus Emacs is compiled against. */);
1914#ifdef DBUS_VERSION_STRING 1914#ifdef DBUS_VERSION_STRING
1915 Vdbus_compiled_version = build_pure_c_string (DBUS_VERSION_STRING); 1915 Vdbus_compiled_version = build_string (DBUS_VERSION_STRING);
1916#else 1916#else
1917 Vdbus_compiled_version = Qnil; 1917 Vdbus_compiled_version = Qnil;
1918#endif 1918#endif
diff --git a/src/deps.mk b/src/deps.mk
index 39edd5c1dd3..cc3f685c7d2 100644
--- a/src/deps.mk
+++ b/src/deps.mk
@@ -132,10 +132,10 @@ insdel.o: insdel.c window.h buffer.h $(INTERVALS_H) blockinput.h character.h \
132keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h character.h \ 132keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h character.h \
133 commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h \ 133 commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h \
134 systime.h syntax.h $(INTERVALS_H) blockinput.h atimer.h composite.h \ 134 systime.h syntax.h $(INTERVALS_H) blockinput.h atimer.h composite.h \
135 xterm.h puresize.h msdos.h keymap.h w32term.h nsterm.h nsgui.h coding.h \ 135 xterm.h msdos.h keymap.h w32term.h nsterm.h nsgui.h coding.h \
136 process.h ../lib/unistd.h gnutls.h lisp.h globals.h $(config_h) 136 process.h ../lib/unistd.h gnutls.h lisp.h globals.h $(config_h)
137keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \ 137keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \
138 atimer.h systime.h puresize.h character.h charset.h $(INTERVALS_H) \ 138 atimer.h systime.h character.h charset.h $(INTERVALS_H) \
139 keymap.h window.h coding.h frame.h lisp.h globals.h $(config_h) 139 keymap.h window.h coding.h frame.h lisp.h globals.h $(config_h)
140lastfile.o: lastfile.c $(config_h) 140lastfile.o: lastfile.c $(config_h)
141macros.o: macros.c window.h buffer.h commands.h macros.h keyboard.h msdos.h \ 141macros.o: macros.c window.h buffer.h commands.h macros.h keyboard.h msdos.h \
@@ -267,12 +267,12 @@ xsettings.o: xterm.h xsettings.h lisp.h frame.h termhooks.h $(config_h) \
267 atimer.h termopts.h globals.h 267 atimer.h termopts.h globals.h
268 268
269## The files of Lisp proper. 269## The files of Lisp proper.
270alloc.o: alloc.c process.h frame.h window.h buffer.h puresize.h syssignal.h \ 270alloc.o: alloc.c process.h frame.h window.h buffer.h syssignal.h \
271 keyboard.h blockinput.h atimer.h systime.h character.h lisp.h $(config_h) \ 271 keyboard.h blockinput.h atimer.h systime.h character.h lisp.h $(config_h) \
272 $(INTERVALS_H) termhooks.h gnutls.h coding.h ../lib/unistd.h globals.h 272 $(INTERVALS_H) termhooks.h gnutls.h coding.h ../lib/unistd.h globals.h
273bytecode.o: bytecode.c buffer.h syntax.h character.h window.h dispextern.h \ 273bytecode.o: bytecode.c buffer.h syntax.h character.h window.h dispextern.h \
274 lisp.h globals.h $(config_h) msdos.h 274 lisp.h globals.h $(config_h) msdos.h
275data.o: data.c buffer.h puresize.h character.h syssignal.h keyboard.h frame.h \ 275data.o: data.c buffer.h character.h syssignal.h keyboard.h frame.h \
276 termhooks.h systime.h coding.h composite.h dispextern.h font.h ccl.h \ 276 termhooks.h systime.h coding.h composite.h dispextern.h font.h ccl.h \
277 lisp.h globals.h $(config_h) msdos.h 277 lisp.h globals.h $(config_h) msdos.h
278eval.o: eval.c commands.h keyboard.h blockinput.h atimer.h systime.h frame.h \ 278eval.o: eval.c commands.h keyboard.h blockinput.h atimer.h systime.h frame.h \
@@ -295,7 +295,7 @@ lread.o: lread.c commands.h keyboard.h buffer.h epaths.h character.h \
295composite.o: composite.c composite.h buffer.h character.h coding.h font.h \ 295composite.o: composite.c composite.h buffer.h character.h coding.h font.h \
296 ccl.h frame.h termhooks.h $(INTERVALS_H) window.h \ 296 ccl.h frame.h termhooks.h $(INTERVALS_H) window.h \
297 lisp.h globals.h $(config_h) 297 lisp.h globals.h $(config_h)
298intervals.o: intervals.c buffer.h $(INTERVALS_H) keyboard.h puresize.h \ 298intervals.o: intervals.c buffer.h $(INTERVALS_H) keyboard.h \
299 keymap.h lisp.h globals.h $(config_h) systime.h coding.h 299 keymap.h lisp.h globals.h $(config_h) systime.h coding.h
300textprop.o: textprop.c buffer.h window.h $(INTERVALS_H) \ 300textprop.o: textprop.c buffer.h window.h $(INTERVALS_H) \
301 lisp.h globals.h $(config_h) 301 lisp.h globals.h $(config_h)
diff --git a/src/doc.c b/src/doc.c
index 34b80d03aa9..09c44e48422 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -450,8 +450,6 @@ store_function_docstring (Lisp_Object obj, EMACS_INT offset)
450 { 450 {
451 tem = Fcdr (Fcdr (fun)); 451 tem = Fcdr (Fcdr (fun));
452 if (CONSP (tem) && FIXNUMP (XCAR (tem))) 452 if (CONSP (tem) && FIXNUMP (XCAR (tem)))
453 /* FIXME: This modifies typically pure hash-cons'd data, so its
454 correctness is quite delicate. */
455 XSETCAR (tem, make_fixnum (offset)); 453 XSETCAR (tem, make_fixnum (offset));
456 } 454 }
457 } 455 }
@@ -541,7 +539,6 @@ the same file name is found in the `doc-directory'. */)
541 int i = ARRAYELTS (buildobj); 539 int i = ARRAYELTS (buildobj);
542 while (0 <= --i) 540 while (0 <= --i)
543 Vbuild_files = Fcons (build_string (buildobj[i]), Vbuild_files); 541 Vbuild_files = Fcons (build_string (buildobj[i]), Vbuild_files);
544 Vbuild_files = Fpurecopy (Vbuild_files);
545 } 542 }
546 543
547 fd = emacs_open (name, O_RDONLY, 0); 544 fd = emacs_open (name, O_RDONLY, 0);
diff --git a/src/emacs-module.c b/src/emacs-module.c
index 1c392d65df8..0b32eaf16b7 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -1598,44 +1598,44 @@ syms_of_module (void)
1598 Vmodule_refs_hash 1598 Vmodule_refs_hash
1599 = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, 1599 = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE,
1600 DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD, 1600 DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD,
1601 Qnil, false); 1601 Qnil);
1602 1602
1603 DEFSYM (Qmodule_load_failed, "module-load-failed"); 1603 DEFSYM (Qmodule_load_failed, "module-load-failed");
1604 Fput (Qmodule_load_failed, Qerror_conditions, 1604 Fput (Qmodule_load_failed, Qerror_conditions,
1605 pure_list (Qmodule_load_failed, Qerror)); 1605 list (Qmodule_load_failed, Qerror));
1606 Fput (Qmodule_load_failed, Qerror_message, 1606 Fput (Qmodule_load_failed, Qerror_message,
1607 build_pure_c_string ("Module load failed")); 1607 build_string ("Module load failed"));
1608 1608
1609 DEFSYM (Qmodule_open_failed, "module-open-failed"); 1609 DEFSYM (Qmodule_open_failed, "module-open-failed");
1610 Fput (Qmodule_open_failed, Qerror_conditions, 1610 Fput (Qmodule_open_failed, Qerror_conditions,
1611 pure_list (Qmodule_open_failed, Qmodule_load_failed, Qerror)); 1611 list (Qmodule_open_failed, Qmodule_load_failed, Qerror));
1612 Fput (Qmodule_open_failed, Qerror_message, 1612 Fput (Qmodule_open_failed, Qerror_message,
1613 build_pure_c_string ("Module could not be opened")); 1613 build_string ("Module could not be opened"));
1614 1614
1615 DEFSYM (Qmodule_not_gpl_compatible, "module-not-gpl-compatible"); 1615 DEFSYM (Qmodule_not_gpl_compatible, "module-not-gpl-compatible");
1616 Fput (Qmodule_not_gpl_compatible, Qerror_conditions, 1616 Fput (Qmodule_not_gpl_compatible, Qerror_conditions,
1617 pure_list (Qmodule_not_gpl_compatible, Qmodule_load_failed, Qerror)); 1617 list (Qmodule_not_gpl_compatible, Qmodule_load_failed, Qerror));
1618 Fput (Qmodule_not_gpl_compatible, Qerror_message, 1618 Fput (Qmodule_not_gpl_compatible, Qerror_message,
1619 build_pure_c_string ("Module is not GPL compatible")); 1619 build_string ("Module is not GPL compatible"));
1620 1620
1621 DEFSYM (Qmissing_module_init_function, "missing-module-init-function"); 1621 DEFSYM (Qmissing_module_init_function, "missing-module-init-function");
1622 Fput (Qmissing_module_init_function, Qerror_conditions, 1622 Fput (Qmissing_module_init_function, Qerror_conditions,
1623 pure_list (Qmissing_module_init_function, Qmodule_load_failed, 1623 list (Qmissing_module_init_function, Qmodule_load_failed,
1624 Qerror)); 1624 Qerror));
1625 Fput (Qmissing_module_init_function, Qerror_message, 1625 Fput (Qmissing_module_init_function, Qerror_message,
1626 build_pure_c_string ("Module does not export an " 1626 build_string ("Module does not export an "
1627 "initialization function")); 1627 "initialization function"));
1628 1628
1629 DEFSYM (Qmodule_init_failed, "module-init-failed"); 1629 DEFSYM (Qmodule_init_failed, "module-init-failed");
1630 Fput (Qmodule_init_failed, Qerror_conditions, 1630 Fput (Qmodule_init_failed, Qerror_conditions,
1631 pure_list (Qmodule_init_failed, Qmodule_load_failed, Qerror)); 1631 list (Qmodule_init_failed, Qmodule_load_failed, Qerror));
1632 Fput (Qmodule_init_failed, Qerror_message, 1632 Fput (Qmodule_init_failed, Qerror_message,
1633 build_pure_c_string ("Module initialization failed")); 1633 build_string ("Module initialization failed"));
1634 1634
1635 DEFSYM (Qinvalid_arity, "invalid-arity"); 1635 DEFSYM (Qinvalid_arity, "invalid-arity");
1636 Fput (Qinvalid_arity, Qerror_conditions, pure_list (Qinvalid_arity, Qerror)); 1636 Fput (Qinvalid_arity, Qerror_conditions, list (Qinvalid_arity, Qerror));
1637 Fput (Qinvalid_arity, Qerror_message, 1637 Fput (Qinvalid_arity, Qerror_message,
1638 build_pure_c_string ("Invalid function arity")); 1638 build_string ("Invalid function arity"));
1639 1639
1640 DEFSYM (Qmodule_function_p, "module-function-p"); 1640 DEFSYM (Qmodule_function_p, "module-function-p");
1641 DEFSYM (Qunicode_string_p, "unicode-string-p"); 1641 DEFSYM (Qunicode_string_p, "unicode-string-p");
diff --git a/src/emacs.c b/src/emacs.c
index 3c768412818..27bb04094a3 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -104,7 +104,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
104#include "syntax.h" 104#include "syntax.h"
105#include "sysselect.h" 105#include "sysselect.h"
106#include "systime.h" 106#include "systime.h"
107#include "puresize.h"
108 107
109#include "getpagesize.h" 108#include "getpagesize.h"
110#include "gnutls.h" 109#include "gnutls.h"
@@ -3029,8 +3028,6 @@ You must run Emacs in batch mode in order to dump it. */)
3029 Lisp_Object symbol; 3028 Lisp_Object symbol;
3030 specpdl_ref count = SPECPDL_INDEX (); 3029 specpdl_ref count = SPECPDL_INDEX ();
3031 3030
3032 check_pure_size ();
3033
3034 if (! noninteractive) 3031 if (! noninteractive)
3035 error ("Dumping Emacs works only in batch mode"); 3032 error ("Dumping Emacs works only in batch mode");
3036 3033
diff --git a/src/eval.c b/src/eval.c
index 141d2546f08..93cd02b023a 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -748,8 +748,6 @@ value. */)
748 XSYMBOL (symbol)->u.s.declared_special = true; 748 XSYMBOL (symbol)->u.s.declared_special = true;
749 if (!NILP (doc)) 749 if (!NILP (doc))
750 { 750 {
751 if (!NILP (Vpurify_flag))
752 doc = Fpurecopy (doc);
753 Fput (symbol, Qvariable_documentation, doc); 751 Fput (symbol, Qvariable_documentation, doc);
754 } 752 }
755 LOADHIST_ATTACH (symbol); 753 LOADHIST_ATTACH (symbol);
@@ -892,8 +890,6 @@ More specifically, behaves like (defconst SYM 'INITVALUE DOCSTRING). */)
892 CHECK_SYMBOL (sym); 890 CHECK_SYMBOL (sym);
893 Lisp_Object tem = initvalue; 891 Lisp_Object tem = initvalue;
894 Finternal__define_uninitialized_variable (sym, docstring); 892 Finternal__define_uninitialized_variable (sym, docstring);
895 if (!NILP (Vpurify_flag))
896 tem = Fpurecopy (tem);
897 Fset_default (sym, tem); /* FIXME: set-default-toplevel-value? */ 893 Fset_default (sym, tem); /* FIXME: set-default-toplevel-value? */
898 Fput (sym, Qrisky_local_variable, Qt); /* FIXME: Why? */ 894 Fput (sym, Qrisky_local_variable, Qt); /* FIXME: Why? */
899 return sym; 895 return sym;
@@ -2195,12 +2191,6 @@ this does nothing and returns nil. */)
2195 && !AUTOLOADP (XSYMBOL (function)->u.s.function)) 2191 && !AUTOLOADP (XSYMBOL (function)->u.s.function))
2196 return Qnil; 2192 return Qnil;
2197 2193
2198 if (!NILP (Vpurify_flag) && BASE_EQ (docstring, make_fixnum (0)))
2199 /* `read1' in lread.c has found the docstring starting with "\
2200 and assumed the docstring will be provided by Snarf-documentation, so it
2201 passed us 0 instead. But that leads to accidental sharing in purecopy's
2202 hash-consing, so we use a (hopefully) unique integer instead. */
2203 docstring = make_ufixnum (XHASH (function));
2204 return Fdefalias (function, 2194 return Fdefalias (function,
2205 list5 (Qautoload, file, docstring, interactive, type), 2195 list5 (Qautoload, file, docstring, interactive, type),
2206 Qnil); 2196 Qnil);
@@ -4360,7 +4350,7 @@ alist of active lexical bindings. */);
4360 also use something like Fcons (Qnil, Qnil), but json.c treats any 4350 also use something like Fcons (Qnil, Qnil), but json.c treats any
4361 cons cell as error data, so use an uninterned symbol instead. */ 4351 cons cell as error data, so use an uninterned symbol instead. */
4362 Qcatch_all_memory_full 4352 Qcatch_all_memory_full
4363 = Fmake_symbol (build_pure_c_string ("catch-all-memory-full")); 4353 = Fmake_symbol (build_string ("catch-all-memory-full"));
4364 4354
4365 defsubr (&Sor); 4355 defsubr (&Sor);
4366 defsubr (&Sand); 4356 defsubr (&Sand);
diff --git a/src/fileio.c b/src/fileio.c
index 10d4b8bc15e..bc5b4570c19 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -6462,39 +6462,39 @@ behaves as if file names were encoded in `utf-8'. */);
6462 DEFSYM (Qcar_less_than_car, "car-less-than-car"); 6462 DEFSYM (Qcar_less_than_car, "car-less-than-car");
6463 6463
6464 Fput (Qfile_error, Qerror_conditions, 6464 Fput (Qfile_error, Qerror_conditions,
6465 Fpurecopy (list2 (Qfile_error, Qerror))); 6465 list2 (Qfile_error, Qerror));
6466 Fput (Qfile_error, Qerror_message, 6466 Fput (Qfile_error, Qerror_message,
6467 build_pure_c_string ("File error")); 6467 build_string ("File error"));
6468 6468
6469 Fput (Qfile_already_exists, Qerror_conditions, 6469 Fput (Qfile_already_exists, Qerror_conditions,
6470 Fpurecopy (list3 (Qfile_already_exists, Qfile_error, Qerror))); 6470 list3 (Qfile_already_exists, Qfile_error, Qerror));
6471 Fput (Qfile_already_exists, Qerror_message, 6471 Fput (Qfile_already_exists, Qerror_message,
6472 build_pure_c_string ("File already exists")); 6472 build_string ("File already exists"));
6473 6473
6474 Fput (Qfile_date_error, Qerror_conditions, 6474 Fput (Qfile_date_error, Qerror_conditions,
6475 Fpurecopy (list3 (Qfile_date_error, Qfile_error, Qerror))); 6475 list3 (Qfile_date_error, Qfile_error, Qerror));
6476 Fput (Qfile_date_error, Qerror_message, 6476 Fput (Qfile_date_error, Qerror_message,
6477 build_pure_c_string ("Cannot set file date")); 6477 build_string ("Cannot set file date"));
6478 6478
6479 Fput (Qfile_missing, Qerror_conditions, 6479 Fput (Qfile_missing, Qerror_conditions,
6480 Fpurecopy (list3 (Qfile_missing, Qfile_error, Qerror))); 6480 list3 (Qfile_missing, Qfile_error, Qerror));
6481 Fput (Qfile_missing, Qerror_message, 6481 Fput (Qfile_missing, Qerror_message,
6482 build_pure_c_string ("File is missing")); 6482 build_string ("File is missing"));
6483 6483
6484 Fput (Qpermission_denied, Qerror_conditions, 6484 Fput (Qpermission_denied, Qerror_conditions,
6485 Fpurecopy (list3 (Qpermission_denied, Qfile_error, Qerror))); 6485 list3 (Qpermission_denied, Qfile_error, Qerror));
6486 Fput (Qpermission_denied, Qerror_message, 6486 Fput (Qpermission_denied, Qerror_message,
6487 build_pure_c_string ("Cannot access file or directory")); 6487 build_string ("Cannot access file or directory"));
6488 6488
6489 Fput (Qfile_notify_error, Qerror_conditions, 6489 Fput (Qfile_notify_error, Qerror_conditions,
6490 Fpurecopy (list3 (Qfile_notify_error, Qfile_error, Qerror))); 6490 list3 (Qfile_notify_error, Qfile_error, Qerror));
6491 Fput (Qfile_notify_error, Qerror_message, 6491 Fput (Qfile_notify_error, Qerror_message,
6492 build_pure_c_string ("File notification error")); 6492 build_string ("File notification error"));
6493 6493
6494 Fput (Qremote_file_error, Qerror_conditions, 6494 Fput (Qremote_file_error, Qerror_conditions,
6495 Fpurecopy (list3 (Qremote_file_error, Qfile_error, Qerror))); 6495 list3 (Qremote_file_error, Qfile_error, Qerror));
6496 Fput (Qremote_file_error, Qerror_message, 6496 Fput (Qremote_file_error, Qerror_message,
6497 build_pure_c_string ("Remote file error")); 6497 build_string ("Remote file error"));
6498 6498
6499 DEFVAR_LISP ("file-name-handler-alist", Vfile_name_handler_alist, 6499 DEFVAR_LISP ("file-name-handler-alist", Vfile_name_handler_alist,
6500 doc: /* Alist of elements (REGEXP . HANDLER) for file names handled specially. 6500 doc: /* Alist of elements (REGEXP . HANDLER) for file names handled specially.
diff --git a/src/fns.c b/src/fns.c
index 7553a094468..0564dbec83c 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -36,7 +36,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
36#include "buffer.h" 36#include "buffer.h"
37#include "intervals.h" 37#include "intervals.h"
38#include "window.h" 38#include "window.h"
39#include "puresize.h"
40#include "gnutls.h" 39#include "gnutls.h"
41 40
42enum equal_kind { EQUAL_NO_QUIT, EQUAL_PLAIN, EQUAL_INCLUDING_PROPERTIES }; 41enum equal_kind { EQUAL_NO_QUIT, EQUAL_PLAIN, EQUAL_INCLUDING_PROPERTIES };
@@ -2653,7 +2652,6 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
2653 size = SCHARS (array); 2652 size = SCHARS (array);
2654 if (size != 0) 2653 if (size != 0)
2655 { 2654 {
2656 CHECK_IMPURE (array, XSTRING (array));
2657 unsigned char str[MAX_MULTIBYTE_LENGTH]; 2655 unsigned char str[MAX_MULTIBYTE_LENGTH];
2658 int len; 2656 int len;
2659 if (STRING_MULTIBYTE (array)) 2657 if (STRING_MULTIBYTE (array))
@@ -2695,7 +2693,6 @@ This makes STRING unibyte and may change its length. */)
2695 ptrdiff_t len = SBYTES (string); 2693 ptrdiff_t len = SBYTES (string);
2696 if (len != 0 || STRING_MULTIBYTE (string)) 2694 if (len != 0 || STRING_MULTIBYTE (string))
2697 { 2695 {
2698 CHECK_IMPURE (string, XSTRING (string));
2699 memset (SDATA (string), 0, len); 2696 memset (SDATA (string), 0, len);
2700 STRING_SET_CHARS (string, len); 2697 STRING_SET_CHARS (string, len);
2701 STRING_SET_UNIBYTE (string); 2698 STRING_SET_UNIBYTE (string);
@@ -4263,16 +4260,12 @@ hash_index_size (struct Lisp_Hash_Table *h, ptrdiff_t size)
4263 size exceeds REHASH_THRESHOLD. 4260 size exceeds REHASH_THRESHOLD.
4264 4261
4265 WEAK specifies the weakness of the table. If non-nil, it must be 4262 WEAK specifies the weakness of the table. If non-nil, it must be
4266 one of the symbols `key', `value', `key-or-value', or `key-and-value'. 4263 one of the symbols `key', `value', `key-or-value', or `key-and-value'. */
4267
4268 If PURECOPY is non-nil, the table can be copied to pure storage via
4269 `purecopy' when Emacs is being dumped. Such tables can no longer be
4270 changed after purecopy. */
4271 4264
4272Lisp_Object 4265Lisp_Object
4273make_hash_table (struct hash_table_test test, EMACS_INT size, 4266make_hash_table (struct hash_table_test test, EMACS_INT size,
4274 float rehash_size, float rehash_threshold, 4267 float rehash_size, float rehash_threshold,
4275 Lisp_Object weak, bool purecopy) 4268 Lisp_Object weak)
4276{ 4269{
4277 struct Lisp_Hash_Table *h; 4270 struct Lisp_Hash_Table *h;
4278 Lisp_Object table; 4271 Lisp_Object table;
@@ -4301,7 +4294,6 @@ make_hash_table (struct hash_table_test test, EMACS_INT size,
4301 h->next = make_vector (size, make_fixnum (-1)); 4294 h->next = make_vector (size, make_fixnum (-1));
4302 h->index = make_vector (hash_index_size (h, size), make_fixnum (-1)); 4295 h->index = make_vector (hash_index_size (h, size), make_fixnum (-1));
4303 h->next_weak = NULL; 4296 h->next_weak = NULL;
4304 h->purecopy = purecopy;
4305 h->mutable = true; 4297 h->mutable = true;
4306 4298
4307 /* Set up the free list. */ 4299 /* Set up the free list. */
@@ -4402,11 +4394,6 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h)
4402 set_hash_next_slot (h, i, HASH_INDEX (h, start_of_bucket)); 4394 set_hash_next_slot (h, i, HASH_INDEX (h, start_of_bucket));
4403 set_hash_index_slot (h, start_of_bucket, i); 4395 set_hash_index_slot (h, start_of_bucket, i);
4404 } 4396 }
4405
4406#ifdef ENABLE_CHECKING
4407 if (HASH_TABLE_P (Vpurify_flag) && XHASH_TABLE (Vpurify_flag) == h)
4408 message ("Growing hash table to: %"pD"d", next_size);
4409#endif
4410 } 4397 }
4411} 4398}
4412 4399
@@ -4470,7 +4457,6 @@ check_mutable_hash_table (Lisp_Object obj, struct Lisp_Hash_Table *h)
4470{ 4457{
4471 if (!h->mutable) 4458 if (!h->mutable)
4472 signal_error ("hash table test modifies table", obj); 4459 signal_error ("hash table test modifies table", obj);
4473 eassert (!PURE_P (h));
4474} 4460}
4475 4461
4476static void 4462static void
@@ -4998,16 +4984,10 @@ key, value, one of key or value, or both key and value, depending on
4998WEAK. WEAK t is equivalent to `key-and-value'. Default value of WEAK 4984WEAK. WEAK t is equivalent to `key-and-value'. Default value of WEAK
4999is nil. 4985is nil.
5000 4986
5001:purecopy PURECOPY -- If PURECOPY is non-nil, the table can be copied
5002to pure storage when Emacs is being dumped, making the contents of the
5003table read only. Any further changes to purified tables will result
5004in an error.
5005
5006usage: (make-hash-table &rest KEYWORD-ARGS) */) 4987usage: (make-hash-table &rest KEYWORD-ARGS) */)
5007 (ptrdiff_t nargs, Lisp_Object *args) 4988 (ptrdiff_t nargs, Lisp_Object *args)
5008{ 4989{
5009 Lisp_Object test, weak; 4990 Lisp_Object test, weak;
5010 bool purecopy;
5011 struct hash_table_test testdesc; 4991 struct hash_table_test testdesc;
5012 ptrdiff_t i; 4992 ptrdiff_t i;
5013 USE_SAFE_ALLOCA; 4993 USE_SAFE_ALLOCA;
@@ -5041,9 +5021,9 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
5041 testdesc.cmpfn = cmpfn_user_defined; 5021 testdesc.cmpfn = cmpfn_user_defined;
5042 } 5022 }
5043 5023
5044 /* See if there's a `:purecopy PURECOPY' argument. */ 5024 /* Ignore a `:purecopy PURECOPY' argument. We used to accept those, but
5045 i = get_key_arg (QCpurecopy, nargs, args, used); 5025 they were only meaningful when we had the purespace. */
5046 purecopy = i && !NILP (args[i]); 5026 get_key_arg (QCpurecopy, nargs, args, used);
5047 /* See if there's a `:size SIZE' argument. */ 5027 /* See if there's a `:size SIZE' argument. */
5048 i = get_key_arg (QCsize, nargs, args, used); 5028 i = get_key_arg (QCsize, nargs, args, used);
5049 Lisp_Object size_arg = i ? args[i] : Qnil; 5029 Lisp_Object size_arg = i ? args[i] : Qnil;
@@ -5093,8 +5073,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
5093 signal_error ("Invalid argument list", args[i]); 5073 signal_error ("Invalid argument list", args[i]);
5094 5074
5095 SAFE_FREE (); 5075 SAFE_FREE ();
5096 return make_hash_table (testdesc, size, rehash_size, rehash_threshold, weak, 5076 return make_hash_table (testdesc, size, rehash_size, rehash_threshold, weak);
5097 purecopy);
5098} 5077}
5099 5078
5100 5079
diff --git a/src/fontset.c b/src/fontset.c
index 1793715450e..2e3f6e096f6 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -2138,7 +2138,7 @@ syms_of_fontset (void)
2138 set_fontset_id (Vdefault_fontset, make_fixnum (0)); 2138 set_fontset_id (Vdefault_fontset, make_fixnum (0));
2139 set_fontset_name 2139 set_fontset_name
2140 (Vdefault_fontset, 2140 (Vdefault_fontset,
2141 build_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default")); 2141 build_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default"));
2142 ASET (Vfontset_table, 0, Vdefault_fontset); 2142 ASET (Vfontset_table, 0, Vdefault_fontset);
2143 next_fontset_id = 1; 2143 next_fontset_id = 1;
2144 PDUMPER_REMEMBER_SCALAR (next_fontset_id); 2144 PDUMPER_REMEMBER_SCALAR (next_fontset_id);
@@ -2196,7 +2196,7 @@ alternate fontnames (if any) are tried instead. */);
2196 doc: /* Alist of fontset names vs the aliases. */); 2196 doc: /* Alist of fontset names vs the aliases. */);
2197 Vfontset_alias_alist 2197 Vfontset_alias_alist
2198 = list1 (Fcons (FONTSET_NAME (Vdefault_fontset), 2198 = list1 (Fcons (FONTSET_NAME (Vdefault_fontset),
2199 build_pure_c_string ("fontset-default"))); 2199 build_string ("fontset-default")));
2200 2200
2201 DEFVAR_LISP ("vertical-centering-font-regexp", 2201 DEFVAR_LISP ("vertical-centering-font-regexp",
2202 Vvertical_centering_font_regexp, 2202 Vvertical_centering_font_regexp,
diff --git a/src/frame.c b/src/frame.c
index 02c90ea6519..055edeb7b63 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1028,7 +1028,7 @@ make_frame (bool mini_p)
1028 1028
1029 fset_face_hash_table 1029 fset_face_hash_table
1030 (f, make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, DEFAULT_REHASH_SIZE, 1030 (f, make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, DEFAULT_REHASH_SIZE,
1031 DEFAULT_REHASH_THRESHOLD, Qnil, false)); 1031 DEFAULT_REHASH_THRESHOLD, Qnil));
1032 1032
1033 if (mini_p) 1033 if (mini_p)
1034 { 1034 {
@@ -1192,7 +1192,7 @@ make_initial_frame (void)
1192 Vframe_list = Fcons (frame, Vframe_list); 1192 Vframe_list = Fcons (frame, Vframe_list);
1193 1193
1194 tty_frame_count = 1; 1194 tty_frame_count = 1;
1195 fset_name (f, build_pure_c_string ("F1")); 1195 fset_name (f, build_string ("F1"));
1196 1196
1197 SET_FRAME_VISIBLE (f, 1); 1197 SET_FRAME_VISIBLE (f, 1);
1198 1198
diff --git a/src/image.c b/src/image.c
index c0a7b85cb3b..bdfe390dc44 100644
--- a/src/image.c
+++ b/src/image.c
@@ -5442,7 +5442,7 @@ xpm_make_color_table_h (void (**put_func) (Lisp_Object, const char *, int,
5442 *get_func = xpm_get_color_table_h; 5442 *get_func = xpm_get_color_table_h;
5443 return make_hash_table (hashtest_equal, DEFAULT_HASH_SIZE, 5443 return make_hash_table (hashtest_equal, DEFAULT_HASH_SIZE,
5444 DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD, 5444 DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD,
5445 Qnil, false); 5445 Qnil);
5446} 5446}
5447 5447
5448static void 5448static void
diff --git a/src/intervals.c b/src/intervals.c
index 85152c58a5d..136dc539a74 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -44,7 +44,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
44#include "lisp.h" 44#include "lisp.h"
45#include "intervals.h" 45#include "intervals.h"
46#include "buffer.h" 46#include "buffer.h"
47#include "puresize.h"
48#include "keymap.h" 47#include "keymap.h"
49 48
50/* Test for membership, allowing for t (actually any non-cons) to mean the 49/* Test for membership, allowing for t (actually any non-cons) to mean the
@@ -101,7 +100,6 @@ create_root_interval (Lisp_Object parent)
101 } 100 }
102 else 101 else
103 { 102 {
104 CHECK_IMPURE (parent, XSTRING (parent));
105 new->total_length = SCHARS (parent); 103 new->total_length = SCHARS (parent);
106 eassert (TOTAL_LENGTH (new) >= 0); 104 eassert (TOTAL_LENGTH (new) >= 0);
107 set_string_intervals (parent, new); 105 set_string_intervals (parent, new);
diff --git a/src/json.c b/src/json.c
index 763f463aa4e..d30e82d8164 100644
--- a/src/json.c
+++ b/src/json.c
@@ -1102,8 +1102,8 @@ define_error (Lisp_Object name, const char *message, Lisp_Object parent)
1102 eassert (CONSP (parent_conditions)); 1102 eassert (CONSP (parent_conditions));
1103 eassert (!NILP (Fmemq (parent, parent_conditions))); 1103 eassert (!NILP (Fmemq (parent, parent_conditions)));
1104 eassert (NILP (Fmemq (name, parent_conditions))); 1104 eassert (NILP (Fmemq (name, parent_conditions)));
1105 Fput (name, Qerror_conditions, pure_cons (name, parent_conditions)); 1105 Fput (name, Qerror_conditions, Fcons (name, parent_conditions));
1106 Fput (name, Qerror_message, build_pure_c_string (message)); 1106 Fput (name, Qerror_message, build_string (message));
1107} 1107}
1108 1108
1109void 1109void
diff --git a/src/keyboard.c b/src/keyboard.c
index 4cac20eb4b7..402d1035c9e 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -12045,14 +12045,14 @@ syms_of_keyboard (void)
12045 pending_funcalls = Qnil; 12045 pending_funcalls = Qnil;
12046 staticpro (&pending_funcalls); 12046 staticpro (&pending_funcalls);
12047 12047
12048 Vlispy_mouse_stem = build_pure_c_string ("mouse"); 12048 Vlispy_mouse_stem = build_string ("mouse");
12049 staticpro (&Vlispy_mouse_stem); 12049 staticpro (&Vlispy_mouse_stem);
12050 12050
12051 regular_top_level_message = build_pure_c_string ("Back to top level"); 12051 regular_top_level_message = build_string ("Back to top level");
12052 staticpro (&regular_top_level_message); 12052 staticpro (&regular_top_level_message);
12053#ifdef HAVE_STACK_OVERFLOW_HANDLING 12053#ifdef HAVE_STACK_OVERFLOW_HANDLING
12054 recover_top_level_message 12054 recover_top_level_message
12055 = build_pure_c_string ("Re-entering top level after C stack overflow"); 12055 = build_string ("Re-entering top level after C stack overflow");
12056 staticpro (&recover_top_level_message); 12056 staticpro (&recover_top_level_message);
12057#endif 12057#endif
12058 DEFVAR_LISP ("internal--top-level-message", Vinternal__top_level_message, 12058 DEFVAR_LISP ("internal--top-level-message", Vinternal__top_level_message,
diff --git a/src/keymap.c b/src/keymap.c
index 2b77a7fc444..c6188a251cb 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -50,7 +50,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
50#include "keyboard.h" 50#include "keyboard.h"
51#include "termhooks.h" 51#include "termhooks.h"
52#include "blockinput.h" 52#include "blockinput.h"
53#include "puresize.h"
54#include "intervals.h" 53#include "intervals.h"
55#include "keymap.h" 54#include "keymap.h"
56#include "window.h" 55#include "window.h"
@@ -121,8 +120,6 @@ in case you use it as a menu with `x-popup-menu'. */)
121{ 120{
122 if (!NILP (string)) 121 if (!NILP (string))
123 { 122 {
124 if (!NILP (Vpurify_flag))
125 string = Fpurecopy (string);
126 return list2 (Qkeymap, string); 123 return list2 (Qkeymap, string);
127 } 124 }
128 return list1 (Qkeymap); 125 return list1 (Qkeymap);
@@ -301,7 +298,6 @@ Return PARENT. PARENT should be nil or another keymap. */)
301 If we came to the end, add the parent in PREV. */ 298 If we came to the end, add the parent in PREV. */
302 if (!CONSP (list) || KEYMAPP (list)) 299 if (!CONSP (list) || KEYMAPP (list))
303 { 300 {
304 CHECK_IMPURE (prev, XCONS (prev));
305 XSETCDR (prev, parent); 301 XSETCDR (prev, parent);
306 return parent; 302 return parent;
307 } 303 }
@@ -744,7 +740,7 @@ store_in_keymap (Lisp_Object keymap, register Lisp_Object idx,
744 740
745 /* If we are preparing to dump, and DEF is a menu element 741 /* If we are preparing to dump, and DEF is a menu element
746 with a menu item indicator, copy it to ensure it is not pure. */ 742 with a menu item indicator, copy it to ensure it is not pure. */
747 if (CONSP (def) && PURE_P (XCONS (def)) 743 if (CONSP (def)
748 && (EQ (XCAR (def), Qmenu_item) || STRINGP (XCAR (def)))) 744 && (EQ (XCAR (def), Qmenu_item) || STRINGP (XCAR (def))))
749 def = Fcons (XCAR (def), XCDR (def)); 745 def = Fcons (XCAR (def), XCDR (def));
750 746
@@ -788,7 +784,6 @@ store_in_keymap (Lisp_Object keymap, register Lisp_Object idx,
788 { 784 {
789 if (FIXNATP (idx) && XFIXNAT (idx) < ASIZE (elt)) 785 if (FIXNATP (idx) && XFIXNAT (idx) < ASIZE (elt))
790 { 786 {
791 CHECK_IMPURE (elt, XVECTOR (elt));
792 ASET (elt, XFIXNAT (idx), def); 787 ASET (elt, XFIXNAT (idx), def);
793 return def; 788 return def;
794 } 789 }
@@ -846,7 +841,6 @@ store_in_keymap (Lisp_Object keymap, register Lisp_Object idx,
846 } 841 }
847 else if (EQ (idx, XCAR (elt))) 842 else if (EQ (idx, XCAR (elt)))
848 { 843 {
849 CHECK_IMPURE (elt, XCONS (elt));
850 if (remove) 844 if (remove)
851 /* Remove the element. */ 845 /* Remove the element. */
852 insertion_point = Fdelq (elt, insertion_point); 846 insertion_point = Fdelq (elt, insertion_point);
@@ -900,7 +894,6 @@ store_in_keymap (Lisp_Object keymap, register Lisp_Object idx,
900 } 894 }
901 else 895 else
902 elt = Fcons (idx, def); 896 elt = Fcons (idx, def);
903 CHECK_IMPURE (insertion_point, XCONS (insertion_point));
904 XSETCDR (insertion_point, Fcons (elt, XCDR (insertion_point))); 897 XSETCDR (insertion_point, Fcons (elt, XCDR (insertion_point)));
905 } 898 }
906 } 899 }
@@ -3340,12 +3333,12 @@ syms_of_keymap (void)
3340 current_global_map = Qnil; 3333 current_global_map = Qnil;
3341 staticpro (&current_global_map); 3334 staticpro (&current_global_map);
3342 3335
3343 exclude_keys = pure_list 3336 exclude_keys = list
3344 (pure_cons (build_pure_c_string ("DEL"), build_pure_c_string ("\\d")), 3337 (Fcons (build_string ("DEL"), build_string ("\\d")),
3345 pure_cons (build_pure_c_string ("TAB"), build_pure_c_string ("\\t")), 3338 Fcons (build_string ("TAB"), build_string ("\\t")),
3346 pure_cons (build_pure_c_string ("RET"), build_pure_c_string ("\\r")), 3339 Fcons (build_string ("RET"), build_string ("\\r")),
3347 pure_cons (build_pure_c_string ("ESC"), build_pure_c_string ("\\e")), 3340 Fcons (build_string ("ESC"), build_string ("\\e")),
3348 pure_cons (build_pure_c_string ("SPC"), build_pure_c_string (" "))); 3341 Fcons (build_string ("SPC"), build_string (" ")));
3349 staticpro (&exclude_keys); 3342 staticpro (&exclude_keys);
3350 3343
3351 DEFVAR_LISP ("minibuffer-local-map", Vminibuffer_local_map, 3344 DEFVAR_LISP ("minibuffer-local-map", Vminibuffer_local_map,
@@ -3407,13 +3400,13 @@ that describe key bindings. That is why the default is nil. */);
3407 DEFSYM (Qmode_line, "mode-line"); 3400 DEFSYM (Qmode_line, "mode-line");
3408 3401
3409 staticpro (&Vmouse_events); 3402 staticpro (&Vmouse_events);
3410 Vmouse_events = pure_list (Qmenu_bar, Qtab_bar, Qtool_bar, 3403 Vmouse_events = list (Qmenu_bar, Qtab_bar, Qtool_bar, Qtab_line,
3411 Qtab_line, Qheader_line, Qmode_line, 3404 Qheader_line, Qmode_line,
3412 intern_c_string ("mouse-1"), 3405 intern_c_string ("mouse-1"),
3413 intern_c_string ("mouse-2"), 3406 intern_c_string ("mouse-2"),
3414 intern_c_string ("mouse-3"), 3407 intern_c_string ("mouse-3"),
3415 intern_c_string ("mouse-4"), 3408 intern_c_string ("mouse-4"),
3416 intern_c_string ("mouse-5")); 3409 intern_c_string ("mouse-5"));
3417 3410
3418 /* Keymap used for minibuffers when doing completion. */ 3411 /* Keymap used for minibuffers when doing completion. */
3419 /* Keymap used for minibuffers when doing completion and require a match. */ 3412 /* Keymap used for minibuffers when doing completion and require a match. */
diff --git a/src/lisp.h b/src/lisp.h
index 7a7d2e79979..7be2e5d38dc 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -859,9 +859,6 @@ struct Lisp_Symbol
859 special (with `defvar' etc), and shouldn't be lexically bound. */ 859 special (with `defvar' etc), and shouldn't be lexically bound. */
860 bool_bf declared_special : 1; 860 bool_bf declared_special : 1;
861 861
862 /* True if pointed to from purespace and hence can't be GC'd. */
863 bool_bf pinned : 1;
864
865 /* The symbol's name, as a Lisp string. */ 862 /* The symbol's name, as a Lisp string. */
866 Lisp_Object name; 863 Lisp_Object name;
867 864
@@ -2426,12 +2423,8 @@ struct Lisp_Hash_Table
2426 /* Index of first free entry in free list, or -1 if none. */ 2423 /* Index of first free entry in free list, or -1 if none. */
2427 ptrdiff_t next_free; 2424 ptrdiff_t next_free;
2428 2425
2429 /* True if the table can be purecopied. The table cannot be
2430 changed afterwards. */
2431 bool purecopy;
2432
2433 /* True if the table is mutable. Ordinarily tables are mutable, but 2426 /* True if the table is mutable. Ordinarily tables are mutable, but
2434 pure tables are not, and while a table is being mutated it is 2427 some tables are not, and while a table is being mutated it is
2435 immutable for recursive attempts to mutate it. */ 2428 immutable for recursive attempts to mutate it. */
2436 bool mutable; 2429 bool mutable;
2437 2430
@@ -4010,7 +4003,7 @@ EMACS_UINT hash_string (char const *, ptrdiff_t);
4010EMACS_UINT sxhash (Lisp_Object); 4003EMACS_UINT sxhash (Lisp_Object);
4011Lisp_Object hashfn_user_defined (Lisp_Object, struct Lisp_Hash_Table *); 4004Lisp_Object hashfn_user_defined (Lisp_Object, struct Lisp_Hash_Table *);
4012Lisp_Object make_hash_table (struct hash_table_test, EMACS_INT, float, float, 4005Lisp_Object make_hash_table (struct hash_table_test, EMACS_INT, float, float,
4013 Lisp_Object, bool); 4006 Lisp_Object);
4014ptrdiff_t hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object *); 4007ptrdiff_t hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object *);
4015ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object, 4008ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object,
4016 Lisp_Object); 4009 Lisp_Object);
@@ -4177,7 +4170,6 @@ extern void parse_str_as_multibyte (const unsigned char *, ptrdiff_t,
4177 4170
4178/* Defined in alloc.c. */ 4171/* Defined in alloc.c. */
4179extern void *my_heap_start (void); 4172extern void *my_heap_start (void);
4180extern void check_pure_size (void);
4181unsigned char *resize_string_data (Lisp_Object, ptrdiff_t, int, int); 4173unsigned char *resize_string_data (Lisp_Object, ptrdiff_t, int, int);
4182extern void malloc_warning (const char *); 4174extern void malloc_warning (const char *);
4183extern AVOID memory_full (size_t); 4175extern AVOID memory_full (size_t);
@@ -4236,11 +4228,8 @@ extern Lisp_Object list4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
4236extern Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, 4228extern Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
4237 Lisp_Object); 4229 Lisp_Object);
4238extern Lisp_Object listn (ptrdiff_t, Lisp_Object, ...); 4230extern Lisp_Object listn (ptrdiff_t, Lisp_Object, ...);
4239extern Lisp_Object pure_listn (ptrdiff_t, Lisp_Object, ...);
4240#define list(...) \ 4231#define list(...) \
4241 listn (ARRAYELTS (((Lisp_Object []) {__VA_ARGS__})), __VA_ARGS__) 4232 listn (ARRAYELTS (((Lisp_Object []) {__VA_ARGS__})), __VA_ARGS__)
4242#define pure_list(...) \
4243 pure_listn (ARRAYELTS (((Lisp_Object []) {__VA_ARGS__})), __VA_ARGS__)
4244 4233
4245enum gc_root_type 4234enum gc_root_type
4246{ 4235{
@@ -4313,18 +4302,8 @@ extern Lisp_Object make_uninit_multibyte_string (EMACS_INT, EMACS_INT);
4313extern Lisp_Object make_string_from_bytes (const char *, ptrdiff_t, ptrdiff_t); 4302extern Lisp_Object make_string_from_bytes (const char *, ptrdiff_t, ptrdiff_t);
4314extern Lisp_Object make_specified_string (const char *, 4303extern Lisp_Object make_specified_string (const char *,
4315 ptrdiff_t, ptrdiff_t, bool); 4304 ptrdiff_t, ptrdiff_t, bool);
4316extern Lisp_Object make_pure_string (const char *, ptrdiff_t, ptrdiff_t, bool);
4317extern Lisp_Object make_pure_c_string (const char *, ptrdiff_t);
4318extern void pin_string (Lisp_Object string); 4305extern void pin_string (Lisp_Object string);
4319 4306
4320/* Make a string allocated in pure space, use STR as string data. */
4321
4322INLINE Lisp_Object
4323build_pure_c_string (const char *str)
4324{
4325 return make_pure_c_string (str, strlen (str));
4326}
4327
4328/* Make a string from the data at STR, treating it as multibyte if the 4307/* Make a string from the data at STR, treating it as multibyte if the
4329 data warrants. */ 4308 data warrants. */
4330 4309
@@ -4334,7 +4313,6 @@ build_string (const char *str)
4334 return make_string (str, strlen (str)); 4313 return make_string (str, strlen (str));
4335} 4314}
4336 4315
4337extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object);
4338extern Lisp_Object make_vector (ptrdiff_t, Lisp_Object); 4316extern Lisp_Object make_vector (ptrdiff_t, Lisp_Object);
4339extern struct Lisp_Vector *allocate_nil_vector (ptrdiff_t) 4317extern struct Lisp_Vector *allocate_nil_vector (ptrdiff_t)
4340 ATTRIBUTE_RETURNS_NONNULL; 4318 ATTRIBUTE_RETURNS_NONNULL;
diff --git a/src/lread.c b/src/lread.c
index 66b13916465..ada20810c3a 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1537,7 +1537,7 @@ Return t if the file exists and loads successfully. */)
1537 } 1537 }
1538 1538
1539 if (! NILP (Vpurify_flag)) 1539 if (! NILP (Vpurify_flag))
1540 Vpreloaded_file_list = Fcons (Fpurecopy (file), Vpreloaded_file_list); 1540 Vpreloaded_file_list = Fcons (file, Vpreloaded_file_list);
1541 1541
1542 if (NILP (nomessage) || force_load_messages) 1542 if (NILP (nomessage) || force_load_messages)
1543 { 1543 {
@@ -2288,36 +2288,32 @@ readevalloop (Lisp_Object readcharfun,
2288 read_objects_map 2288 read_objects_map
2289 = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, 2289 = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE,
2290 DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD, 2290 DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD,
2291 Qnil, false); 2291 Qnil);
2292 if (! HASH_TABLE_P (read_objects_completed) 2292 if (! HASH_TABLE_P (read_objects_completed)
2293 || XHASH_TABLE (read_objects_completed)->count) 2293 || XHASH_TABLE (read_objects_completed)->count)
2294 read_objects_completed 2294 read_objects_completed
2295 = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, 2295 = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE,
2296 DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD, 2296 DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD,
2297 Qnil, false); 2297 Qnil);
2298 if (!NILP (Vpurify_flag) && c == '(') 2298 if (!NILP (readfun))
2299 val = read0 (readcharfun, false);
2300 else
2301 { 2299 {
2302 if (!NILP (readfun)) 2300 val = call1 (readfun, readcharfun);
2303 {
2304 val = call1 (readfun, readcharfun);
2305 2301
2306 /* If READCHARFUN has set point to ZV, we should 2302 /* If READCHARFUN has set point to ZV, we should
2307 stop reading, even if the form read sets point 2303 stop reading, even if the form read sets point
2308 to a different value when evaluated. */ 2304 to a different value when evaluated. */
2309 if (BUFFERP (readcharfun)) 2305 if (BUFFERP (readcharfun))
2310 { 2306 {
2311 struct buffer *buf = XBUFFER (readcharfun); 2307 struct buffer *buf = XBUFFER (readcharfun);
2312 if (BUF_PT (buf) == BUF_ZV (buf)) 2308 if (BUF_PT (buf) == BUF_ZV (buf))
2313 continue_reading_p = 0; 2309 continue_reading_p = 0;
2314 }
2315 } 2310 }
2316 else if (! NILP (Vload_read_function))
2317 val = call1 (Vload_read_function, readcharfun);
2318 else
2319 val = read_internal_start (readcharfun, Qnil, Qnil, false);
2320 } 2311 }
2312 else if (! NILP (Vload_read_function))
2313 val = call1 (Vload_read_function, readcharfun);
2314 else
2315 val = read_internal_start (readcharfun, Qnil, Qnil, false);
2316
2321 /* Empty hashes can be reused; otherwise, reset on next call. */ 2317 /* Empty hashes can be reused; otherwise, reset on next call. */
2322 if (HASH_TABLE_P (read_objects_map) 2318 if (HASH_TABLE_P (read_objects_map)
2323 && XHASH_TABLE (read_objects_map)->count > 0) 2319 && XHASH_TABLE (read_objects_map)->count > 0)
@@ -2539,12 +2535,12 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end,
2539 || XHASH_TABLE (read_objects_map)->count) 2535 || XHASH_TABLE (read_objects_map)->count)
2540 read_objects_map 2536 read_objects_map
2541 = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, DEFAULT_REHASH_SIZE, 2537 = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, DEFAULT_REHASH_SIZE,
2542 DEFAULT_REHASH_THRESHOLD, Qnil, false); 2538 DEFAULT_REHASH_THRESHOLD, Qnil);
2543 if (! HASH_TABLE_P (read_objects_completed) 2539 if (! HASH_TABLE_P (read_objects_completed)
2544 || XHASH_TABLE (read_objects_completed)->count) 2540 || XHASH_TABLE (read_objects_completed)->count)
2545 read_objects_completed 2541 read_objects_completed
2546 = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, DEFAULT_REHASH_SIZE, 2542 = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, DEFAULT_REHASH_SIZE,
2547 DEFAULT_REHASH_THRESHOLD, Qnil, false); 2543 DEFAULT_REHASH_THRESHOLD, Qnil);
2548 2544
2549 if (STRINGP (stream) 2545 if (STRINGP (stream)
2550 || ((CONSP (stream) && STRINGP (XCAR (stream))))) 2546 || ((CONSP (stream) && STRINGP (XCAR (stream)))))
@@ -4150,10 +4146,7 @@ read0 (Lisp_Object readcharfun, bool locate_syms)
4150 if (uninterned_symbol) 4146 if (uninterned_symbol)
4151 { 4147 {
4152 Lisp_Object name 4148 Lisp_Object name
4153 = (!NILP (Vpurify_flag) 4149 = make_specified_string (read_buffer, nchars, nbytes, multibyte);
4154 ? make_pure_string (read_buffer, nchars, nbytes, multibyte)
4155 : make_specified_string (read_buffer, nchars, nbytes,
4156 multibyte));
4157 result = Fmake_symbol (name); 4150 result = Fmake_symbol (name);
4158 } 4151 }
4159 else 4152 else
@@ -4645,16 +4638,8 @@ intern_c_string_1 (const char *str, ptrdiff_t len)
4645 Lisp_Object tem = oblookup (obarray, str, len, len); 4638 Lisp_Object tem = oblookup (obarray, str, len, len);
4646 4639
4647 if (!SYMBOLP (tem)) 4640 if (!SYMBOLP (tem))
4648 { 4641 tem = intern_driver (make_string (str, len), obarray, tem);
4649 Lisp_Object string;
4650 4642
4651 if (NILP (Vpurify_flag))
4652 string = make_string (str, len);
4653 else
4654 string = make_pure_c_string (str, len);
4655
4656 tem = intern_driver (string, obarray, tem);
4657 }
4658 return tem; 4643 return tem;
4659} 4644}
4660 4645
@@ -4662,7 +4647,7 @@ static void
4662define_symbol (Lisp_Object sym, char const *str) 4647define_symbol (Lisp_Object sym, char const *str)
4663{ 4648{
4664 ptrdiff_t len = strlen (str); 4649 ptrdiff_t len = strlen (str);
4665 Lisp_Object string = make_pure_c_string (str, len); 4650 Lisp_Object string = make_string (str, len);
4666 init_symbol (sym, string); 4651 init_symbol (sym, string);
4667 4652
4668 /* Qunbound is uninterned, so that it's not confused with any symbol 4653 /* Qunbound is uninterned, so that it's not confused with any symbol
@@ -4706,8 +4691,7 @@ it defaults to the value of `obarray'. */)
4706 xfree (longhand); 4691 xfree (longhand);
4707 } 4692 }
4708 else 4693 else
4709 tem = intern_driver (NILP (Vpurify_flag) ? string : Fpurecopy (string), 4694 tem = intern_driver (string, obarray, tem);
4710 obarray, tem);
4711 } 4695 }
4712 return tem; 4696 return tem;
4713} 4697}
@@ -5002,7 +4986,7 @@ init_obarray_once (void)
5002 XSYMBOL (Qt)->u.s.declared_special = true; 4986 XSYMBOL (Qt)->u.s.declared_special = true;
5003 4987
5004 /* Qt is correct even if not dumping. loadup.el will set to nil at end. */ 4988 /* Qt is correct even if not dumping. loadup.el will set to nil at end. */
5005 Vpurify_flag = Qt; 4989 Vpurify_flag = Qt; /* FIXME: Redundant with setting in alloc.c. */
5006 4990
5007 DEFSYM (Qvariable_documentation, "variable-documentation"); 4991 DEFSYM (Qvariable_documentation, "variable-documentation");
5008} 4992}
@@ -5019,7 +5003,7 @@ defsubr (union Aligned_Lisp_Subr *aname)
5019 set_symbol_function (sym, tem); 5003 set_symbol_function (sym, tem);
5020#ifdef HAVE_NATIVE_COMP 5004#ifdef HAVE_NATIVE_COMP
5021 eassert (NILP (Vcomp_abi_hash)); 5005 eassert (NILP (Vcomp_abi_hash));
5022 Vcomp_subr_list = Fpurecopy (Fcons (tem, Vcomp_subr_list)); 5006 Vcomp_subr_list = Fcons (tem, Vcomp_subr_list);
5023#endif 5007#endif
5024} 5008}
5025 5009
@@ -5412,20 +5396,20 @@ This list includes suffixes for both compiled and source Emacs Lisp files.
5412This list should not include the empty string. 5396This list should not include the empty string.
5413`load' and related functions try to append these suffixes, in order, 5397`load' and related functions try to append these suffixes, in order,
5414to the specified file name if a suffix is allowed or required. */); 5398to the specified file name if a suffix is allowed or required. */);
5415 Vload_suffixes = list2 (build_pure_c_string (".elc"), 5399 Vload_suffixes = list2 (build_string (".elc"),
5416 build_pure_c_string (".el")); 5400 build_string (".el"));
5417#ifdef HAVE_MODULES 5401#ifdef HAVE_MODULES
5418 Vload_suffixes = Fcons (build_pure_c_string (MODULES_SUFFIX), Vload_suffixes); 5402 Vload_suffixes = Fcons (build_string (MODULES_SUFFIX), Vload_suffixes);
5419#ifdef MODULES_SECONDARY_SUFFIX 5403#ifdef MODULES_SECONDARY_SUFFIX
5420 Vload_suffixes = 5404 Vload_suffixes =
5421 Fcons (build_pure_c_string (MODULES_SECONDARY_SUFFIX), Vload_suffixes); 5405 Fcons (build_string (MODULES_SECONDARY_SUFFIX), Vload_suffixes);
5422#endif 5406#endif
5423 5407
5424#endif 5408#endif
5425 DEFVAR_LISP ("module-file-suffix", Vmodule_file_suffix, 5409 DEFVAR_LISP ("module-file-suffix", Vmodule_file_suffix,
5426 doc: /* Suffix of loadable module file, or nil if modules are not supported. */); 5410 doc: /* Suffix of loadable module file, or nil if modules are not supported. */);
5427#ifdef HAVE_MODULES 5411#ifdef HAVE_MODULES
5428 Vmodule_file_suffix = build_pure_c_string (MODULES_SUFFIX); 5412 Vmodule_file_suffix = build_string (MODULES_SUFFIX);
5429#else 5413#else
5430 Vmodule_file_suffix = Qnil; 5414 Vmodule_file_suffix = Qnil;
5431#endif 5415#endif
@@ -5575,7 +5559,7 @@ from the file, and matches them against this regular expression.
5575When the regular expression matches, the file is considered to be safe 5559When the regular expression matches, the file is considered to be safe
5576to load. */); 5560to load. */);
5577 Vbytecomp_version_regexp 5561 Vbytecomp_version_regexp
5578 = build_pure_c_string ("^;;;.\\(in Emacs version\\|bytecomp version FSF\\)"); 5562 = build_string ("^;;;.\\(in Emacs version\\|bytecomp version FSF\\)");
5579 5563
5580 DEFSYM (Qlexical_binding, "lexical-binding"); 5564 DEFSYM (Qlexical_binding, "lexical-binding");
5581 DEFVAR_LISP ("lexical-binding", Vlexical_binding, 5565 DEFVAR_LISP ("lexical-binding", Vlexical_binding,
diff --git a/src/pdumper.c b/src/pdumper.c
index af451920eb6..38275d39bd8 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -2412,7 +2412,7 @@ dump_symbol (struct dump_context *ctx,
2412 Lisp_Object object, 2412 Lisp_Object object,
2413 dump_off offset) 2413 dump_off offset)
2414{ 2414{
2415#if CHECK_STRUCTS && !defined HASH_Lisp_Symbol_999DC26DEC 2415#if CHECK_STRUCTS && !defined HASH_Lisp_Symbol_DD2E6013B4
2416# error "Lisp_Symbol changed. See CHECK_STRUCTS comment in config.h." 2416# error "Lisp_Symbol changed. See CHECK_STRUCTS comment in config.h."
2417#endif 2417#endif
2418#if CHECK_STRUCTS && !defined (HASH_symbol_redirect_ADB4F5B113) 2418#if CHECK_STRUCTS && !defined (HASH_symbol_redirect_ADB4F5B113)
@@ -2449,7 +2449,6 @@ dump_symbol (struct dump_context *ctx,
2449 DUMP_FIELD_COPY (&out, symbol, u.s.trapped_write); 2449 DUMP_FIELD_COPY (&out, symbol, u.s.trapped_write);
2450 DUMP_FIELD_COPY (&out, symbol, u.s.interned); 2450 DUMP_FIELD_COPY (&out, symbol, u.s.interned);
2451 DUMP_FIELD_COPY (&out, symbol, u.s.declared_special); 2451 DUMP_FIELD_COPY (&out, symbol, u.s.declared_special);
2452 DUMP_FIELD_COPY (&out, symbol, u.s.pinned);
2453 dump_field_lv (ctx, &out, symbol, &symbol->u.s.name, WEIGHT_STRONG); 2452 dump_field_lv (ctx, &out, symbol, &symbol->u.s.name, WEIGHT_STRONG);
2454 switch (symbol->u.s.redirect) 2453 switch (symbol->u.s.redirect)
2455 { 2454 {
@@ -2666,7 +2665,7 @@ dump_hash_table (struct dump_context *ctx,
2666 Lisp_Object object, 2665 Lisp_Object object,
2667 dump_off offset) 2666 dump_off offset)
2668{ 2667{
2669#if CHECK_STRUCTS && !defined HASH_Lisp_Hash_Table_6D63EDB618 2668#if CHECK_STRUCTS && !defined HASH_Lisp_Hash_Table_203821C7EF
2670# error "Lisp_Hash_Table changed. See CHECK_STRUCTS comment in config.h." 2669# error "Lisp_Hash_Table changed. See CHECK_STRUCTS comment in config.h."
2671#endif 2670#endif
2672 const struct Lisp_Hash_Table *hash_in = XHASH_TABLE (object); 2671 const struct Lisp_Hash_Table *hash_in = XHASH_TABLE (object);
@@ -2682,7 +2681,6 @@ dump_hash_table (struct dump_context *ctx,
2682 them as close to the hash table as possible. */ 2681 them as close to the hash table as possible. */
2683 DUMP_FIELD_COPY (out, hash, count); 2682 DUMP_FIELD_COPY (out, hash, count);
2684 DUMP_FIELD_COPY (out, hash, next_free); 2683 DUMP_FIELD_COPY (out, hash, next_free);
2685 DUMP_FIELD_COPY (out, hash, purecopy);
2686 DUMP_FIELD_COPY (out, hash, mutable); 2684 DUMP_FIELD_COPY (out, hash, mutable);
2687 DUMP_FIELD_COPY (out, hash, rehash_threshold); 2685 DUMP_FIELD_COPY (out, hash, rehash_threshold);
2688 DUMP_FIELD_COPY (out, hash, rehash_size); 2686 DUMP_FIELD_COPY (out, hash, rehash_size);
diff --git a/src/print.c b/src/print.c
index d562500b619..bc17cee0ed4 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2509,9 +2509,6 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
2509 print_object (Fhash_table_rehash_threshold (obj), 2509 print_object (Fhash_table_rehash_threshold (obj),
2510 printcharfun, escapeflag); 2510 printcharfun, escapeflag);
2511 2511
2512 if (h->purecopy)
2513 print_c_string (" purecopy t", printcharfun);
2514
2515 print_c_string (" data (", printcharfun); 2512 print_c_string (" data (", printcharfun);
2516 2513
2517 ptrdiff_t size = h->count; 2514 ptrdiff_t size = h->count;
diff --git a/src/process.c b/src/process.c
index af402c8edb3..73bb805dcb5 100644
--- a/src/process.c
+++ b/src/process.c
@@ -8750,7 +8750,7 @@ sentinel or a process filter function has an error. */);
8750 const struct socket_options *sopt; 8750 const struct socket_options *sopt;
8751 8751
8752#define ADD_SUBFEATURE(key, val) \ 8752#define ADD_SUBFEATURE(key, val) \
8753 subfeatures = pure_cons (pure_cons (key, pure_cons (val, Qnil)), subfeatures) 8753 subfeatures = Fcons (Fcons (key, Fcons (val, Qnil)), subfeatures)
8754 8754
8755 ADD_SUBFEATURE (QCnowait, Qt); 8755 ADD_SUBFEATURE (QCnowait, Qt);
8756#ifdef DATAGRAM_SOCKETS 8756#ifdef DATAGRAM_SOCKETS
@@ -8772,7 +8772,7 @@ sentinel or a process filter function has an error. */);
8772 ADD_SUBFEATURE (QCserver, Qt); 8772 ADD_SUBFEATURE (QCserver, Qt);
8773 8773
8774 for (sopt = socket_options; sopt->name; sopt++) 8774 for (sopt = socket_options; sopt->name; sopt++)
8775 subfeatures = pure_cons (intern_c_string (sopt->name), subfeatures); 8775 subfeatures = Fcons (intern_c_string (sopt->name), subfeatures);
8776 8776
8777 Fprovide (intern_c_string ("make-network-process"), subfeatures); 8777 Fprovide (intern_c_string ("make-network-process"), subfeatures);
8778 } 8778 }
diff --git a/src/profiler.c b/src/profiler.c
index 5cb42d54fa6..dc28b3c25ad 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -63,7 +63,7 @@ make_log (void)
63 Lisp_Object log = make_hash_table (hashtest_profiler, heap_size, 63 Lisp_Object log = make_hash_table (hashtest_profiler, heap_size,
64 DEFAULT_REHASH_SIZE, 64 DEFAULT_REHASH_SIZE,
65 DEFAULT_REHASH_THRESHOLD, 65 DEFAULT_REHASH_THRESHOLD,
66 Qnil, false); 66 Qnil);
67 struct Lisp_Hash_Table *h = XHASH_TABLE (log); 67 struct Lisp_Hash_Table *h = XHASH_TABLE (log);
68 68
69 /* What is special about our hash-tables is that the values are pre-filled 69 /* What is special about our hash-tables is that the values are pre-filled
diff --git a/src/puresize.h b/src/puresize.h
deleted file mode 100644
index 5516747ac2b..00000000000
--- a/src/puresize.h
+++ /dev/null
@@ -1,115 +0,0 @@
1/* How much read-only Lisp storage a dumped Emacs needs.
2 Copyright (C) 1993, 2001-2022 Free Software Foundation, Inc.
3
4This file is part of GNU Emacs.
5
6GNU Emacs is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or (at
9your option) any later version.
10
11GNU Emacs is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
18
19#ifndef EMACS_PURESIZE_H
20#define EMACS_PURESIZE_H
21
22#include "lisp.h"
23
24INLINE_HEADER_BEGIN
25
26/* Define PURESIZE, the number of bytes of pure Lisp code to leave space for.
27
28 At one point, this was defined in config.h, meaning that changing
29 PURESIZE would make Make recompile all of Emacs. But only a few
30 files actually use PURESIZE, so we split it out to its own .h file.
31
32 Make sure to include this file after config.h, since that tells us
33 whether we are running X windows, which tells us how much pure
34 storage to allocate. */
35
36/* First define a measure of the amount of data we have. */
37
38/* A system configuration file may set this to request a certain extra
39 amount of storage. This is a lot more update-robust that defining
40 BASE_PURESIZE or even PURESIZE directly. */
41#ifndef SYSTEM_PURESIZE_EXTRA
42#define SYSTEM_PURESIZE_EXTRA 0
43#endif
44
45#ifndef SITELOAD_PURESIZE_EXTRA
46#define SITELOAD_PURESIZE_EXTRA 0
47#endif
48
49#ifndef BASE_PURESIZE
50#define BASE_PURESIZE (2000000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA)
51#endif
52
53/* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */
54#ifndef PURESIZE_RATIO
55#if EMACS_INT_MAX >> 31 != 0
56#if PTRDIFF_MAX >> 31 != 0
57#define PURESIZE_RATIO 10 / 6 /* Don't surround with `()'. */
58#else
59#define PURESIZE_RATIO 8 / 6 /* Don't surround with `()'. */
60#endif
61#else
62#define PURESIZE_RATIO 1
63#endif
64#endif
65
66#ifdef ENABLE_CHECKING
67/* ENABLE_CHECKING somehow increases the purespace used, probably because
68 it tends to cause some macro arguments to be evaluated twice. This is
69 a bug, but it's difficult to track it down. */
70#define PURESIZE_CHECKING_RATIO 12 / 10 /* Don't surround with `()'. */
71#else
72#define PURESIZE_CHECKING_RATIO 1
73#endif
74
75/* This is the actual size in bytes to allocate. */
76#ifndef PURESIZE
77#define PURESIZE (BASE_PURESIZE * PURESIZE_RATIO * PURESIZE_CHECKING_RATIO)
78#endif
79
80extern AVOID pure_write_error (Lisp_Object);
81
82extern EMACS_INT pure[];
83
84/* The puresize_h_* macros are private to this include file. */
85
86/* True if PTR is pure. */
87
88#define puresize_h_PURE_P(ptr) \
89 ((uintptr_t) (ptr) - (uintptr_t) pure <= PURESIZE)
90
91INLINE bool
92PURE_P (void *ptr)
93{
94 return puresize_h_PURE_P (ptr);
95}
96
97/* Signal an error if OBJ is pure. PTR is OBJ untagged. */
98
99#define puresize_h_CHECK_IMPURE(obj, ptr) \
100 (PURE_P (ptr) ? pure_write_error (obj) : (void) 0)
101
102INLINE void
103CHECK_IMPURE (Lisp_Object obj, void *ptr)
104{
105 puresize_h_CHECK_IMPURE (obj, ptr);
106}
107
108#if DEFINE_KEY_OPS_AS_MACROS
109# define PURE_P(ptr) puresize_h_PURE_P (ptr)
110# define CHECK_IMPURE(obj, ptr) puresize_h_CHECK_IMPURE (obj, ptr)
111#endif
112
113INLINE_HEADER_END
114
115#endif /* EMACS_PURESIZE_H */
diff --git a/src/search.c b/src/search.c
index 9d6bd074e1b..c8e0443500e 100644
--- a/src/search.c
+++ b/src/search.c
@@ -3385,19 +3385,19 @@ syms_of_search (void)
3385 DEFSYM (Qinvalid_regexp, "invalid-regexp"); 3385 DEFSYM (Qinvalid_regexp, "invalid-regexp");
3386 3386
3387 Fput (Qsearch_failed, Qerror_conditions, 3387 Fput (Qsearch_failed, Qerror_conditions,
3388 pure_list (Qsearch_failed, Qerror)); 3388 list (Qsearch_failed, Qerror));
3389 Fput (Qsearch_failed, Qerror_message, 3389 Fput (Qsearch_failed, Qerror_message,
3390 build_pure_c_string ("Search failed")); 3390 build_string ("Search failed"));
3391 3391
3392 Fput (Quser_search_failed, Qerror_conditions, 3392 Fput (Quser_search_failed, Qerror_conditions,
3393 pure_list (Quser_search_failed, Quser_error, Qsearch_failed, Qerror)); 3393 list (Quser_search_failed, Quser_error, Qsearch_failed, Qerror));
3394 Fput (Quser_search_failed, Qerror_message, 3394 Fput (Quser_search_failed, Qerror_message,
3395 build_pure_c_string ("Search failed")); 3395 build_string ("Search failed"));
3396 3396
3397 Fput (Qinvalid_regexp, Qerror_conditions, 3397 Fput (Qinvalid_regexp, Qerror_conditions,
3398 pure_list (Qinvalid_regexp, Qerror)); 3398 list (Qinvalid_regexp, Qerror));
3399 Fput (Qinvalid_regexp, Qerror_message, 3399 Fput (Qinvalid_regexp, Qerror_message,
3400 build_pure_c_string ("Invalid regexp")); 3400 build_string ("Invalid regexp"));
3401 3401
3402 re_match_object = Qnil; 3402 re_match_object = Qnil;
3403 staticpro (&re_match_object); 3403 staticpro (&re_match_object);
diff --git a/src/sqlite.c b/src/sqlite.c
index 75a3b2ea32c..6bc4b280844 100644
--- a/src/sqlite.c
+++ b/src/sqlite.c
@@ -769,9 +769,9 @@ syms_of_sqlite (void)
769 769
770 DEFSYM (Qsqlite_locked_error, "sqlite-locked-error"); 770 DEFSYM (Qsqlite_locked_error, "sqlite-locked-error");
771 Fput (Qsqlite_locked_error, Qerror_conditions, 771 Fput (Qsqlite_locked_error, Qerror_conditions,
772 Fpurecopy (list2 (Qsqlite_locked_error, Qerror))); 772 list2 (Qsqlite_locked_error, Qerror));
773 Fput (Qsqlite_locked_error, Qerror_message, 773 Fput (Qsqlite_locked_error, Qerror_message,
774 build_pure_c_string ("Database locked")); 774 build_string ("Database locked"));
775 775
776 DEFSYM (Qsqlitep, "sqlitep"); 776 DEFSYM (Qsqlitep, "sqlitep");
777 DEFSYM (Qfalse, "false"); 777 DEFSYM (Qfalse, "false");
diff --git a/src/syntax.c b/src/syntax.c
index 15625b4d0e2..50e69ef2295 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -3750,9 +3750,9 @@ syms_of_syntax (void)
3750 3750
3751 DEFSYM (Qscan_error, "scan-error"); 3751 DEFSYM (Qscan_error, "scan-error");
3752 Fput (Qscan_error, Qerror_conditions, 3752 Fput (Qscan_error, Qerror_conditions,
3753 pure_list (Qscan_error, Qerror)); 3753 list (Qscan_error, Qerror));
3754 Fput (Qscan_error, Qerror_message, 3754 Fput (Qscan_error, Qerror_message,
3755 build_pure_c_string ("Scan error")); 3755 build_string ("Scan error"));
3756 3756
3757 DEFVAR_BOOL ("parse-sexp-ignore-comments", parse_sexp_ignore_comments, 3757 DEFVAR_BOOL ("parse-sexp-ignore-comments", parse_sexp_ignore_comments,
3758 doc: /* Non-nil means `forward-sexp', etc., should treat comments as whitespace. */); 3758 doc: /* Non-nil means `forward-sexp', etc., should treat comments as whitespace. */);
diff --git a/src/w32fns.c b/src/w32fns.c
index 468073c9170..dfbc09386b9 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -10554,9 +10554,9 @@ syms_of_w32fns (void)
10554 DEFSYM (Qjson, "json"); 10554 DEFSYM (Qjson, "json");
10555 10555
10556 Fput (Qundefined_color, Qerror_conditions, 10556 Fput (Qundefined_color, Qerror_conditions,
10557 pure_list (Qundefined_color, Qerror)); 10557 list (Qundefined_color, Qerror));
10558 Fput (Qundefined_color, Qerror_message, 10558 Fput (Qundefined_color, Qerror_message,
10559 build_pure_c_string ("Undefined color")); 10559 build_string ("Undefined color"));
10560 10560
10561 staticpro (&w32_grabbed_keys); 10561 staticpro (&w32_grabbed_keys);
10562 w32_grabbed_keys = Qnil; 10562 w32_grabbed_keys = Qnil;
diff --git a/src/xdisp.c b/src/xdisp.c
index 4089525e10f..8c97242a134 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -36064,7 +36064,7 @@ See also `overlay-arrow-string'. */);
36064 DEFVAR_LISP ("overlay-arrow-string", Voverlay_arrow_string, 36064 DEFVAR_LISP ("overlay-arrow-string", Voverlay_arrow_string,
36065 doc: /* String to display as an arrow in non-window frames. 36065 doc: /* String to display as an arrow in non-window frames.
36066See also `overlay-arrow-position'. */); 36066See also `overlay-arrow-position'. */);
36067 Voverlay_arrow_string = build_pure_c_string ("=>"); 36067 Voverlay_arrow_string = build_string ("=>");
36068 36068
36069 DEFVAR_LISP ("overlay-arrow-variable-list", Voverlay_arrow_variable_list, 36069 DEFVAR_LISP ("overlay-arrow-variable-list", Voverlay_arrow_variable_list,
36070 doc: /* List of variables (symbols) which hold markers for overlay arrows. 36070 doc: /* List of variables (symbols) which hold markers for overlay arrows.
@@ -36194,17 +36194,17 @@ which no explicit name has been set (see `modify-frame-parameters'). */);
36194This variable has the same structure as `mode-line-format' (which see), 36194This variable has the same structure as `mode-line-format' (which see),
36195and is used only on frames for which no explicit name has been set 36195and is used only on frames for which no explicit name has been set
36196\(see `modify-frame-parameters'). */); 36196\(see `modify-frame-parameters'). */);
36197 /* Do not nest calls to pure_list. This works around a bug in 36197 /* Do not nest calls to list. This works around a bug in
36198 Oracle Developer Studio 12.6. */ 36198 Oracle Developer Studio 12.6. */
36199 Lisp_Object icon_title_name_format 36199 Lisp_Object icon_title_name_format
36200 = pure_list (empty_unibyte_string, 36200 = list (empty_unibyte_string,
36201 build_pure_c_string ("%b - GNU Emacs at "), 36201 build_string ("%b - GNU Emacs at "),
36202 intern_c_string ("system-name")); 36202 intern_c_string ("system-name"));
36203 Vicon_title_format 36203 Vicon_title_format
36204 = Vframe_title_format 36204 = Vframe_title_format
36205 = pure_list (intern_c_string ("multiple-frames"), 36205 = list (intern_c_string ("multiple-frames"),
36206 build_pure_c_string ("%b"), 36206 build_string ("%b"),
36207 icon_title_name_format); 36207 icon_title_name_format);
36208 36208
36209 DEFVAR_LISP ("message-log-max", Vmessage_log_max, 36209 DEFVAR_LISP ("message-log-max", Vmessage_log_max,
36210 doc: /* Maximum number of lines to keep in the message log buffer. 36210 doc: /* Maximum number of lines to keep in the message log buffer.
diff --git a/src/xfaces.c b/src/xfaces.c
index f70fe87c95e..79e5df4bb7f 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -7122,14 +7122,14 @@ only for this purpose. */);
7122 Vface_new_frame_defaults = 7122 Vface_new_frame_defaults =
7123 /* 33 entries is enough to fit all basic faces */ 7123 /* 33 entries is enough to fit all basic faces */
7124 make_hash_table (hashtest_eq, 33, DEFAULT_REHASH_SIZE, 7124 make_hash_table (hashtest_eq, 33, DEFAULT_REHASH_SIZE,
7125 DEFAULT_REHASH_THRESHOLD, Qnil, false); 7125 DEFAULT_REHASH_THRESHOLD, Qnil);
7126 7126
7127 DEFVAR_LISP ("face-default-stipple", Vface_default_stipple, 7127 DEFVAR_LISP ("face-default-stipple", Vface_default_stipple,
7128 doc: /* Default stipple pattern used on monochrome displays. 7128 doc: /* Default stipple pattern used on monochrome displays.
7129This stipple pattern is used on monochrome displays 7129This stipple pattern is used on monochrome displays
7130instead of shades of gray for a face background color. 7130instead of shades of gray for a face background color.
7131See `set-face-stipple' for possible values for this variable. */); 7131See `set-face-stipple' for possible values for this variable. */);
7132 Vface_default_stipple = build_pure_c_string ("gray3"); 7132 Vface_default_stipple = build_string ("gray3");
7133 7133
7134 DEFVAR_LISP ("tty-defined-color-alist", Vtty_defined_color_alist, 7134 DEFVAR_LISP ("tty-defined-color-alist", Vtty_defined_color_alist,
7135 doc: /* An alist of defined terminal colors and their RGB values. 7135 doc: /* An alist of defined terminal colors and their RGB values.
diff --git a/src/xfns.c b/src/xfns.c
index 9dcf73da1ca..b202d62c61e 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -9690,9 +9690,9 @@ syms_of_xfns (void)
9690 DEFSYM (QXdndActionPrivate, "XdndActionPrivate"); 9690 DEFSYM (QXdndActionPrivate, "XdndActionPrivate");
9691 9691
9692 Fput (Qundefined_color, Qerror_conditions, 9692 Fput (Qundefined_color, Qerror_conditions,
9693 pure_list (Qundefined_color, Qerror)); 9693 list (Qundefined_color, Qerror));
9694 Fput (Qundefined_color, Qerror_message, 9694 Fput (Qundefined_color, Qerror_message,
9695 build_pure_c_string ("Undefined color")); 9695 build_string ("Undefined color"));
9696 9696
9697 DEFVAR_LISP ("x-pointer-shape", Vx_pointer_shape, 9697 DEFVAR_LISP ("x-pointer-shape", Vx_pointer_shape,
9698 doc: /* The shape of the pointer when over text. 9698 doc: /* The shape of the pointer when over text.
@@ -9903,7 +9903,7 @@ eliminated in future versions of Emacs. */);
9903 char gtk_version[sizeof ".." + 3 * INT_STRLEN_BOUND (int)]; 9903 char gtk_version[sizeof ".." + 3 * INT_STRLEN_BOUND (int)];
9904 int len = sprintf (gtk_version, "%d.%d.%d", 9904 int len = sprintf (gtk_version, "%d.%d.%d",
9905 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); 9905 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
9906 Vgtk_version_string = make_pure_string (gtk_version, len, len, false); 9906 Vgtk_version_string = make_specified_string (gtk_version, len, len, false);
9907 } 9907 }
9908#endif /* USE_GTK */ 9908#endif /* USE_GTK */
9909 9909
@@ -9917,7 +9917,8 @@ eliminated in future versions of Emacs. */);
9917 int len = sprintf (cairo_version, "%d.%d.%d", 9917 int len = sprintf (cairo_version, "%d.%d.%d",
9918 CAIRO_VERSION_MAJOR, CAIRO_VERSION_MINOR, 9918 CAIRO_VERSION_MAJOR, CAIRO_VERSION_MINOR,
9919 CAIRO_VERSION_MICRO); 9919 CAIRO_VERSION_MICRO);
9920 Vcairo_version_string = make_pure_string (cairo_version, len, len, false); 9920 Vcairo_version_string = make_specified_string (cairo_version, len, len,
9921 false);
9921 } 9922 }
9922#endif 9923#endif
9923 9924
diff --git a/src/xterm.c b/src/xterm.c
index c83ddc6b9ea..ba299e854fc 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -27815,7 +27815,7 @@ syms_of_xterm (void)
27815 DEFSYM (Qx_dnd_targets_list, "x-dnd-targets-list"); 27815 DEFSYM (Qx_dnd_targets_list, "x-dnd-targets-list");
27816 27816
27817#ifdef USE_GTK 27817#ifdef USE_GTK
27818 xg_default_icon_file = build_pure_c_string ("icons/hicolor/scalable/apps/emacs.svg"); 27818 xg_default_icon_file = build_string ("icons/hicolor/scalable/apps/emacs.svg");
27819 staticpro (&xg_default_icon_file); 27819 staticpro (&xg_default_icon_file);
27820 27820
27821 DEFSYM (Qx_gtk_map_stock, "x-gtk-map-stock"); 27821 DEFSYM (Qx_gtk_map_stock, "x-gtk-map-stock");
@@ -27950,7 +27950,7 @@ If set to a non-float value, there will be no wait at all. */);
27950 Vx_keysym_table = make_hash_table (hashtest_eql, 900, 27950 Vx_keysym_table = make_hash_table (hashtest_eql, 900,
27951 DEFAULT_REHASH_SIZE, 27951 DEFAULT_REHASH_SIZE,
27952 DEFAULT_REHASH_THRESHOLD, 27952 DEFAULT_REHASH_THRESHOLD,
27953 Qnil, false); 27953 Qnil);
27954 27954
27955 DEFVAR_BOOL ("x-frame-normalize-before-maximize", 27955 DEFVAR_BOOL ("x-frame-normalize-before-maximize",
27956 x_frame_normalize_before_maximize, 27956 x_frame_normalize_before_maximize,