[GTO] Update struct field indices after localizing operands #9108
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 182 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.312
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #9108"
general
weight: 0.35
stevenfontanella
PR #9043 ("Avoid newly exposing prototypes in GTO") introduced prepending
an i8 placeholder field at index 0 of exposed no-proto descriptors when
their first field becomes prototype-exposing. When all fields of such a
descriptor are kept, the new index of the last field equals the old
struct's
fields.size().Because
updateInstructionsruns beforeupdateTypes(so expressionheap types still refer to the pre-optimization
Structdefinitions), andFieldRemoveris aPostWalker, childstruct.get,struct.rmw, andstruct.cmpxchginstructions had theirindexmutated in-place to thenew index before an enclosing
struct.neworstruct.setranChildLocalizerorgetResultOfFirst. WhenEffectAnalyzersubsequentlyinspected those child instructions,
readsStructaccessedtype.getStruct().fields[index]using the oldHeapTypeand the newindex, causing an out-of-bounds assertion failure (__n < this->size())or reading the wrong field's mutability.
Fix this by splitting instruction updating into two passes executed in a
single nested
PassRunnerinvocation (FieldRemoverfollowed byIndexUpdater), along with sequentialrunOnModuleCoderuns.FieldRemoverremoves/reordersstruct.newoperands and replacesremoved
struct.sets while all struct instructions still have their oldfield indices matching their old
HeapTypes, andIndexUpdaterthenupdates the field indices on all remaining struct instructions.