1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//! MIR `StatementKind::ObjectStore` schema-id threading.
//!
//! Phase 3 cluster-0 Round 16 W17-narrow-follow-up-A
//! (ADR-006 §2.7.5 stamp-at-compile-time).
//!
//! The MIR lowering pass at `crate::mir::lowering::*` produces
//! `StatementKind::ObjectStore { schema_id: None, .. }` because it
//! does not have direct access to the bytecode compiler's
//! `type_tracker.schema_registry`. This module supplies the post-MIR-
//! lowering back-patch that aligns the MIR-side `ObjectStore` carrier
//! with the parallel bytecode-side `OpCode::NewTypedObject` operand
//! (`Operand::TypedObjectAlloc { schema_id, field_count }`), so the
//! JIT MIR consumer at
//! `crates/shape-jit/src/mir_compiler/statements.rs::
//! StatementKind::ObjectStore` writes the user-declared schema id into
//! `(*ptr).schema_id` rather than the prior
//! `register_predeclared_any_schema` `__predecl_*`-named id.
//!
//! Resolution order at each `ObjectStore` site:
//!
//! 1. Named-struct path — if `mir.local_struct_type_names[container_slot]`
//! has an entry, look it up in `type_tracker.schema_registry()`.
//! Matches `Expr::StructLiteral { type_name, .. }` lowering — e.g.
//! `let t = X {}` in Smoke 3.
//!
//! 2. Anonymous-inline path — for `Expr::Object(...)` with no
//! spreads, use `register_inline_object_schema(&field_refs)` (the
//! same helper the bytecode-side compiler calls at
//! `crates/shape-vm/src/compiler/expressions/collections.rs:396`).
//! Empty-field-name entries (spread placeholders) are skipped.
//!
//! 3. Otherwise — leave `schema_id: None`. The downstream JIT
//! consumer surfaces-and-stops on `None` per ADR-006 §2.7.5
//! forbidden list (no `register_predeclared_any_schema` fallback,
//! no Bool-default).
//!
//! ADR-006 §2.7.5 forbidden list (refused on sight): no
//! `register_predeclared_any_schema` fallback, no
//! `register_predeclared_any_schema` resurrection under a rename.
//! Once the threading is wired, the JIT-side
//! `register_predeclared_any_schema` call site at
//! `crates/shape-jit/src/mir_compiler/statements.rs:152` is deleted in
//! the same commit.
use crate;
use crateTypeTracker;
/// Back-patch `StatementKind::ObjectStore { schema_id }` entries in
/// `mir` using `type_tracker.schema_registry()` for named structs and
/// `type_tracker.register_inline_object_schema()` for anonymous
/// inline objects.
///
/// Mutates `mir` in place. Statements that cannot be resolved
/// (unknown struct name, spread-bearing inline object) keep
/// `schema_id: None`; the downstream JIT consumer surfaces-and-stops
/// per the §2.7.5 discipline.
pub