[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-janitors] #1293: eq?-hash tables calculcate different value
From: |
Chicken Trac |
Subject: |
Re: [Chicken-janitors] #1293: eq?-hash tables calculcate different value for objects after they're mutated and lose locatives after GC |
Date: |
Tue, 23 Aug 2016 19:45:43 -0000 |
#1293: eq?-hash tables calculcate different value for objects after they're
mutated and lose locatives after GC
-----------------------------+---------------------------------------------
Reporter: sjamaan | Owner:
Type: defect | Status: new
Priority: critical | Milestone: 4.12.0
Component: core libraries | Version: 4.10.x
Resolution: | Keywords: srfi-69, hash tables, locatives
-----------------------------+---------------------------------------------
Comment (by sjamaan):
One (very) ugly way to "fix" this is to change `hash-by-identity`: It can
simply hash the object's pointer, and record it in a side table along with
the current pointer. This means that every object that ever was hashed
has an entry in that table.
Whenever the object is moved, update the current pointer. Then, if the
object is looked up again we can obtain the originally assigned hash
value. On major GC, walk the table and remove all the keys that no longer
exist.
It's ugly and stupid and takes up a lot of unnecessary memory. I really
don't like it, but we could do this in a generic/reusable way and also use
it in core's symbol table, for example.
--
Ticket URL: <http://bugs.call-cc.org/ticket/1293#comment:7>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.