diff options
| author | Paul Eggert | 2017-02-21 15:31:29 -0800 |
|---|---|---|
| committer | Paul Eggert | 2017-02-21 15:39:17 -0800 |
| commit | 83c9c6fc1cc943f239a021b42a8ca9b0e162198c (patch) | |
| tree | eb0a1840bc941357c4dffac5050776b5e8165cd3 /src | |
| parent | 5cbdaa98f975c870c4afa24346630a18b55f27ab (diff) | |
| download | emacs-83c9c6fc1cc943f239a021b42a8ca9b0e162198c.tar.gz emacs-83c9c6fc1cc943f239a021b42a8ca9b0e162198c.zip | |
Use float instead of Lisp_Object for rehash_size
* src/alloc.c (purecopy_hash_table):
* src/fns.c (maybe_resize_hash_table, Fmake_hash_table):
(Fhash_table_rehash_size):
* src/lisp.h (struct Lisp_Hash_Table.rehash_size):
The rehash_size member of struct Lisp_Hash_Table is now a
float, not a Lisp_Object.
* src/alloc.c (purecopy_hash_table): Assign members in order.
* src/fns.c (make_hash_table): Use EMACS_INT for size and
float for rehash_size, instead of Lisp_Object for both.
All callers changed.
* src/lisp.h (DEFAULT_REHASH_SIZE): Now float, not double,
and 1 smaller.
* src/print.c (print_object): Simplify by calling
Fhash_table_rehash_size and Fhash_table_rehash_threshold.
Avoid unnecessary NILP.
Diffstat (limited to 'src')
| -rw-r--r-- | src/alloc.c | 6 | ||||
| -rw-r--r-- | src/category.c | 5 | ||||
| -rw-r--r-- | src/emacs-module.c | 5 | ||||
| -rw-r--r-- | src/fns.c | 95 | ||||
| -rw-r--r-- | src/image.c | 5 | ||||
| -rw-r--r-- | src/lisp.h | 22 | ||||
| -rw-r--r-- | src/print.c | 10 | ||||
| -rw-r--r-- | src/profiler.c | 5 | ||||
| -rw-r--r-- | src/xterm.c | 4 |
9 files changed, 81 insertions, 76 deletions
diff --git a/src/alloc.c b/src/alloc.c index 5da4290701e..b44b90e558a 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -5453,18 +5453,18 @@ purecopy_hash_table (struct Lisp_Hash_Table *table) | |||
| 5453 | pure_test.user_hash_function = purecopy (table->test.user_hash_function); | 5453 | pure_test.user_hash_function = purecopy (table->test.user_hash_function); |
| 5454 | pure_test.user_cmp_function = purecopy (table->test.user_cmp_function); | 5454 | pure_test.user_cmp_function = purecopy (table->test.user_cmp_function); |
| 5455 | 5455 | ||
| 5456 | pure->test = pure_test; | ||
| 5457 | pure->header = table->header; | 5456 | pure->header = table->header; |
| 5458 | pure->weak = purecopy (Qnil); | 5457 | pure->weak = purecopy (Qnil); |
| 5459 | pure->rehash_size = purecopy (table->rehash_size); | ||
| 5460 | pure->hash = purecopy (table->hash); | 5458 | pure->hash = purecopy (table->hash); |
| 5461 | pure->next = purecopy (table->next); | 5459 | pure->next = purecopy (table->next); |
| 5462 | pure->next_free = table->next_free; | ||
| 5463 | pure->index = purecopy (table->index); | 5460 | pure->index = purecopy (table->index); |
| 5464 | pure->count = table->count; | 5461 | pure->count = table->count; |
| 5462 | pure->next_free = table->next_free; | ||
| 5465 | pure->pure = table->pure; | 5463 | pure->pure = table->pure; |
| 5466 | pure->rehash_threshold = table->rehash_threshold; | 5464 | pure->rehash_threshold = table->rehash_threshold; |
| 5465 | pure->rehash_size = table->rehash_size; | ||
| 5467 | pure->key_and_value = purecopy (table->key_and_value); | 5466 | pure->key_and_value = purecopy (table->key_and_value); |
| 5467 | pure->test = pure_test; | ||
| 5468 | 5468 | ||
| 5469 | return pure; | 5469 | return pure; |
| 5470 | } | 5470 | } |
diff --git a/src/category.c b/src/category.c index f5edd20c8a3..b633f65532a 100644 --- a/src/category.c +++ b/src/category.c | |||
| @@ -64,9 +64,8 @@ hash_get_category_set (Lisp_Object table, Lisp_Object category_set) | |||
| 64 | if (NILP (XCHAR_TABLE (table)->extras[1])) | 64 | if (NILP (XCHAR_TABLE (table)->extras[1])) |
| 65 | set_char_table_extras | 65 | set_char_table_extras |
| 66 | (table, 1, | 66 | (table, 1, |
| 67 | make_hash_table (hashtest_equal, make_number (DEFAULT_HASH_SIZE), | 67 | make_hash_table (hashtest_equal, DEFAULT_HASH_SIZE, |
| 68 | make_float (DEFAULT_REHASH_SIZE), | 68 | DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD, |
| 69 | DEFAULT_REHASH_THRESHOLD, | ||
| 70 | Qnil, false)); | 69 | Qnil, false)); |
| 71 | h = XHASH_TABLE (XCHAR_TABLE (table)->extras[1]); | 70 | h = XHASH_TABLE (XCHAR_TABLE (table)->extras[1]); |
| 72 | i = hash_lookup (h, category_set, &hash); | 71 | i = hash_lookup (h, category_set, &hash); |
diff --git a/src/emacs-module.c b/src/emacs-module.c index 5a66b516513..1b445dcc3b2 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c | |||
| @@ -1013,9 +1013,8 @@ syms_of_module (void) | |||
| 1013 | doc: /* Module global reference table. */); | 1013 | doc: /* Module global reference table. */); |
| 1014 | 1014 | ||
| 1015 | Vmodule_refs_hash | 1015 | Vmodule_refs_hash |
| 1016 | = make_hash_table (hashtest_eq, make_number (DEFAULT_HASH_SIZE), | 1016 | = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, |
| 1017 | make_float (DEFAULT_REHASH_SIZE), | 1017 | DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD, |
| 1018 | DEFAULT_REHASH_THRESHOLD, | ||
| 1019 | Qnil, false); | 1018 | Qnil, false); |
| 1020 | Funintern (Qmodule_refs_hash, Qnil); | 1019 | Funintern (Qmodule_refs_hash, Qnil); |
| 1021 | 1020 | ||
| @@ -3684,13 +3684,13 @@ allocate_hash_table (void) | |||
| 3684 | `equal' or a symbol denoting a user-defined test named TEST with | 3684 | `equal' or a symbol denoting a user-defined test named TEST with |
| 3685 | test and hash functions USER_TEST and USER_HASH. | 3685 | test and hash functions USER_TEST and USER_HASH. |
| 3686 | 3686 | ||
| 3687 | Give the table initial capacity SIZE, SIZE >= 0, an integer. | 3687 | Give the table initial capacity SIZE, 0 <= SIZE <= MOST_POSITIVE_FIXNUM. |
| 3688 | 3688 | ||
| 3689 | If REHASH_SIZE is an integer, it must be > 0, and this hash table's | 3689 | If REHASH_SIZE is equal to a negative integer, this hash table's |
| 3690 | new size when it becomes full is computed by adding REHASH_SIZE to | 3690 | new size when it becomes full is computed by subtracting |
| 3691 | its old size. If REHASH_SIZE is a float, it must be > 1.0, and the | 3691 | REHASH_SIZE from its old size. Otherwise it must be positive, and |
| 3692 | table's new size is computed by multiplying its old size with | 3692 | the table's new size is computed by multiplying its old size by |
| 3693 | REHASH_SIZE. | 3693 | REHASH_SIZE + 1. |
| 3694 | 3694 | ||
| 3695 | REHASH_THRESHOLD must be a float <= 1.0, and > 0. The table will | 3695 | REHASH_THRESHOLD must be a float <= 1.0, and > 0. The table will |
| 3696 | be resized when the approximate ratio of table entries to table | 3696 | be resized when the approximate ratio of table entries to table |
| @@ -3704,34 +3704,31 @@ allocate_hash_table (void) | |||
| 3704 | changed after purecopy. */ | 3704 | changed after purecopy. */ |
| 3705 | 3705 | ||
| 3706 | Lisp_Object | 3706 | Lisp_Object |
| 3707 | make_hash_table (struct hash_table_test test, | 3707 | make_hash_table (struct hash_table_test test, EMACS_INT size, |
| 3708 | Lisp_Object size, Lisp_Object rehash_size, | 3708 | float rehash_size, float rehash_threshold, |
| 3709 | float rehash_threshold, Lisp_Object weak, | 3709 | Lisp_Object weak, bool pure) |
| 3710 | bool pure) | ||
| 3711 | { | 3710 | { |
| 3712 | struct Lisp_Hash_Table *h; | 3711 | struct Lisp_Hash_Table *h; |
| 3713 | Lisp_Object table; | 3712 | Lisp_Object table; |
| 3714 | EMACS_INT index_size, sz; | 3713 | EMACS_INT index_size; |
| 3715 | ptrdiff_t i; | 3714 | ptrdiff_t i; |
| 3716 | double index_float; | 3715 | double index_float; |
| 3717 | 3716 | ||
| 3718 | /* Preconditions. */ | 3717 | /* Preconditions. */ |
| 3719 | eassert (SYMBOLP (test.name)); | 3718 | eassert (SYMBOLP (test.name)); |
| 3720 | eassert (INTEGERP (size) && XINT (size) >= 0); | 3719 | eassert (0 <= size && size <= MOST_POSITIVE_FIXNUM); |
| 3721 | eassert ((INTEGERP (rehash_size) && XINT (rehash_size) > 0) | 3720 | eassert (rehash_size <= -1 || 0 < rehash_size); |
| 3722 | || (FLOATP (rehash_size) && 1 < XFLOAT_DATA (rehash_size))); | ||
| 3723 | eassert (0 < rehash_threshold && rehash_threshold <= 1); | 3721 | eassert (0 < rehash_threshold && rehash_threshold <= 1); |
| 3724 | 3722 | ||
| 3725 | if (XFASTINT (size) == 0) | 3723 | if (size == 0) |
| 3726 | size = make_number (1); | 3724 | size = 1; |
| 3727 | 3725 | ||
| 3728 | sz = XFASTINT (size); | ||
| 3729 | double threshold = rehash_threshold; | 3726 | double threshold = rehash_threshold; |
| 3730 | index_float = sz / threshold; | 3727 | index_float = size / threshold; |
| 3731 | index_size = (index_float < INDEX_SIZE_BOUND + 1 | 3728 | index_size = (index_float < INDEX_SIZE_BOUND + 1 |
| 3732 | ? next_almost_prime (index_float) | 3729 | ? next_almost_prime (index_float) |
| 3733 | : INDEX_SIZE_BOUND + 1); | 3730 | : INDEX_SIZE_BOUND + 1); |
| 3734 | if (INDEX_SIZE_BOUND < max (index_size, 2 * sz)) | 3731 | if (INDEX_SIZE_BOUND < max (index_size, 2 * size)) |
| 3735 | error ("Hash table too large"); | 3732 | error ("Hash table too large"); |
| 3736 | 3733 | ||
| 3737 | /* Allocate a table and initialize it. */ | 3734 | /* Allocate a table and initialize it. */ |
| @@ -3743,14 +3740,14 @@ make_hash_table (struct hash_table_test test, | |||
| 3743 | h->rehash_threshold = rehash_threshold; | 3740 | h->rehash_threshold = rehash_threshold; |
| 3744 | h->rehash_size = rehash_size; | 3741 | h->rehash_size = rehash_size; |
| 3745 | h->count = 0; | 3742 | h->count = 0; |
| 3746 | h->key_and_value = Fmake_vector (make_number (2 * sz), Qnil); | 3743 | h->key_and_value = Fmake_vector (make_number (2 * size), Qnil); |
| 3747 | h->hash = Fmake_vector (size, Qnil); | 3744 | h->hash = Fmake_vector (make_number (size), Qnil); |
| 3748 | h->next = Fmake_vector (size, make_number (-1)); | 3745 | h->next = Fmake_vector (make_number (size), make_number (-1)); |
| 3749 | h->index = Fmake_vector (make_number (index_size), make_number (-1)); | 3746 | h->index = Fmake_vector (make_number (index_size), make_number (-1)); |
| 3750 | h->pure = pure; | 3747 | h->pure = pure; |
| 3751 | 3748 | ||
| 3752 | /* Set up the free list. */ | 3749 | /* Set up the free list. */ |
| 3753 | for (i = 0; i < sz - 1; ++i) | 3750 | for (i = 0; i < size - 1; ++i) |
| 3754 | set_hash_next_slot (h, i, i + 1); | 3751 | set_hash_next_slot (h, i, i + 1); |
| 3755 | h->next_free = 0; | 3752 | h->next_free = 0; |
| 3756 | 3753 | ||
| @@ -3810,22 +3807,21 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h) | |||
| 3810 | ptrdiff_t old_size = HASH_TABLE_SIZE (h); | 3807 | ptrdiff_t old_size = HASH_TABLE_SIZE (h); |
| 3811 | EMACS_INT new_size, index_size, nsize; | 3808 | EMACS_INT new_size, index_size, nsize; |
| 3812 | ptrdiff_t i; | 3809 | ptrdiff_t i; |
| 3810 | double rehash_size = h->rehash_size; | ||
| 3813 | double index_float; | 3811 | double index_float; |
| 3814 | 3812 | ||
| 3815 | if (INTEGERP (h->rehash_size)) | 3813 | if (rehash_size < 0) |
| 3816 | new_size = old_size + XFASTINT (h->rehash_size); | 3814 | new_size = old_size - rehash_size; |
| 3817 | else | 3815 | else |
| 3818 | { | 3816 | { |
| 3819 | double float_new_size = old_size * XFLOAT_DATA (h->rehash_size); | 3817 | double float_new_size = old_size * (rehash_size + 1); |
| 3820 | if (float_new_size < INDEX_SIZE_BOUND + 1) | 3818 | if (float_new_size < INDEX_SIZE_BOUND + 1) |
| 3821 | { | 3819 | new_size = float_new_size; |
| 3822 | new_size = float_new_size; | ||
| 3823 | if (new_size <= old_size) | ||
| 3824 | new_size = old_size + 1; | ||
| 3825 | } | ||
| 3826 | else | 3820 | else |
| 3827 | new_size = INDEX_SIZE_BOUND + 1; | 3821 | new_size = INDEX_SIZE_BOUND + 1; |
| 3828 | } | 3822 | } |
| 3823 | if (new_size <= old_size) | ||
| 3824 | new_size = old_size + 1; | ||
| 3829 | double threshold = h->rehash_threshold; | 3825 | double threshold = h->rehash_threshold; |
| 3830 | index_float = new_size / threshold; | 3826 | index_float = new_size / threshold; |
| 3831 | index_size = (index_float < INDEX_SIZE_BOUND + 1 | 3827 | index_size = (index_float < INDEX_SIZE_BOUND + 1 |
| @@ -4408,7 +4404,7 @@ in an error. | |||
| 4408 | usage: (make-hash-table &rest KEYWORD-ARGS) */) | 4404 | usage: (make-hash-table &rest KEYWORD-ARGS) */) |
| 4409 | (ptrdiff_t nargs, Lisp_Object *args) | 4405 | (ptrdiff_t nargs, Lisp_Object *args) |
| 4410 | { | 4406 | { |
| 4411 | Lisp_Object test, size, rehash_size, weak; | 4407 | Lisp_Object test, weak; |
| 4412 | bool pure; | 4408 | bool pure; |
| 4413 | struct hash_table_test testdesc; | 4409 | struct hash_table_test testdesc; |
| 4414 | ptrdiff_t i; | 4410 | ptrdiff_t i; |
| @@ -4448,18 +4444,26 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */) | |||
| 4448 | pure = i && !NILP (args[i]); | 4444 | pure = i && !NILP (args[i]); |
| 4449 | /* See if there's a `:size SIZE' argument. */ | 4445 | /* See if there's a `:size SIZE' argument. */ |
| 4450 | i = get_key_arg (QCsize, nargs, args, used); | 4446 | i = get_key_arg (QCsize, nargs, args, used); |
| 4451 | size = i ? args[i] : Qnil; | 4447 | Lisp_Object size_arg = i ? args[i] : Qnil; |
| 4452 | if (NILP (size)) | 4448 | EMACS_INT size; |
| 4453 | size = make_number (DEFAULT_HASH_SIZE); | 4449 | if (NILP (size_arg)) |
| 4454 | else if (!INTEGERP (size) || XINT (size) < 0) | 4450 | size = DEFAULT_HASH_SIZE; |
| 4455 | signal_error ("Invalid hash table size", size); | 4451 | else if (NATNUMP (size_arg)) |
| 4452 | size = XFASTINT (size_arg); | ||
| 4453 | else | ||
| 4454 | signal_error ("Invalid hash table size", size_arg); | ||
| 4456 | 4455 | ||
| 4457 | /* Look for `:rehash-size SIZE'. */ | 4456 | /* Look for `:rehash-size SIZE'. */ |
| 4457 | float rehash_size; | ||
| 4458 | i = get_key_arg (QCrehash_size, nargs, args, used); | 4458 | i = get_key_arg (QCrehash_size, nargs, args, used); |
| 4459 | rehash_size = i ? args[i] : make_float (DEFAULT_REHASH_SIZE); | 4459 | if (!i) |
| 4460 | if (! ((INTEGERP (rehash_size) && 0 < XINT (rehash_size)) | 4460 | rehash_size = DEFAULT_REHASH_SIZE; |
| 4461 | || (FLOATP (rehash_size) && 1 < XFLOAT_DATA (rehash_size)))) | 4461 | else if (INTEGERP (args[i]) && 0 < XINT (args[i])) |
| 4462 | signal_error ("Invalid hash table rehash size", rehash_size); | 4462 | rehash_size = - XINT (args[i]); |
| 4463 | else if (FLOATP (args[i]) && 0 < (float) (XFLOAT_DATA (args[i]) - 1)) | ||
| 4464 | rehash_size = (float) (XFLOAT_DATA (args[i]) - 1); | ||
| 4465 | else | ||
| 4466 | signal_error ("Invalid hash table rehash size", args[i]); | ||
| 4463 | 4467 | ||
| 4464 | /* Look for `:rehash-threshold THRESHOLD'. */ | 4468 | /* Look for `:rehash-threshold THRESHOLD'. */ |
| 4465 | i = get_key_arg (QCrehash_threshold, nargs, args, used); | 4469 | i = get_key_arg (QCrehash_threshold, nargs, args, used); |
| @@ -4513,7 +4517,14 @@ DEFUN ("hash-table-rehash-size", Fhash_table_rehash_size, | |||
| 4513 | doc: /* Return the current rehash size of TABLE. */) | 4517 | doc: /* Return the current rehash size of TABLE. */) |
| 4514 | (Lisp_Object table) | 4518 | (Lisp_Object table) |
| 4515 | { | 4519 | { |
| 4516 | return check_hash_table (table)->rehash_size; | 4520 | double rehash_size = check_hash_table (table)->rehash_size; |
| 4521 | if (rehash_size < 0) | ||
| 4522 | { | ||
| 4523 | EMACS_INT s = -rehash_size; | ||
| 4524 | return make_number (min (s, MOST_POSITIVE_FIXNUM)); | ||
| 4525 | } | ||
| 4526 | else | ||
| 4527 | return make_float (rehash_size + 1); | ||
| 4517 | } | 4528 | } |
| 4518 | 4529 | ||
| 4519 | 4530 | ||
diff --git a/src/image.c b/src/image.c index 0a6bbd17d88..fc396c7353d 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -4017,9 +4017,8 @@ xpm_make_color_table_h (void (**put_func) (Lisp_Object, const char *, int, | |||
| 4017 | { | 4017 | { |
| 4018 | *put_func = xpm_put_color_table_h; | 4018 | *put_func = xpm_put_color_table_h; |
| 4019 | *get_func = xpm_get_color_table_h; | 4019 | *get_func = xpm_get_color_table_h; |
| 4020 | return make_hash_table (hashtest_equal, make_number (DEFAULT_HASH_SIZE), | 4020 | return make_hash_table (hashtest_equal, DEFAULT_HASH_SIZE, |
| 4021 | make_float (DEFAULT_REHASH_SIZE), | 4021 | DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD, |
| 4022 | DEFAULT_REHASH_THRESHOLD, | ||
| 4023 | Qnil, false); | 4022 | Qnil, false); |
| 4024 | } | 4023 | } |
| 4025 | 4024 | ||
diff --git a/src/lisp.h b/src/lisp.h index 027fd07d720..e048011a860 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -1969,11 +1969,6 @@ struct Lisp_Hash_Table | |||
| 1969 | weakness of the table. */ | 1969 | weakness of the table. */ |
| 1970 | Lisp_Object weak; | 1970 | Lisp_Object weak; |
| 1971 | 1971 | ||
| 1972 | /* When the table is resized, and this is an integer, compute the | ||
| 1973 | new size by adding this to the old size. If a float, compute the | ||
| 1974 | new size by multiplying the old size with this factor. */ | ||
| 1975 | Lisp_Object rehash_size; | ||
| 1976 | |||
| 1977 | /* Vector of hash codes. If hash[I] is nil, this means that the | 1972 | /* Vector of hash codes. If hash[I] is nil, this means that the |
| 1978 | I-th entry is unused. */ | 1973 | I-th entry is unused. */ |
| 1979 | Lisp_Object hash; | 1974 | Lisp_Object hash; |
| @@ -2008,6 +2003,13 @@ struct Lisp_Hash_Table | |||
| 2008 | ratio. */ | 2003 | ratio. */ |
| 2009 | float rehash_threshold; | 2004 | float rehash_threshold; |
| 2010 | 2005 | ||
| 2006 | /* Used when the table is resized. If equal to a negative integer, | ||
| 2007 | the user rehash-size is the integer -REHASH_SIZE, and the new | ||
| 2008 | size is the old size plus -REHASH_SIZE. If positive, the user | ||
| 2009 | rehash-size is the floating-point value REHASH_SIZE + 1, and the | ||
| 2010 | new size is the old size times REHASH_SIZE + 1. */ | ||
| 2011 | float rehash_size; | ||
| 2012 | |||
| 2011 | /* Vector of keys and values. The key of item I is found at index | 2013 | /* Vector of keys and values. The key of item I is found at index |
| 2012 | 2 * I, the value is found at index 2 * I + 1. | 2014 | 2 * I, the value is found at index 2 * I + 1. |
| 2013 | This is gc_marked specially if the table is weak. */ | 2015 | This is gc_marked specially if the table is weak. */ |
| @@ -2076,9 +2078,9 @@ enum DEFAULT_HASH_SIZE { DEFAULT_HASH_SIZE = 65 }; | |||
| 2076 | 2078 | ||
| 2077 | static float const DEFAULT_REHASH_THRESHOLD = 0.8125; | 2079 | static float const DEFAULT_REHASH_THRESHOLD = 0.8125; |
| 2078 | 2080 | ||
| 2079 | /* Default factor by which to increase the size of a hash table. */ | 2081 | /* Default factor by which to increase the size of a hash table, minus 1. */ |
| 2080 | 2082 | ||
| 2081 | static double const DEFAULT_REHASH_SIZE = 1.5; | 2083 | static float const DEFAULT_REHASH_SIZE = 1.5 - 1; |
| 2082 | 2084 | ||
| 2083 | /* Combine two integers X and Y for hashing. The result might not fit | 2085 | /* Combine two integers X and Y for hashing. The result might not fit |
| 2084 | into a Lisp integer. */ | 2086 | into a Lisp integer. */ |
| @@ -3347,10 +3349,8 @@ extern Lisp_Object larger_vector (Lisp_Object, ptrdiff_t, ptrdiff_t); | |||
| 3347 | extern void sweep_weak_hash_tables (void); | 3349 | extern void sweep_weak_hash_tables (void); |
| 3348 | EMACS_UINT hash_string (char const *, ptrdiff_t); | 3350 | EMACS_UINT hash_string (char const *, ptrdiff_t); |
| 3349 | EMACS_UINT sxhash (Lisp_Object, int); | 3351 | EMACS_UINT sxhash (Lisp_Object, int); |
| 3350 | Lisp_Object make_hash_table (struct hash_table_test test, | 3352 | Lisp_Object make_hash_table (struct hash_table_test, EMACS_INT, float, float, |
| 3351 | Lisp_Object size, Lisp_Object rehash_size, | 3353 | Lisp_Object, bool); |
| 3352 | float rehash_threshold, Lisp_Object weak, | ||
| 3353 | bool pure); | ||
| 3354 | ptrdiff_t hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, EMACS_UINT *); | 3354 | ptrdiff_t hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, EMACS_UINT *); |
| 3355 | ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object, | 3355 | ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object, |
| 3356 | EMACS_UINT); | 3356 | EMACS_UINT); |
diff --git a/src/print.c b/src/print.c index 3a36a4eb54d..8c4bb24555e 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -1806,14 +1806,12 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) | |||
| 1806 | print_object (h->weak, printcharfun, escapeflag); | 1806 | print_object (h->weak, printcharfun, escapeflag); |
| 1807 | } | 1807 | } |
| 1808 | 1808 | ||
| 1809 | if (!NILP (h->rehash_size)) | 1809 | print_c_string (" rehash-size ", printcharfun); |
| 1810 | { | 1810 | print_object (Fhash_table_rehash_size (obj), |
| 1811 | print_c_string (" rehash-size ", printcharfun); | 1811 | printcharfun, escapeflag); |
| 1812 | print_object (h->rehash_size, printcharfun, escapeflag); | ||
| 1813 | } | ||
| 1814 | 1812 | ||
| 1815 | print_c_string (" rehash-threshold ", printcharfun); | 1813 | print_c_string (" rehash-threshold ", printcharfun); |
| 1816 | print_object (make_float (h->rehash_threshold), | 1814 | print_object (Fhash_table_rehash_threshold (obj), |
| 1817 | printcharfun, escapeflag); | 1815 | printcharfun, escapeflag); |
| 1818 | 1816 | ||
| 1819 | if (h->pure) | 1817 | if (h->pure) |
diff --git a/src/profiler.c b/src/profiler.c index 08ef6ee9623..6dc0d8ce72d 100644 --- a/src/profiler.c +++ b/src/profiler.c | |||
| @@ -44,9 +44,8 @@ make_log (EMACS_INT heap_size, EMACS_INT max_stack_depth) | |||
| 44 | a special way. This is OK as long as the object is not exposed | 44 | a special way. This is OK as long as the object is not exposed |
| 45 | to Elisp, i.e. until it is returned by *-profiler-log, after which | 45 | to Elisp, i.e. until it is returned by *-profiler-log, after which |
| 46 | it can't be used any more. */ | 46 | it can't be used any more. */ |
| 47 | Lisp_Object log = make_hash_table (hashtest_profiler, | 47 | Lisp_Object log = make_hash_table (hashtest_profiler, heap_size, |
| 48 | make_number (heap_size), | 48 | DEFAULT_REHASH_SIZE, |
| 49 | make_float (DEFAULT_REHASH_SIZE), | ||
| 50 | DEFAULT_REHASH_THRESHOLD, | 49 | DEFAULT_REHASH_THRESHOLD, |
| 51 | Qnil, false); | 50 | Qnil, false); |
| 52 | struct Lisp_Hash_Table *h = XHASH_TABLE (log); | 51 | struct Lisp_Hash_Table *h = XHASH_TABLE (log); |
diff --git a/src/xterm.c b/src/xterm.c index b04c6999b39..52bc8f9eca2 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -12874,8 +12874,8 @@ keysyms. The default is nil, which is the same as `super'. */); | |||
| 12874 | 12874 | ||
| 12875 | DEFVAR_LISP ("x-keysym-table", Vx_keysym_table, | 12875 | DEFVAR_LISP ("x-keysym-table", Vx_keysym_table, |
| 12876 | doc: /* Hash table of character codes indexed by X keysym codes. */); | 12876 | doc: /* Hash table of character codes indexed by X keysym codes. */); |
| 12877 | Vx_keysym_table = make_hash_table (hashtest_eql, make_number (900), | 12877 | Vx_keysym_table = make_hash_table (hashtest_eql, 900, |
| 12878 | make_float (DEFAULT_REHASH_SIZE), | 12878 | DEFAULT_REHASH_SIZE, |
| 12879 | DEFAULT_REHASH_THRESHOLD, | 12879 | DEFAULT_REHASH_THRESHOLD, |
| 12880 | Qnil, false); | 12880 | Qnil, false); |
| 12881 | 12881 | ||