chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-janitors] #1293: Locatives get moved around causing hash ta


From: Chicken Trac
Subject: Re: [Chicken-janitors] #1293: Locatives get moved around causing hash tables to lose them
Date: Fri, 27 May 2016 14:26:17 -0000

#1293: Locatives get moved around causing hash tables to lose them
-----------------------------+---------------------------------------------
  Reporter:  sjamaan         |      Owner:
      Type:  defect          |     Status:  new
  Priority:  major           |  Milestone:  4.12.0
 Component:  core libraries  |    Version:  4.10.x
Resolution:                  |   Keywords:  srfi-69, hash tables, locatives
-----------------------------+---------------------------------------------

Comment (by jacius):

 Context from IRC:

 <jacius> I am having the weirdest bug. If I erase an unused slot from the
 source code of a record type, it greatly changes the behavior of my app.
 <jacius> No code is referencing the slot, and I can rename the slot with
 no effect. But if I delete it from the code things break.
 <jacius> Also if I change the order of the slots, things break.

 (later)

 <jacius> Okay, I think I have narrowed down my weird bug. I think it's
 related to hashing behavior for records and locatives.
 <jacius> I think that if a record holds a locative in any of its first
 three slots,  the record's hash will change after GC.
 <jacius> But not if the locative is in the 4th or later slots.
 <jacius> I think this also applies recursively for records that hold
 records that hold locatives.
 <jacius> So, I think my app was breaking because I was using a record as a
 key in a hash table, but the record's hash was changing after GC. Whee.
 <evhan> jacius: Wow, that's a pretty nice bug.
 <evhan> "Good work." :)
 <jacius> That's my theory, anyway. Making a minimal test case to see if I
 am right.
 <jacius> I am surprised that the result of eq?-hash depends on the
 record's contents
 <evhan> I think eq?-hash should just use the object's address.
 <jacius> That's what I would think too
 <jacius> Oh
 <jacius> So maybe the record itself is moving during GC, so its address
 changes?
 <jacius> No, that can't be it
 <jacius> Because it only changes if one of the first three slots holds a
 locative

--
Ticket URL: <http://bugs.call-cc.org/ticket/1293#comment:1>
CHICKEN Scheme <http://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]