Add DOHASH_SAFE, make DOHASH faster (bug#68690)
authorMattias Engdegård <mattiase@acm.org>
Thu, 25 Jan 2024 17:56:03 +0000 (18:56 +0100)
committerMattias Engdegård <mattiase@acm.org>
Sat, 27 Jan 2024 11:37:53 +0000 (12:37 +0100)
commitda726c6de201cdb9123bd99e22206dbed5fdc50f
tree7211aebebf8b41c6aa2206882ae2ed271eba479b
parent9b3f43fa08b2672a5ef33b872b2c6d1b0e881b88
Add DOHASH_SAFE, make DOHASH faster (bug#68690)

Revert DOHASH to the fast (field-caching) implementation but with
an assertion to detect misuses.  Add DOHASH_SAFE for use in
code that must tolerate arbitrary mutation of the table being
iterated through.

* src/lisp.h (DOHASH): Go back to fast design that only allows
restricted mutation, but with a checking assertion.
(DOHASH_SAFE): New macro that tolerates arbitrary mutation while being
much simpler (and acceptably fast).
* src/fns.c (Fmaphash):
* src/comp.c (compile_function, Fcomp__compile_ctxt_to_file):
Use DOHASH_SAFE.
src/comp.c
src/fns.c
src/lisp.h