Skip to main content

patch_seq_list_push

Function patch_seq_list_push 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn patch_seq_list_push(stack: Stack) -> Stack
Expand description

Append an element to a list with COW optimization.

Stack effect: ( Variant Value – Variant )

Fast path: if the list (at sp-2) is a sole-owned heap value, mutates in place via peek_heap_mut_second — no Arc alloc/dealloc cycle. Slow path: pops, clones, and pushes a new list.

§Safety

Stack must have a Value on top and a Variant (list) below