[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/hash-table-perf 4e8d7725fd4 11/35: ; * src/fns.c (Fmake_hash_tab
From: |
Mattias Engdegård |
Subject: |
scratch/hash-table-perf 4e8d7725fd4 11/35: ; * src/fns.c (Fmake_hash_table): ensure `test` is a bare symbol |
Date: |
Thu, 4 Jan 2024 10:56:41 -0500 (EST) |
branch: scratch/hash-table-perf
commit 4e8d7725fd46443cec1dc5d109fb3ffd5d0882c1
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>
; * src/fns.c (Fmake_hash_table): ensure `test` is a bare symbol
---
src/fns.c | 25 +++++++++++--------------
src/lisp.h | 2 +-
2 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/src/fns.c b/src/fns.c
index 2ba29f42b75..7cccabe74a2 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -5299,10 +5299,6 @@ in an error.
usage: (make-hash-table &rest KEYWORD-ARGS) */)
(ptrdiff_t nargs, Lisp_Object *args)
{
- Lisp_Object test, weak;
- bool purecopy;
- struct hash_table_test testdesc;
- ptrdiff_t i;
USE_SAFE_ALLOCA;
/* The vector `used' is used to keep track of arguments that
@@ -5311,20 +5307,21 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
memset (used, 0, nargs * sizeof *used);
/* See if there's a `:test TEST' among the arguments. */
- i = get_key_arg (QCtest, nargs, args, used);
- test = i ? args[i] : Qeql;
- if (EQ (test, Qeq))
+ ptrdiff_t i = get_key_arg (QCtest, nargs, args, used);
+ Lisp_Object test = i ? args[i] : Qeql;
+ if (symbols_with_pos_enabled && SYMBOL_WITH_POS_P (test))
+ test = SYMBOL_WITH_POS_SYM (test);
+ struct hash_table_test testdesc;
+ if (BASE_EQ (test, Qeq))
testdesc = hashtest_eq;
- else if (EQ (test, Qeql))
+ else if (BASE_EQ (test, Qeql))
testdesc = hashtest_eql;
- else if (EQ (test, Qequal))
+ else if (BASE_EQ (test, Qequal))
testdesc = hashtest_equal;
else
{
/* See if it is a user-defined test. */
- Lisp_Object prop;
-
- prop = Fget (test, Qhash_table_test);
+ Lisp_Object prop = Fget (test, Qhash_table_test);
if (!CONSP (prop) || !CONSP (XCDR (prop)))
signal_error ("Invalid hash table test", test);
testdesc.name = test;
@@ -5336,7 +5333,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
/* See if there's a `:purecopy PURECOPY' argument. */
i = get_key_arg (QCpurecopy, nargs, args, used);
- purecopy = i && !NILP (args[i]);
+ bool purecopy = i && !NILP (args[i]);
/* See if there's a `:size SIZE' argument. */
i = get_key_arg (QCsize, nargs, args, used);
Lisp_Object size_arg = i ? args[i] : Qnil;
@@ -5370,7 +5367,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
/* Look for `:weakness WEAK'. */
i = get_key_arg (QCweakness, nargs, args, used);
- weak = i ? args[i] : Qnil;
+ Lisp_Object weak = i ? args[i] : Qnil;
if (EQ (weak, Qt))
weak = Qkey_and_value;
if (!NILP (weak)
diff --git a/src/lisp.h b/src/lisp.h
index 55decdcf5da..669ca3a8626 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2387,7 +2387,7 @@ struct Lisp_Hash_Table;
struct hash_table_test
{
- /* Name of the function used to compare keys. */
+ /* Function used to compare keys; always a bare symbol. */
Lisp_Object name;
/* User-supplied hash function, or nil. */
- scratch/hash-table-perf e2a6ce36d83 03/35: Decouple profiler from Lisp hash table internals, (continued)
- scratch/hash-table-perf e2a6ce36d83 03/35: Decouple profiler from Lisp hash table internals, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 9141966be51 09/35: ; * src/alloc.c (purecopy_hash_table): Simplify, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf fdc390f8dc0 10/35: Abstract predicate and constant for unused hash keys, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf c4df6041de8 12/35: * src/print.c (print_object): Don't print hash table test if `eql`., Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf f3e985a16ba 14/35: Don't print or read the hash table size parameter, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 1ebd00f6d0a 21/35: Retype hash interfaces to use EMACS_UINT instead of Lisp fixnum, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf fc68176120f 24/35: Use hash_hash_t for storing hash values, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 4b5d9f92abe 13/35: * src/print.c (print_object): Don't print empty hash-table data, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 310f6584ccb 18/35: Allow zero hash table size, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf e53398ab698 26/35: ; Reorder structs (hash and test), Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 4e8d7725fd4 11/35: ; * src/fns.c (Fmake_hash_table): ensure `test` is a bare symbol,
Mattias Engdegård <=
- scratch/hash-table-perf 8335891387a 22/35: Inlined and specialised hash table look-up, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 54807fee4d0 23/35: Use hash_idx_t for storing hash indices, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 8cd35079f4c 34/35: Don't pretend that hash-table-size is useful, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf e6defe82569 27/35: Change default hash table size to 8 (from 65), Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 422c91a822a 02/35: ; * src/pdumper.c (dump_hash_table): Remove unused argument., Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 3d2042c48a6 07/35: Refactor: extract hash index computation to a function, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf c188b9f2bf5 08/35: Refactor hash table vector reallocation, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 6ffbccbf1dd 15/35: Represent hash table weakness as an enum internally, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 3e9e68333ae 16/35: Remove rehash-threshold and rehash-size struct members, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 8e80d1930e3 20/35: Store hash values as EMACS_UINT instead of Lisp_Object, Mattias Engdegård, 2024/01/04