- air: types local/ref/mut/array/slice/slice_mut, from-returns, multi-result binding, 18 new instructions; feature gating reports E0006 feature_not_declared; borrow-typed block parameters gated by borrow_joins; printer and round-trip tests for all new forms - verifier: second-class and zeroable type rules (E1001); local.alloc only in entry (E5002); frame size accounting (E5101); stages init (E1010), borrow (E2101, E2102, E2105-E2108) and bounds facts (E2103); value types shared between stages - interp: frame cells, places, slices, deep copies between storage and SSA values, T0008 bounds traps - features arrays and ownership supported; implemented_phase = 1 - conformance: 5 accept, 18 reject, 11 run tests for Phase 1, including the file-copy core exit program; 6000 mutants without a crash
31 lines
692 B
LLVM
31 lines
692 B
LLVM
; slice.copy copies len(src) elements into the start of a longer destination.
|
|
; expect: run
|
|
; result: [9,9,0,0]
|
|
; phase: 1
|
|
; spec: docs/spec/07a-air-instructions.md
|
|
module test.copy_into_prefix
|
|
air 0
|
|
lang 0.1
|
|
features [arrays, ownership]
|
|
|
|
fn @main() -> array<u8, 4>
|
|
effects []
|
|
entry:
|
|
%x = local.alloc array<u8, 2>
|
|
%y = local.alloc array<u8, 4>
|
|
%nine = const.u8 9
|
|
%a = array.splat array<u8, 2> %nine
|
|
local.store %x, %a
|
|
local.zero %y
|
|
%rx = borrow.ref %x
|
|
%sx = slice.make %rx
|
|
%my = borrow.mut %y
|
|
%sy = slice.make %my
|
|
slice.copy %sy, %sx
|
|
borrow.end %sy
|
|
borrow.end %my
|
|
borrow.end %sx
|
|
borrow.end %rx
|
|
%out = local.load %y
|
|
ret %out
|