From 9b4f8302682b75b291f1c3b4f49c0c5ed5b2ecf3 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 2 Mar 2016 10:42:57 -0700 Subject: [PATCH] improve hashing on structs, especially prefabs Use the structure-type name, in addition to the structure content. Including the name is espeically useful for distinguishing prefabs structs that differ in the prefab name. --- racket/src/racket/src/hash.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/racket/src/racket/src/hash.c b/racket/src/racket/src/hash.c index 31eb672737..59cdae159e 100644 --- a/racket/src/racket/src/hash.c +++ b/racket/src/racket/src/hash.c @@ -1699,6 +1699,12 @@ static uintptr_t equal_hash_key(Scheme_Object *o, uintptr_t k, Hash_Info *hi) hi->depth += 2; + /* Use structure-type names (especially for prefabs): */ + for (i = s1->stype->name_pos+1; i--; ) { + k += equal_hash_key(s1->stype->parent_types[i]->name, 0, hi); + MZ_MIX(k); + } + for (i = SCHEME_STRUCT_NUM_SLOTS(s1); i--; ) { if (SAME_OBJ(o, orig_obj)) elem = s1->slots[i];