From 8fe464dbb030a722ca173c442906482ef210f46e Mon Sep 17 00:00:00 2001 From: Pip Cet Date: Wed, 3 Jul 2019 11:27:50 +0000 Subject: [PATCH 1/2] Test bug#36447 --- lisp/custom.el | 10 ++++++++++ src/puresize.h | 2 +- test-custom.el | 12 ++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 test-custom.el diff --git a/lisp/custom.el b/lisp/custom.el index 736460fec7..c49321b829 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -35,6 +35,16 @@ (require 'widget) +(defvar hash-tables (make-vector 256 nil)) + +(dotimes (i 256) + (let ((ht (make-hash-table :purecopy t :size 2 :test 'eq))) + (when (= (% i 3) 0) + (puthash 'dummy-symbol t ht)) + (dotimes (j 16) + (puthash (logand i (lsh 1 j)) t ht)) + (aset hash-tables i (purecopy ht)))) + (defvar custom-define-hook nil ;; Customize information for this option is in `cus-edit.el'. "Hook called after defining each customize option.") diff --git a/src/puresize.h b/src/puresize.h index f5fad8b42b..d29e3e80df 100644 --- a/src/puresize.h +++ b/src/puresize.h @@ -47,7 +47,7 @@ #define SITELOAD_PURESIZE_EXTRA 0 #endif #ifndef BASE_PURESIZE -#define BASE_PURESIZE (2000000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) +#define BASE_PURESIZE (80000000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) #endif /* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */ diff --git a/test-custom.el b/test-custom.el new file mode 100644 index 0000000000..b871d30cfa --- /dev/null +++ b/test-custom.el @@ -0,0 +1,12 @@ +(dotimes (i 256) + (let ((ht (aref hash-tables i))) + (dotimes (j 16) + (unless (eq (/= 0 (logand (lsh 1 j) i)) + (gethash (lsh 1 j) ht)) + (error "hash table corruption at table %S, bit %S" i j))))) + +(aref hash-tables 17) +;; #s(hash-table size 3 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (1 t 0 t 16 t)) + +(gethash 1 (aref hash-tables 17)) +;; nil -- 2.20.1