diff options
| author | Paul Eggert | 2019-07-20 19:40:03 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-07-20 20:13:46 -0700 |
| commit | b6f194a0fb6dbd1b19aa01f95a955f5b8b23b40e (patch) | |
| tree | 009e3beff4781c98e733657d60003b3eee97e068 /src/bytecode.c | |
| parent | 5018b663c6c0d31f27fb44630a69d9e0bd73273d (diff) | |
| download | emacs-b6f194a0fb6dbd1b19aa01f95a955f5b8b23b40e.tar.gz emacs-b6f194a0fb6dbd1b19aa01f95a955f5b8b23b40e.zip | |
Simplify hashfn/cmpfn calling convention
* src/fns.c (cmpfn_eql, cmpfn_equal, cmpfn_user_defined)
(hashfn_eq, hashfn_equal, hashfn_eql, hashfn_user_defined):
* src/profiler.c (cmpfn_profiler, hashfn_profiler):
Use new calling convention where the return value is a fixnum
instead of EMACS_UINT. While we’re at it, put the hash table
at the end, since that’s a bit simpler and generates better
code (at least on the x86-64). All callers changed.
* src/fns.c (hash_lookup): Store fixnum rather than EMACS_UINT.
All callers changed.
(hash_put): Take a fixnum rather than an EMACS_UINT.
All callers changed. Remove unnecessary eassert (XUFIXNUM does it).
* src/lisp.h (struct hash_table_test):
Adjust signatures of cmpfn and hashfn.
Diffstat (limited to 'src/bytecode.c')
| -rw-r--r-- | src/bytecode.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/bytecode.c b/src/bytecode.c index 29dff44f007..e82de026a82 100644 --- a/src/bytecode.c +++ b/src/bytecode.c | |||
| @@ -1409,16 +1409,16 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 1409 | if (h->count <= 5) | 1409 | if (h->count <= 5) |
| 1410 | { /* Do a linear search if there are not many cases | 1410 | { /* Do a linear search if there are not many cases |
| 1411 | FIXME: 5 is arbitrarily chosen. */ | 1411 | FIXME: 5 is arbitrarily chosen. */ |
| 1412 | Lisp_Object hash_code = h->test.cmpfn | 1412 | Lisp_Object hash_code |
| 1413 | ? make_fixnum (h->test.hashfn (&h->test, v1)) : Qnil; | 1413 | = h->test.cmpfn ? h->test.hashfn (v1, &h->test) : Qnil; |
| 1414 | 1414 | ||
| 1415 | for (i = h->count; 0 <= --i; ) | 1415 | for (i = h->count; 0 <= --i; ) |
| 1416 | if (EQ (v1, HASH_KEY (h, i)) | 1416 | if (EQ (v1, HASH_KEY (h, i)) |
| 1417 | || (h->test.cmpfn | 1417 | || (h->test.cmpfn |
| 1418 | && EQ (hash_code, HASH_HASH (h, i)) | 1418 | && EQ (hash_code, HASH_HASH (h, i)) |
| 1419 | && h->test.cmpfn (&h->test, v1, HASH_KEY (h, i)))) | 1419 | && !NILP (h->test.cmpfn (v1, HASH_KEY (h, i), |
| 1420 | &h->test)))) | ||
| 1420 | break; | 1421 | break; |
| 1421 | |||
| 1422 | } | 1422 | } |
| 1423 | else | 1423 | else |
| 1424 | i = hash_lookup (h, v1, NULL); | 1424 | i = hash_lookup (h, v1, NULL); |