aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 98d60067f9e..37ec06c7be1 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4893,14 +4893,21 @@ Does not copy symbols. Copies strings without text properties. */)
4893 if (PURE_POINTER_P (XPNTR (obj))) 4893 if (PURE_POINTER_P (XPNTR (obj)))
4894 return obj; 4894 return obj;
4895 4895
4896 if (HASH_TABLE_P (Vpurify_flag)) /* Hash consing. */
4897 {
4898 Lisp_Object tmp = Fgethash (obj, Vpurify_flag, Qnil);
4899 if (!NILP (tmp))
4900 return tmp;
4901 }
4902
4896 if (CONSP (obj)) 4903 if (CONSP (obj))
4897 return pure_cons (XCAR (obj), XCDR (obj)); 4904 obj = pure_cons (XCAR (obj), XCDR (obj));
4898 else if (FLOATP (obj)) 4905 else if (FLOATP (obj))
4899 return make_pure_float (XFLOAT_DATA (obj)); 4906 obj = make_pure_float (XFLOAT_DATA (obj));
4900 else if (STRINGP (obj)) 4907 else if (STRINGP (obj))
4901 return make_pure_string (SDATA (obj), SCHARS (obj), 4908 obj = make_pure_string (SDATA (obj), SCHARS (obj),
4902 SBYTES (obj), 4909 SBYTES (obj),
4903 STRING_MULTIBYTE (obj)); 4910 STRING_MULTIBYTE (obj));
4904 else if (COMPILEDP (obj) || VECTORP (obj)) 4911 else if (COMPILEDP (obj) || VECTORP (obj))
4905 { 4912 {
4906 register struct Lisp_Vector *vec; 4913 register struct Lisp_Vector *vec;
@@ -4920,10 +4927,15 @@ Does not copy symbols. Copies strings without text properties. */)
4920 } 4927 }
4921 else 4928 else
4922 XSETVECTOR (obj, vec); 4929 XSETVECTOR (obj, vec);
4923 return obj;
4924 } 4930 }
4925 else if (MARKERP (obj)) 4931 else if (MARKERP (obj))
4926 error ("Attempt to copy a marker to pure storage"); 4932 error ("Attempt to copy a marker to pure storage");
4933 else
4934 /* Not purified, don't hash-cons. */
4935 return obj;
4936
4937 if (HASH_TABLE_P (Vpurify_flag)) /* Hash consing. */
4938 Fputhash (obj, obj, Vpurify_flag);
4927 4939
4928 return obj; 4940 return obj;
4929} 4941}
@@ -6371,7 +6383,9 @@ If this portion is smaller than `gc-cons-threshold', this is ignored. */);
6371 6383
6372 DEFVAR_LISP ("purify-flag", &Vpurify_flag, 6384 DEFVAR_LISP ("purify-flag", &Vpurify_flag,
6373 doc: /* Non-nil means loading Lisp code in order to dump an executable. 6385 doc: /* Non-nil means loading Lisp code in order to dump an executable.
6374This means that certain objects should be allocated in shared (pure) space. */); 6386This means that certain objects should be allocated in shared (pure) space.
6387It can also be set to a hash-table, in which case this table is used to
6388do hash-consing of the objects allocated to pure space. */);
6375 6389
6376 DEFVAR_BOOL ("garbage-collection-messages", &garbage_collection_messages, 6390 DEFVAR_BOOL ("garbage-collection-messages", &garbage_collection_messages,
6377 doc: /* Non-nil means display messages at start and end of garbage collection. */); 6391 doc: /* Non-nil means display messages at start and end of garbage collection. */);