pub enum RefTarget {
Local {
frame_index: u32,
slot_index: u32,
kind: NativeKind,
},
ModuleBinding {
binding_idx: u32,
kind: NativeKind,
},
TypedField {
receiver: TypedObjectPtr,
field_offset: u32,
kind: NativeKind,
},
}Expand description
Kinded reference target.
Each variant carries the NativeKind of the projected slot — what
you get when you deref the reference, not what you reference into.
Threaded from the producing-opcode emit at MakeRef /
MakeFieldRef / MakeIndexRef time per ADR-006 §2.7.13.
Variants§
Local
Reference to a local stack slot.
frame_index is the index into VirtualMachine.call_stack at
MakeRef time; slot_index is the offset from that frame’s
base_pointer (i.e. the local-slot ordinal). kind is the
NativeKind of the slot at construction time, sourced from the
stack’s §2.7.7 parallel-kind track.
Local-shaped refs do NOT escape their originating frame —
the MIR ref-escape analysis (mir/lowering/mod.rs, ADR-006
§3.1) rejects closure capture / function return of a Local
ref at compile time.
ModuleBinding
Reference to a module binding.
binding_idx is the position in
VirtualMachine.module_bindings; kind is sourced from the
module-binding §2.7.8 parallel-kind track at construction
time.
TypedField
Projected reference into a typed-object field.
receiver keeps the projected object alive via the v2-raw
TypedObjectPtr carrier (ADR-006 §2.3 typed-Arc carrier — one
HeapHeader-at-offset-0 refcount share, retained/released through
v2_retain / TypedObjectStorage::release_elem). Production
TypedObjectStorage is allocated via the v2-raw _new path
(op_new_typed_object), so the receiver slot bits are the raw
struct pointer (HeapHeader at offset 0); the wrapper matches that
allocation provenance. field_offset is the slot index inside
TypedObjectStorage.slots (the schema-resolved field_idx from
Operand::TypedField); kind is the projected slot’s
NativeKind, sourced from the emitter’s field_type_tag.
Implementations§
Source§impl RefTarget
impl RefTarget
Sourcepub fn projected_kind(&self) -> NativeKind
pub fn projected_kind(&self) -> NativeKind
The NativeKind of the projected slot — what op_deref_load
will push, and what op_deref_store expects.