Subject: Re: bug#68690: Segmentation fault building with native-comp

From: Stefan Monnier <[email-masked]>
Date: Thu, 25 Jan 2024 10:58:03 -0500

>> I wonder if a puthash while being in a DOHASH (which is the ASAN failure
>> I showed) is something we should pursue. I don't think that's something
>> that's guaranteed to work in a meaningful way. WDYT?

The original DOHASH's comment indeed said it didn't support that
operation, yet the code used DOHASH to implement `maphash`, which *does*
support such operations, and it used DOHASH in places which perform such
operations, so I think it's clear we do want to support `puthash` there.

> BTW, I'm using the code below for CL packages, which have a hash table.
> A bit less hideous ;-)

Nice.

The motivation for the change from `DOHASH (h, i)` to `DOHASH (h, k, v)`
was not only to offer cleaner code but also to avoid reloading
`h->key_and_value` and `h->table_size` at every iteration
(`h->key_and_value` is particularly annoying because it's on the
critical path to load `key` and `value`).

        Stefan