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.
(cherry picked from commit
da726c6de201cdb9123bd99e22206dbed5fdc50f)