module_version_1 tests: read a symbol table record's name only for the codes it spells

vst_record read the characters of any record before matching its code; a code
it does not abbreviate is now written unabbreviated before its operands are read
as characters.

(cherry picked from commit a507f448ca63b001225486ee648219a9e6f54e32)
This commit is contained in:
Anees Iqbal committed 2026-11-08 10:15:51 -08:00
1 parent c178704fef
commit 1dc4e8ab46
1 file changed
+7 -9
@@ -395,19 +395,17 @@ fn write_record(w: &mut BitWriter, code: u32, ops: &[u64], blob: Option<&[u8]>)
/// [`VST_ABBREVS`] by their characters' width (a basic block's 7-bit name takes the 8-bit one),
/// `VST_FNENTRY` through [`FNENTRY_ABBREVS`].
fn vst_record(w: &mut BitWriter, code: u32, ops: &[u64]) {
let chars = if code == VST_FNENTRY { 2 } else { 1 };
let (ids, chars) = match code {
VST_ENTRY => ([4, 5, 6], 1),
VST_BBENTRY => ([4, 4, 7], 1),
VST_FNENTRY => ([8, 9, 10], 2),
_ => return w.record(code, ops),
};
let name: Vec<u8> = ops[chars..]
.iter()
.map(|&c| u8::try_from(c).expect("a byte"))
.collect();
let width = name_width(&name);
let id = match code {
VST_ENTRY => [4, 5, 6][width],
VST_BBENTRY => [4, 4, 7][width],
VST_FNENTRY => [8, 9, 10][width],
_ => return w.record(code, ops),
};
w.abbreviated(id, code, ops, None);
w.abbreviated(ids[name_width(&name)], code, ops, None);
}
/// Copy the rest of block `id`, just entered, as read (a function's symbol table spelled as