spasm: Hang with large numbers of labels


The hash table implementation backing labels and preprocessor replacements is unable to resize the table after creation, and gets stuck in entry insertion when there are no longer any free table entries.

This problem has been observed in practice. A simple workaround would be to increase the value of MAX_LABELS beyond its current 7919, or a proper fix would be to implement rehashing at some particular load factor.

See also, https://bitbucket.org/tari/spasm-emscripten/issue/1/hang-with-large-numbers-of-labels


BuckeyeDude wrote Dec 20, 2014 at 8:00 AM

The hash implementation in hash.c is deprecated. I'd recommend using the new hash implementation in hashmap.cpp. It will use an unordered_map to implement the hash functions used by spasm, thus bypassing your current issue. I believe its #ifdef'd on line 17 of hash.h