From 16ea060382e52db998f883337b412cf8253c8180 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Mon, 20 Apr 2026 14:06:34 -0700 Subject: [PATCH] fix source of vmap baking determinism issue, + fix use-after-free from cross-lane scratch usage --- src/rdi_from_pdb/rdi_from_pdb.c | 1 + src/rdi_make/rdi_make_local.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rdi_from_pdb/rdi_from_pdb.c b/src/rdi_from_pdb/rdi_from_pdb.c index 5089378b..fa5de982 100644 --- a/src/rdi_from_pdb/rdi_from_pdb.c +++ b/src/rdi_from_pdb/rdi_from_pdb.c @@ -4837,6 +4837,7 @@ p2r_convert(Arena *arena, P2R_ConvertParams *params) result.line_tables = all_line_tables; } + lane_sync(); scratch_end(scratch); return result; } diff --git a/src/rdi_make/rdi_make_local.c b/src/rdi_make/rdi_make_local.c index e641be7c..f228b117 100644 --- a/src/rdi_make/rdi_make_local.c +++ b/src/rdi_make/rdi_make_local.c @@ -881,7 +881,7 @@ rdim_bake(Arena *arena, RDIM_BakeParams *params) } } } - + lane_sync(); scratch_end(scratch); } lane_sync(); @@ -3202,7 +3202,7 @@ rdim_bake(Arena *arena, RDIM_BakeParams *params) for EachNode(case_n, RDIM_LocationCase, s->location_cases.first) { lane_chunk_constant_data_counts[slot_idx] += case_n->location.value_data.size; - lane_chunk_bytecode_data_counts[slot_idx] += case_n->location.bytecode.encoded_size; + lane_chunk_bytecode_data_counts[slot_idx] += case_n->location.bytecode.encoded_size + 1; // NOTE(rjf): +1 for the `stop` op } } chunk_idx += 1;