Bug Fixes
-
Fix undefined 32-bit shift in packrat
mix()on wasm32 (4b3bd64): The packrat cache's hash function performedh >> 32on asize_t-typed value. On wasm32, wheresize_tis 32 bits, this shift is undefined behavior — clang -O2 detected it and collapsed the packrat lookup intounreachable, causing a trap at parse time. Fixed by mixing inuint64_tand narrowing at the end (bit-identical to the previous behavior on 64-bit targets). -
Serialize grammar definitions in name order (73a37a3):
GrammarBlob::serializewalkedGrammar(astd::unordered_map) in its raw iteration order, which is implementation-defined — the same grammar could produce different byte sequences under different standard libraries, making a checked-in blob non-byte-comparable across platforms. Fixed by emitting definitions sorted by name (deserialize()rebuilds the map from names, so nothing depends on the order).
Both fixes include new tests in test_serialize.cc.