pub unsafe extern "C" fn logos_rt_str_append(
frame: *mut i64,
handle_slot: i64,
src: i64,
src_len: i64,
)Expand description
MUTABLE-Text append helper for the MicroOp::StrAppend regalloc lowering of a
Set text to text + <s> build loop. frame[handle_slot] holds a *mut Value
pointing AT THE VM REGISTER CELL holding the accumulator (planted at region
entry). src/src_len carry the appended operand:
src_len < 0— BYTE form:srcis a single ASCII byte VALUE (0..=127); the appended text is that one character.src_len >= 0— CONST form:srcis a*const u8tosrc_lenbytes (a baked ASCII literal).
The grow reproduces the VM’s Vm::add_assign semantics EXACTLY so the
tiered run is BIT-IDENTICAL to the tree-walker for every alias case:
- if the accumulator is a sole-owned
Rc<String>(Rc::get_mutsucceeds), it is extended IN PLACE (String::push_str); - otherwise (the
Rcis aliased — a capturedSet saved to text) it is grown COPY-ON-WRITE through the kernel’sarith::add(Rc::new(format!("{a}{b}")), the SAME pathadd_assignfalls through to), and the FRESHRcreplaces the accumulator’s cell — the alias keeps its own (unchanged)Rc; - a non-
Textaccumulator (never planted — the entry pin declines a non-Text) still falls to the kerneladd, matching the bytecode.
§Safety
frame[handle_slot] must be the live *mut Value planted by the region-entry
pin loop; for the CONST form src must point to src_len readable ASCII bytes
valid for the call. The single accumulator cell is exclusively reachable for
the native run (no other code touches that register), so the &mut Value is
non-aliasing.