diff options
author | Vibhav Pant <vibhavp@gmail.com> | 2017-01-30 12:03:23 +0530 |
---|---|---|
committer | Vibhav Pant <vibhavp@gmail.com> | 2017-01-30 12:03:23 +0530 |
commit | 9c4dfdd1af9f97c6a8d7e922b68a39052116790c (patch) | |
tree | 1fb54fcb7d5eaa61ed88ea67ee9d17fde112bc4a /src/lread.c | |
parent | 8ba236e772b64d0bb021aa691bd7eacf4b7f3ae4 (diff) | |
download | emacs-9c4dfdd1af9f97c6a8d7e922b68a39052116790c.tar.gz emacs-9c4dfdd1af9f97c6a8d7e922b68a39052116790c.tar.bz2 emacs-9c4dfdd1af9f97c6a8d7e922b68a39052116790c.zip |
Fix hash tables not being purified correctly.
* src/alloc.c
(purecopy_hash_table) New function, makes a copy of the given hash
table in pure storage.
Add new struct `pinned_object' and `pinned_objects' linked list for
pinning objects.
(Fpurecopy) Allow purifying hash tables
(purecopy) Pin hash tables that are either weak or not declared with
`:purecopy t`, use purecopy_hash_table otherwise.
(marked_pinned_objects) New function, marks all objects in pinned_objects.
(garbage_collect_1) Use it. Mark all pinned objects before sweeping.
* src/lisp.h Add new field `pure' to struct `Lisp_Hash_Table'.
* src/fns.c: Add `purecopy' parameter to hash tables.
(Fmake_hash_table): Check for a `:purecopy PURECOPY' argument, pass it
to make_hash_table.
(make_hash_table): Add `pure' parameter, set h->pure to it.
(Fclrhash, Fremhash, Fputhash): Enforce that the table is impure with
CHECK_IMPURE.
* src/lread.c: (read1) Parse for `purecopy' parameter while reading
hash tables.
* src/print.c: (print_object) add the `purecopy' parameter while
printing hash tables.
* src/category.c, src/emacs-module.c, src/image.c, src/profiler.c,
src/xterm.c: Use new (make_hash_table).
Diffstat (limited to 'src/lread.c')
-rw-r--r-- | src/lread.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lread.c b/src/lread.c index ea2a1d1d858..17806922a8c 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2599,7 +2599,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) Lisp_Object val = Qnil; /* The size is 2 * number of allowed keywords to make-hash-table. */ - Lisp_Object params[10]; + Lisp_Object params[12]; Lisp_Object ht; Lisp_Object key = Qnil; int param_count = 0; @@ -2636,6 +2636,11 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) if (!NILP (params[param_count + 1])) param_count += 2; + params[param_count] = QCpurecopy; + params[param_count + 1] = Fplist_get (tmp, Qpurecopy); + if (!NILP (params[param_count + 1])) + param_count += 2; + /* This is the hash table data. */ data = Fplist_get (tmp, Qdata); @@ -4849,6 +4854,7 @@ that are loaded before your customizations are read! */); DEFSYM (Qdata, "data"); DEFSYM (Qtest, "test"); DEFSYM (Qsize, "size"); + DEFSYM (Qpurecopy, "purecopy"); DEFSYM (Qweakness, "weakness"); DEFSYM (Qrehash_size, "rehash-size"); DEFSYM (Qrehash_threshold, "rehash-threshold"); |