Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/tests/compiler/progs/handles_exhaust.osc # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / tests / compiler / progs / handles_exhaust.osc` 51 lines ยท 1387 bytes Raw Blame History 1 // entry: retire full cycle 2 // OSC-3 item 2: a declared generation base reaches exhaustion in a test. A slot 3 // freed at generation 2^64 - 1 is retired, never wrapped; allocating when every 4 // slot is live or retired traps RETIRED (some slot retired) or POOL_FULL. 5 // expect-run: retire 2 -> 3 6 // expect-run: retire 3 -> trap=RETIRED 7 // expect-run: full 3 -> 3 8 // expect-run: full 4 -> trap=POOL_FULL 9 // expect-run: cycle 100 -> 4950 10 // (cycle: 100 allocations from one slot; the model replay re-windows past 11 // its 64 handle ids) 12 fn retire(n: u8) -> i64 { 13 let mut s: i64 = 0; 14 pool p: [i64; 1] gen `18446744073709551614` { 15 let mut i: u8 = 0; 16 while i < n bound 8 { 17 let h: handle p = p.alloc(i as i64); 18 s = s + p[h] + 1; 19 p.free(h); 20 i = i + 1; 21 } 22 } 23 return s; 24 } 25 26 fn full(n: u8) -> i64 { 27 let mut s: i64 = 0; 28 pool p: [i64; 3] { 29 let mut i: u8 = 0; 30 while i < n bound 8 { 31 let h: handle p = p.alloc(i as i64); 32 s = s + p[h]; 33 i = i + 1; 34 } 35 } 36 return s; 37 } 38 39 fn cycle(n: u8) -> i64 { 40 let mut s: i64 = 0; 41 pool p: [i64; 1] { 42 let mut i: u8 = 0; 43 while i < n bound 200 { 44 let h: handle p = p.alloc(i as i64); 45 s = s + p[h]; 46 p.free(h); 47 i = i + 1; 48 } 49 } 50 return s; 51 }