# New Ticket Created by Jason Gloudon # Please include the string: [perl #16670] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=16670 >
find_bucket as writen is GC-unsafe. This patch corrects this, by not reusing old values of bucket pointers across calls to string_compare, which can invoke compaction, causing the bucket to move. I have code to fix the same problem in hash_delete, but hash_delete does not appear to be used, so I can't test it. -- Jason -- attachment 1 ------------------------------------------------------ url: http://rt.perl.org/rt2/attach/34819/28529/9eadc8/hash.diff
Index: hash.c =================================================================== RCS file: /cvs/public/parrot/hash.c,v retrieving revision 1.24 diff -u -r1.24 hash.c --- hash.c 19 Aug 2002 23:14:48 -0000 1.24 +++ hash.c 20 Aug 2002 15:02:57 -0000 @@ -275,15 +275,19 @@ static HASHBUCKET * find_bucket(Interp *interpreter, HASH* hash, BucketIndex head, STRING *key) { + BucketIndex next; if (head == NULLBucketIndex) return NULL; if (key != NULL) { HASHBUCKET* bucket = getBucket(hash, head); while (bucket != NULL) { + next = bucket->next; + if (string_compare(interpreter, key, bucket->key) == 0) { - return bucket; + return getBucket(hash, head); } - bucket = getBucket(hash, bucket->next); + head = next; + bucket = getBucket(hash, next); } } else {