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-pdf/blob/main/corpus/expect/omegese.txt # omega-pdf Omega PDF: read and write PDF files in Omega Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-pdf / corpus / expect / omegese.txt` 2195 lines · 115798 bytes Raw Blame History 1 # Omegese: a program language built for the AI writer 2 Status: v1 (nested values, exact next oracle, 2026-10-15). Phase 1 done 3 (language, translator, checks, token measurement); 4 phase 2 started (section 7). 5 Tool: `tools/omegese/omegese.c`; tests: `make test-omegese`. Named Glyph until 6 2026-10-15 (the name was 7 taken); evidence recorded before then says glyph. Home: omegese.com (owned by 8 Drake since 2026-10-15). 9 ## 1. Why 10 exp445 (`docs/one_layer/EXP445_PROTOCOL.md`) asks AIs to write Omega programs as 11 OSC text, as a 12 JSON op list (`tools/omega_emit/SCHEMA.md`) and as hex bytes of the binary IR. 13 The cost and the 14 errors come from the same places: punctuation and keys (JSON), two characters 15 per byte (hex), and 16 bookkeeping the writer must do in its head: numbered registers with declared 17 types, numbered blocks, 18 byte offsets. Text avoids the bookkeeping but needs a compiler for a human- 19 readable language. 20 Omegese keeps the machine-first path (no human source language in production) 21 and removes the 22 bookkeeping and the punctuation. Its words are chosen from the writer model's 23 own vocabulary. 24 ## 2. Design rules 25 1. **Efficiency metric: verified programs per unit of inference cost.** Language 26 design optimizes 27 for verified programs produced per unit of inference cost (measured on held- 28 out tasks by 29 first-attempt correctness, successful compilation, verified behavior, 30 completion time, and total 31 compute cost), rather than treating single-token vocabulary as a rigid 32 language rule. 33 Fitting fixed words into single tokens under a specific tokenizer (e.g. Qwen3 34 where ops, types, 35 and keywords were verified as single tokens with a leading space) is an 36 empirical token-cost 37 consideration, not a binding constraint on the language definition. The 38 compiler-guided interface 39 must remain portable across models and tokenizers. 40 There is no punctuation besides `=` (also one token, and optional) and the 41 optional brackets `( )`; 42 no commas, no indentation. Values nest in prefix order (every op takes a 43 fixed number of values), 44 so brackets are never needed. Numbers cost one token for the space plus one 45 per digit under tokenizers 46 that split digits. 47 2. **Types are inferred.** Only parameters, the return type, conversions, typed 48 numbers 49 (`uint 5`) and new arrays name a type. A value's type comes from the op that 50 makes it, bottom-up 51 through nested values; a number takes the type of the other value in its op. 52 This removes the 53 "register declared one type, written with another" error class. 54 3. **Names, not numbers.** Values are named; registers, blocks and branch 55 targets are numbered by 56 the translator. Control is structured (`if`/`else`/`end`, `while`, `for`). 57 4. **Scope gives definite assignment.** A name first written inside an `if`, 58 `else`, `while` or 59 `for` dies at its `end`; to carry a value out, write it before the block. So 60 every read is 61 written on every path by construction. 62 Every name written must be read before its scope ends (parameters and loop 63 counters excepted), so a 64 misspelled word (the short form turns `rte a` into a new name) or a forgotten 65 value is refused. 66 No name hides a visible one (loop names included). Parameter names are 67 distinct. Calls go to earlier functions only, with each argument checked 68 against the parameter (arrays: own from own, edit from own or edit, view from 69 any). 70 5. **Loops are proven to end.** Every loop lowers to the shape checker2 proves 71 terminating 72 (`src/checker2/c2_check.c`, "loop bounds"; the shape oscc emits for 73 `while ... bound N`). 74 6. **Prefix-decidable.** After any prefix the checker knows which words may come 75 next 76 (`omegese next`): the mask an inference engine can apply while the model 77 writes, so an invalid 78 program cannot be written. 79 7. **Same trust chain.** Omegese -> omega_emit op list -> canonical OSC binary 80 IR -> checker2 -> 81 signed receipt. Omegese changes nothing after the op list. 82 ## 3. The language 83 A program is one or more functions. A line holds one statement; words are 84 separated by spaces. 85 ``` 86 fn ( )* to | void a function; `end` closes it 87 = write a value (a new name, or an existing one of the 88 same type); 89 the same, with `=` left out 90 if / else / end 91 while [bound N] / end N 1..`9223372036854775807` (a number or any 92 integer const; IR 93 mode: 1..`1000000`), default `1000000`; past N iterations: 94 trap 4 95 for [bound N] / end name = 0 .. count-1 (count a number, 96 or a value of that 97 type; IR mode: a number count 0..`1000000`); N as for 98 while. With no bound a 99 number count is not guarded and any other count traps 100 4 after `1000000` 101 passes; with `bound N` any count traps 4 after N 102 passes (the counter may 103 be written in the body) 104 break leave the innermost loop; outside a loop: error 9. 105 Like ret, it ends the 106 path (a later line in the same block is error 17) 107 continue jump to the next iteration: a while's head, a for's 108 increment. Outside a 109 loop: error 9. Like ret, it ends the path (a later 110 line is error 17) 111 ret [] 112 put store 113 trap stop with that code (out of range: error 8). Program 114 mode exits 100 + code; 115 function mode calls OscRt.trap. Like ret, it ends the 116 path (a later line in 117 the same block is error 17) 118 call a function that returns nothing 119 ``` 120 Values are prefix expressions. Every op takes a fixed number of values, and each 121 of those values may 122 itself be an op, so no brackets are needed: `add mul r r 4` is add(mul(r, r), 123 4), and 124 `eq rem n 2 0` is eq(rem(n, 2), 0). 125 | value | takes | meaning | IR | 126 |---|---|---|---| 127 | `` / number | 0 | copy | mov / const | 128 | `add sub mul div rem and or xor shl shr` a b | 2 | arithmetic, bitwise, shifts 129 (shift amount any whole-number type) | bin | 130 | `eq ne lt le gt ge` a b | 2 | comparison, gives bool | cmp | 131 | `neg` a / `not` a | 1 | negate (signed) / logical not (bool) or bitwise not 132 (number) | un | 133 | `` a | 1 | a typed number (`uint 5`) or a conversion (`ulong x`, `ulong 134 add a b`) | const / cast | 135 | `get` arr i | 2 | load (arr is an array name) | load | 136 | `new` type len init | 3 | a new own array of len elements (omc: 1..`16777216`, 137 at most 4 MiB of local arrays, s.9.4; the C reference path through OSC IR: 138 1..64, `OSC_MAX_ARRAY_LEN`); only as the whole value of ` =` | alloc | 139 | `own` / `edit` / `view` arr | 1 | move / mutable borrow / shared borrow (arr 140 is an array name) | mov | 141 | `` args | its parameter count | call an earlier function | call | 142 Brackets are optional grouping: `( )` holds exactly one complete value 143 and changes nothing 144 else (`sub diff (i64 b)` = `sub diff i64 b`). A `(` without its `)`, a `)` 145 without its `(`, an empty 146 `( )`, or a `( )` holding more than one value is refused. `(` and `)` are 147 separate words even when 148 written against a name. 149 Typing is bottom-up. A value's type comes from its op; a bare number takes the 150 type of the other 151 value of its op (`add x 1`, `sub 15 i`, `shl 1 sh`), or the type the place needs 152 when it stands 153 alone (`ret 0`, `x = 5` for an existing x, a call argument, an index is uint). 154 Two bare numbers in one 155 op are refused (`add 1 2`, also when nested: `add a mul 2 3`). Comparisons give 156 bool. In a shift a 157 bare number on the left takes the type of the shift amount (`shl 1 sh` with sh 158 uchar shifts a uchar); 159 write its type when you mean another (`shl ulong 1 sh`). A typed number inside a 160 conversion is 161 converted (`long int 5` is the int 5 converted to long; `uchar int 300` traps 162 5). 163 A condition is any value that gives bool (`while ne b 0`, `if or lt p -32768 gt 164 p 32767`). Values may 165 be nested wherever a value goes: after `=`, `ret`, `if`, `while`, `put` (index 166 and value), call 167 arguments, a `for` count, inside conversions. `and`, `or` evaluate both sides 168 (no short cut). 169 A wrong number of values is refused with its place: `line 3: le has 3 values 170 after it; it takes 2`, 171 `line 2: sub has 1 value after it; it takes 2`, `extra words at the end of the 172 line: 'b'`. 173 Types: `bool uchar ushort uint ulong byte short int long` = bool u8 u16 u32 u64 174 i8 i16 i32 i64 175 (the IR names `u8` .. `i64` are accepted too, as the task signature writes them; 176 they cost 2 or 3 tokens) 177 (`u32` is three Qwen3 tokens; `uint` is one). Arrays: `own|edit|view 178 `. 179 Example (dev04): 180 ``` 181 fn gcd a uint b uint to uint 182 while ne b 0 bound 100 183 t = rem a b 184 a = b 185 b = t 186 end 187 ret a 188 end 189 ``` 190 ## 4. Lowering 191 Numbers are hoisted into the entry block, one CONST per distinct value and type 192 (so the loop bound 193 is defined exactly once, as checker2 requires). Blocks are numbered in the order 194 they start. 195 - `while c bound N`: hidden ulong counter = 0; head: c -> guard | exit; guard: 196 `ge counter N` -> 197 trap block (trap 4, br exit) | body; the body starts with `counter = add 198 counter 1`. 199 - `for i T K` (K a number or an integer constant, no bound): i = 0; head: `lt i 200 K` -> body | exit; 201 latch: `i = add i 1`. IR mode refuses a number or integer-constant count 202 outside 0..`1000000` (bound 203 or not), a minus sign included, with error 8 (the C oracle's count range), so 204 this unguarded loop 205 is also one checker2 proves. 206 - `for i T n` (n a name or any value that is not a number), and any `for ... 207 bound N` (omc's IR mode 208 only): as `while lt i n bound N` (N `1000000` when omitted), with the hidden 209 guard, plus 210 `i = add i 1` at the latch. IR mode refuses N above `1000000` with error 8 (as 211 the C oracle does), 212 so every emitted guard is one checker2 proves. 213 - `if c` -> cbr then | else-or-join; a join block exists only if some branch 214 reaches it. 215 - Nested values: each op inside a value writes a fresh hidden register (a local 216 with the op's type, 217 never a name, so the unread-name rule does not apply), in evaluation order: 218 innermost first, left 219 to right (`x = add mul a b c` -> `t = mul a b; x = add t c`). Only the 220 outermost op writes the 221 target name, after every operand has been read. Call arguments are evaluated 222 left to right before 223 the call; a `put` evaluates its index, then its value, then stores. 224 - A typed number used as a value (`uint 5`) is the hoisted CONST itself; a bare 225 name or number used 226 as an operand is read in place (no copy). 227 - `while`: the condition's ops are emitted in the head block, so the whole 228 nested condition is 229 computed again before every pass. 230 - `for i T ` (a count that is not a number): a name is read at every pass 231 (as v0); any other 232 value is computed once, before the loop. 233 - `trap N`: `trap N`, then a `ret` that is never reached (with a zero of the 234 return type), because 235 the IR block still needs a terminator. 236 ## 5. Measured (phase 1) 237 The 10 public dev tasks (`tests/one_layer/exp445/dev`), reference solutions in 238 each spelling, 239 tokens counted offline with the Qwen3 tokenizer (the measure.sh method: text = 240 reference.osc; 241 bytes = hex of the compiled IR; structured = `omega_emit lift` of that IR; 242 Omegese = 243 `tests/one_layer/omegese/dev/*.omegese`; Omegese short = the same with `=` left 244 out). 245 | task | text | bytes | structured | Omegese | Omegese short | 246 |---|---|---|---|---|---| 247 | dev01 | 64 | 281 | 309 | 48 | 45 | 248 | dev02 | 60 | 256 | 286 | 43 | 40 | 249 | dev03 | 81 | 567 | 624 | 57 | 53 | 250 | dev04 | 82 | 441 | 507 | 41 | 38 | 251 | dev05 | 27 | 118 | 91 | 17 | 17 | 252 | dev06 | 27 | 112 | 91 | 17 | 17 | 253 | dev07 | 120 | 594 | 750 | 72 | 65 | 254 | dev08 | 103 | 807 | 926 | 84 | 77 | 255 | dev09 | 75 | 488 | 547 | 55 | 50 | 256 | dev10 | 22 | 98 | 79 | 15 | 15 | 257 | **total** | **661** | **3762** | **4210** | **449** | **417** | 258 Omegese is 9.4x fewer tokens than the structured op list and 32% fewer than OSC 259 text, for the same 260 IR shape (all 10: harness `ola.sh experiment` set omegese-1 accepted 10/10, RUN 261 VALID, run 262 `20261015T094000Z-`e27a33ee052d`-562014`; checker2 ACCEPT on all 10). 263 Limits: the Omegese programs were written by the designer, not by a model, and 264 in places use the 265 shortest form (writing to parameters instead of copies), so the text column is 266 not an equal-effort 267 rewrite. Whether models write Omegese reliably is not measured yet. 268 ## 6. The next oracle and the checks (`make test-omegese`) 269 ### 6.1 What `omegese next` promises 270 `omegese next ` reads a prefix of a program (any text, cut anywhere, 271 even inside a word) and 272 prints what may come next. It is **exact**: an item is printed if and only if 273 some text that starts 274 with it turns the prefix into a program `omegese emit` accepts. Nothing that can 275 still lead to an 276 accepted program is missing (within the limits in 6.4), and nothing printed 277 leads to a dead end. When no text can, it prints one 278 `REFUSED omegese: ...` line and exits 1: a defect in its complete words gets the 279 reason `emit` would 280 give; otherwise (also when the word being written cannot be finished) the line 281 says `no text after this prefix makes a program emit accepts` with the reason 282 the 283 nearest attempt failed. 284 How it decides. The prefix is split into its complete lines, the complete words 285 of the last line, and 286 the word still being written (empty after a space, a bracket or at a line 287 start). For each candidate 288 item a witness is built: the line is finished with the words it still needs (a 289 `ret` line also reads 290 the names the ending path would otherwise leave unread), every open block is 291 closed (`x = x` for each 292 unread name, a `ret` of a zero where a value is owed, `end`), and the real 293 parser that `emit` runs 294 re-reads that line and the closing lines from the state after the complete 295 lines, with every 296 end-of-input check. An item is printed only when its witness is accepted, so 297 every printed item is 298 legal by construction. Completeness rests on the witness finder; the test fuzz 299 below checks it. 300 Names stay open at the character level. When a line binds a new name, any 301 identifier is legal except 302 a reserved word (`omegese words` and the IR type names `u8` .. `i64`) or one 303 equal to a visible 304 name; that is printed as one class item. When a line reads a name, the names 305 printed are the 306 visible names (and earlier functions) of the right type and kind. 307 Numbers come as intervals: the parser only compares a number with fixed bounds 308 (type ranges, array 309 lengths 1..64, trap codes 1..14, loop bounds and counts up to `1000000`) and with 310 the lengths of the 311 arrays in scope, so one test per breakpoint and per gap between breakpoints 312 decides every number, and 313 neighbouring legal pieces merge. Numbers are written as decimal digits with an 314 optional minus sign and 315 no leading zeros; `-0` is refused by `emit` as well (it is not a number). 316 ### 6.2 `omegese next --machine`: the fixed grammar 317 One item per line, in this order, nothing else on stdout. Exit 0 with at least 318 one item, or exit 1 319 with exactly one line starting `REFUSED omegese: `. Let U be the word still 320 being written. 321 | line | meaning | 322 |---|---| 323 | `word X` | finish the current word as X (X starts with U): a fixed word, a 324 visible name, a function, or a name written earlier on the same line (a new 325 parameter) | 326 | `newname E1 E2 ...` | finish the current word as any new name: a letter or 327 `_`, then letters, digits or `_`, at most 63 characters, starting with U, not a 328 reserved word, and not one of E1 E2 ... (the visible names, functions and names 329 earlier on the line that start with U; the list may be empty) | 330 | `number LO HI` | finish the current word as a number v with LO <= v <= HI 331 whose decimal text starts with U | 332 | `(` | an opening bracket (it also ends the current word) | 333 | `)` | a closing bracket (it also ends the current word) | 334 | `space` | a space or tab: ends the current word, or adds blank space between 335 words | 336 | `newline` | ends the current word and the line | 337 | `eof` | the input may end here: the prefix is already an accepted program | 338 A writer (an engine's mask) may append text s to the current word exactly when U 339 followed by s is 340 still the start of some `word`, `newname` or `number` item; the soundness fuzz 341 checks that a word 342 stays legal after each of its first characters. 343 Example, after `fn f a uint to uint` and a newline: `word if`, `word while`, 344 `word for`, `word ret`, 345 `word trap`, `word a`, `newname a f`, `space`, `newline`. 346 ### 6.3 Human output and `omegese complete` 347 `omegese next` without `--machine` prints the same set for a person, one 348 labelled line per kind, 349 empty lines left out: `assign:` (at a line start, the names that may be 350 assigned) or `names:`, 351 `number: LO..HI, ...`, `new-name: any name not in use`, and `words:` (fixed 352 words, functions, `(`, 353 `)`, `(space)` inside a word, `(newline)`, `(end of input)`). 354 `omegese complete ` prints one text that, appended to the prefix, gives 355 a program `emit` 356 accepts (finish the word and the line, then close everything); nothing when the 357 prefix is already a 358 program; exit 1 (`REFUSED`) when there is none. 359 ### 6.4 Limits (where exact can miss) 360 There is no over-approximation: every printed item was accepted by the real 361 parser. An item can be 362 missed only when the witness finder fails although a completion exists, which 363 needs one of these 364 limits: a line longer than 96 words (a witness can be longer than the shortest 365 completion), more than 366 480 registers, 256 distinct constants or the block and frame limits in one 367 program, more than 64 368 tries when several names of the right kind could be read, or a new name within a 369 few characters of 370 the 63-character limit (the class is decided by one representative name). None 371 of these is reached 372 by any program in the suite or the fuzz. 373 **Ownership (checker2's C2-OWN rules), folded into `emit` on 2026-10-15.** 374 checker2 follows every own 375 array along every path (it holds an array, holds nothing yet, or was freed or 376 moved) and rejects a use, 377 a move or a free where it holds nothing on every path (C2-OWN-USE-DEAD, C2-OWN- 378 DOUBLE-RELEASE), and a 379 new array or a return where it still holds one on some path (C2-OWN-LEAK). 380 `emit` keeps the same 381 states along the lines it reads and refuses such a line where it is written, so 382 `next` leaves out the 383 word that leads there. Inside an open loop a state that includes the loop head 384 is not known until the 385 loop's `end` line (a later line of the body can change it); such a check waits 386 and is decided at 387 `end`. `complete` (and every witness) settles what it can: before a loop's `end` 388 it gives a name the 389 loop head needs an array (`x = new ...`, after `free x` when the name may still 390 hold the array an 391 earlier pass gave it) or frees one that would still hold its array there, and at 392 the function's end 393 it frees each array that still holds one on some path (or ends the path with 394 `trap 1` when that 395 array's name is out of scope). Since omega#465 a leak on some path is refused, 396 so a loop that gives 397 an array a second one while it still holds the first (`x = new ...` before the 398 loop and again in its 399 body, with no `free x` before it) leaks on its first pass, and no line after it 400 repairs that: `next` 401 and `complete` report that no completion exists. 402 Measured with the residual walk in 6.5 (1000 walks from each of two starts, seed 403 4453): completed 404 walks that `emit` accepts and omega_emit or checker2 then rejects. 405 | build | rejected later | by rule | 406 |---|---|---| 407 | before (2026-10-15, ``f6b44356``) | 154 of 2000 (7.7%) | 136 C2-OWN-LEAK, 15 C2- 408 OWN-USE-DEAD, 3 C2-OWN-DOUBLE-RELEASE | 409 | ownership states only, no loop checks | 2 of 2000 (0.1%) | 2 C2-OWN-USE-DEAD 410 (a use in a loop head of an array freed before it) | 411 | after | 0 of 2000 | none | 412 | `emit` leak checks on some path (omega#465) | 1 of 2000 (0.05%) | 1 C2-OWN- 413 DOUBLE-RELEASE | 414 Not folded, so a program `emit` accepts can still be rejected later: 415 - C2-OWN-DOUBLE-RELEASE after a branch whose condition is a constant (`if 416 true`): `emit` follows 417 both sides, so an array freed on one side holds one on some path and 418 `complete` frees it again; 419 checker2 follows the constant and sees the second free on every path (1 of 420 2000 walks); 421 - C2-BORROW-OUTLIVES-OWNER: checker2 ties each view to the array it was taken 422 from over the whole 423 function (a view filled from two arrays loses its origin); `emit` does not 424 follow borrows (0 of 425 2000 walks met it); 426 - C2-BORROW-MUT-ALIAS (omega#465): `emit` does not follow borrows, so a mutable 427 view copied and used 428 beside its copy is refused by checker2 only (0 of 2000 walks met it); 429 - more than 64 own arrays in one function: the ones past 64 are not tracked; 430 - C2-OWN-ARENA-MOVE and C2-OWN-RELEASE-ARENA: Omegese has no arenas, so no 431 program reaches them. 432 The other way, `emit` refuses a function with more than 256 distinct ownership 433 checks waiting for loops to end, 434 which checker2 might accept. And where exact can miss: a waiting check whose 435 name is out of scope (or 436 hidden by a newer name) at the loop's `end` gets no settling line, so the word 437 that led there is left 438 out; a `ret` whose value moves the array into a call is not tried by the 439 witness. 440 ### 6.5 The checks 441 - the 10 dev programs: omegese -> omega_emit -> checker2 ACCEPT; 442 - nested values: 6 dev programs rewritten with nested values 443 (`tests/one_layer/omegese/nested`) and 5 444 trial 2 answers kept verbatim (`trial2`), all ACCEPT; the trial 2 isqrt answer 445 (dev07) is still refused 446 with `line 3: le has 3 values after it; it takes 2` (it has one value too 447 many); 448 - 8 coverage programs (IR type names, break, nested loops, else-if, a for with a 449 name or a value as count, 450 arrays and calls, calls without values, a bool function as a condition, nested 451 values); 452 - 46 refusals, each with its expected reason, each with a fixed control that is 453 accepted (arity, brackets, 454 two numbers in one op, extra words, `new` inside a value, lines after trap, 455 and 12 ownership cases: a 456 leak at a return or at a second `new`, a second free, a use after a move, an 457 out-of-scope array at a 458 return, and five decided at a loop's `end`, one of them through a nested 459 loop); 460 - review fixes: a conversion of a typed number converts it (`ret long int 5`, 461 `uchar int 300`); a for 462 count in brackets lowers exactly as the bare count and has the same limit; 463 - `omegese next` on 69 prefixes and cases, red before green (the open-type list 464 after a binary op, a typed second 465 value, a bracket waiting for `)`, a `ret` that must read the names its path 466 leaves unread, a cut 467 inside a word, the exact number range of every scalar type and of trap codes, 468 array lengths, loop 469 bounds and counts, a minus sign where none fits, `-0`, the `--machine` lines 470 including the 6.2 471 example and the new-name exclusion list, `complete`, refusals as soon as a 472 prefix is wrong, and 473 ownership: no `ret` or second free while it would be refused, `end` left out 474 of a loop whose head 475 needs an array, `complete` settling a loop and freeing at the function's end, 476 a loop opened at the 477 nesting limit refused, 300 uses of one array in a loop accepted); 478 - next oracle: at all 2636 word boundaries of the 75 accepted programs in the 479 suite, the real next 480 word, and the end of input at the end, are legal; 481 - completeness: 150 single-word mutants of those programs (a word dropped, 482 doubled, or replaced by a 483 number, a name, a fresh name or a fixed word): `emit` accepts a mutant if and 484 only if every word of 485 it was legal when it was written (2906 word boundaries); 486 - soundness fuzz: 40 random walks of up to 25 legal items from random cut points 487 (a number item is 488 tried at its ends and at a random value inside); the legal set is 489 never empty, a word picked stays legal after each of its first characters, and 490 `omegese complete` 491 then finishes the walk into a program `emit` accepts within a bounded number 492 of lines; 493 - checker2 residual: 40 walks from each of two starts (an empty file and a cut 494 point in a suite 495 program), each closed with `complete` and sent through omega_emit and 496 checker2; at most 497 `OMEGESE_RESIDUAL_MAX` (default 0) may be rejected there 498 (`OMEGESE_RESIDUAL_WALKS` sets the count, 499 `OMEGESE_RESIDUAL_KEEP` a folder that keeps the rejected programs; the table 500 in 6.4 used 1000); 501 - truncation fuzz: all 2799 byte prefixes of the nested, trial and coverage 502 programs through `emit`, 503 `next` and `next --machine`, which must answer (accept or refuse with a 504 reason) and never crash; at 505 the 2698 prefixes of accepted programs, `next` must also allow the byte that 506 follows (the whole 507 word it belongs to) and `complete` must finish the prefix into a program 508 `emit` accepts; 509 - loop guard negative control: the dev04 op list without the hidden counter 510 increment passes 511 omega_emit and is REJECTED by checker2 (`C2-LOOP-UNBOUNDED`); 512 - tokenizer measurement: when `OMEGESE_TOKCOUNT` (a counter: ` 513 words ...` 514 printing the token count of " word" first) and `OMEGESE_TOKENIZER` are set, 515 records empirical token 516 efficiency across candidate vocabularies (an observational cost consideration 517 rather than a language rule). 518 The same suite then runs again on a build with AddressSanitizer and 519 UndefinedBehaviorSanitizer 520 (memory and undefined-behaviour checks), with 10 walks and one mutant per 521 program; every sanitizer 522 finding fails the run. Its negative control: two canary builds (`- 523 DOMEGESE_CANARY=1`, a read after 524 free; `=2`, a signed overflow) must each be caught first. Clean. A stress run 525 with 25 mutants per 526 program (1575 mutants) and 500 walks of up to 40 items (17386 items) found no 527 failure. 528 ## 7. Phase 2 529 1. Prompt-only trial on the dev tasks, no mask (done once, 2026-10-15): the 30B 530 on my own engine, one 531 attempt, harness run `20261015T105049Z-`e27a33ee052d`-`1500714`` (RUN VALID): 532 Omegese 3/10, text 3/10, 533 structured 0/10; completion tokens 1015 / 1346 / 12027. 8 of 10 first answers 534 were refused only for 535 writing the task signature's type names (`u8`, `u32`); those are now 536 accepted. 537 Trial 2 (same model, one attempt plus one repair round): Omegese 2/10, text 538 3/10. 6 of the 8 Omegese 539 failures wrote nested values (`n = add (mul (uint 3) n) 1`), which v0 540 refused. Values now nest (section 3): 5 of 541 those 6 answers, kept verbatim in `tests/one_layer/omegese/trial2`, now pass 542 checker2; the sixth 543 (dev07) has one value too many and is still refused, with its place. Rerun 544 owed. 545 2. The mask inside my own engine: `omegese next` as a table on the GPU, one 546 lookup per token; 547 positions with one legal word need no model step. 548 3. A pre-registered held-out comparison: exp445 revision r3 549 (`docs/one_layer/EXP445_PROTOCOL.md` 550 section 13), Omegese against OSC text. The `omegese` arm's system prompt is 551 `tools/exp445/arms/common.md`, then `tools/exp445/arms/omegese.md` (the 552 language and a word card: 553 every fixed word on one line with what it does), then the worked examples 554 (`tools/exp445/arms/examples/`, built by `reader.sh system_prompt`): 14 dev- 555 style tasks in the 556 many-shot mode, the r2 single example (`clamp_sub`) in the one-shot mode 557 (Stage 0 only). The `text` 558 arm gets the same tasks with the program in OSC. `make test-exp445` checks 559 every example in both 560 forms (reader, back end, the sealed harness on its own inputs), that the word 561 card is exactly 562 `omegese words`, the one-token gate on every word of the examples, and that 563 no example shares an 564 entry name with a held-out task. 565 4. Where the r3 Stage 1 answers failed, by reader stage (config A, attempt 1, 60 566 held-out tasks per 567 arm; aggregate counts and refusal categories from the score output only, no 568 task text read): 569 | arm | round | passed the reader | refused | where refused, by category | 570 |---|---|---|---|---| 571 | Omegese | first answer | 35 | 25 | all at `omegese emit`: type 13, 572 structure 6, arity 4, scope 1, range 1 | 573 | Omegese | repair round | 4 | 21 | all at `omegese emit`: type 11, structure 574 6, arity 3, scope 1 | 575 | text | first answer | 44 | 16 | the OSC compiler | 576 | text | repair round | 5 | 11 | the OSC compiler | 577 No Omegese answer was refused at omega_emit, at the signature check or by the 578 back end. Final 579 verdicts: Omegese 23 ACCEPT, 21 no candidate, 16 wrong behaviour (7 580 unexpected trap, 8 wrong result, 581 1 wrong trap); text 34 ACCEPT, 11 compile refused, 15 wrong behaviour (6 582 missing trap, 8 unexpected 583 trap, 1 wrong result). 584 What a legal-word mask (`omegese next` in the engine) prevents: every one of 585 those Omegese refusals, 586 since each was an `emit` refusal and the mask only lets through words that 587 some accepted program 588 continues. With the ownership rules folded in, what the mask lets through 589 also passes checker2's 590 ownership rules, within the limits in 6.4. 591 What it does not prevent: an answer whose function has the wrong name, 592 parameters or return type is 593 still an accepted program, so only a forced signature header (the task's `fn` 594 line written for the 595 model) prevents a signature mismatch; none was seen, but every Omegese 596 refusal stopped at `emit` 597 before the signature check, so mismatches could be hidden behind them. 598 Neither prevents the 16 599 wrong-behaviour answers. The 11 text refusals would need a mask for OSC text. 600 ## 8. Prior art (quick search, not exhaustive) 601 Grammar-constrained decoding (Outlines, XGrammar, llguidance, SynCode), grammar- 602 aligned decoding 603 (NeurIPS 2024), type-constrained decoding for TypeScript (Mündler et al., PLDI 604 2025), and a grammar 605 redesigned for fewer tokens (SimPy, 2024). Not found: a lexicon chosen so one 606 terminal is one vocab 607 token, with type-aware prefix checking feeding an independently checked, signed 608 IR. "New" is 609 UNVERIFIED. 610 ## 9. Systems words (seed chain om4 and omc, ledger L408) 611 Added 2026-10-22 for the Omega compiler written in Omegese (`seed/omc/omc.om`) 612 and the translator that 613 first builds it (`seed/rung4/om4.s`). Every word below is used by omc or by the 614 seed test corpus 615 (`seed/rung4/tests`); the C path (`tools/omegese`) does not read these words 616 yet. Each rule names the 617 gate that tests it (`seed/rung4/gate4.sh`, section numbers of that script). 618 Decisions 16-24 are those of 619 `docs/PROGRAM.md` (branch doc/program). 620 ### 9.1 Two kinds of output 621 - A program with a line `fn main` is a whole Linux program (program mode); 622 otherwise the output is the 623 functions' machine words under the OSC-1 native rules (function mode), entry = 624 word 0. (gate 4 s.4-6) 625 - `fn main` has no parameters and returns a whole-number type or void. The 626 program's exit status is 627 main's value modulo 256 (Linux keeps the low 8 bits), 0 for a void main. (s.6 628 t_exit, s.7) 629 - A trap in program mode ends the program with exit status 100 + the trap code; 630 in function mode it 631 calls OscRt.trap as the C path does. (s.6 t_*, s.4-5) 632 - A conditional branch (B.cond, CBZ, CBNZ) carries a signed 19-bit word 633 displacement. A block layout 634 that needs more than 2^18 - 1 words forward or 2^18 words back (1,048,572 or 635 1,048,576 bytes) is 636 refused with error 24 before any output is accepted; it is never silently 637 truncated. Unconditional 638 B uses a 26-bit field, which the 8 MiB output capacity cannot exceed. (gate 639 669) 640 An initial line `target x86linux` selects the candidate FR-9 native x86-64 Linux 641 backend. 642 Without it, the existing AArch64 output remains unchanged. Whole-program output 643 is a 644 static ELF64 image with Linux x86-64 syscalls. A bare x86 unit has six-byte 645 `JMP rel32`/`NOP` entry slots and uses omc's private frame ABI; it is not a SysV 646 C-callable object. In bare mode, physical R14 points to an immutable runtime 647 entry table: a trap places its code in ESI and jumps through entry 2, whose 648 landing pad recovers the wrapper stack through R12 without storing a result. 649 This is not the AArch64 register ABI. Whole-program traps still terminate with 650 `100 + code`. Explicit raw AArch64 `emit` is refused on x86 (error 25). 651 OS flag values remain target-native. 652 See [the backend design and evidence](../X86-LINUX.md) for the register map, 653 syscall adaptation, seed-chain boundaries and qualification status. 654 An initial line `target x86efi` selects the x86-64 UEFI backend: the same x86-64 655 code 656 generator wrapped in a PE32+ EFI application image with the UEFI entry/exit and 657 Microsoft 658 x64 firmware calls. Only whole programs (`fn main`) are accepted; a bare unit is 659 refused 660 at line 1 with error 25, and Linux host words such as `read` and `write` are 661 refused with 662 error 25 at their line. The firmware is reached through one word, `efi` 663 (keyword id 178), recognised only under `target x86efi` (elsewhere it is an 664 ordinary name, 665 and a call to it is error 3): `r = efi OP ARG A OFF N`, OP a literal 0..14 (a 666 literal outside 667 0..14 is error 25, an OP that is not a literal, such as a name, is error 16), 668 `OFF+N <= len A` 669 (else trap 3), bit 63 of the ulong result marks an error code. A trap T returns 670 the 671 EFI_STATUS `2^63 | (100 + T)`. See [the x86efi design and evidence](../X86- 672 EFI.md) for 673 the operations, the efi 12 file contract and qualification status. 674 ### 9.2 Functions and calls 675 - `fn` may appear many times. A names pass reads every signature before any code 676 is written, so a call 677 names any function in the unit, earlier or later. A name that is a function 678 never becomes a new 679 scalar: a value-returning function used as a statement is error 7, including 680 `name = value`. 681 (s.6 r5b_fwd, r5b_assign, r5b_fwd_fm) 682 - In program mode a function may call itself, and two functions may call each 683 other. In function mode 684 a call cycle, including a function calling itself, is error 9, so the stack a 685 call chain uses is 686 bounded. (s.6 fib, r5b_mut, r5b_cycle, s.7) 687 - ` ` as a value calls a function that returns a value; as a 688 line it calls a void one. 689 Using the one where the other is needed is error 7. (s.7) 690 - `to void` makes a void function; `ret` with no value returns from it, and so 691 does reaching its `end`. 692 A function with a return type whose `end` can be reached is error 18. (s.6 693 t_void, s.7) 694 - Arguments are read left to right, each fully before the next. (s.5 fm5) 695 - Function names may have up to 63 characters; other names up to 8 (error 13). 696 (s.4 dev01, s.7) A 697 function name longer than 8 characters is never a keyword, even when its first 698 8 spell one 699 (`continue_x`, `truncate_number`); a name that is exactly a keyword is error 700 16. (s1 kw-long-names) 701 - A function has at most 6 parameters; a seventh is error 9. `main` has none 702 (error 9). A new name 703 may not reuse a name already in scope, a function or a struct: error 10. 704 - In program mode the stack is a fixed 8 MiB pool; a call or a local array that 705 would go below it traps 706 6 before it writes anything. (s.6 t_stack) 707 - omc sets no recursion depth limit of its own; only the 8 MiB stack bounds it. 708 A program that takes 709 input-driven recursion bounds it itself, checking the depth before the call, 710 as 711 `seed/omc/tests/recursion/nest.om` does: depth 16 accepted, depth 17 refused 712 with status 40 before 713 any frame for it exists, plus a work bound (fuel, status 42). (`seed/omc/gate- 714 recursion.sh`, #645) 715 ### 9.3 Numbers (decision 19: one meaning per word and width) 716 - Unsigned add, sub, mul, shl, neg, not wrap modulo 2^width (uchar 8, ushort 16, 717 uint 32, ulong 64 bits). 718 (gate 3, s.4) 719 - Signed add, sub, mul, neg, div and shl trap 1 when the exact result is outside 720 the type (byte 8, 721 short 16, int 32, long 64 bits), including the minimum divided by -1. (s.5 722 fm1-fm4, fm9) 723 - div and rem trap 2 when the divisor is 0. Signed div rounds toward zero; 724 signed rem has the sign of 725 the dividend, and the minimum rem -1 is 0. (s.5 fm1, fm2, fm9) 726 - A shift amount outside 0 .. width - 1 traps 7, for every type. shr of a signed 727 value keeps the sign. 728 (s.5 fm3, fm4) 729 - A conversion ` v` traps 5 when the value is outside the new type. (s.6 730 t_conv) 731 - There are no implicit conversions (decision 20): the two values of an op, a 732 value and the name it is 733 written to, an argument and its parameter, all have the same type, or the line 734 is refused (error 7). 735 A bare number takes the type the place needs. `uchar` is an 8-bit unsigned 736 number, never a character. (s.7) 737 - A number is written in decimal, with a `-` in front when negative, in at most 738 20 digits; it must be a 739 value of the type it takes: -2^63 .. 2^63 - 1 for long, 0 .. 2^64 - 1 for 740 ulong, and so on (error 8 741 outside; more than 20 digits, or a character that is not a digit, is error 6). 742 (s.6 t_u63, t_u64max, 743 t_cmp_unsigned, t_conv_sign, t_write_wrap, s.7) 744 - `true` and `false` are the bool numbers 1 and 0. (s.6 t_loop) 745 ### 9.4 Arrays (decisions 16, 17, 18, 23, 24) 746 - Every array has a fixed element type (uchar .. long, never bool) and a fixed 747 length written as a 748 number; the length travels with the array's name, never as a terminator byte. 749 An array parameter or 750 a pool written without its length is refused (error 16). (s.7) 751 - `global NAME T N`: a pool of N elements (1 .. `16777216`), all 0 when the 752 program starts, in the 753 program's own memory image (no heap, no allocation call); at most 1 GiB of 754 pools, else error 23. 755 Program mode only (error 9). (s.6 echo, bytecopy, s.7) 756 - `text NAME "bytes"`: a read-only array of uchar holding the bytes between the 757 quotes, with its 758 length; `\n` is 10, `\t` is 9, `\\` is 92, `\"` is 34; any other escape, or a 759 quote missing its end, 760 is error 22. An empty text `""` is a sized array of length 0: `len` is 0, a 761 number index is error 21, 762 a run-time index or `part`/`write` past 0 traps 3, and as a `view` argument 763 its count is 0. Program 764 mode only. (s.7) 765 - `NAME = new T N v`: a local array of N elements, each v, on the stack, given 766 back when the function 767 returns. Only in a function's outermost block (error 9); at most 4 MiB of 768 local arrays (error 23). 769 There is no `free`: nothing is given back by hand (decision 24), and the word 770 is refused (error 9). 771 (s.5 fm7, fm8, s.6 sort, s.7) 772 - A parameter `NAME view T N` or `NAME edit T N` takes an array of exactly that 773 type and length (error 7 774 otherwise). A view is read-only; `put`, `read` into it, or passing it as edit 775 is error 20. A text is 776 read-only in the same way. (s.7) 777 - An argument is a local array or an array parameter, optionally after `view` or 778 `edit`. A global is 779 never passed (error 19), and the arrays of one call are distinct names (error 780 19); so two live 781 references in one function are always distinct storage, and no write is ever 782 seen through another 783 name. (s.7) 784 - `get A i` reads element i; `put A i v` reads i, then v, then writes. `len A` 785 is A's length as a ulong. 786 A number index must be inside A when om4 reads it (error 21); any other index 787 is checked when it runs 788 and traps 3 when it is not below the length (a negative signed index traps 789 too). There is no word that 790 turns an array into an address or adds to one. (s.5 fm8, s.6 t_bounds, s.7) 791 ### 9.5 System calls and lines 792 - `read fd A off n` and `write fd A off n` (fd int, off and n ulong) move n 793 bytes between the open file 794 fd and A's elements off .. off + n - 1 with the Linux read and write calls, 795 and give a long: the bytes 796 moved, or minus the Linux error number. They trap 3 unless n <= len A and off 797 <= len A - n, before the 798 call. `read` needs a writable array (error 20). A must be an array of uchar 799 for the counts to be bytes. 800 `pread fd A off n pos` / `pwrite fd A off n pos` (pos long) do the same at an 801 explicit file position 802 without changing the descriptor's offset, with the same slice checks and 803 result. Like `read`, `pread` 804 needs a writable array (error 20); `pwrite`, like `write`, also takes a text 805 or a view. (s.6 echo, 806 bytecopy, t_rw; s4 v-bad-pread-text, v-pwrite-text) 807 - `exit v` (v int) ends the program with status v modulo 256. Like `ret`, it 808 ends the path: a line after 809 it in the same block is error 17. (s.6 t_exit, s.7) 810 - `note ...` is a line the translator does not read beyond its first word. (s.6 811 sort, fib) 812 ### 9.6 Capacities (decision 23) 813 Input over a capacity is refused with error 14, never overrun: om4 reads at most 814 8 MiB - 1 bytes and 815 writes at most 8 MiB, 1024 names in scope, values nested 1024 deep, 4096 816 functions, 8192 trap sites per function, 512 nested 817 blocks. A function that needs more than the 16 registers it hands out is error 818 12. omc keeps the same 819 input, output, nesting, trap-site, block and function limits but holds 8192 820 names in scope and 821 524288 call sites per unit (`seed/omc/gate12.sh`, `gate15.sh`), so whole 822 programs such as an 823 interpreter fit in one unit; om4 itself keeps its own smaller name and call 824 tables. om4's function 825 table (512 entries through om4 ``d0da40e4``) bounds `seed/omc/omc.om` itself, 826 which om4 must compile; 827 `seed/rung4/gate4.sh` section 7b checks 4096 accepted and the 4097th error 14. 828 The candidate `target x86linux` backend has a 16 MiB output pool because native 829 x86 instruction sequences can require more bytes than their AArch64 830 counterparts. 831 The AArch64 output ceiling remains 8 MiB; input and frontend limits are 832 unchanged. 833 An exhausted target output pool still refuses with error 14. 834 A single AArch64 conditional branch span is limited to 2^18 - 1 words forward or 835 2^18 words back 836 (section 9.1); a larger span is error 24, even when the input and output pools 837 still fit. 838 ### 9.7 Structs (omc only, rung 6) 839 om4 does not grow for this. A struct program is refused by om4. omc.om does not 840 use these words, so 841 om4(omc.om) stays equal to omc(omc.om). Checked by `seed/omc/gate6.sh`. 842 - `struct Name field type [len] ... end`, one line, before the first `fn`. 1 to 843 16 fields, at most 16 844 structs, at most 64 cells (error 14 over that, error 16 if empty, error 4 if 845 the line ends before `end`). A field is a name 846 and a scalar type; a number after the type is an array field of that length (1 847 .. 64). Every field 848 is one or more 8-byte cells, in order, no padding. (gate6 t7, t8, t9: a wrong 849 scale overlaps a 850 neighbour and changes the result; the expected results are 1, from the layout, 851 not from this compiler) 852 - The struct's name is a word from that line on. No function, variable, or field 853 may be spelled the 854 same (error 10). Field names are unique in their struct (error 10). A variable 855 may share a field's name. 856 - `p = new S v1 .. vn`, only as the whole of an assignment, and only in the 857 function's outermost block 858 (error 9 inside `if` / `while` / `for`). One value per field; an array field 859 takes one value, stored 860 in every element. The cells are a stack slot, 16-byte aligned, given back when 861 the function returns. 862 There is no `free` (decision 24); the word stays error 9. (gate6 t1-t6, 863 still_free, new_in_if) 864 - `get p f` reads a scalar field. `get p f i` reads an element of an array 865 field. `put p f v` and 866 `put p f i v` write. A view cannot be written (error 20). An unknown field is 867 error 3. A number index 868 outside the field is error 21; any other index is checked when it runs and 869 traps 3, as for arrays. 870 - A parameter is `p view S` or `p edit S`. A call passes an own or edit struct 871 to edit, and any struct 872 to view, always of the same struct (error 7 otherwise, error 20 for a view 873 passed to edit). The 874 structs of one call are distinct names (error 19). A function does not return 875 a struct. 876 - `len` of a struct is refused (error 7). `read` and `write` of a struct are 877 refused (error 7). 878 ### 9.8 Break, continue and trap (omc only, gate7) 879 `break`, `continue` and `trap` are the path-ending statements §3 lists. omc 880 implements all three; 881 om4 refuses them, so they are omc-only like structs. Checked by 882 `seed/omc/gate7.sh`; it is run by 883 `seed/host/check.sh`. 884 - `break` scans the open blocks for the innermost loop (kind 3 while, 4 for), 885 emits an 886 always-taken `B.AL` to that loop's exit and records the word. When the loop 887 closes, `s_end` 888 patches only the entries recorded for that block and marks them spent, so a 889 later loop that 890 reuses the block slot cannot move an earlier break. Outside a loop it is error 891 9. Like `ret`, 892 the line ends the path: a later line in the same block is error 17. At most 893 1024 break sites 894 per function (error 14 over that), reset when the function ends. (gate7 w1, 895 f1, n1-n3) 896 - `continue` finds the innermost loop the same way, but its recorded branch is 897 patched to the loop's 898 latch, not its exit: the head of a while, so the condition and the bound count 899 run again, or the 900 increment of a for, so the counter still advances. Outside a loop it is error 901 9; a later line in the 902 same block is error 17; at most 1024 sites per function (error 14). (gate7 c1- 903 c5, bad_continue, 904 bad_after_continue) 905 - `trap N` takes a decimal number 1..14 (error 4 when the line ends, 16 when the 906 token is not a 907 number, 8 out of range). It emits the same always-taken branch the runtime 908 trap checks use; 909 `finish` makes one stub per code, so program mode exits 100 + N and function 910 mode calls 911 `OscRt.trap`. The line ends the path (error 17 for a later line in the same 912 block). 913 (gate7 t1, t2, bad_trap0, bad_trap15) 914 - None of the three may be a name; all are reserved from the keyword table. 915 (gate7 om4 refusal) 916 ### 9.9 Floating point (omc only, gate8) 917 The words are `bitcast`, `fsqrt`, `fabs`, `fmin`, `fmax` and `fma`, not `bits`, 918 `sqrt`, `abs`, `min` and 919 `max`: the benchmark corpus uses those shorter spellings as ordinary 920 identifiers, and a keyword may 921 not take a name that existing `.om` code already uses. gate11 pins both halves 922 of that rule. 923 `f32` and `f64` are IEEE-754 binary32 and binary64. A float value is its bit 924 pattern held in an 925 ordinary integer register or its SIMD twin; arithmetic runs one scalar FP 926 instruction. 927 FPCR is never written: under the Linux default it is round to nearest even with 928 subnormals kept. 929 Ordinary `mul` then `add` stay separate operations and round separately; only 930 explicit `fma` fuses. 931 There is no implicit conversion: mixing f32 and f64, or float and integer, 932 without a conversion 933 is error 7. 934 - Literals: `digits.digits[(e|E)[+|-]digits][f32|f64]`; a digit must be present 935 on both sides of the 936 dot, and a leading `-` negates. A literal with no suffix takes its type from 937 context exactly as an 938 integer literal does; where no context gives a float type it is error 11. An 939 integer literal where 940 a float is expected (assignment, `ret`, argument, `put`, `new` fill) is error 941 7; write `f64 1` or 942 `1.0`. The decimal text is converted exactly: digits times a power of ten is 943 held as an exact 944 quotient of two integers, long division gives a 64-bit significand and the 945 remainder gives the 946 sticky bit, then the value is rounded once to nearest even: 0.1f64 is 947 0x3FB999999999999A and 948 6816.`702656e`-27 is 0x3B207B55A6D4A130. The full binary32 and binary64 range is 949 covered, including 950 subnormals (5e-324, 1e-45; 2.`4703282292062328e`-324 is 0x1) and signed zero. A 951 literal that 952 rounds to infinity is refused (error 8); one at or below half the smallest 953 subnormal rounds to signed 954 zero. The significant digits must still fit in 2^63-1 (error 8 beyond that). 955 (gate8 f64_bits, 956 f32_bits, lit_round, neg_int_*, neg_ambiguous, neg_dot, neg_overflow, 957 neg_overflow2, 958 neg_overflow3; `seed/omc/float-lits.py diff OMC N SEED` is the randomized 959 differential) 960 - Operators: `+ - * /` and unary `neg`; comparisons `eq ne lt le gt ge`. Bit 961 operators, shifts and 962 `rem` on a float are error 7. IEEE results: division by zero and overflow give 963 infinity, 0/0 gives 964 NaN, and no float operation traps. NaN compares false everywhere except `ne`, 965 which is true. -0.0 966 compares equal to 0.0; `bitcast` exposes the sign. (gate8 arith, compare) 967 - Intrinsics `fsqrt x` and `fabs x` take one float; `fmin a b` and `fmax a b` 968 take two of one float 969 type and follow FMINNM/FMAXNM (IEEE minNum/maxNum: one quiet NaN returns the 970 other operand; -0.0 971 orders below +0.0). A bare integer operand is error 7 and an unresolved 972 literal is error 11. 973 (gate8 intrinsics, neg_intr_*) 974 - `fma a b c` multiplies `a` by `b` and adds `c` with **one rounding of the 975 exact combined result**. 976 All three operands must have the same explicit f32 or f64 type (error 7 977 otherwise; an unresolved 978 decimal literal is error 11). AArch64 emits one scalar FMADD; its IEEE/Arm 979 FPMulAdd behavior follows 980 FPCR, including subnormals, infinities, signed zero, quieting signaling NaNs 981 and invalid operations 982 such as zero times infinity. NaN payload selection is Arm's rule, not a host- 983 library rule. 984 In particular `(1+2^-52)*(1-2^-52)-1` is `-2^-104` for f64 rather than the 985 zero from separately 986 rounded multiply and add. x86linux and x86efi refuse a well-typed `fma` with 987 error 9: their SSE2 988 baseline does not provide a fused instruction, and no unfused fallback is 989 permitted. The operands 990 are typed first, so errors 7 and 11 have the same line and code on every 991 target. IR mode refuses 992 float words with error 3. (gate8 fma, neg_fma_* on AArch64, x86linux and 993 x86efi; gate-fma 994 wrong-opcode, unfused and rounding mutants) 995 - Conversions ` value` handle int<->float, f32<->f64 and float->int. Int 996 to float is SCVTF/UCVTF 997 (round to nearest even); float to int is FCVTZS/FCVTZU (truncate, saturate, 998 NaN -> 0); f32<->f64 is 999 FCVT. `bitcast T value` reinterprets a value of the same width (f32/i32/u32, 1000 f64/i64/u64, and 1001 i8/u8, i16/u16 between integers) without changing its bits; any other width or 1002 a bool is error 7. 1003 The result is an ordinary value of T: `bitcast int uint `4294967295`` equals -1 1004 and 1005 `bitcast uint int -1` equals `4294967295`; an 8/16/32-bit integer or f32 is 1006 extended again for T into 1007 a new register, so the source name keeps its value (omc `2c824805` kept the 1008 source's extension). 1009 (gate8 convert, bitcast_int, neg_bitcast_width) 1010 - Floats are allowed in `global` pools, `new` arrays, parameters, returns and 1011 struct fields. 1012 Arrays are packed by element type: f32 occupies four bytes and f64 eight 1013 (`tlog` and `sa_arr` 1014 in `seed/omc/omc.om`). Struct fields retain eight-byte cells, including f32 in 1015 the low half. 1016 A float cannot index an array or be a `for` count 1017 (error 7), `read`/`write` still need a uchar array (error 7), and IR mode 1018 refuses float words 1019 (error 3). (gate8 arrays, globals, params, structs, neg_*) 1020 ### 9.10 Grouping parentheses (omc only, gate9) 1021 `(` and `)` are separate words even when written against a value (`(int 2)`, 1022 `((7))`); the lexer 1023 splits them out of the surrounding word. A group returns exactly the value 1024 inside it and adds no 1025 code. A group whose only value has no type is still ambiguous (error 11), and a 1026 group missing its 1027 `)` is error 16. Checked by `seed/omc/gate9.sh`, which `seed/host/check.sh` 1028 runs. 1029 ### 9.11 Layout queries (omc only, gate10) 1030 `sizeof T` is the size in bytes of a scalar type (bool 1; uchar/byte 1; 1031 ushort/short 2; 1032 uint/int/f32 4; ulong/long/f64 8). `sizeof S` is a struct's size: 8 bytes for 1033 each of its cells. 1034 `offsetof S f` is the byte offset of field `f`; an array field gives its first 1035 element. Both are 1036 compile-time constants of type ulong and add no code, so they compose in 1037 expressions. 1038 An unknown type name is error 16, an unknown struct or field is error 3, and 1039 `sizeof void` is 1040 error 9. Checked by `seed/omc/gate10.sh`, which `seed/host/check.sh` runs. 1041 ### 9.12 Constants (omc only, gate16) 1042 `const NAME TYPE LITERAL` at top level defines a named value before use. `NAME` 1043 is at most 1044 8 characters and may not collide with a visible name, a function or a struct 1045 (error 10); the value 1046 must fit the type (error 8). The constant is a typed number: an integer (`uint 1047 5`, `long -3`) or a 1048 float literal (`f64 0.1`, `f32 0.1`); an integer literal under a float type is 1049 refused (error 16). 1050 It composes wherever a value goes, including inside functions and as a call 1051 argument, and it cannot 1052 be assigned (error 7). In IR mode an integer constant is folded to its literal, 1053 including as a 1054 `trap` code, a `while` bound, or a `for` count; a float constant there is 1055 refused (error 9), as are 1056 struct/global/text declarations. Definitions are sequential, so a 1057 constant defined after a function is not visible to that function. 1058 A constant needs no program image, so it is also accepted in function mode (a 1059 unit without 1060 `fn main`): every read folds to the typed number, and the function words are 1061 byte for byte those of 1062 the same unit written with the literal (gate16 `fm_*`: value, negative value, 1063 parameter and `new` 1064 length, `while` bound, `trap` code, `for` count, two functions, f64). A `global` 1065 or `text` in a 1066 function-mode unit is still error 9 at the end of the input, with or without 1067 constants beside it, 1068 and a host word is still error 9 at its line (gate16 `fm_global`, `fm_text`, 1069 `fm_host_word`). 1070 An integer constant is also accepted as an array length in `new`, `global`, a 1071 parameter declaration 1072 (`view T N` / `edit T N`) and a struct field length (1..64, error 14); a float 1073 constant used as a 1074 length is error 16. A length token that is a name other than an integer constant 1075 is error 16, and 1076 `arrlen` still enforces 1..`16777216` for arrays (errors 8 and 23). Signatures are 1077 pre-scanned, so a 1078 constant used in a parameter length must be defined before that function. 1079 An integer constant is also accepted as a `trap` code (1..14) and as a 1080 `while ... bound` or 1081 `for ... bound` count (1..`9223372036854775807`; 1..`1000000` in IR mode); a `for` 1082 count is an ordinary value, so a constant 1083 works there too (0..`1000000` in IR mode). Out-of-range values keep error 8, and a 1084 float constant in any of these positions is 1085 error 16. 1086 ### 9.13 Profile OM-2 (omc only, `spec/omegese-om2.md`, ledger L834) 1087 OM-2 is opt-in per unit; the contract `spec/omegese-om2.md` and its errata are 1088 normative, and this 1089 section lists what omc implements of it. Fixtures, expected results and compiled 1090 mutants: 1091 `seed/omc/om2/` (run by the #748 gate `seed/qualification/om2/gate.om`). Every 1092 OM-1 unit keeps its 1093 meaning and, for the C2 manifest, its exact output bytes or error. 1094 - **Opt-in.** Leading blank lines and `note` lines are skipped; when the next 1095 line is exactly `om2`, 1096 `om2 diag` or `om2 fmt` (no other bytes on it) the unit is OM-2. Any other 1097 line leaves the unit OM-1, 1098 where the `om2` line itself is error 16 as before. The words of this section 1099 are reserved only in an 1100 OM-2 unit: `rotr rotl unroll inline fresh abstract seal open holds layout 1101 field at little big part out 1102 export ops dit scrub`. Using one as a name there is error 16; an OM-1 unit 1103 keeps them as ordinary names. 1104 - **`om2 diag`.** After the human line `omc: line N: error E` (unchanged), 1105 stderr gets one record 1106 `omc-diag 1 code=E sev=S line=N col=C span=A-B expect=K found=H obligation=O 1107 profile=OM-2`. `line` is 1108 the human line. `A-B` is the half-open byte span of the token being read (the 1109 LF for a line that ends 1110 too early; `len-len` at the end of input) and `col` the 1-based byte column of 1111 A on its line. `found` is 1112 the span's bytes in hex (at most 32 bytes), `-` when empty. `expect` is the 1113 class being read: `number` 1114 for errors 6 and 8, `end` for error 15, `name` for an unknown name, otherwise 1115 `value`, `type`, `name`, 1116 `newline` or `word` from the reader that failed. `sev` is `unknown` for an 1117 undeclared function or struct 1118 (errors 3 and 13 at a call or `offsetof`; error 16 for an undeclared word 1119 where a type or struct is 1120 read, as in `new Pt` or `p view Pt`), `incomplete` when the failure is on the 1121 end-of-input token or 1122 in a text cut by the end (except the call-cycle error 9), else `error`. 1123 `obligation` is `bounds` (21), 1124 `growth` (14), `regs` (12), `init` (27), `ctor` (28), `layout` (29) or `-`. 1125 - **Hex literals.** `0x` and 1..16 digits `0-9a-f` is the unsigned value and 1126 takes the type the place 1127 needs under the decimal range rule (error 8 outside; `int 0xffffffff` is error 1128 8). A `-` before it, `0X`, 1129 no digits, more than 16 digits, an uppercase digit, `_` or any other character 1130 is error 6. 1131 - **`om2 fmt`.** Only when the input's first line, at byte 0, is `om2 fmt` 1132 (error 16 elsewhere). The rest 1133 (the bytes after the first LF) is compiled as a unit of its own, OM-1 or OM-2 1134 by its own first line; 1135 if it is refused, the error is reported against the whole input and nothing is 1136 written. If it is 1137 accepted, stdout gets its canonical text: note lines and text literal bytes 1138 exactly as written; the 1139 indentation as written; each other run of blanks between words one space, 1140 except next to `(` or `)` 1141 where it is kept; no blanks at a line end; a whitespace-only line empty; one 1142 LF after the last line. A 1143 CR anywhere and blank lines at the end are error 6. fmt never adds or removes 1144 a line, is idempotent, 1145 and compile(fmt(x)) is byte-identical to compile(x). 1146 - **Rotate.** `rotr x n` and `rotl x n`: x and n of one unsigned type (uchar, 1147 ushort, uint, ulong; else 1148 error 7), the result x's type. n outside 0..w-1 traps 7 at run time, a number 1149 n included. uint/ulong 1150 with a number n give one `ROR` (immediate, EXTR); otherwise the amount check, 1151 then `RORV` (rotl through 1152 `NEG`). uchar/ushort replicate the value into a 32-bit pattern, rotate it, 1153 then truncate. 1154 - **Unroll.** `for i T K unroll`: K a number 1..64 (error 8 outside; a name or 1155 other value is error 16). 1156 The body is compiled K times with `i` the constant 0..K-1 (a write to it is 1157 error 7). `break` or 1158 `continue` whose innermost loop is the unrolled one is error 9; inside a 1159 rolled loop in the body they 1160 work as usual. No loop branch or counter is emitted. Removing `unroll` leaves 1161 behaviour unchanged. 1162 - **Inline.** `fn NAME ... to T inline`: every call is compiled in place. 1163 Arguments are read left to 1164 right as for a call; a scalar argument in a named register is copied, one in a 1165 temporary is used as it 1166 is. The caller's locals are hidden from the body, and `ret` becomes a branch 1167 to the body's end (a last 1168 one is dropped). The standalone function is still emitted. `new` in it, or an 1169 inline function reached 1170 again while it is being inlined (itself included), is error 9; so is an inline 1171 function that reaches 1172 itself anywhere in the call graph, through non-inline calls too (checked at 1173 the end of the input). A 1174 fifth nested inline level is error 14. Calls to other functions stay calls. 1175 Removing `inline` leaves 1176 behaviour unchanged. An argument that is a number is copied to a register, so 1177 folding does not reach 1178 through parameters. 1179 - **Folding and checks.** Only inside an unrolled or inlined body, an operation 1180 (`add` .. `shr`, 1181 comparisons, `rotr`/`rotl`, `neg`, `not`) on two typed numbers is computed 1182 with OM-1 arithmetic. One 1183 that would trap (signed overflow, a divisor 0, an amount at or above the 1184 width) is not folded and keeps 1185 its runtime trap. Conversions are never folded. A number index into a sized 1186 array is checked when it 1187 is compiled (error 21), as in OM-1, and in an OM-2 unit up to 4095 it is an 1188 immediate offset (LDR/STR 1189 unsigned offset) with no runtime check. Every other index keeps its runtime 1190 check. 1191 - **Bounds.** At most 65536 emitted words per function after unrolling and 1192 inlining, 64 copies per 1193 unrolled loop and 4 inline levels (error 14, `obligation=growth`). 16 1194 registers stay the limit 1195 (error 12, `obligation=regs`). Expansion fuel (E14, E16): each function has 1196 65536; an unrolled loop is 1197 charged K when it starts, at its line, before any copy expands, and an inline 1198 expansion 1 at its call 1199 line, in emission order at every nesting depth (nested unrolls multiply). The 1200 charge that takes the 1201 total above 65536 is error 14 (`growth`) on its line; exactly 65536 is 1202 allowed. So two nested 64-copy 1203 unrolls (4160) compile and three do not. An inline function's standalone body 1204 is compiled with its own 1205 fuel where it stands in the source. The inline call graph keeps each edge 1206 once. 1207 - **Trap sites.** With `om2 diag`, an accepted unit's stderr gets one `omc-site 1208 1 line=N iter=k` record 1209 per runtime trap site, in emission order: N the source line, k the counters of 1210 the open unrolled loops 1211 outer to inner joined by `.`, or `-`. stdout is unchanged. 1212 - **External layout.** `layout NAME SIZE`, then one line `field F T [COUNT] at 1213 OFF little|big` per field 1214 (note lines allowed), then `end`, at top level before the first `fn`. NAME and 1215 F at most 8 bytes and not 1216 OM-2 words; NAME is a new name (error 10), F unique in its layout (error 10); 1217 T an integer type 1218 (`uchar` .. `long`; else error 7). SIZE outside 1..4096 or a `layout` after 1219 the first `fn` is error 29 1220 on the layout line; a COUNT outside 1..4096, an OFF or field extent past SIZE, 1221 or a byte shared with an 1222 earlier field is error 29 on the field line (`obligation=layout`). No COUNT is 1223 a scalar field (E5). 1224 A parameter `c view NAME` / `c edit NAME` is a `uchar` array of exactly SIZE 1225 bytes (another array is 1226 error 7; ABI: one pointer). `get c F` / `get c F i` and `put c F v` / `put c F 1227 i v` load / store the field 1228 at OFF + i * width with its width and byte order (unscaled register-offset 1229 LDR/STR, REV16/REV for 1230 big; signed fields sign-extended). The index is checked like an array's: a 1231 number outside COUNT is 1232 error 21, a run-time one traps 3. A missing index on an array field is error 1233 4, an extra one on a 1234 scalar field error 5, `put` through a view error 20. Any other word after `c` 1235 reads it as the plain 1236 `uchar` array (`get c i`, `len c`, passing it on). Structs (9.7) are 1237 unchanged. 1238 - **Fresh scratch.** A parameter `s edit T N fresh` (N at most 64, else error 14 1239 `obligation=init`; on 1240 a view error 16) has unspecified incoming elements. omc tracks, per such 1241 array, which elements are 1242 definitely written on the path being compiled: a `put` with a number index 1243 (after unrolling, 1244 inlining and folding) marks its element; a `get` with a number index needs 1245 that element, any other 1246 `get` all N (else error 27, `obligation=init`, on the get line). An if without 1247 else, a while and a 1248 rolled for leave the set as it was when they opened (no induction); an if/else 1249 keeps the elements 1250 written in both arms, or in the arm that does not end in `ret`; an unrolled or 1251 inlined body keeps 1252 what it wrote. Passing the array to a non-inline call, `read`, `write` or a 1253 host operation is error 1254 27 on that line; an inline callee works on the same set, and its own `fresh` 1255 parameter starts empty. 1256 At most 16 fresh arrays per function, inline ones included (error 14). The 1257 generated code is unchanged. 1258 - **Abstract types.** `abstract NAME T [ops W ...]` (T `uint` or `ulong`, else 1259 error 7; W from `rotr rotl 1260 and or xor`, else error 16) and `holds NAME dup32`, at top level before the 1261 first `fn` (error 9 after 1262 it). NAME is a type distinct from T. A value of it is made only by `seal NAME 1263 v` (v of type T) in the 1264 function named NAME followed by `mk` that returns NAME, inlined or not; a 1265 `seal` anywhere else is 1266 error 28 (`obligation=ctor`) on its line. `open v` gives the T value. A T 1267 value or a number where NAME 1268 is needed, a conversion, comparison or any operation on it not listed by 1269 `ops`, an array or struct 1270 field or `const` of it, `sizeof`/`bitcast` of it, and NAME as a parameter or 1271 result of the entry of a 1272 function-mode unit are error 7. Listed operations run on T and give NAME: 1273 `rotr`/`rotl` of NAME by a T 1274 count (E9; 64 traps 7), `and`/`or`/`xor` of two NAME values. `holds NAME 1275 dup32` (ulong only; any 1276 other predicate, or a uint NAME, is error 28 on the holds line) makes every 1277 seal check high32 == 1278 low32 at run time (LSR, CMP UXTW, B.NE trap 10), except when the constructor's 1279 body is exactly the 1280 line `ret seal NAME or shl ulong x 32 ulong x`, x a uint parameter, then `end` 1281 (the check is erased, 1282 rule `dup32`: uint values are held zero-extended). With `om2 diag` each seal 1283 compiled writes 1284 `omc-check 1 kept|erased line=N rule=dup32|-` (N the seal line) with the omc- 1285 site records. 1286 - **Unsized views.** A parameter `NAME view T *` / `NAME edit T *` takes an 1287 array of element type T of any 1288 length (error 7 for another type): a sized array (E2, also on internal 1289 functions), an unsized one or a 1290 text (view only). `len NAME` is its run-time count, a ulong value. Every index 1291 into it, a number too, 1292 is checked at run time against the count (CMP, B.HS trap 3; no error 21, no 1293 elimination); `read`, 1294 `write`, `pread`, `pwrite` and the host words keep their slice checks against 1295 the count. An unsized 1296 array never goes to a sized parameter (error 7); view / edit rules, distinct 1297 names (19) and fresh (27) 1298 are as for sized arrays. `new` stays sized; `fresh` needs a length (error 16). 1299 - **Parameter slots.** Parameters take x0..x5 in order, in both modes: an 1300 unsized view or edit two slots 1301 (pointer, then count), every other parameter one (a scalar, a sized array, a 1302 layout or a struct by its 1303 pointer). A parameter that needs a seventh slot is error 9 on the fn line. 1304 - **Part.** `part A o k` (o, k ulong; another type is error 7), only as an 1305 argument for an unsized 1306 parameter of a call (a sized parameter is error 7; anywhere else, 1307 `read`/`write` included, error 9), is 1308 the k elements of A from o. A is a name: a local, a view, an edit or a text (a 1309 global is error 19, a fresh 1310 array error 27). o is read, then k, then the checks run in this order: o <= 1311 len A, then k <= len A - o 1312 (CMP, B.HI trap 3; the wrapped o + k is never formed). The callee gets A + o * 1313 size and count k. A part 1314 of a local or an edit is an edit, or a view with `view` in front; a part of a 1315 view or a text is a view 1316 (to an edit parameter error 20). For distinct names a part is its base A: A 1317 and a part of it, or two 1318 parts of A, in one call are error 19 whatever the ranges. 1319 - **Out.** A parameter `NAME out T N` (N a length; `*` or `fresh` is error 16) 1320 is written by the unit; 1321 the bridge owns the buffer and copies it out after status 0 (spec 6, E1). 1322 Inside the unit it is an edit 1323 of T N in one slot (its pointer): `get`, `put`, passing it on as an edit; a 1324 view or an array of another 1325 length passed to it is error 20 / 7. 1326 - **Export.** `export fn NAME ...` at top level (error 16 elsewhere, and when 1327 `fn` does not follow) marks a 1328 function-mode entry (with `fn main` error 9; a 33rd export error 14). With any 1329 export, words 0 .. E-1 1330 are `B` to the exports in source order and the code starts at word E; the 1331 other functions are private. 1332 Without export the OM-1 rule holds (one function: its bare words; more: word 0 1333 is `B` to the last). The 1334 entry rules of the abstract types apply to each export (to the last function 1335 when there is none). 1336 #### 9.13.1 Secret hygiene: `dit` and `scrub` (program mode) 1337 Two value words for code that handles secrets. Both are OM-2 only (reserved as 1338 above), program mode only 1339 (error 9 in function mode), AArch64 only (error 25 under `target x86linux`), and 1340 give a long. They are 1341 value-only words: they stand where an expression is read (`k = scrub 16`, an 1342 argument, an operand); a bare 1343 statement `scrub 16` or `dit 1` reads the word as a statement name and is error 1344 16 (keyword used as a 1345 name). IR mode never reaches them: `ir` together with `om2` is already error 16 1346 in either header order, 1347 so omc's IR-mode error 9 test for these words is a defensive check that no 1348 source exercises. The emitted 1349 words are fixed, so the output is byte-for-byte deterministic. Fixtures: 1350 `seed/omc/om2/s5/` (`s5.cases`, 1351 `s5-mutants.cases`, both standing gates in `seed/host/check.sh`); `s5-scrub- 1352 emit` pins the sha256 of the 1353 whole output of `scrub-emit.om`, so the exact register-zeroing sequence below is 1354 checked, and the 1355 mutants `m-zpool`, `m-zvec` and `m-movz16` (zeroing words retargeted to X16 or 1356 V0) are detected by it. 1357 `s5-scrub-femit` pins the same for a unit with a live float local, so which V 1358 registers are spared is 1359 checked (`m-twinall`, sparing the dead twins of live slots too), and `s5-scrub- 1360 flive` reads live float 1361 locals, a held float operand and a float call argument back after scrub (`m- 1362 twinnone`, zeroing V0-V31). 1363 - **`dit v`** (v int, else error 7) sets PSTATE.DIT (Arm ARM C5.2.4, FEAT_DIT; 1364 bit 24 of the DIT 1365 special-purpose register) and gives the previous bit as 0 or 1. v outside {0, 1366 1} (a negative int too) 1367 is trap 3 before the write. Words: `CMP Xv, #1` (SUBS, C6.2.464), `B.HI` trap 1368 3, `LSL X16, Xv, #24` 1369 (UBFM, C6.2.487), `MRS Xd, DIT` (C6.2.287, `d53b42a0`|d), `MSR DIT, X16` 1370 (C6.2.289, `d51b42b0`), 1371 `UBFX Xd, Xd, #24, #1`. Writes to PSTATE take effect in program order with no 1372 barrier (C5.1). A core 1373 without FEAT_DIT raises SIGILL; the Spark's GB10 lists `dit` in /proc/cpuinfo. 1374 Linux starts a process 1375 with DIT 0 and keeps it across context switches; `dit` does not restore it at 1376 function exit. 1377 - **`scrub n`** (n ulong, else error 7) zeroes the dead stack and the dead 1378 registers and gives 0. n must 1379 be a multiple of 16 and at most `1048576` (1 MiB), else trap 3; when SP - n is 1380 below the stack-pool floor 1381 X28 it is trap 6, before any store. Then the n bytes `[SP - n, SP)` are zeroed 1382 with `STP XZR, XZR, 1383 [X16], #16` (C6.2.414) from SP - n upward: the frames of returned callees, 1384 their spilled registers and 1385 local arrays. Then `MOVZ Xr, #0` for every register that holds no live value: 1386 the pool registers at 1387 index npar + temporaries-in-use and above (the free temporaries and caller- 1388 saved registers), X16, and 1389 X7, X18-X26, X29 (never used by program-mode code); and `MOVI Vd.2D, #0` 1390 (C7.2.247), which also clears 1391 the upper SVE Z bits, for V0-V15 and for every dead twin. Since #853 an 1392 f32/f64 local name and a held 1393 float value live in the twin V16+j of their pool register (omc.om, "floats in 1394 v registers"); the twin 1395 is live when slot j is below the free index and its value lives there, and 1396 only such twins are 1397 spared. The twin of a free slot, or of a slot whose value is in its x register 1398 (a float parameter, an 1399 integer), is zeroed; V0-V15 carry a float only inside one operation. Not 1400 zeroed: SP; X27 (the Linux 1401 initial stack when the unit reads its arguments or environment); X28 (the 1402 floor); X30 (the return 1403 address); the pool registers below the free index (parameters, locals, the 1404 held operands of the 1405 expression and of an enclosing call) and their live twins; NZCV, FPCR, FPSR, 1406 the SVE P registers and 1407 FFR; memory above SP, the live frames. The result register is set 1408 to 0 last. 1409 ### 9.14 Compiler error codes (omc, registry `seed/omc/error-codes.reg`) 1410 A refusal prints one line, `omc: line L: error C`, on stderr, writes no program 1411 and exits with C. 1412 The single source of the codes is `seed/omc/error-codes.reg` (issue #797): one 1413 row per code with its 1414 status (emitted, io or unused), the `seed/omc/gate15.sh` case that must refuse 1415 with it, and the 1416 meaning below. `seed/omc/codereg.om` (run by gate15) fails when a `fail`, 1417 `nfail`, `unkfail`, 1418 `lenval` or `exit int` site in `omc.om` has no row, when an emitted row has no 1419 site, when a row of 1420 this table differs from the registry, or when a registry case did not refuse 1421 with its code at its 1422 expected line. Codes 1 and 2 are I/O errors on the compiler's own stdin/stdout 1423 (line 0 when the input 1424 cannot be read). In IR mode (section 11) the same codes apply; a contract line 1425 (`requires`, 1426 `ensures`, `invariant` not followed by `=`) is error 30 there. irwasm exit codes 1427 are a separate namespace (section 11.1). 1428 | Code | Meaning | 1429 |---|---| 1430 | omc 1 | the compiler's standard input could not be read | 1431 | omc 2 | the compiler's standard output could not be written | 1432 | omc 3 | unknown name or field, or a word this mode does not provide | 1433 | omc 4 | the line ends where a word or value is needed | 1434 | omc 5 | extra words after a complete statement | 1435 | omc 6 | malformed number or token | 1436 | omc 7 | type mismatch | 1437 | omc 8 | number out of range for its type or place | 1438 | omc 9 | word or declaration in a place that does not allow it | 1439 | omc 10 | duplicate name | 1440 | omc 11 | bare number without a type from its context | 1441 | omc 12 | register pool exhausted | 1442 | omc 13 | name too long (8 bytes, 63 for a function) | 1443 | omc 14 | capacity exceeded (names, functions, sites, nesting, input or output) 1444 | 1445 | omc 15 | missing end | 1446 | omc 16 | syntax: unknown or misplaced word | 1447 | omc 17 | line after ret, break, continue, trap or exit in the same block | 1448 | omc 18 | a function with a result can reach its end | 1449 | omc 19 | global passed as an argument, or one array twice in a call | 1450 | omc 20 | write to a view or a text | 1451 | omc 21 | constant index outside the array | 1452 | omc 22 | malformed text literal | 1453 | omc 23 | size capacity | 1454 | omc 24 | AArch64 branch displacement out of range | 1455 | omc 25 | unknown target, an AArch64-only path on another target, or an x86efi 1456 refusal (bare unit, Linux host word, efi OP literal outside 0..14) | 1457 | omc 26 | no emitting site | 1458 | omc 27 | fresh element read before it is definitely written, or fresh array 1459 passed on | 1460 | omc 28 | abstract type: seal outside its constructor, or an unsupported holds 1461 | 1462 | omc 29 | external layout out of bounds or misplaced | 1463 | omc 30 | contract syntax misplaced or not supported here (IR mode included) | 1464 ## 10. Native host extension (2026-10-23) 1465 Implemented by the Omega-written compiler in `seed/omc/omc.om`. The original 1466 om4 parent builds this extended compiler; the extended compiler reproduces 1467 itself byte for byte. The original subset retains its machine code. The new 1468 words are reserved and require program mode (error 9 in function mode), with one 1469 exception: an OM-2 function unit (first line `om2`, no `fn main`) may use the 1470 file 1471 and identity subset `fopen`, `fclose`, `fstat`, `stat`, `lstat`, `getuid`, 1472 `geteuid`, `getgid` and `getegid`, the clocks `monons`, `realns` and `sleepns`, 1473 and 1474 the device subset `devctl`, `mapnew`, `mapdrop`, `mapread`, `mapwrite`, 1475 `devcall`, 1476 `uvmctl`, `mapaddr`, `mapget`, `mapset`, `maphold` and `mapbind` 1477 (`seed/host/MAPPING.md`) on the AArch64 1478 target. Each of these is an inline `svc` with its arguments saved and restored 1479 around 1480 it; none reads argv, the x28 stack floor or a global, and none writes x7 or x19- 1481 x28, 1482 so a unit called through the omega-bridge native ABI keeps its frame. In 1483 function 1484 mode entry31 points at a32-byte header followed by1..4098 owned32-byte mapping 1485 slots. The header supplies capacity and nonwrapping generation limits; handles 1486 have13 low slot bits. The bridge selects an explicit context and serializes 1487 its calls. Fixed bind replaces only an entire live PROT_NONE reservation in 1488 that table. Failed bind retires its token on successful cleanup; a cleanup 1489 failure traps3 and leaves an inaccessible, un-rebindable owner for mapdrop only 1490 (mapaddr may inspect it). The bridge refuses destroy while it is live. 1491 Program mode retains its raw128 1492 slots and eight slot bits. Every other host word, every OM-1 function unit and 1493 other targets stay error9. This context-format contract is a draft requiring 1494 Drake approval before merge (PROPOSED `spec/omegese-om3.md` section1, gate 1495 `seed/omc/om2/fnhost/fnhost.cases`). 1496 All results below have type `long`. Successful kernel results are nonnegative; 1497 failures return minus the Linux error number. Programs must check errors. 1498 These operations do not form a sandbox: they operate with the process's 1499 existing permissions. They expose no pointer values and no arbitrary syscall. 1500 In signatures, `fd`, `flags`, `mode`, `pid`, `signal`, `events`, `domain`, 1501 `kind`, `protocol`, `backlog`, `target`, `options`, `level`, `option`, `whence` 1502 and `op` are `int`. 1503 Offsets, byte counts, capacities and argument indices are `ulong`. File offsets 1504 and time intervals are `long`. `A` is a `uchar` array. Every slice checks 1505 `n <= len A` and `off <= len A - n` before kernel access, otherwise trap 3 1506 (program exit 103). Writable operations reject `view` and `text` (error 20). 1507 Non-byte arrays and mismatched scalar types are error 7. 1508 | Expression | Meaning | 1509 | --- | --- | 1510 | `fopen A off n flags mode` | Open a length-delimited path relative to the 1511 current directory. Return descriptor. | 1512 | `fclose fd` | Close descriptor. | 1513 | `fsync fd` | Sync file data and metadata. | 1514 | `fdsync fd` | Sync file data only (`fdatasync`). | 1515 | `memfd A off n flags` | Create an anonymous in-memory file and return its 1516 descriptor (`memfd_create`). | 1517 | `fchmod fd mode` | Set permissions on an open descriptor. | 1518 | `chmod A off n mode` | Set permissions on a checked path (`fchmodat`, flags 1519 0). | 1520 | `chown A off n uid gid` | Set ownership on a checked path (`fchownat`, flags 1521 0). | 1522 | `faccess A off n mode` | Check access to a checked path (`faccessat`, flags 1523 0): mode 0/1/2/4. | 1524 | `getuid` / `geteuid` / `getgid` / `getegid` | Process identity (syscalls 174- 1525 177). | 1526 | `fchdir fd` | Change the working directory to an open directory descriptor. | 1527 | `getppid` | Parent process id. | 1528 | `setsid` | Create a session and become its leader. | 1529 | `getpgid pid` | Process group id of `pid` (0 = self). | 1530 | `getsid pid` | Session id of `pid` (0 = self). | 1531 | `syncfs fd` | Sync the filesystem containing an open descriptor. | 1532 | `shutdown fd how` | Shut down part of a connected socket. | 1533 | `flock fd op` | Advisory whole-file lock (Linux `flock`, ARM64 syscall 32; 1534 keyword id 197). `op` is passed unchanged: 1 `LOCK_SH`, 2 `LOCK_EX`, 8 1535 `LOCK_UN`, plus 4 `LOCK_NB` for no wait. Returns 0 or -errno: -11 when a 1536 `LOCK_NB` request is held by another open file, -22 for any other op, -9 for a 1537 closed fd. The lock belongs to the open file, so it is released when the last 1538 descriptor sharing that open file is closed. Fixture `seed/host/tests/flock.om`. 1539 | 1540 | `setpgid pid pgid` | Set a process's group (0 = self/own pid). | 1541 | `umask mask` | Set the file-mode mask; return the previous mask. | 1542 | `fseek fd offset whence` | Seek and return the resulting signed file offset. | 1543 | `ftrunc fd length` | Set an open descriptor's length (Linux `ftruncate`). | 1544 | `truncate A off n length` | Set a checked path's length (Linux `truncate`). | 1545 | `unlink A off n` | Remove the named file. | 1546 | `makedir A off n mode` | Create a directory. | 1547 | `rmdir A off n` | Remove an empty directory. | 1548 | `cwd A off capacity` | Write the current directory into writable bytes. Return 1549 the kernel byte count including the trailing zero byte. A short buffer returns a 1550 negative error. | 1551 | `chdir A off n` | Change the working directory to a checked, nonempty path. 1552 Return 0 or -errno. | 1553 | `readlnk PATH off n OUT off capacity` | Read a symbolic link through a 1554 checked, nonempty path into writable output bytes. Return the byte count without 1555 a terminator. A result equal to capacity may be truncated. | 1556 | `getdnts fd A off n` | Write raw Linux `getdents64` records; return bytes 1557 written. | 1558 | `fstat fd A off n` | Write the 128-byte Linux ARM64 stat structure; requires 1559 capacity at least 128. | 1560 | `stat A off n B off capacity` | Metadata for a checked path via `newfstatat`; 1561 writes the same 128-byte ARM64 structure; a short output traps 3. | 1562 | `lstat A off n B off capacity` | As `stat`, but does not follow a final 1563 symbolic link (`AT_SYMLINK_NOFOLLOW`). | 1564 | `renames A off n flags` | Rename the two paths in a packed list using 1565 `renameat2`; flag 1 refuses replacement. | 1566 | `link A off n` | Create a hard link from a packed two-path list (old, new). | 1567 | `symlnk A off n` | Create a symbolic link from a packed two-path list (target 1568 text, link path). | 1569 | `monons` | Monotonic nanoseconds, suitable for elapsed-time measurement. | 1570 | `realns` | Realtime nanoseconds since the Unix epoch, suitable for timestamps. 1571 | 1572 | `sleepns interval` | Sleep for nonnegative nanoseconds. Negative intervals 1573 trap 3. Interruptions return the kernel error. | 1574 | `socknew domain kind protocol` | Create a socket. | 1575 | `bind fd A off n` | Bind the socket to the address bytes in the slice. | 1576 | `connect fd A off n` | Connect using the address bytes in the slice. | 1577 | `listen fd backlog` | Listen for connections. | 1578 | `accept fd flags` | Accept a connection with `accept4`; return descriptor, 1579 without peer-address output. | 1580 | `sockname fd A off n` | Write socket address bytes; return the full address 1581 length, which may exceed capacity when truncated. | 1582 | `peername fd A off n` | Query the connected peer of an existing descriptor 1583 into a writable byte slice; return full peer-address length, or negative errno. 1584 A result greater than `n` truthfully indicates truncation. | 1585 | `sockopt fd level option A off n` | Set one allowlisted scalar transport 1586 option from a readonly four-byte slice; see the allowlist below. | 1587 | `recv fd A off n flags` | Receive into a writable slice. | 1588 | `send fd A off n flags` | Send a slice with `MSG_NOSIGNAL` added, so a closed 1589 peer returns an error. | 1590 | `waitio fd events interval` | Poll one descriptor. Return readiness bits, zero 1591 on timeout, or negative errno. Interval is nanoseconds; negative means infinite. 1592 Events outside 0..65535 trap 3. | 1593 | `peercred fd A off capacity` | Read Linux `SO_PEERCRED` into a writable slice 1594 of at least 12 bytes: little-endian 32-bit PID, UID, GID; return zero or 1595 negative errno. | 1596 | `pollfds A off n interval` | Poll a writable slice of packed eight-byte Linux 1597 `pollfd` records. `n` is bytes, a multiple of eight, at most 8192. Return ready- 1598 entry count, zero on timeout, or negative errno. Interval is nanoseconds; 1599 negative means infinite. | 1600 | `sendmsg fd A off n flags` | Send one checked payload using a private `msghdr` 1601 and single `iovec`, without ancillary data or destination-address override. Adds 1602 `MSG_NOSIGNAL`; returns a possibly partial byte count or negative errno. | 1603 | `fork` | Copy the current process: zero in the child, child PID in the parent, 1604 negative errno on failure. | 1605 | `getpid` | Return the current process ID. | 1606 | `killpid pid signal` | Send a signal; zero signal checks existence/permission. 1607 | 1608 | `waitpid pid A off n options` | Wait with `wait4`; write a four-byte status, 1609 return PID or zero for an unfinished nonblocking wait. Capacity at least four. | 1610 | `pipefds A off n flags` | Create a pipe with `pipe2`; write two little-endian 1611 32-bit descriptors. Capacity at least eight. | 1612 | `dupfd fd target flags` | Duplicate onto a chosen descriptor using `dup3`. | 1613 | `execprog A off n` | Replace the process using a packed argument list. Only 1614 returns on failure. | 1615 | `execpure A off n` | Keyword id 198, AArch64 only (x86 emission refuses with 1616 error 25). As `execprog`, then pin the executable as descriptor 3 and apply the 1617 fixed strict stdio profile below before `execveat(AT_EMPTY_PATH)`. Only returns 1618 on failure, with the first failing step's negative errno. | 1619 | `execenv A off n B off m` | Keyword id 233, AArch64 and x86linux. As `execprog 1620 A off n`, but the child's environment is exactly packet B (u16 count 1..64, 1621 nonempty u16-length records, 2..4096 bytes, no embedded zero, no trailing bytes) 1622 instead of an empty one. Both packets are checked (trap 3) before descriptors 1623 above 2 close. Only returns on failure, with a negative errno; refused in 1624 function mode (error 9) and in contracts (error 30). Gate: `seed/host/execenv/`. 1625 | 1626 | `prlimit pid res A off n` | Keyword id 235, AArch64 and x86linux: Linux 1627 `prlimit64` (syscall 261 / 302). `pid` and `res` are int (0 = this process), A a 1628 writable byte array, `off` and `n` ulong. `n` 16 reads: the old `{rlim_cur, 1629 rlim_max}` is written to `A[off..off+16)` as two little-endian u64. `n` 32 sets: 1630 the new pair is read from `A[off..off+16)` and the old pair is written to 1631 `A[off+16..off+32)`. Any other `n` returns -22 without a kernel call; with `n` 1632 32 the kernel also returns -22 (EINVAL) when the new soft value is above the new 1633 hard value, which does not mean a bad `n`. The slice `A[off..off+n)` is checked 1634 first (trap 3). Returns 0 or a negative errno. Limits are inherited across 1635 `fork` and kept across `execprog` (the gate checks RLIMIT_AS in an exec'd 1636 child). Refused in function mode (error 9), in contracts (error 30) and under 1637 `target x86efi` (error 25). Gate: `seed/host/prlimit/`. | 1638 | `argcnt` | Return argument count, including the executable name. | 1639 | `argread index A off capacity` | Copy argument bytes without a terminator; 1640 return byte length. An invalid index traps 3. Insufficient capacity returns -105 1641 without changing the slice. | 1642 | `envcnt` | Return the number of entries in the process environment (the `envp` 1643 the kernel supplied). | 1644 | `envread index A off capacity` | Copy one environment entry without its 1645 terminator; return its byte length. An index at or past `envcnt` traps 3; 1646 insufficient capacity returns -105 without changing the slice. | 1647 | `random A off n flags` | Fill a writable byte slice from Linux `getrandom`. 1648 Return the bytes written or -errno. `flags` is `int`: 0 blocks until the pool is 1649 ready, 1 `GRND_NONBLOCK`, 2 `GRND_RANDOM`, 4 `GRND_INSECURE`; other flags return 1650 -EINVAL. | 1651 ### Path and process boundaries 1652 Paths are at most 4095 bytes. Embedded zero bytes and longer paths trap 3 1653 before a kernel operation. The compiler privately copies and terminates paths 1654 at the Linux boundary; Omega array lengths remain explicit. Private stack 1655 space is checked against the existing stack floor before writing. 1656 `readlnk` additionally rejects an empty path with trap 3. Its path may be a 1657 readonly slice; its output must be writable. Both slices receive the ordinary 1658 array bounds and byte-type checks. The private path copy is complete before 1659 the kernel writes the output, so overlapping path and output slices are safe. 1660 `cwd` requires writable bytes. It preserves the kernel's count convention: 1661 the returned count includes its trailing zero byte. `readlnk` never appends a 1662 zero byte. These operations are Linux `getcwd` and `readlinkat(AT_FDCWD)`. 1663 `sockopt` is Linux `setsockopt`, restricted to `SOL_SOCKET` (level 1) 1664 `SO_REUSEADDR` (2), `SO_REUSEPORT` (15), `SO_KEEPALIVE` (9), `SO_SNDBUF` (7), 1665 `SO_RCVBUF` (8), and `IPPROTO_TCP` (level 6) `TCP_NODELAY` (1). 1666 Each value is exactly four little-endian bytes. An unlisted level/option returns 1667 `-92` (`ENOPROTOOPT`) without invoking the kernel; an allowed option with a 1668 different length returns `-22` (`EINVAL`). Kernel errors for listed operations 1669 are preserved, including `-9` (`EBADF`) and `-95` (`EOPNOTSUPP`) when a socket 1670 family does not support a listed option. No pointer-bearing option is exposed. 1671 `peername` uses Linux AArch64 `getpeername` (syscall 205), not `getsockname` 1672 (204); under `target x86linux` it uses x86-64 `getpeername` (52), not 1673 `getsockname` (51). It shares `sockname`'s checked writable slice and private 1674 32-bit 1675 length convention. Zero capacity is allowed, including at the array end; 1676 success still returns the full address length without writing address bytes. 1677 The checked array capacity fits the kernel's signed 32-bit length. No descriptor 1678 is created or connected. The descriptor is an existing process descriptor; 1679 callers must control its lifetime, including close/reuse races. 1680 Consume output only after success and after checking length and address family. 1681 The native Linux sockaddr describes the transport endpoint, not an authenticated 1682 user or an original client behind a proxy. Forwarding headers gain no authority. 1683 Existing trusted-proxy policy remains a separate caller responsibility. 1684 `peercred` is kernel-attested local peer identity, not application 1685 authorization. 1686 Use it only on a connected Unix socket and compare the returned identity with 1687 the service's explicit policy. Unavailable or unexpected credentials must fail 1688 closed. Capacity below 12 traps 3 before the syscall; extra capacity is 1689 untouched. 1690 Each `pollfds` record is `fd:int32`, `events:uint16`, `revents:uint16`, in 1691 little-endian byte order. The kernel updates `revents` in place. Misaligned byte 1692 lengths and lengths above 8192 trap 3. A zero-length slice is a timed sleep. 1693 Applications must inspect error/hangup bits and every syscall result. 1694 Networking errors use the existing stable Linux-arm64 negative-errno contract: 1695 `-4` interrupted, `-11` would block, `-32` broken pipe, `-110` timeout, 1696 `-111` refused, and `-115` connect in progress. `read`, `write`, `send`, `recv`, 1697 and `sendmsg` may complete partially. The library must advance by the actual 1698 count, distinguish EOF from errors, retry interruptions within a monotonic 1699 deadline, and wait for readiness on nonblocking sockets rather than spin. 1700 Never retry `fclose` after an error: the descriptor may already be released. 1701 A packed list is a little-endian `u16` count followed by that many records, 1702 each a little-endian `u16` byte length and those bytes. There is no padding or 1703 terminator in the public format. The whole packet is at most 4096 bytes and 1704 the count is 1..64. Embedded zero bytes, truncated records, extra trailing 1705 bytes and out-of-range counts trap 3. `execprog` uses the first record as both 1706 the executable path and argument zero; it must be nonempty. Other arguments 1707 may be empty. `renames` requires exactly two nonempty path records. 1708 The compiler constructs private, bounded pointer lists for the kernel. They 1709 are never exposed as language values. `execprog` supplies an empty environment, 1710 preserves the working directory and standard streams (descriptors 0, 1 and 2), 1711 and does 1712 not search PATH or invoke a shell. Before execution it closes every descriptor 1713 at or above 3 using Linux `close_range(3, UINT_MAX, CLOSE_RANGE_UNSHARE)` 1714 (AArch64 and x86-64 emission alike). 1715 If that kernel operation fails or is unavailable, execution is refused with 1716 the kernel's negative error result; no descriptor-loop fallback is used. 1717 After a successful close, an executable-path failure still leaves those 1718 descriptors 1719 closed. Malformed packets trap before descriptor closure. Callers must 1720 explicitly 1721 bind intended streams before invoking `execprog`; higher-numbered descriptor 1722 inheritance is unsupported. This prevents accidental descriptor inheritance; 1723 it does not restrict filesystem paths, network creation, current-directory 1724 access, 1725 subprocesses or arbitrary native code. Existing authority/launcher integration 1726 is 1727 still required for those effects. Forked children are independent 1728 processes and must be reaped; this extension does not add shared-memory threads. 1729 `execpure` (word 198) decodes and closes descriptors exactly as `execprog`, then 1730 applies a fixed 1731 strict stdio profile before entering the program: it opens the executable path 1732 `O_PATH|O_CLOEXEC` 1733 as descriptor 3; creates a Landlock ruleset that handles every ABI-3 filesystem 1734 right and allows 1735 only execute and read-file beneath that inode; sets `PR_SET_NO_NEW_PRIVS`; 1736 restricts itself to the 1737 ruleset; sets seven `prlimit64` ceilings (CPU 1/2 s, file size 1 MiB, stack 8 1738 MiB, core 0, processes 1739 0, descriptors 4, address space 128 MiB); installs a seccomp filter that kills 1740 the process on a 1741 non-AArch64 audit architecture and allows only `read` on descriptor 0, `write` 1742 on descriptors 1 and 1743 2, `exit`, `exit_group` and `execveat` on descriptor 3 with flags 1744 `AT_EMPTY_PATH`, returning EPERM for 1745 everything else; and finally calls `execveat(3, "", argv, empty envp, 1746 AT_EMPTY_PATH)`. The first step that returns a 1747 negative value restores the private stack and returns that negative errno 1748 without executing. 1749 There is no weaker fallback. This is a fixed profile, not a general sandbox; 1750 output and wall-clock 1751 budgets still need a trusted supervisor. Qualification is 1752 `seed/qualification/security673/gate669.om` 1753 (`pure-*.om` fixtures). The x86-64 emitter has no strict-profile lowering and 1754 refuses the word with 1755 error 25. 1756 Clock results require nonnegative seconds and a signed nanosecond total; 1757 values outside that range trap 1. `argread` bounds 1758 its internal string scan at 1 MiB; reaching that bound traps 3. Linux ARM64 is 1759 the only qualified host. OS flags, address layouts and metadata layouts are 1760 host-specific; portable library contracts remain separate work. 1761 Qualification is `sh seed/host/check.sh`; see `seed/host/README.md`. The seed 1762 loader and shell test coordinator do not implement these operations. No 1763 foreign-language compiler or runtime is on the new implementation path. 1764 The proposed device/memory extension adds checked `devctl`, `mapnew`, 1765 `mapdrop`, `mapread` and `mapwrite` to this same compiler, plus the VFIO words 1766 `vfioctl` (literal allowlisted request, exact size, `argsz` forced; 1767 IOMMU_MAP_DMA takes an 1768 owned mapping handle, never an address), 1769 `eventfd` (uint initial value, CLOEXEC|NONBLOCK, existing 1770 read/write/poll/close), 1771 `vfioirq` (acquired-device/eventfd kinds, exact argsz, bounded IRQ forms), 1772 `vfiomap` (read-only shared map of exactly one reported VFIO region) and 1773 `vfiomapw` 1774 (the same map read/write, for device registers). Its exact type, 1775 ownership, range and refusal contract is 1776 [seed/host/MAPPING.md](../../seed/host/MAPPING.md). 1777 The VFIO/event words use keywords228..232 respectively as `vfioctl`, 1778 `vfiomap`, `vfiomapw`, `eventfd`, `vfioirq`. They are AArch64 1779 program-mode words; function mode refuses them, and hosted x86 VFIO 1780 is not implemented. Descriptor-kind tracking remains program-local: 1781 existing OM-2 unit `fclose`/`dupfd` emission does not access that 1782 standalone-program table. 1783 The draft `devctl` boundary also admits five exact aien-gpu ABI1 request 1784 numbers, not arbitrary type-A ioctls; changing their direction or encoded 1785 payload size is refused. See the pinned UAPI and Wolfram-derived matrix there. 1786 Drake must approve this trust-surface extension before merge. 1787 It adds process-local mapped resources while the compiler's own storage remains 1788 fixed pools. GPU launch and model execution are separate, still-unqualified 1789 gates. 1790 #### `devcall` (keyword 171) 1791 `devcall fd request H hoff 32 P poff n` returns `long`, the ioctl result or 1792 negative Linux errno. `fd` is `int`, `request` a literal `uint` RM_ALLOC or 1793 RM_CONTROL request, `H` and `P` writable `uchar` arrays, and `hoff`, `poff` 1794 and `n` are `ulong`. The header span must be exactly 32 bytes and the 1795 parameter span at most `1048576` bytes (inclusive, the RM default copy-in cap). 1796 Both slices must fit their arrays, must not overlap, and the header's caller 1797 pointer bytes must be zero; violations trap 3 (exit 103). 1798 The checked parameter span is bound directly, not copied onto the stack; 1799 only a private 32-byte header is stack-backed. See 1800 [`MAPPING.md`](../../seed/host/MAPPING.md) for the ABI and upstream cap source. 1801 `seed/host/tests/devcall.om` checks harmless memfd ioctls at 16384, 55888 1802 and `1048576` bytes, and refusal at `1048577` bytes. `devctl` retains its 1803 request-encoded size limit. 1804 ### Host CPU ordering words (#939) 1805 | Statement | Meaning | 1806 |---|---| 1807 | `cpufence` | Publication barrier (keyword id 199). Every load and store before 1808 it completes before any load or store after it. AArch64: `DSB SY` (``d5033f9f``), 1809 the barrier `mapget`/`mapset` already bracket their access with. x86-64 (`target 1810 x86linux`): `MFENCE` (`0f ae f0`), the fence the x86 `mapget`/`mapset` use. | 1811 | `cpurelax` | Spin-wait hint, no ordering (keyword id 200). AArch64: `YIELD` 1812 (``d503203f``). x86-64: `PAUSE` (`f3 90`). Use it inside a bounded poll loop and 1813 pair it with `cpufence` when order matters. | 1814 Both are statements with no operands and no value. Unlike the other host words 1815 they are accepted in function mode as well as program mode, because they make no 1816 system call. An operand is error 5, use as a value or outside a function is 1817 error 16, use as the name on the left of `=` is error 5, and a statement after 1818 `ret` is error 17. IR mode (`ir` first line) refuses them with error 16. 1819 `seed/host/cpufence.sh` (run by `seed/host/check.sh`) checks each refusal 1820 except the IR one, plus a function-mode unit, on the host. The fixture 1821 `seed/host/tests/cpufence.om` exits 42 natively on AArch64 and under 1822 qemu-x86_64. GNU objdump, used only as a referee, finds exactly one added 1823 `dsb sy`/`mfence` per `cpufence` and one `yield`/`pause` per `cpurelax`, 1824 compared with the same program with the words deleted. The script also checks 1825 the refusals above and builds a compiler whose `cpufence` emits NOPs. That 1826 compiler still runs the fixture to exit 42, and the instruction count catches 1827 it. These are host results only. Ordering against a GPU is not qualified here. 1828 ## 11. OSC IR output (omc only, experimental checkpoint) 1829 A leading line `ir`, before any other line, puts omc in IR mode: it writes OSC 1830 IR version 1 1831 (`spec/one-layer-format.md`) for a unit of up to 32 functions instead of AArch64 1832 machine words, and 1833 the AArch64 path is not taken. Every function is encoded in source order. A 1834 function may call an 1835 **earlier** function (self and forward calls are error 3) with at most six 1836 arguments; a 1837 value-returning call composes as a value, a void call is a statement, and using 1838 one where the other 1839 is needed is error 7. Argument types are checked at compile time (error 7). 1840 `break` lowers to a 1841 `BR` to the innermost loop's exit and marks the path dead; `continue` is still 1842 refused (error 3). 1843 A `TYPE value` cast reads its operand at the operand's own type and converts it, 1844 exactly as the 1845 AArch64 path does: `ret ulong sub c 48` with `c` a `uchar` lowers to a `sub` 1846 then a `cast`. A bare 1847 number in the cast is range-checked against the cast's type (error 8), a bare 1848 number inside the 1849 operand against the operand's type (error 8), and a bool converts to or from a 1850 number only by 1851 comparison (error 9). A same-type cast of a constant is the constant itself; any 1852 other same-type 1853 value is a `mov`. 1854 The producer validates complete statement lines rather than discarding 1855 trailing words (error 5); missing operands are error 4 and untyped bare 1856 expressions error 11. Locals and loop counters obey block scope, including 1857 the `else` boundary; redeclaring an in-scope name is error 10, and reading 1858 an out-of-scope name is error 3. Locals and parameters retain the native 1859 eight-byte name limit (13), while function names retain full matching up 1860 to 63 bytes. A reachable non-void function end is error 18; a void end 1861 emits an implicit return. Missing function `end` is error 15. Unsupported 1862 float parameter/result types are refused with error 9 before serialization. 1863 Typed literals are range-checked (8). Parentheses remain unsupported in 1864 this scalar IR checkpoint, rather than being silently discarded. 1865 `seed/omc/gate-ir.sh` compares 10 dev programs, nine hand-written multi-function 1866 call units and 30 1867 randomized two-function call units byte-for-byte with the C-built `omegese` + 1868 `omega_emit` oracle, requires `checker2` to ACCEPT every unit, requires 1869 a mul-to-add mutant to differ, and pins refusal cases. Its validation 1870 regressions 1871 cover trailing/missing words, scopes, scalar types, literal bounds and name 1872 limits; positive controls include implicit void returns, sequential `for` 1873 counters, scope reuse and functions sharing a name prefix. Those C tools 1874 are referees only; they never write omc's bytes. 1875 Boolean `and`, `or` and `xor` lower to the IR bitwise sub-operations, just as on 1876 the 1877 native path. `gate-ir.sh` checks all three against the C encoder and checker2. 1878 Arithmetic (`add` through `rem`) and shifts of booleans remain error 7. 1879 Limits, said plainly: scalar values, calls to earlier functions, at most 32 1880 functions and 6 1881 parameters. IR mode refuses a `struct`, `global` or `text` declaration with 1882 error 9 and refuses a 1883 float word, a host word, `continue`, `sizeof` or `offsetof` with error 3, and a 1884 contract line 1885 (`requires`, `ensures`, `invariant`; section 12 is native only) with error 30 on 1886 that line (#791); it 1887 never skips a declaration it cannot lower or reads a contract clause as a local. 1888 A contract word followed 1889 by `=` (`ensures = ulong 1`) assigns a local of that name, as the C oracle and 1890 native mode do. `note` lines are 1891 skipped. Struct IR remains open. The gate needs the 1892 C-built oracles, so `seed/host/check.sh` runs it only when 1893 `build/omegese/omegese`, 1894 `build/omega_emit/omega_emit` and `build/checker2/checker2` exist, and says 1895 `SKIP` otherwise. 1896 ### 11.1 WebAssembly MVP from seeded Omega 1897 `seed/wasm/irwasm.om` reads OSC IR v1 from stdin and emits a deterministic, 1898 import-free WebAssembly MVP module to stdout. The implementation and binary 1899 writer 1900 are seeded Omega; neither C nor Node participates in generation: 1901 ```sh 1902 seed/out/omc < seed/wasm/irwasm.om > irwasm 1903 chmod +x irwasm 1904 { printf 'ir\n'; cat functions.om; } | seed/out/omc > functions.ir 1905 ./irwasm < functions.ir > functions.wasm 1906 nice -n 19 sh seed/wasm/gate-irwasm.sh 1907 ``` 1908 The path is a backend for the existing OSC scalar wire format, not a universal 1909 source converter. Every IR function is exported under its original, unique 1910 ASCII name. For a v1 unit no memory, table, start function, imports, WASI or 1911 JavaScript runtime is required, and the sections are type, function, export 1912 and code, in that order (v7 additions below). 1913 Fixed-width five-byte unsigned LEB section/body lengths are valid MVP encodings; 1914 all other LEB fields use minimal encodings. 1915 | IR scalar tag | Wasm parameter/result | Internal representation and operations 1916 | 1917 |---|---|---| 1918 | 0 void | no result | no value register may have tag 0 | 1919 | 1 bool | i32 | canonical 0/1 in an i64 local; logical not and bitwise 1920 AND/OR/XOR | 1921 | 2 u8, 3 u16, 4 u32 | i32 | zero-extended i64; unsigned operations, mask after 1922 wrapping arithmetic | 1923 | 5 u64 | i64 | all bits preserved; unsigned compare/div/rem/right shift | 1924 | 6 i8, 7 i16, 8 i32 | i32 | sign-extended i64; signed compare/div/rem/right 1925 shift, checked arithmetic | 1926 | 9 i64 | i64 | signed compare/div/rem/right shift; checked arithmetic | 1927 CONST/MOV preserve canonical bits. BIN subcodes 1..10 map to 1928 add/sub/mul/div/rem/and/or/xor/shl/shr; UN 1..3 map to negation, 1929 bitwise not and logical not; CMP 1..6 map to eq/ne/lt/le/gt/ge with the 1930 operand's signedness. Signed add/sub/mul/neg/left-shift overflow traps rather 1931 than wrapping; unsigned results wrap at their declared width. Shift counts 1932 are checked before wasm can mask them. Division by zero traps; signed 1933 MIN/-1 division traps, while MIN%-1 is zero. CAST checks the destination range 1934 before changing width/signedness. CALLs name earlier functions and preserve 1935 each declared ABI type, including void. RET converts the internal local to 1936 the declared ABI. TRAP and every failed numeric check become wasm traps 1937 (`WebAssembly.RuntimeError`); MVP does not preserve the numeric Omega trap code. 1938 BR/CBR lower through an i32 block-dispatch local inside `block`/`loop`, 1939 with per-block `if`, `br` and `br_if`. This handles loops, joins, nested 1940 conditionals and `break` without assuming reducible input. The original 1941 lowered loop-bound instructions remain in the stream. Arbitrary IR cycles 1942 are not independently proven bounded here: this is a backend, not checker2. 1943 Limits are OSC v1 only: at most 32 functions, 6 parameters, 480 registers, 1944 512 blocks and 4096 instructions per function; names at most 63 ASCII bytes; 1945 contract texts at most 255 bytes; input at most 2,620,251 bytes, buffered 1946 output at most 8,388,608 bytes. Tags 10..12, versions 2..5, allocation, 1947 memory/arena/pool/slice operations and all unknown opcodes are refused. 1948 Blocks must partition instructions and end in BR/CBR/RET; scalar types, 1949 call signatures, constant canonicality and definite assignment are checked. 1950 Contract text is retained only as input metadata: its executable checks 1951 must already be present as IR instructions. 1952 | Code | Named stderr refusal | 1953 |---|---| 1954 | irwasm 20 | MAGIC | 1955 | irwasm 21 | VERSION (anything except v1 and v7; v7 with no v7 feature) | 1956 | irwasm 22 | TRUNCATED | 1957 | irwasm 23 | CAPACITY | 1958 | irwasm 24 | UNSUPPORTED_OP | 1959 | irwasm 25 | UNSUPPORTED_TAG | 1960 | irwasm 26 | INVALID (typing, register, block, text, or definite assignment) | 1961 | irwasm 27 | TRAILING | 1962 | irwasm 28 | IO | 1963 Every parse/type/capacity refusal writes no stdout: the module is buffered 1964 until the complete unit and code generation succeed. As with any stream 1965 writer, a later stdout I/O failure cannot retract bytes already written. 1966 The gate pins the compiler digest and compares every export on a fixed 1967 input table with full-width results from real AArch64 Omega drivers. Node 1968 v24.21.0 is solely the read-only validation/execution oracle and is not in 1969 the build path; it can be replaced by another conforming wasm validator. 1970 The gate also compares two translations byte-for-byte, substitutes an 1971 add-to-sub IR-byte mutant into the parity check (must fail), and pins 1972 named refusal exits with empty stdout. This is host evidence, not browser 1973 integration, hardware qualification or a deployment. 1974 Numeric bounds were checked with WolframLanguageEvaluator: 1975 `Table[{w,2^w-1,-2^(w-1),2^(w-1)-1},{w,{1,8,16,32,64}}]`; 1976 the unsigned masks are 1, 255, 65535, `4294967295` and 1977 `18446744073709551615`. The definite-assignment iteration bound was checked 1978 with `512*480+1 -> 245761` (a monotone bit-removal fixed point). 1979 **OSC IR v7 (spec section 10).** irwasm also accepts wire version 7: module, 1980 local and text regions, tags 13 f32 and 14 f64, and opcodes 30 RLOAD, 31 1981 RSTORE, 32 BITCAST and 33 RINIT. A v1 unit translates to exactly the bytes it 1982 did before (the gate checks every v1 fixture). A v7 module adds, in order: 1983 a memory section after the function section (limits flag 1, min = max = the 1984 exact page count, no growth); immutable i32 globals holding the byte offset 1985 of each module and text region; exports for the functions, then `memory`, 1986 then `region.NAME` for each module and text region; one active data segment 1987 per non-empty text region after the code section; and a final custom section 1988 `osc.v7.abi` (function count; per function its name, parameter tags and 1989 result tag; module-region count; per region its name, tag, class and count; 1990 all unsigned LEB) so a host can tell `u8` from `i32` behind an i32. No imports. 1991 | v7 element | Lowering | 1992 |---|---| 1993 | 13 f32, 14 f64 | wasm f32/f64 at the ABI; inside, the bit pattern in an i64 1994 local (wrap/reinterpret on use, so NaN payloads move exactly through CONST, MOV, 1995 regions and BITCAST) | 1996 | BIN add/sub/mul/div, UN neg, CMP 1..6 on floats | IEEE f32/f64 operations; CMP 1997 gives canonical 0/1 | 1998 | CAST int to float, f32 to f64, f64 to f32 | convert_s/u, promote, demote | 1999 | CAST float to int | saturating: NaN gives 0, values beyond the range give its 2000 nearest end, others truncate toward zero; written without the non-MVP trunc_sat 2001 opcodes | 2002 | BITCAST | same width class: no code beyond renormalizing integer signedness | 2003 | RLOAD/RSTORE | full-width index compared unsigned against the region count 2004 before any address arithmetic (a negative index is a huge unsigned value), trap 2005 if not below it; then i64 to i32 wrap, shift by the element width, static region 2006 offset in the memarg | 2007 | RINIT | a bounded loop storing the value into every element of the function's 2008 local region | 2009 Every region, local ones included, gets static storage in table order, 2010 aligned to its element width. A text region's bytes come from its data 2011 segment and are read-only to Omega code (RSTORE and RINIT to text are 2012 refused), though not to a host holding `memory`. Local regions are owned by 2013 one function and only ever seen after that call's RINIT; the validator 2014 computes definite initialization of local regions on every path (unreachable 2015 blocks start with no region initialized), like registers. The memory is at 2016 most 2^31 bytes: `2^31 -> `2147483648`` bytes `= 32768` pages of 65536 2017 (WolframLanguageEvaluator); a larger layout is CAPACITY. At most 1024 2018 regions, `16777216` elements each; a v7 input may be up to 8,388,608 bytes 2019 (the v1 limit of 2,620,251 bytes stays for v1 headers). The region-bit 2020 fixed point is bounded by `512*1024+1 -> 524289` iterations. 2021 Refusals keep the table above. v7 adds: a nonempty struct table is 2022 UNSUPPORTED_TAG (more than 16 structs CAPACITY); region class 3 and opcodes 2023 9/10 are UNSUPPORTED_OP; tags 13/14 or opcodes 30..33 in a v1 unit are 2024 UNSUPPORTED_TAG/UNSUPPORTED_OP; a v7 header on a unit that uses no v7 2025 feature is VERSION, reported after a complete parse; duplicate function 2026 names, duplicate or shadowing region names and an export collision with 2027 `memory` or `region.NAME` are INVALID. 2028 The float-to-int boundaries were computed with WolframLanguageEvaluator as 2029 IEEE bit patterns: f32 2^63 ``5f000000`` (`1593835520`), -2^63 ``df000000``, 2^64 2030 ``5f800000`` (`1602224128`); f64 2^63 ``43e0000000000000`` (`4890909195324358656`), 2031 -2^63 ``c3e0000000000000``, 2^64 ``43f0000000000000`` (`4895412794951729152`). 2032 The gate's v7 section takes its units from the independent hand writer 2033 `seed/wasm/v7/writer.js` plus `seed/wasm/v7cases.js`, and its verdicts and 2034 expected outputs from the independent oracle `seed/wasm/v7/oracle.js`. 2035 Every accepted unit must translate twice to identical, valid wasm; every 2036 refused unit must exit with the oracle's class and empty stdout. For each 2037 run case, `node seed/wasm/v7run.js MODULE SCRIPT` (a read-only executor that 2038 reads `osc.v7.abi`) must print exactly what `oracle.js run` prints. The RGBX 2039 case fills a 16x8 `uint` framebuffer whose byte lanes follow a `text "RGBX"` 2040 table; its sha256 must agree, and a one-channel mutant and a `BGRX` mutant 2041 must hash differently. The out-of-bounds case (index = count, count + 1, 2042 negative i8/i32/i64, u64 with an in-range low 32 bits, all-ones u64) must 2043 trap in both, and an irwasm compiled with its two bounds-check calls 2044 deleted must be caught. 2045 ### Equivalence of scalar IR functions (seed/equiv, issue 826) 2046 `seed/equiv/irequiv.om` is a seeded-Omega interpreter for the same OSC IR v1 2047 units (its reader is 2048 irspirv's v1 reader byte for byte; irwasm's v7 reader is that reader plus the 2049 edits recorded in 2050 `seed/equiv/irwasm-v7.sed`). `irequiv check A B` runs both functions on every 2051 input of a signature of 2052 at most 24 bits (all 256 for one uchar, all 65536 for a ushort or two uchars) 2053 and prints 2054 `EQUIV PASS ... checked=N differing=0`, or `EQUIV FAIL ... differing=K 2055 first=` with both 2056 results; equal means the same bits or the same trap code. Wider signatures are 2057 only sampled 2058 (`irequiv sample`), printed as `NOT_A_PROOF` with exit 10. A PASS covers the IR 2059 both functions 2060 lowered to under `src/compiler/osc_interp.c` semantics, not native words. 2061 `seed/equiv/gate-irequiv.sh` 2062 runs the fixture pairs (repo functions js_hexv/hhexv, clamp_add, bitrev8, r8 2063 against refactors and 2064 single-input mutants), then checks `irequiv eval` against native AArch64 2065 programs on the 140 rows of 2066 `seed/wasm/cases.tsv`, `seed/spirv/regression.tsv` and `seed/spirv/demo.tsv` 2067 (same bits, same trap 2068 code); `seed/equiv/README.md` has the command line and exit codes. 2069 ### 11.2 Memory profile contract (IR v7) 2070 The backend half of this contract is implemented by `seed/wasm/irwasm.om` 2071 (section 11.1). The producer half (omc's IR mode writing version 7) is separate 2072 work: on this compiler IR mode still writes version 1 only, so the v7 units the 2073 gate translates come from the hand writer `seed/wasm/v7/writer.js`. The 2074 authoritative wire 2075 allocation and validation rules are in `spec/one-layer-format.md` section 10. 2076 The milestone name does not repurpose OSC wire version 2. 2077 The source spelling reuses native arrays: 2078 ``` 2079 global pixels uint 4096 2080 text palette "RGBX" 2081 fn frame phase uint to uint 2082 scratch = new uint 4 phase 2083 put pixels 0 get scratch 0 2084 ret get pixels 0 2085 end 2086 ``` 2087 `global` creates mutable per-instance storage; `text` creates a read-only 2088 byte table; `new` creates a function-local fixed-size array whose initializer 2089 is evaluated once at its declaration and copied to every element on each 2090 invocation. `len` is a compile-time element count. A one-element global is 2091 the scalar-state spelling. Mutable globals start at zero and persist 2092 between exported calls. Local storage never exposes a previous call. 2093 `get` and `put` retain exact element typing and bounds behavior: a constant 2094 out-of-range index is error 21, a dynamic negative or high index is trap 3, 2095 and writing text is error 20. All accesses are checked before address 2096 arithmetic; there is no unchecked form. Integer indices do not become valid 2097 by wrapping to a wasm32 address. Elements are naturally aligned and packed 2098 at their scalar width; struct-cell layout is a separate contract. 2099 Type/context/capacity refusals remain errors 7/9/14/23 respectively. 2100 The first memory profile names globals directly from functions. It does not 2101 add array parameters, raw pointers, dynamic allocation or GPU synchronization. 2102 Function/Workgroup storage distinctions are wire contracts, not permission 2103 to lower persistent state to per-work-item temporary storage. 2104 The wasm ABI exports `memory`, original scalar function names, and immutable 2105 `region.NAME` offset globals for module regions. JavaScript can form a typed 2106 framebuffer view and invoke `frame` explicitly; Omega does not install a 2107 browser loop or import JavaScript services. A read-only source table is not 2108 protected from a JavaScript caller that holds the exported memory. 2109 ## 12. Executable native contracts, version 1 (OM-2 extension) 2110 This section extends the seeded native compiler, not the OSC v1 metadata in 2111 section 11.1. `om2` and `om2 debug` check contracts. `om2 release` erases their 2112 runtime evaluation after the same syntax, scope, type and purity checks. 2113 `om2 diag debug` and `om2 diag release` combine the policy with diagnostic 2114 records. `om2 fmt` keeps its existing canonical profile and checks contracts. 2115 OM-1 does not reserve any new words. No environment variable selects policy. 2116 ``` 2117 om2 2118 fn step x uint to uint 2119 requires lt x 10 2120 ensures eq result add x 1 2121 ret add x 1 2122 end 2123 fn main to int 2124 i = uint 0 2125 while lt i 3 2126 invariant le i 3 2127 i = step i 2128 end 2129 ret int sub i 3 2130 end 2131 ``` 2132 ### Declaration and observation points 2133 `requires BOOL` and `ensures BOOL` form a function's prefix, before its first 2134 executable statement. Blanks and `note` lines may separate clauses. A function 2135 has at most 64 prefix clauses. Preconditions execute in declaration order on 2136 entry, after parameter binding, including inline calls. 2137 Postconditions execute in declaration order on **every normal return**: 2138 explicit value/void `ret`, implicit void fallthrough, and inline returns. 2139 They do not execute on `exit`, a trap or abnormal process termination. The 2140 return expression is evaluated exactly once and preserved while checks run. 2141 The read-only name `result` is available only in value postconditions. It has 2142 the declared return type. The caller receives that same value after the checks. 2143 Function predicates bind globals and parameters visible at their declaration, 2144 not names introduced later in the body. A parameter in a postcondition means 2145 its **current value at return**; array reads likewise observe current contents. 2146 There is no implicit entry snapshot and no `old` operator. Reads of `fresh` 2147 output arrays are checked for definite initialization at every return. 2148 `invariant BOOL` forms the prefix of a `while` or `for` body, before any body 2149 statement. There are at most 64 clauses per loop. It sees loop-entry names and, 2150 for `for`, its counter. Clauses run at the **loop head**, before the condition: 2151 on entry even for zero trips, on every backedge, and before the final false 2152 condition. `continue` reaches that head; `for` increments first. `break` 2153 bypasses the next check and makes no promise about the break-exit state. A 2154 return from inside a loop runs function postconditions, not an extra invariant. 2155 Unrolled loops preserve these observation points, including their final 2156 counter value. Their diagnostic `iter` can therefore equal the loop limit. 2157 ### Purity, proofs and failure 2158 Predicates have type `bool`. Their bounded, recursive expression grammar 2159 permits integer/bool literals and names, integer/bool operations and checked 2160 conversions, grouping, `len`, and ordinary checked array/struct/layout reads. 2161 It excludes user calls (including inline calls), floats and abstract values, 2162 host operations, mapped-device operations, allocation, writes and ownership 2163 operations. The exclusion is recursive, including in release and under a 2164 constant expression. `and` and `or` remain eager, never short-circuit bounds 2165 guards. 2166 The checker proves literal `true` and safely folded constant predicates using 2167 the existing checked integer folder. A proof erases evaluation only when the 2168 whole predicate is known to return true without trapping. It does not assume 2169 that arbitrary reflexive expressions are safe. Constant false remains a 2170 runtime failure in debug; release erases it by policy, not by proof. 2171 False `requires` uses existing trap **9** (program exit **109**); false 2172 `ensures` or `invariant` uses existing trap **10** (exit **110**). 2173 Function-mode callers receive those same trap codes through `OscRt.trap`. 2174 An arithmetic, conversion or bounds failure while evaluating a predicate 2175 retains its original trap code. Compiler error **30** means misplaced 2176 contract syntax, unavailable `result`, or a forbidden predicate operation. 2177 Existing type, unknown-name, initialization and capacity errors retain their 2178 codes. Diagnostic trap sites name the predicate's source line. 2179 Error 30 has diagnostic obligation `contract`. Each emitted contract site also 2180 has an `omc-check 1 kept|erased line=N rule=RULE kind=KIND` record in diagnostic 2181 mode: `runtime` for kept checks, `constant-true` for a proof, or `release` for 2182 policy erasure; KIND is `requires`, `ensures` or `invariant`. Deferred 2183 postconditions are reported at their actual return sites, not during entry 2184 validation. 2185 Release erasure removes predicate instructions, trap records and diagnostic 2186 sites, and restores temporary allocation and branch bookkeeping. It never 2187 uses the predicate as an optimizer assumption and never erases the body's 2188 arithmetic, bounds, initialization, stack or loop-fuel protection. Contract 2189 sources still must fit the compiler's validation capacities in release. 2190 Fixtures and exact expected outcomes are in 2191 `seed/omc/contracts/contracts.cases`, using the existing pinned 2192 `seed/qualification/om2/gate.om` conductor. The example above is exercised by 2193 `seed/omc/contracts/ok.om`; release/erased and proved/plain pairs require 2194 byte-identical output, not just equal exit statuses. 2195