[pypy-dev] RPython hashes no longer preserved across translation

Carl Friedrich Bolz cfbolz at gmx.de
Sat Jan 28 07:42:35 EST 2017


Hi Armin, 

That sounds like a good simplification to me. 

Cheers, 
Carl Friedrich

On January 28, 2017 1:28:18 PM GMT+01:00, Armin Rigo <armin.rigo at gmail.com> wrote:
>Hi all,
>
>I would like to merge the branch "rpython-hash".  That branch drops
>the RPython requirement that hashes (notably of prebuilt instances)
>don't change across translation.  By dropping it, I could remove some
>cruft at various places, and it makes the life a bit easier for other
>systems like STM, too.
>
>The motivation is that in py3.5 we're considering the hash
>randomization feature again, for strings.  This feature is not
>compatible at all with the idea that hashes should not change.  So
>with "rpython-hash" it should be possible, at translation-time, to
>choose the algorithm used by CPython 3.5 (siphash-2-4), and moreover
>with an optional seed at runtime.
>
>The main place that relied on the hashes not changing is prebuilt
>dictionaries.  That branch fixes them by not including the "indexes"
>part at all during translation, and rebuilding the index on the first
>usage.
>
>There were only three places I found in PyPy that relied on this
>feature: weakrefs caching the hash of their referent; frozensets
>caching their own hash; and a detail inside _cffi_backend.  All places
>needed fixing, but that was easy.
>
>I think it's a good move and a small simplification of RPython
>internals.  Of course it might break other RPython-based interpreters
>out there.  Any feedback about that would be appreciated.
>
>
>A bientôt,
>
>Armin.
>_______________________________________________
>pypy-dev mailing list
>pypy-dev at python.org
>https://mail.python.org/mailman/listinfo/pypy-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20170128/35096e51/attachment.html>


More information about the pypy-dev mailing list