aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPip Cet2021-05-16 15:44:26 +0200
committerStefan Monnier2022-07-01 09:42:00 -0400
commit094fd7ded365434b08f5d7c8ff499d17d566d54b (patch)
tree40366419e9d899e48c26439f428fee7b741d307c
parent3a4c408a7b6f3df5ca0eb4a406efbdb4899e9742 (diff)
downloademacs-scratch/no-purespace-2.tar.gz
emacs-scratch/no-purespace-2.zip
Remove purespace from Emacsscratch/no-purespace-2
-rw-r--r--doc/lispref/elisp.texi1
-rw-r--r--doc/lispref/internals.texi78
-rw-r--r--doc/lispref/symbols.texi3
-rw-r--r--src/Makefile.in2
-rw-r--r--src/alloc.c530
-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.c68
-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.c5
-rw-r--r--src/eval.c12
-rw-r--r--src/fileio.c24
-rw-r--r--src/fns.c32
-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.c8
-rw-r--r--src/keymap.c36
-rw-r--r--src/lisp.h40
-rw-r--r--src/lread.c40
-rw-r--r--src/pdumper.c9
-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.c2
-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
43 files changed, 199 insertions, 1048 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..28df20bba17 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
@@ -946,12 +874,6 @@ require a large number of iterations; in this case, the list of
946arguments could be very long. This increases Emacs responsiveness and 874arguments could be very long. This increases Emacs responsiveness and
947improves user experience. 875improves user experience.
948 876
949 You must not use C initializers for static or global variables unless
950the variables are never written once Emacs is dumped. These variables
951with initializers are allocated in an area of memory that becomes
952read-only (on certain operating systems) as a result of dumping Emacs.
953@xref{Pure Storage}.
954
955@cindex @code{defsubr}, Lisp symbol for a primitive 877@cindex @code{defsubr}, Lisp symbol for a primitive
956 Defining the C function is not enough to make a Lisp primitive 878 Defining the C function is not enough to make a Lisp primitive
957available; you must also create the Lisp symbol for the primitive and 879available; you must also create the Lisp symbol for the primitive and
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/Makefile.in b/src/Makefile.in
index 7d15b7afd51..e6f23811eda 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -424,8 +424,6 @@ ALL_CXX_CFLAGS = $(EMACS_CFLAGS) \
424.cc.o: 424.cc.o:
425 $(AM_V_CXX)$(CXX) -c $(CPPFLAGS) $(ALL_CXX_CFLAGS) $(PROFILING_CFLAGS) $< 425 $(AM_V_CXX)$(CXX) -c $(CPPFLAGS) $(ALL_CXX_CFLAGS) $(PROFILING_CFLAGS) $<
426 426
427## lastfile must follow all files whose initialized data areas should
428## be dumped as pure by dump-emacs.
429base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \ 427base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
430 charset.o coding.o category.o ccl.o character.o chartab.o bidi.o \ 428 charset.o coding.o category.o ccl.o character.o chartab.o bidi.o \
431 $(CM_OBJ) term.o terminal.o xfaces.o $(XOBJ) $(GTK_OBJ) $(DBUS_OBJ) \ 429 $(CM_OBJ) term.o terminal.o xfaces.o $(XOBJ) $(GTK_OBJ) $(DBUS_OBJ) \
diff --git a/src/alloc.c b/src/alloc.c
index f115a3cebaa..d95d1a644da 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;
@@ -435,7 +407,6 @@ no_sanitize_memcpy (void *dest, void const *src, size_t size)
435static void unchain_finalizer (struct Lisp_Finalizer *); 407static void unchain_finalizer (struct Lisp_Finalizer *);
436static void mark_terminals (void); 408static void mark_terminals (void);
437static void gc_sweep (void); 409static void gc_sweep (void);
438static Lisp_Object make_pure_vector (ptrdiff_t);
439static void mark_buffer (struct buffer *); 410static void mark_buffer (struct buffer *);
440 411
441#if !defined REL_ALLOC || defined SYSTEM_MALLOC || defined HYBRID_MALLOC 412#if !defined REL_ALLOC || defined SYSTEM_MALLOC || defined HYBRID_MALLOC
@@ -562,8 +533,6 @@ Lisp_Object const *staticvec[NSTATICS]
562 533
563int staticidx; 534int staticidx;
564 535
565static void *pure_alloc (size_t, int);
566
567/* Return PTR rounded up to the next multiple of ALIGNMENT. */ 536/* Return PTR rounded up to the next multiple of ALIGNMENT. */
568 537
569static void * 538static void *
@@ -1677,9 +1646,9 @@ static ptrdiff_t const STRING_BYTES_MAX =
1677static void 1646static void
1678init_strings (void) 1647init_strings (void)
1679{ 1648{
1680 empty_unibyte_string = make_pure_string ("", 0, 0, 0); 1649 empty_unibyte_string = make_specified_string ("", 0, 0, false);
1681 staticpro (&empty_unibyte_string); 1650 staticpro (&empty_unibyte_string);
1682 empty_multibyte_string = make_pure_string ("", 0, 0, 1); 1651 empty_multibyte_string = make_specified_string ("", 0, 0, true);
1683 staticpro (&empty_multibyte_string); 1652 staticpro (&empty_multibyte_string);
1684} 1653}
1685 1654
@@ -1697,7 +1666,7 @@ string_bytes (struct Lisp_String *s)
1697 ptrdiff_t nbytes = 1666 ptrdiff_t nbytes =
1698 (s->u.s.size_byte < 0 ? s->u.s.size & ~ARRAY_MARK_FLAG : s->u.s.size_byte); 1667 (s->u.s.size_byte < 0 ? s->u.s.size & ~ARRAY_MARK_FLAG : s->u.s.size_byte);
1699 1668
1700 if (!PURE_P (s) && !pdumper_object_p (s) && s->u.s.data 1669 if (!pdumper_object_p (s) && s->u.s.data
1701 && nbytes != SDATA_NBYTES (SDATA_OF_STRING (s))) 1670 && nbytes != SDATA_NBYTES (SDATA_OF_STRING (s)))
1702 emacs_abort (); 1671 emacs_abort ();
1703 return nbytes; 1672 return nbytes;
@@ -2413,7 +2382,7 @@ make_specified_string (const char *contents,
2413{ 2382{
2414 Lisp_Object val; 2383 Lisp_Object val;
2415 2384
2416 if (nchars < 0) 2385 if (nchars <= 0)
2417 { 2386 {
2418 if (multibyte) 2387 if (multibyte)
2419 nchars = multibyte_chars_in_text ((const unsigned char *) contents, 2388 nchars = multibyte_chars_in_text ((const unsigned char *) contents,
@@ -2467,8 +2436,6 @@ make_clear_multibyte_string (EMACS_INT nchars, EMACS_INT nbytes, bool clearit)
2467 2436
2468 if (nchars < 0) 2437 if (nchars < 0)
2469 emacs_abort (); 2438 emacs_abort ();
2470 if (!nbytes)
2471 return empty_multibyte_string;
2472 2439
2473 s = allocate_string (); 2440 s = allocate_string ();
2474 s->u.s.intervals = NULL; 2441 s->u.s.intervals = NULL;
@@ -2512,7 +2479,7 @@ pin_string (Lisp_Object string)
2512 unsigned char *data = s->u.s.data; 2479 unsigned char *data = s->u.s.data;
2513 2480
2514 if (!(size > LARGE_STRING_BYTES 2481 if (!(size > LARGE_STRING_BYTES
2515 || PURE_P (data) || pdumper_object_p (data) 2482 || pdumper_object_p (data)
2516 || s->u.s.size_byte == -3)) 2483 || s->u.s.size_byte == -3))
2517 { 2484 {
2518 eassert (s->u.s.size_byte == -1); 2485 eassert (s->u.s.size_byte == -1);
@@ -2772,17 +2739,16 @@ list5 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4,
2772} 2739}
2773 2740
2774/* Make a list of COUNT Lisp_Objects, where ARG is the first one. 2741/* Make a list of COUNT Lisp_Objects, where ARG is the first one.
2775 Use CONS to construct the pairs. AP has any remaining args. */ 2742 AP has any remaining args. */
2776static Lisp_Object 2743static Lisp_Object
2777cons_listn (ptrdiff_t count, Lisp_Object arg, 2744cons_listn (ptrdiff_t count, Lisp_Object arg, va_list ap)
2778 Lisp_Object (*cons) (Lisp_Object, Lisp_Object), va_list ap)
2779{ 2745{
2780 eassume (0 < count); 2746 eassume (0 < count);
2781 Lisp_Object val = cons (arg, Qnil); 2747 Lisp_Object val = Fcons (arg, Qnil);
2782 Lisp_Object tail = val; 2748 Lisp_Object tail = val;
2783 for (ptrdiff_t i = 1; i < count; i++) 2749 for (ptrdiff_t i = 1; i < count; i++)
2784 { 2750 {
2785 Lisp_Object elem = cons (va_arg (ap, Lisp_Object), Qnil); 2751 Lisp_Object elem = Fcons (va_arg (ap, Lisp_Object), Qnil);
2786 XSETCDR (tail, elem); 2752 XSETCDR (tail, elem);
2787 tail = elem; 2753 tail = elem;
2788 } 2754 }
@@ -2795,18 +2761,7 @@ listn (ptrdiff_t count, Lisp_Object arg1, ...)
2795{ 2761{
2796 va_list ap; 2762 va_list ap;
2797 va_start (ap, arg1); 2763 va_start (ap, arg1);
2798 Lisp_Object val = cons_listn (count, arg1, Fcons, ap); 2764 Lisp_Object val = cons_listn (count, arg1, ap);
2799 va_end (ap);
2800 return val;
2801}
2802
2803/* Make a pure list of COUNT Lisp_Objects, where ARG1 is the first one. */
2804Lisp_Object
2805pure_listn (ptrdiff_t count, Lisp_Object arg1, ...)
2806{
2807 va_list ap;
2808 va_start (ap, arg1);
2809 Lisp_Object val = cons_listn (count, arg1, pure_cons, ap);
2810 va_end (ap); 2765 va_end (ap);
2811 return val; 2766 return val;
2812} 2767}
@@ -2972,7 +2927,7 @@ static struct Lisp_Vector *vector_free_lists[VECTOR_MAX_FREE_LIST_INDEX];
2972 2927
2973static struct large_vector *large_vectors; 2928static struct large_vector *large_vectors;
2974 2929
2975/* The only vector with 0 slots, allocated from pure space. */ 2930/* The only vector with 0 slots. */
2976 2931
2977Lisp_Object zero_vector; 2932Lisp_Object zero_vector;
2978 2933
@@ -3008,15 +2963,6 @@ allocate_vector_block (void)
3008 return block; 2963 return block;
3009} 2964}
3010 2965
3011/* Called once to initialize vector allocation. */
3012
3013static void
3014init_vectors (void)
3015{
3016 zero_vector = make_pure_vector (0);
3017 staticpro (&zero_vector);
3018}
3019
3020/* Allocate vector from a vector block. */ 2966/* Allocate vector from a vector block. */
3021 2967
3022static struct Lisp_Vector * 2968static struct Lisp_Vector *
@@ -3107,6 +3053,8 @@ vectorlike_nbytes (const union vectorlike_header *hdr)
3107 } 3053 }
3108 else 3054 else
3109 nwords = size; 3055 nwords = size;
3056 if (nwords == 0)
3057 nwords = 1;
3110 return vroundup (header_size + word_size * nwords); 3058 return vroundup (header_size + word_size * nwords);
3111} 3059}
3112 3060
@@ -3384,6 +3332,18 @@ allocate_nil_vector (ptrdiff_t len)
3384} 3332}
3385 3333
3386 3334
3335/* Called once to initialize vector allocation. */
3336
3337static void
3338init_vectors (void)
3339{
3340 zero_vector =
3341 make_lisp_ptr (allocate_vectorlike (1, true), Lisp_Vectorlike);
3342 XVECTOR (zero_vector)->header.size = 0;
3343 XVECTOR (zero_vector)->contents[0] = Qnil;
3344 staticpro (&zero_vector);
3345}
3346
3387/* Allocate other vector-like structures. */ 3347/* Allocate other vector-like structures. */
3388 3348
3389struct Lisp_Vector * 3349struct Lisp_Vector *
@@ -3598,13 +3558,6 @@ struct symbol_block
3598 3558
3599static struct symbol_block *symbol_block; 3559static struct symbol_block *symbol_block;
3600static int symbol_block_index = SYMBOL_BLOCK_SIZE; 3560static int symbol_block_index = SYMBOL_BLOCK_SIZE;
3601/* Pointer to the first symbol_block that contains pinned symbols.
3602 Tests for 24.4 showed that at dump-time, Emacs contains about 15K symbols,
3603 10K of which are pinned (and all but 250 of them are interned in obarray),
3604 whereas a "typical session" has in the order of 30K symbols.
3605 `symbol_block_pinned' lets mark_pinned_symbols scan only 15K symbols rather
3606 than 30K to find the 10K symbols we need to mark. */
3607static struct symbol_block *symbol_block_pinned;
3608 3561
3609/* List of free symbols. */ 3562/* List of free symbols. */
3610 3563
@@ -3630,7 +3583,6 @@ init_symbol (Lisp_Object val, Lisp_Object name)
3630 p->u.s.interned = SYMBOL_UNINTERNED; 3583 p->u.s.interned = SYMBOL_UNINTERNED;
3631 p->u.s.trapped_write = SYMBOL_UNTRAPPED_WRITE; 3584 p->u.s.trapped_write = SYMBOL_UNTRAPPED_WRITE;
3632 p->u.s.declared_special = false; 3585 p->u.s.declared_special = false;
3633 p->u.s.pinned = false;
3634} 3586}
3635 3587
3636DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0, 3588DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0,
@@ -5238,8 +5190,6 @@ valid_lisp_object_p (Lisp_Object obj)
5238 return 1; 5190 return 1;
5239 5191
5240 void *p = XPNTR (obj); 5192 void *p = XPNTR (obj);
5241 if (PURE_P (p))
5242 return 1;
5243 5193
5244 if (BARE_SYMBOL_P (obj) && c_symbol_p (p)) 5194 if (BARE_SYMBOL_P (obj) && c_symbol_p (p))
5245 return ((char *) p - (char *) lispsym) % sizeof lispsym[0] == 0; 5195 return ((char *) p - (char *) lispsym) % sizeof lispsym[0] == 0;
@@ -5295,296 +5245,8 @@ valid_lisp_object_p (Lisp_Object obj)
5295 return 0; 5245 return 0;
5296} 5246}
5297 5247
5298/***********************************************************************
5299 Pure Storage Management
5300 ***********************************************************************/
5301
5302/* Allocate room for SIZE bytes from pure Lisp storage and return a
5303 pointer to it. TYPE is the Lisp type for which the memory is
5304 allocated. TYPE < 0 means it's not used for a Lisp object,
5305 and that the result should have an alignment of -TYPE.
5306
5307 The bytes are initially zero.
5308
5309 If pure space is exhausted, allocate space from the heap. This is
5310 merely an expedient to let Emacs warn that pure space was exhausted
5311 and that Emacs should be rebuilt with a larger pure space. */
5312
5313static void *
5314pure_alloc (size_t size, int type)
5315{
5316 void *result;
5317
5318 again:
5319 if (type >= 0)
5320 {
5321 /* Allocate space for a Lisp object from the beginning of the free
5322 space with taking account of alignment. */
5323 result = pointer_align (purebeg + pure_bytes_used_lisp, LISP_ALIGNMENT);
5324 pure_bytes_used_lisp = ((char *)result - (char *)purebeg) + size;
5325 }
5326 else
5327 {
5328 /* Allocate space for a non-Lisp object from the end of the free
5329 space. */
5330 ptrdiff_t unaligned_non_lisp = pure_bytes_used_non_lisp + size;
5331 char *unaligned = purebeg + pure_size - unaligned_non_lisp;
5332 int decr = (intptr_t) unaligned & (-1 - type);
5333 pure_bytes_used_non_lisp = unaligned_non_lisp + decr;
5334 result = unaligned - decr;
5335 }
5336 pure_bytes_used = pure_bytes_used_lisp + pure_bytes_used_non_lisp;
5337
5338 if (pure_bytes_used <= pure_size)
5339 return result;
5340
5341 /* Don't allocate a large amount here,
5342 because it might get mmap'd and then its address
5343 might not be usable. */
5344 int small_amount = 10000;
5345 eassert (size <= small_amount - LISP_ALIGNMENT);
5346 purebeg = xzalloc (small_amount);
5347 pure_size = small_amount;
5348 pure_bytes_used_before_overflow += pure_bytes_used - size;
5349 pure_bytes_used = 0;
5350 pure_bytes_used_lisp = pure_bytes_used_non_lisp = 0;
5351
5352 /* Can't GC if pure storage overflowed because we can't determine
5353 if something is a pure object or not. */
5354 garbage_collection_inhibited++;
5355 goto again;
5356}
5357
5358
5359#ifdef HAVE_UNEXEC
5360
5361/* Print a warning if PURESIZE is too small. */
5362
5363void
5364check_pure_size (void)
5365{
5366 if (pure_bytes_used_before_overflow)
5367 message (("emacs:0:Pure Lisp storage overflow (approx. %"pI"d"
5368 " bytes needed)"),
5369 pure_bytes_used + pure_bytes_used_before_overflow);
5370}
5371#endif
5372
5373
5374/* Find the byte sequence {DATA[0], ..., DATA[NBYTES-1], '\0'} from
5375 the non-Lisp data pool of the pure storage, and return its start
5376 address. Return NULL if not found. */
5377
5378static char *
5379find_string_data_in_pure (const char *data, ptrdiff_t nbytes)
5380{
5381 int i;
5382 ptrdiff_t skip, bm_skip[256], last_char_skip, infinity, start, start_max;
5383 const unsigned char *p;
5384 char *non_lisp_beg;
5385
5386 if (pure_bytes_used_non_lisp <= nbytes)
5387 return NULL;
5388
5389 /* Set up the Boyer-Moore table. */
5390 skip = nbytes + 1;
5391 for (i = 0; i < 256; i++)
5392 bm_skip[i] = skip;
5393
5394 p = (const unsigned char *) data;
5395 while (--skip > 0)
5396 bm_skip[*p++] = skip;
5397
5398 last_char_skip = bm_skip['\0'];
5399
5400 non_lisp_beg = purebeg + pure_size - pure_bytes_used_non_lisp;
5401 start_max = pure_bytes_used_non_lisp - (nbytes + 1);
5402
5403 /* See the comments in the function `boyer_moore' (search.c) for the
5404 use of `infinity'. */
5405 infinity = pure_bytes_used_non_lisp + 1;
5406 bm_skip['\0'] = infinity;
5407
5408 p = (const unsigned char *) non_lisp_beg + nbytes;
5409 start = 0;
5410 do
5411 {
5412 /* Check the last character (== '\0'). */
5413 do
5414 {
5415 start += bm_skip[*(p + start)];
5416 }
5417 while (start <= start_max);
5418
5419 if (start < infinity)
5420 /* Couldn't find the last character. */
5421 return NULL;
5422
5423 /* No less than `infinity' means we could find the last
5424 character at `p[start - infinity]'. */
5425 start -= infinity;
5426
5427 /* Check the remaining characters. */
5428 if (memcmp (data, non_lisp_beg + start, nbytes) == 0)
5429 /* Found. */
5430 return non_lisp_beg + start;
5431
5432 start += last_char_skip;
5433 }
5434 while (start <= start_max);
5435
5436 return NULL;
5437}
5438
5439
5440/* Return a string allocated in pure space. DATA is a buffer holding
5441 NCHARS characters, and NBYTES bytes of string data. MULTIBYTE
5442 means make the result string multibyte.
5443
5444 Must get an error if pure storage is full, since if it cannot hold
5445 a large string it may be able to hold conses that point to that
5446 string; then the string is not protected from gc. */
5447
5448Lisp_Object
5449make_pure_string (const char *data,
5450 ptrdiff_t nchars, ptrdiff_t nbytes, bool multibyte)
5451{
5452 Lisp_Object string;
5453 struct Lisp_String *s = pure_alloc (sizeof *s, Lisp_String);
5454 s->u.s.data = (unsigned char *) find_string_data_in_pure (data, nbytes);
5455 if (s->u.s.data == NULL)
5456 {
5457 s->u.s.data = pure_alloc (nbytes + 1, -1);
5458 memcpy (s->u.s.data, data, nbytes);
5459 s->u.s.data[nbytes] = '\0';
5460 }
5461 s->u.s.size = nchars;
5462 s->u.s.size_byte = multibyte ? nbytes : -1;
5463 s->u.s.intervals = NULL;
5464 XSETSTRING (string, s);
5465 return string;
5466}
5467
5468/* Return a string allocated in pure space. Do not
5469 allocate the string data, just point to DATA. */
5470
5471Lisp_Object
5472make_pure_c_string (const char *data, ptrdiff_t nchars)
5473{
5474 Lisp_Object string;
5475 struct Lisp_String *s = pure_alloc (sizeof *s, Lisp_String);
5476 s->u.s.size = nchars;
5477 s->u.s.size_byte = -2;
5478 s->u.s.data = (unsigned char *) data;
5479 s->u.s.intervals = NULL;
5480 XSETSTRING (string, s);
5481 return string;
5482}
5483
5484static Lisp_Object purecopy (Lisp_Object obj);
5485
5486/* Return a cons allocated from pure space. Give it pure copies
5487 of CAR as car and CDR as cdr. */
5488
5489Lisp_Object
5490pure_cons (Lisp_Object car, Lisp_Object cdr)
5491{
5492 Lisp_Object new;
5493 struct Lisp_Cons *p = pure_alloc (sizeof *p, Lisp_Cons);
5494 XSETCONS (new, p);
5495 XSETCAR (new, purecopy (car));
5496 XSETCDR (new, purecopy (cdr));
5497 return new;
5498}
5499
5500
5501/* Value is a float object with value NUM allocated from pure space. */
5502
5503static Lisp_Object
5504make_pure_float (double num)
5505{
5506 Lisp_Object new;
5507 struct Lisp_Float *p = pure_alloc (sizeof *p, Lisp_Float);
5508 XSETFLOAT (new, p);
5509 XFLOAT_INIT (new, num);
5510 return new;
5511}
5512
5513/* Value is a bignum object with value VALUE allocated from pure
5514 space. */
5515
5516static Lisp_Object 5248static Lisp_Object
5517make_pure_bignum (Lisp_Object value) 5249purecopy (Lisp_Object obj);
5518{
5519 mpz_t const *n = xbignum_val (value);
5520 size_t i, nlimbs = mpz_size (*n);
5521 size_t nbytes = nlimbs * sizeof (mp_limb_t);
5522 mp_limb_t *pure_limbs;
5523 mp_size_t new_size;
5524
5525 struct Lisp_Bignum *b = pure_alloc (sizeof *b, Lisp_Vectorlike);
5526 XSETPVECTYPESIZE (b, PVEC_BIGNUM, 0, VECSIZE (struct Lisp_Bignum));
5527
5528 int limb_alignment = alignof (mp_limb_t);
5529 pure_limbs = pure_alloc (nbytes, - limb_alignment);
5530 for (i = 0; i < nlimbs; ++i)
5531 pure_limbs[i] = mpz_getlimbn (*n, i);
5532
5533 new_size = nlimbs;
5534 if (mpz_sgn (*n) < 0)
5535 new_size = -new_size;
5536
5537 mpz_roinit_n (b->value, pure_limbs, new_size);
5538
5539 return make_lisp_ptr (b, Lisp_Vectorlike);
5540}
5541
5542/* Return a vector with room for LEN Lisp_Objects allocated from
5543 pure space. */
5544
5545static Lisp_Object
5546make_pure_vector (ptrdiff_t len)
5547{
5548 Lisp_Object new;
5549 size_t size = header_size + len * word_size;
5550 struct Lisp_Vector *p = pure_alloc (size, Lisp_Vectorlike);
5551 XSETVECTOR (new, p);
5552 XVECTOR (new)->header.size = len;
5553 return new;
5554}
5555
5556/* Copy all contents and parameters of TABLE to a new table allocated
5557 from pure space, return the purified table. */
5558static struct Lisp_Hash_Table *
5559purecopy_hash_table (struct Lisp_Hash_Table *table)
5560{
5561 eassert (NILP (table->weak));
5562 eassert (table->purecopy);
5563
5564 struct Lisp_Hash_Table *pure = pure_alloc (sizeof *pure, Lisp_Vectorlike);
5565 struct hash_table_test pure_test = table->test;
5566
5567 /* Purecopy the hash table test. */
5568 pure_test.name = purecopy (table->test.name);
5569 pure_test.user_hash_function = purecopy (table->test.user_hash_function);
5570 pure_test.user_cmp_function = purecopy (table->test.user_cmp_function);
5571
5572 pure->header = table->header;
5573 pure->weak = purecopy (Qnil);
5574 pure->hash = purecopy (table->hash);
5575 pure->next = purecopy (table->next);
5576 pure->index = purecopy (table->index);
5577 pure->count = table->count;
5578 pure->next_free = table->next_free;
5579 pure->purecopy = table->purecopy;
5580 eassert (!pure->mutable);
5581 pure->rehash_threshold = table->rehash_threshold;
5582 pure->rehash_size = table->rehash_size;
5583 pure->key_and_value = purecopy (table->key_and_value);
5584 pure->test = pure_test;
5585
5586 return pure;
5587}
5588 5250
5589DEFUN ("purecopy", Fpurecopy, Spurecopy, 1, 1, 0, 5251DEFUN ("purecopy", Fpurecopy, Spurecopy, 1, 1, 0,
5590 doc: /* Make a copy of object OBJ in pure storage. 5252 doc: /* Make a copy of object OBJ in pure storage.
@@ -5601,104 +5263,23 @@ Does not copy symbols. Copies strings without text properties. */)
5601 return purecopy (obj); 5263 return purecopy (obj);
5602} 5264}
5603 5265
5604/* Pinned objects are marked before every GC cycle. */
5605static struct pinned_object
5606{
5607 Lisp_Object object;
5608 struct pinned_object *next;
5609} *pinned_objects;
5610
5611static Lisp_Object 5266static Lisp_Object
5612purecopy (Lisp_Object obj) 5267purecopy (Lisp_Object obj)
5613{ 5268{
5614 if (FIXNUMP (obj) 5269 if (FIXNUMP (obj) || SUBRP (obj))
5615 || (! SYMBOLP (obj) && PURE_P (XPNTR (obj)))
5616 || SUBRP (obj))
5617 return obj; /* Already pure. */ 5270 return obj; /* Already pure. */
5618 5271
5619 if (STRINGP (obj) && XSTRING (obj)->u.s.intervals)
5620 message_with_string ("Dropping text-properties while making string `%s' pure",
5621 obj, true);
5622
5623 if (HASH_TABLE_P (Vpurify_flag)) /* Hash consing. */ 5272 if (HASH_TABLE_P (Vpurify_flag)) /* Hash consing. */
5624 { 5273 {
5625 Lisp_Object tmp = Fgethash (obj, Vpurify_flag, Qnil); 5274 Lisp_Object tmp = Fgethash (obj, Vpurify_flag, Qnil);
5626 if (!NILP (tmp)) 5275 if (!NILP (tmp))
5627 return tmp; 5276 return tmp;
5277 Fputhash (obj, obj, Vpurify_flag);
5628 } 5278 }
5629 5279
5630 if (CONSP (obj))
5631 obj = pure_cons (XCAR (obj), XCDR (obj));
5632 else if (FLOATP (obj))
5633 obj = make_pure_float (XFLOAT_DATA (obj));
5634 else if (STRINGP (obj))
5635 obj = make_pure_string (SSDATA (obj), SCHARS (obj),
5636 SBYTES (obj),
5637 STRING_MULTIBYTE (obj));
5638 else if (HASH_TABLE_P (obj))
5639 {
5640 struct Lisp_Hash_Table *table = XHASH_TABLE (obj);
5641 /* Do not purify hash tables which haven't been defined with
5642 :purecopy as non-nil or are weak - they aren't guaranteed to
5643 not change. */
5644 if (!NILP (table->weak) || !table->purecopy)
5645 {
5646 /* Instead, add the hash table to the list of pinned objects,
5647 so that it will be marked during GC. */
5648 struct pinned_object *o = xmalloc (sizeof *o);
5649 o->object = obj;
5650 o->next = pinned_objects;
5651 pinned_objects = o;
5652 return obj; /* Don't hash cons it. */
5653 }
5654
5655 struct Lisp_Hash_Table *h = purecopy_hash_table (table);
5656 XSET_HASH_TABLE (obj, h);
5657 }
5658 else if (COMPILEDP (obj) || VECTORP (obj) || RECORDP (obj))
5659 {
5660 struct Lisp_Vector *objp = XVECTOR (obj);
5661 ptrdiff_t nbytes = vector_nbytes (objp);
5662 struct Lisp_Vector *vec = pure_alloc (nbytes, Lisp_Vectorlike);
5663 register ptrdiff_t i;
5664 ptrdiff_t size = ASIZE (obj);
5665 if (size & PSEUDOVECTOR_FLAG)
5666 size &= PSEUDOVECTOR_SIZE_MASK;
5667 memcpy (vec, objp, nbytes);
5668 for (i = 0; i < size; i++)
5669 vec->contents[i] = purecopy (vec->contents[i]);
5670 // Byte code strings must be pinned.
5671 if (COMPILEDP (obj) && size >= 2 && STRINGP (vec->contents[1])
5672 && !STRING_MULTIBYTE (vec->contents[1]))
5673 pin_string (vec->contents[1]);
5674 XSETVECTOR (obj, vec);
5675 }
5676 else if (BARE_SYMBOL_P (obj))
5677 {
5678 if (!XBARE_SYMBOL (obj)->u.s.pinned && !c_symbol_p (XBARE_SYMBOL (obj)))
5679 { /* We can't purify them, but they appear in many pure objects.
5680 Mark them as `pinned' so we know to mark them at every GC cycle. */
5681 XBARE_SYMBOL (obj)->u.s.pinned = true;
5682 symbol_block_pinned = symbol_block;
5683 }
5684 /* Don't hash-cons it. */
5685 return obj;
5686 }
5687 else if (BIGNUMP (obj))
5688 obj = make_pure_bignum (obj);
5689 else
5690 {
5691 AUTO_STRING (fmt, "Don't know how to purify: %S");
5692 Fsignal (Qerror, list1 (CALLN (Fformat, fmt, obj)));
5693 }
5694
5695 if (HASH_TABLE_P (Vpurify_flag)) /* Hash consing. */
5696 Fputhash (obj, obj, Vpurify_flag);
5697
5698 return obj; 5280 return obj;
5699} 5281}
5700 5282
5701
5702 5283
5703/*********************************************************************** 5284/***********************************************************************
5704 Protection from GC 5285 Protection from GC
@@ -5890,31 +5471,6 @@ compact_undo_list (Lisp_Object list)
5890} 5471}
5891 5472
5892static void 5473static void
5893mark_pinned_objects (void)
5894{
5895 for (struct pinned_object *pobj = pinned_objects; pobj; pobj = pobj->next)
5896 mark_object (pobj->object);
5897}
5898
5899static void
5900mark_pinned_symbols (void)
5901{
5902 struct symbol_block *sblk;
5903 int lim = (symbol_block_pinned == symbol_block
5904 ? symbol_block_index : SYMBOL_BLOCK_SIZE);
5905
5906 for (sblk = symbol_block_pinned; sblk; sblk = sblk->next)
5907 {
5908 struct Lisp_Symbol *sym = sblk->symbols, *end = sym + lim;
5909 for (; sym < end; ++sym)
5910 if (sym->u.s.pinned)
5911 mark_object (make_lisp_symbol (sym));
5912
5913 lim = SYMBOL_BLOCK_SIZE;
5914 }
5915}
5916
5917static void
5918visit_vectorlike_root (struct gc_root_visitor visitor, 5474visit_vectorlike_root (struct gc_root_visitor visitor,
5919 struct Lisp_Vector *ptr, 5475 struct Lisp_Vector *ptr,
5920 enum gc_root_type type) 5476 enum gc_root_type type)
@@ -6178,8 +5734,6 @@ garbage_collect (void)
6178 struct gc_root_visitor visitor = { .visit = mark_object_root_visitor }; 5734 struct gc_root_visitor visitor = { .visit = mark_object_root_visitor };
6179 visit_static_gc_roots (visitor); 5735 visit_static_gc_roots (visitor);
6180 5736
6181 mark_pinned_objects ();
6182 mark_pinned_symbols ();
6183 mark_lread (); 5737 mark_lread ();
6184 mark_terminals (); 5738 mark_terminals ();
6185 mark_kboards (); 5739 mark_kboards ();
@@ -6306,10 +5860,6 @@ where each entry has the form (NAME SIZE USED FREE), where:
6306 keeps around for future allocations (maybe because it does not know how 5860 keeps around for future allocations (maybe because it does not know how
6307 to return them to the OS). 5861 to return them to the OS).
6308 5862
6309However, if there was overflow in pure space, and Emacs was dumped
6310using the \"unexec\" method, `garbage-collect' returns nil, because
6311real GC can't be done.
6312
6313Note that calling this function does not guarantee that absolutely all 5863Note that calling this function does not guarantee that absolutely all
6314unreachable objects will be garbage-collected. Emacs uses a 5864unreachable objects will be garbage-collected. Emacs uses a
6315mark-and-sweep garbage collector, but is conservative when it comes to 5865mark-and-sweep garbage collector, but is conservative when it comes to
@@ -6737,8 +6287,6 @@ process_mark_stack (ptrdiff_t base_sp)
6737 Lisp_Object obj = mark_stack_pop (); 6287 Lisp_Object obj = mark_stack_pop ();
6738 mark_obj: ; 6288 mark_obj: ;
6739 void *po = XPNTR (obj); 6289 void *po = XPNTR (obj);
6740 if (PURE_P (po))
6741 continue;
6742 6290
6743#if GC_REMEMBER_LAST_MARKED 6291#if GC_REMEMBER_LAST_MARKED
6744 last_marked[last_marked_index++] = obj; 6292 last_marked[last_marked_index++] = obj;
@@ -6964,8 +6512,7 @@ process_mark_stack (ptrdiff_t base_sp)
6964 break; 6512 break;
6965 default: emacs_abort (); 6513 default: emacs_abort ();
6966 } 6514 }
6967 if (!PURE_P (XSTRING (ptr->u.s.name))) 6515 set_string_marked (XSTRING (ptr->u.s.name));
6968 set_string_marked (XSTRING (ptr->u.s.name));
6969 mark_interval_tree (string_intervals (ptr->u.s.name)); 6516 mark_interval_tree (string_intervals (ptr->u.s.name));
6970 /* Inner loop to mark next symbol in this bucket, if any. */ 6517 /* Inner loop to mark next symbol in this bucket, if any. */
6971 po = ptr = ptr->u.s.next; 6518 po = ptr = ptr->u.s.next;
@@ -7099,7 +6646,7 @@ survives_gc_p (Lisp_Object obj)
7099 emacs_abort (); 6646 emacs_abort ();
7100 } 6647 }
7101 6648
7102 return survives_p || PURE_P (XPNTR (obj)); 6649 return survives_p;
7103} 6650}
7104 6651
7105 6652
@@ -7719,8 +7266,6 @@ init_alloc_once (void)
7719static void 7266static void
7720init_alloc_once_for_pdumper (void) 7267init_alloc_once_for_pdumper (void)
7721{ 7268{
7722 purebeg = PUREBEG;
7723 pure_size = PURESIZE;
7724 mem_init (); 7269 mem_init ();
7725 7270
7726#ifdef DOUG_LEA_MALLOC 7271#ifdef DOUG_LEA_MALLOC
@@ -7764,7 +7309,7 @@ If this portion is smaller than `gc-cons-threshold', this is ignored. */);
7764 Vgc_cons_percentage = make_float (0.1); 7309 Vgc_cons_percentage = make_float (0.1);
7765 7310
7766 DEFVAR_INT ("pure-bytes-used", pure_bytes_used, 7311 DEFVAR_INT ("pure-bytes-used", pure_bytes_used,
7767 doc: /* Number of bytes of shareable Lisp data allocated so far. */); 7312 doc: /* No longer used. */);
7768 7313
7769 DEFVAR_INT ("cons-cells-consed", cons_cells_consed, 7314 DEFVAR_INT ("cons-cells-consed", cons_cells_consed,
7770 doc: /* Number of cons cells that have been consed so far. */); 7315 doc: /* Number of cons cells that have been consed so far. */);
@@ -7789,10 +7334,7 @@ If this portion is smaller than `gc-cons-threshold', this is ignored. */);
7789 doc: /* Number of strings that have been consed so far. */); 7334 doc: /* Number of strings that have been consed so far. */);
7790 7335
7791 DEFVAR_LISP ("purify-flag", Vpurify_flag, 7336 DEFVAR_LISP ("purify-flag", Vpurify_flag,
7792 doc: /* Non-nil means loading Lisp code in order to dump an executable. 7337 doc: /* No longer used. */);
7793This means that certain objects should be allocated in shared (pure) space.
7794It can also be set to a hash-table, in which case this table is used to
7795do hash-consing of the objects allocated to pure space. */);
7796 7338
7797 DEFVAR_BOOL ("garbage-collection-messages", garbage_collection_messages, 7339 DEFVAR_BOOL ("garbage-collection-messages", garbage_collection_messages,
7798 doc: /* Non-nil means display messages at start and end of garbage collection. */); 7340 doc: /* Non-nil means display messages at start and end of garbage collection. */);
@@ -7808,10 +7350,10 @@ do hash-consing of the objects allocated to pure space. */);
7808 /* We build this in advance because if we wait until we need it, we might 7350 /* We build this in advance because if we wait until we need it, we might
7809 not be able to allocate the memory to hold it. */ 7351 not be able to allocate the memory to hold it. */
7810 Vmemory_signal_data 7352 Vmemory_signal_data
7811 = pure_list (Qerror, 7353 = list (Qerror,
7812 build_pure_c_string ("Memory exhausted--use" 7354 build_string ("Memory exhausted--use"
7813 " M-x save-some-buffers then" 7355 " M-x save-some-buffers then"
7814 " exit and restart Emacs")); 7356 " exit and restart Emacs"));
7815 7357
7816 DEFVAR_LISP ("memory-full", Vmemory_full, 7358 DEFVAR_LISP ("memory-full", Vmemory_full,
7817 doc: /* Non-nil means Emacs cannot get much more Lisp memory. */); 7359 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..0eec2e5db01 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 }
@@ -5690,40 +5642,40 @@ compiled one. */);
5690 Fput (Qnative_compiler_error, Qerror_conditions, 5642 Fput (Qnative_compiler_error, Qerror_conditions,
5691 pure_list (Qnative_compiler_error, Qerror)); 5643 pure_list (Qnative_compiler_error, Qerror));
5692 Fput (Qnative_compiler_error, Qerror_message, 5644 Fput (Qnative_compiler_error, Qerror_message,
5693 build_pure_c_string ("Native compiler error")); 5645 build_string ("Native compiler error"));
5694 5646
5695 DEFSYM (Qnative_ice, "native-ice"); 5647 DEFSYM (Qnative_ice, "native-ice");
5696 Fput (Qnative_ice, Qerror_conditions, 5648 Fput (Qnative_ice, Qerror_conditions,
5697 pure_list (Qnative_ice, Qnative_compiler_error, Qerror)); 5649 pure_list (Qnative_ice, Qnative_compiler_error, Qerror));
5698 Fput (Qnative_ice, Qerror_message, 5650 Fput (Qnative_ice, Qerror_message,
5699 build_pure_c_string ("Internal native compiler error")); 5651 build_string ("Internal native compiler error"));
5700 5652
5701 /* By the load machinery. */ 5653 /* By the load machinery. */
5702 DEFSYM (Qnative_lisp_load_failed, "native-lisp-load-failed"); 5654 DEFSYM (Qnative_lisp_load_failed, "native-lisp-load-failed");
5703 Fput (Qnative_lisp_load_failed, Qerror_conditions, 5655 Fput (Qnative_lisp_load_failed, Qerror_conditions,
5704 pure_list (Qnative_lisp_load_failed, Qerror)); 5656 pure_list (Qnative_lisp_load_failed, Qerror));
5705 Fput (Qnative_lisp_load_failed, Qerror_message, 5657 Fput (Qnative_lisp_load_failed, Qerror_message,
5706 build_pure_c_string ("Native elisp load failed")); 5658 build_string ("Native elisp load failed"));
5707 5659
5708 DEFSYM (Qnative_lisp_wrong_reloc, "native-lisp-wrong-reloc"); 5660 DEFSYM (Qnative_lisp_wrong_reloc, "native-lisp-wrong-reloc");
5709 Fput (Qnative_lisp_wrong_reloc, Qerror_conditions, 5661 Fput (Qnative_lisp_wrong_reloc, Qerror_conditions,
5710 pure_list (Qnative_lisp_wrong_reloc, Qnative_lisp_load_failed, Qerror)); 5662 pure_list (Qnative_lisp_wrong_reloc, Qnative_lisp_load_failed, Qerror));
5711 Fput (Qnative_lisp_wrong_reloc, Qerror_message, 5663 Fput (Qnative_lisp_wrong_reloc, Qerror_message,
5712 build_pure_c_string ("Primitive redefined or wrong relocation")); 5664 build_string ("Primitive redefined or wrong relocation"));
5713 5665
5714 DEFSYM (Qwrong_register_subr_call, "wrong-register-subr-call"); 5666 DEFSYM (Qwrong_register_subr_call, "wrong-register-subr-call");
5715 Fput (Qwrong_register_subr_call, Qerror_conditions, 5667 Fput (Qwrong_register_subr_call, Qerror_conditions,
5716 pure_list (Qwrong_register_subr_call, Qnative_lisp_load_failed, Qerror)); 5668 pure_list (Qwrong_register_subr_call, Qnative_lisp_load_failed, Qerror));
5717 Fput (Qwrong_register_subr_call, Qerror_message, 5669 Fput (Qwrong_register_subr_call, Qerror_message,
5718 build_pure_c_string ("comp--register-subr can only be called during " 5670 build_string ("comp--register-subr can only be called during "
5719 "native lisp load phase.")); 5671 "native lisp load phase."));
5720 5672
5721 DEFSYM (Qnative_lisp_file_inconsistent, "native-lisp-file-inconsistent"); 5673 DEFSYM (Qnative_lisp_file_inconsistent, "native-lisp-file-inconsistent");
5722 Fput (Qnative_lisp_file_inconsistent, Qerror_conditions, 5674 Fput (Qnative_lisp_file_inconsistent, Qerror_conditions,
5723 pure_list (Qnative_lisp_file_inconsistent, Qnative_lisp_load_failed, Qerror)); 5675 pure_list (Qnative_lisp_file_inconsistent, Qnative_lisp_load_failed, Qerror));
5724 Fput (Qnative_lisp_file_inconsistent, Qerror_message, 5676 Fput (Qnative_lisp_file_inconsistent, Qerror_message,
5725 build_pure_c_string ("eln file inconsistent with current runtime " 5677 build_string ("eln file inconsistent with current runtime "
5726 "configuration, please recompile")); 5678 "configuration, please recompile"));
5727 5679
5728 defsubr (&Scomp__subr_signature); 5680 defsubr (&Scomp__subr_signature);
5729 defsubr (&Scomp_el_to_eln_rel_filename); 5681 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..b2239e34ccd 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"
@@ -1880,7 +1879,9 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1880 if (!initialized) 1879 if (!initialized)
1881 { 1880 {
1882 init_alloc_once (); 1881 init_alloc_once ();
1882#ifdef HAVE_PDUMPER
1883 init_pdumper_once (); 1883 init_pdumper_once ();
1884#endif
1884 init_obarray_once (); 1885 init_obarray_once ();
1885 init_eval_once (); 1886 init_eval_once ();
1886 init_charset_once (); 1887 init_charset_once ();
@@ -3029,8 +3030,6 @@ You must run Emacs in batch mode in order to dump it. */)
3029 Lisp_Object symbol; 3030 Lisp_Object symbol;
3030 specpdl_ref count = SPECPDL_INDEX (); 3031 specpdl_ref count = SPECPDL_INDEX ();
3031 3032
3032 check_pure_size ();
3033
3034 if (! noninteractive) 3033 if (! noninteractive)
3035 error ("Dumping Emacs works only in batch mode"); 3034 error ("Dumping Emacs works only in batch mode");
3036 3035
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..6b5552f14c2 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 Fpurecopy (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 Fpurecopy (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..d02e1c3f3d5 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,8 @@ 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. */
5045 i = get_key_arg (QCpurecopy, nargs, args, used); 5025 get_key_arg (QCpurecopy, nargs, args, used);
5046 purecopy = i && !NILP (args[i]);
5047 /* See if there's a `:size SIZE' argument. */ 5026 /* See if there's a `:size SIZE' argument. */
5048 i = get_key_arg (QCsize, nargs, args, used); 5027 i = get_key_arg (QCsize, nargs, args, used);
5049 Lisp_Object size_arg = i ? args[i] : Qnil; 5028 Lisp_Object size_arg = i ? args[i] : Qnil;
@@ -5093,8 +5072,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
5093 signal_error ("Invalid argument list", args[i]); 5072 signal_error ("Invalid argument list", args[i]);
5094 5073
5095 SAFE_FREE (); 5074 SAFE_FREE ();
5096 return make_hash_table (testdesc, size, rehash_size, rehash_threshold, weak, 5075 return make_hash_table (testdesc, size, rehash_size, rehash_threshold, weak);
5097 purecopy);
5098} 5076}
5099 5077
5100 5078
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..63950d62265 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1147,8 +1147,6 @@ top_level_1 (Lisp_Object ignore)
1147 /* On entry to the outer level, run the startup file. */ 1147 /* On entry to the outer level, run the startup file. */
1148 if (!NILP (Vtop_level)) 1148 if (!NILP (Vtop_level))
1149 internal_condition_case (top_level_2, Qerror, cmd_error); 1149 internal_condition_case (top_level_2, Qerror, cmd_error);
1150 else if (!NILP (Vpurify_flag))
1151 message1 ("Bare impure Emacs (standard Lisp code not loaded)");
1152 else 1150 else
1153 message1 ("Bare Emacs (standard Lisp code not loaded)"); 1151 message1 ("Bare Emacs (standard Lisp code not loaded)");
1154 return Qnil; 1152 return Qnil;
@@ -12045,14 +12043,14 @@ syms_of_keyboard (void)
12045 pending_funcalls = Qnil; 12043 pending_funcalls = Qnil;
12046 staticpro (&pending_funcalls); 12044 staticpro (&pending_funcalls);
12047 12045
12048 Vlispy_mouse_stem = build_pure_c_string ("mouse"); 12046 Vlispy_mouse_stem = build_string ("mouse");
12049 staticpro (&Vlispy_mouse_stem); 12047 staticpro (&Vlispy_mouse_stem);
12050 12048
12051 regular_top_level_message = build_pure_c_string ("Back to top level"); 12049 regular_top_level_message = build_string ("Back to top level");
12052 staticpro (&regular_top_level_message); 12050 staticpro (&regular_top_level_message);
12053#ifdef HAVE_STACK_OVERFLOW_HANDLING 12051#ifdef HAVE_STACK_OVERFLOW_HANDLING
12054 recover_top_level_message 12052 recover_top_level_message
12055 = build_pure_c_string ("Re-entering top level after C stack overflow"); 12053 = build_string ("Re-entering top level after C stack overflow");
12056 staticpro (&recover_top_level_message); 12054 staticpro (&recover_top_level_message);
12057#endif 12055#endif
12058 DEFVAR_LISP ("internal--top-level-message", Vinternal__top_level_message, 12056 DEFVAR_LISP ("internal--top-level-message", Vinternal__top_level_message,
diff --git a/src/keymap.c b/src/keymap.c
index 2b77a7fc444..53e231dd565 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,13 +841,12 @@ 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)); 844 XSETCDR (elt, def);
850 if (remove) 845 if (remove)
851 /* Remove the element. */ 846 /* Remove the element. */
852 insertion_point = Fdelq (elt, insertion_point); 847 insertion_point = Fdelq (elt, insertion_point);
853 else 848 else
854 /* Just set the definition. */ 849 /* Just set the definition. */
855 XSETCDR (elt, def);
856 return def; 850 return def;
857 } 851 }
858 else if (CONSP (idx) 852 else if (CONSP (idx)
@@ -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,12 @@ 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, Qtool_bar, Qheader_line, Qmode_line,
3411 Qtab_line, Qheader_line, Qmode_line, 3404 intern_c_string ("mouse-1"),
3412 intern_c_string ("mouse-1"), 3405 intern_c_string ("mouse-2"),
3413 intern_c_string ("mouse-2"), 3406 intern_c_string ("mouse-3"),
3414 intern_c_string ("mouse-3"), 3407 intern_c_string ("mouse-4"),
3415 intern_c_string ("mouse-4"), 3408 intern_c_string ("mouse-5"));
3416 intern_c_string ("mouse-5"));
3417 3409
3418 /* Keymap used for minibuffers when doing completion. */ 3410 /* Keymap used for minibuffers when doing completion. */
3419 /* Keymap used for minibuffers when doing completion and require a match. */ 3411 /* Keymap used for minibuffers when doing completion and require a match. */
diff --git a/src/lisp.h b/src/lisp.h
index 7a7d2e79979..8840caa06c2 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
@@ -1632,20 +1629,14 @@ STRING_MULTIBYTE (Lisp_Object str)
1632/* Mark STR as a unibyte string. */ 1629/* Mark STR as a unibyte string. */
1633#define STRING_SET_UNIBYTE(STR) \ 1630#define STRING_SET_UNIBYTE(STR) \
1634 do { \ 1631 do { \
1635 if (XSTRING (STR)->u.s.size == 0) \ 1632 XSTRING (STR)->u.s.size_byte = -1; \
1636 (STR) = empty_unibyte_string; \
1637 else \
1638 XSTRING (STR)->u.s.size_byte = -1; \
1639 } while (false) 1633 } while (false)
1640 1634
1641/* Mark STR as a multibyte string. Assure that STR contains only 1635/* Mark STR as a multibyte string. Assure that STR contains only
1642 ASCII characters in advance. */ 1636 ASCII characters in advance. */
1643#define STRING_SET_MULTIBYTE(STR) \ 1637#define STRING_SET_MULTIBYTE(STR) \
1644 do { \ 1638 do { \
1645 if (XSTRING (STR)->u.s.size == 0) \ 1639 XSTRING (STR)->u.s.size_byte = XSTRING (STR)->u.s.size; \
1646 (STR) = empty_multibyte_string; \
1647 else \
1648 XSTRING (STR)->u.s.size_byte = XSTRING (STR)->u.s.size; \
1649 } while (false) 1640 } while (false)
1650 1641
1651/* Convenience functions for dealing with Lisp strings. */ 1642/* Convenience functions for dealing with Lisp strings. */
@@ -2426,12 +2417,8 @@ struct Lisp_Hash_Table
2426 /* Index of first free entry in free list, or -1 if none. */ 2417 /* Index of first free entry in free list, or -1 if none. */
2427 ptrdiff_t next_free; 2418 ptrdiff_t next_free;
2428 2419
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 2420 /* 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 2421 some tables are not, and while a table is being mutated it is
2435 immutable for recursive attempts to mutate it. */ 2422 immutable for recursive attempts to mutate it. */
2436 bool mutable; 2423 bool mutable;
2437 2424
@@ -4010,7 +3997,7 @@ EMACS_UINT hash_string (char const *, ptrdiff_t);
4010EMACS_UINT sxhash (Lisp_Object); 3997EMACS_UINT sxhash (Lisp_Object);
4011Lisp_Object hashfn_user_defined (Lisp_Object, struct Lisp_Hash_Table *); 3998Lisp_Object hashfn_user_defined (Lisp_Object, struct Lisp_Hash_Table *);
4012Lisp_Object make_hash_table (struct hash_table_test, EMACS_INT, float, float, 3999Lisp_Object make_hash_table (struct hash_table_test, EMACS_INT, float, float,
4013 Lisp_Object, bool); 4000 Lisp_Object);
4014ptrdiff_t hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object *); 4001ptrdiff_t hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object *);
4015ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object, 4002ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object,
4016 Lisp_Object); 4003 Lisp_Object);
@@ -4177,7 +4164,6 @@ extern void parse_str_as_multibyte (const unsigned char *, ptrdiff_t,
4177 4164
4178/* Defined in alloc.c. */ 4165/* Defined in alloc.c. */
4179extern void *my_heap_start (void); 4166extern void *my_heap_start (void);
4180extern void check_pure_size (void);
4181unsigned char *resize_string_data (Lisp_Object, ptrdiff_t, int, int); 4167unsigned char *resize_string_data (Lisp_Object, ptrdiff_t, int, int);
4182extern void malloc_warning (const char *); 4168extern void malloc_warning (const char *);
4183extern AVOID memory_full (size_t); 4169extern AVOID memory_full (size_t);
@@ -4236,11 +4222,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, 4222extern Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
4237 Lisp_Object); 4223 Lisp_Object);
4238extern Lisp_Object listn (ptrdiff_t, Lisp_Object, ...); 4224extern Lisp_Object listn (ptrdiff_t, Lisp_Object, ...);
4239extern Lisp_Object pure_listn (ptrdiff_t, Lisp_Object, ...);
4240#define list(...) \ 4225#define list(...) \
4241 listn (ARRAYELTS (((Lisp_Object []) {__VA_ARGS__})), __VA_ARGS__) 4226 listn (ARRAYELTS (((Lisp_Object []) {__VA_ARGS__})), __VA_ARGS__)
4242#define pure_list(...) \
4243 pure_listn (ARRAYELTS (((Lisp_Object []) {__VA_ARGS__})), __VA_ARGS__)
4244 4227
4245enum gc_root_type 4228enum gc_root_type
4246{ 4229{
@@ -4313,18 +4296,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); 4296extern Lisp_Object make_string_from_bytes (const char *, ptrdiff_t, ptrdiff_t);
4314extern Lisp_Object make_specified_string (const char *, 4297extern Lisp_Object make_specified_string (const char *,
4315 ptrdiff_t, ptrdiff_t, bool); 4298 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); 4299extern void pin_string (Lisp_Object string);
4319 4300
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 4301/* Make a string from the data at STR, treating it as multibyte if the
4329 data warrants. */ 4302 data warrants. */
4330 4303
@@ -4334,7 +4307,6 @@ build_string (const char *str)
4334 return make_string (str, strlen (str)); 4307 return make_string (str, strlen (str));
4335} 4308}
4336 4309
4337extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object);
4338extern Lisp_Object make_vector (ptrdiff_t, Lisp_Object); 4310extern Lisp_Object make_vector (ptrdiff_t, Lisp_Object);
4339extern struct Lisp_Vector *allocate_nil_vector (ptrdiff_t) 4311extern struct Lisp_Vector *allocate_nil_vector (ptrdiff_t)
4340 ATTRIBUTE_RETURNS_NONNULL; 4312 ATTRIBUTE_RETURNS_NONNULL;
diff --git a/src/lread.c b/src/lread.c
index 66b13916465..703c5fe242c 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2288,13 +2288,13 @@ 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 (Vpurify_flag) && c == '(')
2299 val = read0 (readcharfun, false); 2299 val = read0 (readcharfun, false);
2300 else 2300 else
@@ -2539,12 +2539,12 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end,
2539 || XHASH_TABLE (read_objects_map)->count) 2539 || XHASH_TABLE (read_objects_map)->count)
2540 read_objects_map 2540 read_objects_map
2541 = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, DEFAULT_REHASH_SIZE, 2541 = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, DEFAULT_REHASH_SIZE,
2542 DEFAULT_REHASH_THRESHOLD, Qnil, false); 2542 DEFAULT_REHASH_THRESHOLD, Qnil);
2543 if (! HASH_TABLE_P (read_objects_completed) 2543 if (! HASH_TABLE_P (read_objects_completed)
2544 || XHASH_TABLE (read_objects_completed)->count) 2544 || XHASH_TABLE (read_objects_completed)->count)
2545 read_objects_completed 2545 read_objects_completed
2546 = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, DEFAULT_REHASH_SIZE, 2546 = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, DEFAULT_REHASH_SIZE,
2547 DEFAULT_REHASH_THRESHOLD, Qnil, false); 2547 DEFAULT_REHASH_THRESHOLD, Qnil);
2548 2548
2549 if (STRINGP (stream) 2549 if (STRINGP (stream)
2550 || ((CONSP (stream) && STRINGP (XCAR (stream))))) 2550 || ((CONSP (stream) && STRINGP (XCAR (stream)))))
@@ -4150,10 +4150,7 @@ read0 (Lisp_Object readcharfun, bool locate_syms)
4150 if (uninterned_symbol) 4150 if (uninterned_symbol)
4151 { 4151 {
4152 Lisp_Object name 4152 Lisp_Object name
4153 = (!NILP (Vpurify_flag) 4153 = 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); 4154 result = Fmake_symbol (name);
4158 } 4155 }
4159 else 4156 else
@@ -4645,16 +4642,8 @@ intern_c_string_1 (const char *str, ptrdiff_t len)
4645 Lisp_Object tem = oblookup (obarray, str, len, len); 4642 Lisp_Object tem = oblookup (obarray, str, len, len);
4646 4643
4647 if (!SYMBOLP (tem)) 4644 if (!SYMBOLP (tem))
4648 { 4645 tem = intern_driver (make_string (str, len), obarray, tem);
4649 Lisp_Object string;
4650 4646
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; 4647 return tem;
4659} 4648}
4660 4649
@@ -4662,7 +4651,7 @@ static void
4662define_symbol (Lisp_Object sym, char const *str) 4651define_symbol (Lisp_Object sym, char const *str)
4663{ 4652{
4664 ptrdiff_t len = strlen (str); 4653 ptrdiff_t len = strlen (str);
4665 Lisp_Object string = make_pure_c_string (str, len); 4654 Lisp_Object string = make_string (str, len);
4666 init_symbol (sym, string); 4655 init_symbol (sym, string);
4667 4656
4668 /* Qunbound is uninterned, so that it's not confused with any symbol 4657 /* Qunbound is uninterned, so that it's not confused with any symbol
@@ -4706,8 +4695,7 @@ it defaults to the value of `obarray'. */)
4706 xfree (longhand); 4695 xfree (longhand);
4707 } 4696 }
4708 else 4697 else
4709 tem = intern_driver (NILP (Vpurify_flag) ? string : Fpurecopy (string), 4698 tem = intern_driver (string, obarray, tem);
4710 obarray, tem);
4711 } 4699 }
4712 return tem; 4700 return tem;
4713} 4701}
@@ -5412,20 +5400,20 @@ This list includes suffixes for both compiled and source Emacs Lisp files.
5412This list should not include the empty string. 5400This list should not include the empty string.
5413`load' and related functions try to append these suffixes, in order, 5401`load' and related functions try to append these suffixes, in order,
5414to the specified file name if a suffix is allowed or required. */); 5402to the specified file name if a suffix is allowed or required. */);
5415 Vload_suffixes = list2 (build_pure_c_string (".elc"), 5403 Vload_suffixes = list2 (build_string (".elc"),
5416 build_pure_c_string (".el")); 5404 build_string (".el"));
5417#ifdef HAVE_MODULES 5405#ifdef HAVE_MODULES
5418 Vload_suffixes = Fcons (build_pure_c_string (MODULES_SUFFIX), Vload_suffixes); 5406 Vload_suffixes = Fcons (build_string (MODULES_SUFFIX), Vload_suffixes);
5419#ifdef MODULES_SECONDARY_SUFFIX 5407#ifdef MODULES_SECONDARY_SUFFIX
5420 Vload_suffixes = 5408 Vload_suffixes =
5421 Fcons (build_pure_c_string (MODULES_SECONDARY_SUFFIX), Vload_suffixes); 5409 Fcons (build_string (MODULES_SECONDARY_SUFFIX), Vload_suffixes);
5422#endif 5410#endif
5423 5411
5424#endif 5412#endif
5425 DEFVAR_LISP ("module-file-suffix", Vmodule_file_suffix, 5413 DEFVAR_LISP ("module-file-suffix", Vmodule_file_suffix,
5426 doc: /* Suffix of loadable module file, or nil if modules are not supported. */); 5414 doc: /* Suffix of loadable module file, or nil if modules are not supported. */);
5427#ifdef HAVE_MODULES 5415#ifdef HAVE_MODULES
5428 Vmodule_file_suffix = build_pure_c_string (MODULES_SUFFIX); 5416 Vmodule_file_suffix = build_string (MODULES_SUFFIX);
5429#else 5417#else
5430 Vmodule_file_suffix = Qnil; 5418 Vmodule_file_suffix = Qnil;
5431#endif 5419#endif
@@ -5575,7 +5563,7 @@ from the file, and matches them against this regular expression.
5575When the regular expression matches, the file is considered to be safe 5563When the regular expression matches, the file is considered to be safe
5576to load. */); 5564to load. */);
5577 Vbytecomp_version_regexp 5565 Vbytecomp_version_regexp
5578 = build_pure_c_string ("^;;;.\\(in Emacs version\\|bytecomp version FSF\\)"); 5566 = build_string ("^;;;.\\(in Emacs version\\|bytecomp version FSF\\)");
5579 5567
5580 DEFSYM (Qlexical_binding, "lexical-binding"); 5568 DEFSYM (Qlexical_binding, "lexical-binding");
5581 DEFVAR_LISP ("lexical-binding", Vlexical_binding, 5569 DEFVAR_LISP ("lexical-binding", Vlexical_binding,
diff --git a/src/pdumper.c b/src/pdumper.c
index af451920eb6..4d8a20c741f 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);
@@ -5775,8 +5773,6 @@ thaw_hash_tables (void)
5775 hash_table_thaw (AREF (hash_tables, i)); 5773 hash_table_thaw (AREF (hash_tables, i));
5776} 5774}
5777 5775
5778#endif /* HAVE_PDUMPER */
5779
5780 5776
5781void 5777void
5782init_pdumper_once (void) 5778init_pdumper_once (void)
@@ -5785,6 +5781,7 @@ init_pdumper_once (void)
5785 pdumper_do_now_and_after_load (thaw_hash_tables); 5781 pdumper_do_now_and_after_load (thaw_hash_tables);
5786#endif 5782#endif
5787} 5783}
5784#endif /* HAVE_PDUMPER */
5788 5785
5789void 5786void
5790syms_of_pdumper (void) 5787syms_of_pdumper (void)
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..3eb07c2ab4b 100644
--- a/src/sqlite.c
+++ b/src/sqlite.c
@@ -771,7 +771,7 @@ syms_of_sqlite (void)
771 Fput (Qsqlite_locked_error, Qerror_conditions, 771 Fput (Qsqlite_locked_error, Qerror_conditions,
772 Fpurecopy (list2 (Qsqlite_locked_error, Qerror))); 772 Fpurecopy (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,