From 9c4dfdd1af9f97c6a8d7e922b68a39052116790c Mon Sep 17 00:00:00 2001 From: Vibhav Pant Date: Mon, 30 Jan 2017 12:03:23 +0530 Subject: 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). --- src/emacs-module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/emacs-module.c') diff --git a/src/emacs-module.c b/src/emacs-module.c index e22c7dc5b72..69fa5c8e64c 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -1016,7 +1016,7 @@ syms_of_module (void) = make_hash_table (hashtest_eq, make_number (DEFAULT_HASH_SIZE), make_float (DEFAULT_REHASH_SIZE), make_float (DEFAULT_REHASH_THRESHOLD), - Qnil); + Qnil, Qnil); Funintern (Qmodule_refs_hash, Qnil); DEFSYM (Qmodule_environments, "module-environments"); -- cgit v1.2.3