interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / docs / one_layer / OMEGESE.md

1896 lines · 143457 bytes Raw Blame History Source

Omegese: a program language built for the AI writer

Status: v1 (nested values, exact next oracle, 2026-10-15). Phase 1 done (language, translator, checks, token measurement); phase 2 started (section 7). Tool: tools/omegese/omegese.c; tests: make test-omegese. Named Glyph until 2026-10-15 (the name was taken); evidence recorded before then says glyph. Home: omegese.com (owned by Drake since 2026-10-15).

1. Why

exp445 (docs/one_layer/EXP445_PROTOCOL.md) asks AIs to write Omega programs as OSC text, as a JSON op list (tools/omega_emit/SCHEMA.md) and as hex bytes of the binary IR. The cost and the errors come from the same places: punctuation and keys (JSON), two characters per byte (hex), and bookkeeping the writer must do in its head: numbered registers with declared types, numbered blocks, byte offsets. Text avoids the bookkeeping but needs a compiler for a human-readable language.

Omegese keeps the machine-first path (no human source language in production) and removes the bookkeeping and the punctuation. Its words are chosen from the writer model's own vocabulary.

2. Design rules

  1. Efficiency metric: verified programs per unit of inference cost. Language design optimizes for verified programs produced per unit of inference cost (measured on held-out tasks by first-attempt correctness, successful compilation, verified behavior, completion time, and total compute cost), rather than treating single-token vocabulary as a rigid language rule. Fitting fixed words into single tokens under a specific tokenizer (e.g. Qwen3 where ops, types, and keywords were verified as single tokens with a leading space) is an empirical token-cost consideration, not a binding constraint on the language definition. The compiler-guided interface must remain portable across models and tokenizers. There is no punctuation besides = (also one token, and optional) and the optional brackets ( ); no commas, no indentation. Values nest in prefix order (every op takes a fixed number of values), so brackets are never needed. Numbers cost one token for the space plus one per digit under tokenizers that split digits.
  2. Types are inferred. Only parameters, the return type, conversions, typed numbers (uint 5) and new arrays name a type. A value's type comes from the op that makes it, bottom-up through nested values; a number takes the type of the other value in its op. This removes the "register declared one type, written with another" error class.
  3. Names, not numbers. Values are named; registers, blocks and branch targets are numbered by the translator. Control is structured (if/else/end, while, for).
  4. Scope gives definite assignment. A name first written inside an if, else, while or for dies at its end; to carry a value out, write it before the block. So every read is written on every path by construction. Every name written must be read before its scope ends (parameters and loop counters excepted), so a misspelled word (the short form turns rte a into a new name) or a forgotten value is refused. No name hides a visible one (loop names included). Parameter names are distinct. Calls go to earlier functions only, with each argument checked against the parameter (arrays: own from own, edit from own or edit, view from any).
  5. Loops are proven to end. Every loop lowers to the shape checker2 proves terminating (src/checker2/c2_check.c, "loop bounds"; the shape oscc emits for while ... bound N).
  6. Prefix-decidable. After any prefix the checker knows which words may come next (omegese next): the mask an inference engine can apply while the model writes, so an invalid program cannot be written.
  7. Same trust chain. Omegese -> omega_emit op list -> canonical OSC binary IR -> checker2 -> signed receipt. Omegese changes nothing after the op list.

3. The language

A program is one or more functions. A line holds one statement; words are separated by spaces.

fn <name> (<param> <type>)* to <type> | void      a function; `end` closes it
<name> = <value>          write a value (a new name, or an existing one of the same type);
<name> <value>            the same, with `=` left out
if <cond> / else / end
while <cond> [bound N] / end      N 1..9223372036854775807 (a number or any integer const; IR
                          mode: 1..1000000), default 1000000; past N iterations: trap 4
for <name> <type> <count> [bound N] / end   name = 0 .. count-1 (count a number, or a value of that
                          type; IR mode: a number count 0..1000000); N as for while. With no bound a
                          number count is not guarded and any other count traps 4 after 1000000
                          passes; with `bound N` any count traps 4 after N passes (the counter may
                          be written in the body)
break                     leave the innermost loop; outside a loop: error 9. Like ret, it ends the
                          path (a later line in the same block is error 17)
continue                  jump to the next iteration: a while's head, a for's increment. Outside a
                          loop: error 9. Like ret, it ends the path (a later line is error 17)
ret [<value>]
put <array> <index> <value>      store
trap <code 1..14>         stop with that code (out of range: error 8). Program mode exits 100 + code;
                          function mode calls OscRt.trap. Like ret, it ends the path (a later line in
                          the same block is error 17)
<function> <args>         call a function that returns nothing

Values are prefix expressions. Every op takes a fixed number of values, and each of those values may itself be an op, so no brackets are needed: add mul r r 4 is add(mul(r, r), 4), and eq rem n 2 0 is eq(rem(n, 2), 0).

valuetakesmeaningIR
<name> / number0copymov / const
add sub mul div rem and or xor shl shr a b2arithmetic, bitwise, shifts (shift amount any whole-number type)bin
eq ne lt le gt ge a b2comparison, gives boolcmp
neg a / not a1negate (signed) / logical not (bool) or bitwise not (number)un
<type> a1a typed number (uint 5) or a conversion (ulong x, ulong add a b)const / cast
get arr i2load (arr is an array name)load
new type len init3a new own array of len elements (omc: 1..16777216, at most 4 MiB of local arrays, s.9.4; the C reference path through OSC IR: 1..64, OSC_MAX_ARRAY_LEN); only as the whole value of <name> =alloc
own / edit / view arr1move / mutable borrow / shared borrow (arr is an array name)mov
<function> argsits parameter countcall an earlier functioncall

Brackets are optional grouping: ( <value> ) holds exactly one complete value and changes nothing else (sub diff (i64 b) = sub diff i64 b). A ( without its ), a ) without its (, an empty ( ), or a ( ) holding more than one value is refused. ( and ) are separate words even when written against a name.

Typing is bottom-up. A value's type comes from its op; a bare number takes the type of the other value of its op (add x 1, sub 15 i, shl 1 sh), or the type the place needs when it stands alone (ret 0, x = 5 for an existing x, a call argument, an index is uint). Two bare numbers in one op are refused (add 1 2, also when nested: add a mul 2 3). Comparisons give bool. In a shift a bare number on the left takes the type of the shift amount (shl 1 sh with sh uchar shifts a uchar); write its type when you mean another (shl ulong 1 sh). A typed number inside a conversion is converted (long int 5 is the int 5 converted to long; uchar int 300 traps 5).

A condition is any value that gives bool (while ne b 0, if or lt p -32768 gt p 32767). Values may be nested wherever a value goes: after =, ret, if, while, put (index and value), call arguments, a for count, inside conversions. and, or evaluate both sides (no short cut).

A wrong number of values is refused with its place: line 3: le has 3 values after it; it takes 2, line 2: sub has 1 value after it; it takes 2, extra words at the end of the line: 'b'.

Types: bool uchar ushort uint ulong byte short int long = bool u8 u16 u32 u64 i8 i16 i32 i64 (the IR names u8 .. i64 are accepted too, as the task signature writes them; they cost 2 or 3 tokens) (u32 is three Qwen3 tokens; uint is one). Arrays: own|edit|view <type> <len>.

Example (dev04):

fn gcd a uint b uint to uint
while ne b 0 bound 100
t = rem a b
a = b
b = t
end
ret a
end

4. Lowering

Numbers are hoisted into the entry block, one CONST per distinct value and type (so the loop bound is defined exactly once, as checker2 requires). Blocks are numbered in the order they start.

5. Measured (phase 1)

The 10 public dev tasks (tests/one_layer/exp445/dev), reference solutions in each spelling, tokens counted offline with the Qwen3 tokenizer (the measure.sh method: text = reference.osc; bytes = hex of the compiled IR; structured = omega_emit lift of that IR; Omegese = tests/one_layer/omegese/dev/*.omegese; Omegese short = the same with = left out).

tasktextbytesstructuredOmegeseOmegese short
dev01642813094845
dev02602562864340
dev03815676245753
dev04824415074138
dev0527118911717
dev0627112911717
dev071205947507265
dev081038079268477
dev09754885475550
dev102298791515
total66137624210449417

Omegese is 9.4x fewer tokens than the structured op list and 32% fewer than OSC text, for the same IR shape (all 10: harness ola.sh experiment set omegese-1 accepted 10/10, RUN VALID, run 20261015T094000Z-e27a33ee052d-562014; checker2 ACCEPT on all 10).

Limits: the Omegese programs were written by the designer, not by a model, and in places use the shortest form (writing to parameters instead of copies), so the text column is not an equal-effort rewrite. Whether models write Omegese reliably is not measured yet.

6. The next oracle and the checks (make test-omegese)

6.1 What omegese next promises

omegese next <prefix> reads a prefix of a program (any text, cut anywhere, even inside a word) and prints what may come next. It is exact: an item is printed if and only if some text that starts with it turns the prefix into a program omegese emit accepts. Nothing that can still lead to an accepted program is missing (within the limits in 6.4), and nothing printed leads to a dead end. When no text can, it prints one REFUSED omegese: ... line and exits 1: a defect in its complete words gets the reason emit would give; otherwise (also when the word being written cannot be finished) the line says no text after this prefix makes a program emit accepts with the reason the nearest attempt failed.

How it decides. The prefix is split into its complete lines, the complete words of the last line, and the word still being written (empty after a space, a bracket or at a line start). For each candidate item a witness is built: the line is finished with the words it still needs (a ret line also reads the names the ending path would otherwise leave unread), every open block is closed (x = x for each unread name, a ret of a zero where a value is owed, end), and the real parser that emit runs re-reads that line and the closing lines from the state after the complete lines, with every end-of-input check. An item is printed only when its witness is accepted, so every printed item is legal by construction. Completeness rests on the witness finder; the test fuzz below checks it.

Names stay open at the character level. When a line binds a new name, any identifier is legal except a reserved word (omegese words and the IR type names u8 .. i64) or one equal to a visible name; that is printed as one class item. When a line reads a name, the names printed are the visible names (and earlier functions) of the right type and kind. Numbers come as intervals: the parser only compares a number with fixed bounds (type ranges, array lengths 1..64, trap codes 1..14, loop bounds and counts up to 1000000) and with the lengths of the arrays in scope, so one test per breakpoint and per gap between breakpoints decides every number, and neighbouring legal pieces merge. Numbers are written as decimal digits with an optional minus sign and no leading zeros; -0 is refused by emit as well (it is not a number).

6.2 omegese next --machine: the fixed grammar

One item per line, in this order, nothing else on stdout. Exit 0 with at least one item, or exit 1 with exactly one line starting REFUSED omegese: . Let U be the word still being written.

linemeaning
word Xfinish the current word as X (X starts with U): a fixed word, a visible name, a function, or a name written earlier on the same line (a new parameter)
newname E1 E2 ...finish the current word as any new name: a letter or _, then letters, digits or _, at most 63 characters, starting with U, not a reserved word, and not one of E1 E2 ... (the visible names, functions and names earlier on the line that start with U; the list may be empty)
number LO HIfinish the current word as a number v with LO <= v <= HI whose decimal text starts with U
(an opening bracket (it also ends the current word)
)a closing bracket (it also ends the current word)
spacea space or tab: ends the current word, or adds blank space between words
newlineends the current word and the line
eofthe input may end here: the prefix is already an accepted program

A writer (an engine's mask) may append text s to the current word exactly when U followed by s is still the start of some word, newname or number item; the soundness fuzz checks that a word stays legal after each of its first characters.

Example, after fn f a uint to uint and a newline: word if, word while, word for, word ret, word trap, word a, newname a f, space, newline.

6.3 Human output and omegese complete

omegese next without --machine prints the same set for a person, one labelled line per kind, empty lines left out: assign: (at a line start, the names that may be assigned) or names:, number: LO..HI, ..., new-name: any name not in use, and words: (fixed words, functions, (, ), (space) inside a word, (newline), (end of input)).

omegese complete <prefix> prints one text that, appended to the prefix, gives a program emit accepts (finish the word and the line, then close everything); nothing when the prefix is already a program; exit 1 (REFUSED) when there is none.

6.4 Limits (where exact can miss)

There is no over-approximation: every printed item was accepted by the real parser. An item can be missed only when the witness finder fails although a completion exists, which needs one of these limits: a line longer than 96 words (a witness can be longer than the shortest completion), more than 480 registers, 256 distinct constants or the block and frame limits in one program, more than 64 tries when several names of the right kind could be read, or a new name within a few characters of the 63-character limit (the class is decided by one representative name). None of these is reached by any program in the suite or the fuzz.

Ownership (checker2's C2-OWN rules), folded into emit on 2026-10-15. checker2 follows every own array along every path (it holds an array, holds nothing yet, or was freed or moved) and rejects a use, a move or a free where it holds nothing on every path (C2-OWN-USE-DEAD, C2-OWN-DOUBLE-RELEASE), and a new array or a return where it still holds one on some path (C2-OWN-LEAK). emit keeps the same states along the lines it reads and refuses such a line where it is written, so next leaves out the word that leads there. Inside an open loop a state that includes the loop head is not known until the loop's end line (a later line of the body can change it); such a check waits and is decided at end. complete (and every witness) settles what it can: before a loop's end it gives a name the loop head needs an array (x = new ..., after free x when the name may still hold the array an earlier pass gave it) or frees one that would still hold its array there, and at the function's end it frees each array that still holds one on some path (or ends the path with trap 1 when that array's name is out of scope). Since omega#465 a leak on some path is refused, so a loop that gives an array a second one while it still holds the first (x = new ... before the loop and again in its body, with no free x before it) leaks on its first pass, and no line after it repairs that: next and complete report that no completion exists.

Measured with the residual walk in 6.5 (1000 walks from each of two starts, seed 4453): completed walks that emit accepts and omega_emit or checker2 then rejects.

buildrejected laterby rule
before (2026-10-15, f6b44356)154 of 2000 (7.7%)136 C2-OWN-LEAK, 15 C2-OWN-USE-DEAD, 3 C2-OWN-DOUBLE-RELEASE
ownership states only, no loop checks2 of 2000 (0.1%)2 C2-OWN-USE-DEAD (a use in a loop head of an array freed before it)
after0 of 2000none
emit leak checks on some path (omega#465)1 of 2000 (0.05%)1 C2-OWN-DOUBLE-RELEASE

Not folded, so a program emit accepts can still be rejected later:

The other way, emit refuses a function with more than 256 distinct ownership checks waiting for loops to end, which checker2 might accept. And where exact can miss: a waiting check whose name is out of scope (or hidden by a newer name) at the loop's end gets no settling line, so the word that led there is left out; a ret whose value moves the array into a call is not tried by the witness.

6.5 The checks

The same suite then runs again on a build with AddressSanitizer and UndefinedBehaviorSanitizer (memory and undefined-behaviour checks), with 10 walks and one mutant per program; every sanitizer finding fails the run. Its negative control: two canary builds (-DOMEGESE_CANARY=1, a read after free; =2, a signed overflow) must each be caught first. Clean. A stress run with 25 mutants per program (1575 mutants) and 500 walks of up to 40 items (17386 items) found no failure.

7. Phase 2

  1. Prompt-only trial on the dev tasks, no mask (done once, 2026-10-15): the 30B on my own engine, one attempt, harness run 20261015T105049Z-e27a33ee052d-1500714 (RUN VALID): Omegese 3/10, text 3/10, structured 0/10; completion tokens 1015 / 1346 / 12027. 8 of 10 first answers were refused only for writing the task signature's type names (u8, u32); those are now accepted. Trial 2 (same model, one attempt plus one repair round): Omegese 2/10, text 3/10. 6 of the 8 Omegese failures wrote nested values (n = add (mul (uint 3) n) 1), which v0 refused. Values now nest (section 3): 5 of those 6 answers, kept verbatim in tests/one_layer/omegese/trial2, now pass checker2; the sixth (dev07) has one value too many and is still refused, with its place. Rerun owed.
  2. The mask inside my own engine: omegese next as a table on the GPU, one lookup per token; positions with one legal word need no model step.
  3. A pre-registered held-out comparison: exp445 revision r3 (docs/one_layer/EXP445_PROTOCOL.md section 13), Omegese against OSC text. The omegese arm's system prompt is tools/exp445/arms/common.md, then tools/exp445/arms/omegese.md (the language and a word card: every fixed word on one line with what it does), then the worked examples (tools/exp445/arms/examples/, built by reader.sh system_prompt): 14 dev-style tasks in the many-shot mode, the r2 single example (clamp_sub) in the one-shot mode (Stage 0 only). The text arm gets the same tasks with the program in OSC. make test-exp445 checks every example in both forms (reader, back end, the sealed harness on its own inputs), that the word card is exactly omegese words, the one-token gate on every word of the examples, and that no example shares an entry name with a held-out task.
  4. Where the r3 Stage 1 answers failed, by reader stage (config A, attempt 1, 60 held-out tasks per arm; aggregate counts and refusal categories from the score output only, no task text read):
    armroundpassed the readerrefusedwhere refused, by category
    Omegesefirst answer3525all at omegese emit: type 13, structure 6, arity 4, scope 1, range 1
    Omegeserepair round421all at omegese emit: type 11, structure 6, arity 3, scope 1
    textfirst answer4416the OSC compiler
    textrepair round511the OSC compiler

    No Omegese answer was refused at omega_emit, at the signature check or by the back end. Final verdicts: Omegese 23 ACCEPT, 21 no candidate, 16 wrong behaviour (7 unexpected trap, 8 wrong result, 1 wrong trap); text 34 ACCEPT, 11 compile refused, 15 wrong behaviour (6 missing trap, 8 unexpected trap, 1 wrong result). What a legal-word mask (omegese next in the engine) prevents: every one of those Omegese refusals, since each was an emit refusal and the mask only lets through words that some accepted program continues. With the ownership rules folded in, what the mask lets through also passes checker2's ownership rules, within the limits in 6.4. What it does not prevent: an answer whose function has the wrong name, parameters or return type is still an accepted program, so only a forced signature header (the task's fn line written for the model) prevents a signature mismatch; none was seen, but every Omegese refusal stopped at emit before the signature check, so mismatches could be hidden behind them. Neither prevents the 16 wrong-behaviour answers. The 11 text refusals would need a mask for OSC text.

8. Prior art (quick search, not exhaustive)

Grammar-constrained decoding (Outlines, XGrammar, llguidance, SynCode), grammar-aligned decoding (NeurIPS 2024), type-constrained decoding for TypeScript (Mündler et al., PLDI 2025), and a grammar redesigned for fewer tokens (SimPy, 2024). Not found: a lexicon chosen so one terminal is one vocab token, with type-aware prefix checking feeding an independently checked, signed IR. "New" is UNVERIFIED.

9. Systems words (seed chain om4 and omc, ledger L408)

Added 2026-10-22 for the Omega compiler written in Omegese (seed/omc/omc.om) and the translator that first builds it (seed/rung4/om4.s). Every word below is used by omc or by the seed test corpus (seed/rung4/tests); the C path (tools/omegese) does not read these words yet. Each rule names the gate that tests it (seed/rung4/gate4.sh, section numbers of that script). Decisions 16-24 are those of docs/PROGRAM.md (branch doc/program).

9.1 Two kinds of output

An initial line target x86linux selects the candidate FR-9 native x86-64 Linux backend. Without it, the existing AArch64 output remains unchanged. Whole-program output is a static ELF64 image with Linux x86-64 syscalls. A bare x86 unit has six-byte JMP rel32/NOP entry slots and uses omc's private frame ABI; it is not a SysV C-callable object. In bare mode, physical R14 points to an immutable runtime entry table: a trap places its code in ESI and jumps through entry 2, whose landing pad recovers the wrapper stack through R12 without storing a result. This is not the AArch64 register ABI. Whole-program traps still terminate with 100 + code. Explicit raw AArch64 emit is refused on x86 (error 25). OS flag values remain target-native. See the backend design and evidence for the register map, syscall adaptation, seed-chain boundaries and qualification status.

An initial line target x86efi selects the x86-64 UEFI backend: the same x86-64 code generator wrapped in a PE32+ EFI application image with the UEFI entry/exit and Microsoft x64 firmware calls. Only whole programs (fn main) are accepted; a bare unit is refused at line 1 with error 25, and Linux host words such as read and write are refused with error 25 at their line. The firmware is reached through one word, efi (keyword id 178), recognised only under target x86efi (elsewhere it is an ordinary name, and a call to it is error 3): r = efi OP ARG A OFF N, OP a literal 0..14 (a literal outside 0..14 is error 25, an OP that is not a literal, such as a name, is error 16), OFF+N <= len A (else trap 3), bit 63 of the ulong result marks an error code. A trap T returns the EFI_STATUS 2^63 | (100 + T). See the x86efi design and evidence for the operations, the efi 12 file contract and qualification status.

An initial line target a64efi selects the AArch64 UEFI backend: the default AArch64 code generator, a PE32+ image a 64-bit Arm firmware starts with no operating system, base-relative addresses, and no host words (error 25, as is function mode and a run-time pool). Its efi word keeps the x86efi contract and compiles to a call of the program's own fn efirt (seed/a64efi/efirt.om); the firmware words fwcall, fwld, fwst, fwsys, fwadr and fwop exist under this target only. See the a64efi design and evidence.

9.2 Functions and calls

9.3 Numbers (decision 19: one meaning per word and width)

9.4 Arrays (decisions 16, 17, 18, 23, 24)

9.5 System calls and lines

9.6 Capacities (decision 23, amended 2026-11-11)

A refusal is defined behaviour: input past a real capacity is refused with error 14, never overrun, truncated or corrupted. Since 2026-11-11 (Drake: "no hard caps on our own software; notice and fix instead") omc has no table capacity of its own; om4 keeps its own.

om4 reads at most 8 MiB - 1 bytes and writes at most 8 MiB, 1024 names in scope, values nested 1024 deep, 4096 functions, 8192 trap sites per function, 512 nested blocks (error 14 past each). om4's function table (512 entries through om4 d0da40e4) bounds seed/omc/omc.om itself, which om4 must compile; seed/rung4/gate4.sh section 7b checks 4096 accepted and the 4097th error 14.

omc keeps every table that grows with the unit in one arena: the input, the output, names in scope (globals, texts, constants, locals), names of 9 to 63 characters, functions and their parameters, call sites, trap sites, open blocks, breaks and continues, inline returns and edges, the per-depth value cells, the x86 fixups and the om2 diag site records. A table starts small and doubles when it fills. The arena itself is a run-time pool (global a_ar ulong *, section 9.15; since landing 2 of the run-time pools, docs/RUNTIME-POOLS.md section 6): its length is 0 when omc starts, and when a table's doubling does not fit in the words left, enlarge grows the arena to twice its length (or to what the tables need, when that is more). Only when the host refuses that growth (enlarge's negative result, for example under prlimit --as) is the arena compacted (the words that moved tables left behind are reclaimed) and the table grown in place, to the largest size that fits; a table is refused only when the host refused and all the live tables, with that one grown by one entry, no longer fit in the arena as it is. Measured 2026-11-11: 1,500,000 globals (61,354,864 words handed out) and a 512 MiB input compile and run (seed/omc/gate-nocaps.sh section 3); the static 128 MiB arena before it refused that globals unit at its line 877,501. Name, long-name and function lookups are hashed, and the call graph is settled in linear time, so compile time stays linear (seed/omc/gate-usage.sh times units up to 100,000 names, calls and trap sites). seed/omc/gate-nocaps.sh drives every table past its first room and compiles those units with a checked twin of omc as well, in which an index past its table is trap 3 (omc c52e986e and 1e628c80 stopped with trap 3 on a unit with more inline edges than its call table held; fixed 2026-11-11). What is left, and why:

The alarm in place of the old capacities: a unit whose first line (after notes and blank lines) is usage is compiled as usual; instead of the artifact omc writes one line to stdout and exits 0:

omc-use 1 arena=A top=T waste=W full=F GROUP=N/H ...

A the arena's words (its length when the record is written: the arena grows), T the words handed out, W the words left behind when a table moved, F 1 when the host refused to grow the arena (or the memory ceiling stopped it) and the tables no longer fit (error 14); for each group (`inp out site names namehash long longhash fns fnhash calls traps x86addr x86exit blocks breaks conts inlret inledge depth kahnfn kahncall`) N what the unit asked it to hold (bytes for inp, out and site, else the highest index plus 1) and H the words it holds; last, ceiling=C, the OMC_MEMORY_MAX in force (0: none). A refused usage unit writes the human line and then the record to stderr. seed/omc/gate-usage.sh compiles the largest units of the stack (omc.om itself, omega-mcp, cortex, forged) and scale units, and fails loudly, naming the unit, the measure and the number, when the words handed out pass 4194304 (12582912 for a scale unit), one group holds more than 2097152 words (16777216), the host refused (full=1), a compile takes more than 2 s (10 s) or more than 64 MiB (256 MiB) resident. Since the arena grows to fit, the words are absolute (the old fractions of the 16777216-word static arena). Its mutant control, tables that never double (a_need's growth made +512 entries), must be caught (measured 2026-11-11: calls100k, 94,048,221 words handed out and 730 MB resident).

9.7 Structs (omc only, rung 6)

om4 does not grow for this. A struct program is refused by om4. omc.om does not use these words, so om4(omc.om) stays equal to omc(omc.om). Checked by seed/omc/gate6.sh.

9.8 Break, continue and trap (omc only, gate7)

break, continue and trap are the path-ending statements §3 lists. omc implements all three; om4 refuses them, so they are omc-only like structs. Checked by seed/omc/gate7.sh; it is run by seed/host/check.sh.

9.9 Floating point (omc only, gate8)

The words are bitcast, fsqrt, fabs, fmin, fmax and fma, not bits, sqrt, abs, min and max: the benchmark corpus uses those shorter spellings as ordinary identifiers, and a keyword may not take a name that existing .om code already uses. gate11 pins both halves of that rule.

f32 and f64 are IEEE-754 binary32 and binary64. A float value is its bit pattern held in an ordinary integer register or its SIMD twin; arithmetic runs one scalar FP instruction. FPCR is never written: under the Linux default it is round to nearest even with subnormals kept. Ordinary mul then add stay separate operations and round separately; only explicit fma fuses. There is no implicit conversion: mixing f32 and f64, or float and integer, without a conversion is error 7.

9.10 Grouping parentheses (omc only, gate9)

( and ) are separate words even when written against a value ((int 2), ((7))); the lexer splits them out of the surrounding word. A group returns exactly the value inside it and adds no code. A group whose only value has no type is still ambiguous (error 11), and a group missing its ) is error 16. Checked by seed/omc/gate9.sh, which seed/host/check.sh runs.

9.11 Layout queries (omc only, gate10)

sizeof T is the size in bytes of a scalar type (bool 1; uchar/byte 1; ushort/short 2; uint/int/f32 4; ulong/long/f64 8). sizeof S is a struct's size: 8 bytes for each of its cells. offsetof S f is the byte offset of field f; an array field gives its first element. Both are compile-time constants of type ulong and add no code, so they compose in expressions.

An unknown type name is error 16, an unknown struct or field is error 3, and sizeof void is error 9. Checked by seed/omc/gate10.sh, which seed/host/check.sh runs.

9.12 Constants (omc only, gate16)

const NAME TYPE LITERAL at top level defines a named value before use. NAME is at most 63 characters and may not collide with a visible name, a function or a struct (error 10); the value must fit the type (error 8). The constant is a typed number: an integer (uint 5, long -3) or a float literal (f64 0.1, f32 0.1); an integer literal under a float type is refused (error 16). It composes wherever a value goes, including inside functions and as a call argument, and it cannot be assigned (error 7). In IR mode an integer constant is folded to its literal, including as a trap code, a while bound, or a for count; a float constant there is refused (error 9), as are struct/global/text declarations. Definitions are sequential, so a constant defined after a function is not visible to that function.

A constant needs no program image, so it is also accepted in function mode (a unit without fn main): every read folds to the typed number, and the function words are byte for byte those of the same unit written with the literal (gate16 fm_*: value, negative value, parameter and new length, while bound, trap code, for count, two functions, f64). A global or text in a function-mode unit is still error 9 at the end of the input, with or without constants beside it, and a host word is still error 9 at its line (gate16 fm_global, fm_text, fm_host_word).

An integer constant is also accepted as an array length in new, global, a parameter declaration (view T N / edit T N) and a struct field length (1..64, error 14); a float constant used as a length is error 16. A length token that is a name other than an integer constant is error 16, and arrlen still enforces 1..16777216 for arrays (errors 8 and 23). Signatures are pre-scanned, so a constant used in a parameter length must be defined before that function.

An integer constant is also accepted as a trap code (1..14) and as a while ... bound or for ... bound count (1..9223372036854775807; 1..1000000 in IR mode); a for count is an ordinary value, so a constant works there too (0..1000000 in IR mode). Out-of-range values keep error 8, and a float constant in any of these positions is error 16.

9.13 Profile OM-2 (omc only, spec/omegese-om2.md, ledger L834)

OM-2 is opt-in per unit; the contract spec/omegese-om2.md and its errata are normative, and this section lists what omc implements of it. Fixtures, expected results and compiled mutants: seed/omc/om2/ (run by the #748 gate seed/qualification/om2/gate.om). Every OM-1 unit keeps its meaning and, for the C2 manifest, its exact output bytes or error.

9.13.1 Secret hygiene: dit and scrub (program mode)

Two value words for code that handles secrets. Both are OM-2 only (reserved as above), program mode only (error 9 in function mode), AArch64 only (error 25 under target x86linux), and give a long. They are value-only words: they stand where an expression is read (k = scrub 16, an argument, an operand); a bare statement scrub 16 or dit 1 reads the word as a statement name and is error 16 (keyword used as a name). IR mode never reaches them: ir together with om2 is already error 16 in either header order, so omc's IR-mode error 9 test for these words is a defensive check that no source exercises. The emitted words are fixed, so the output is byte-for-byte deterministic. Fixtures: seed/omc/om2/s5/ (s5.cases, s5-mutants.cases, both standing gates in seed/host/check.sh); s5-scrub-emit pins the sha256 of the whole output of scrub-emit.om, so the exact register-zeroing sequence below is checked, and the mutants m-zpool, m-zvec and m-movz16 (zeroing words retargeted to X16 or V0) are detected by it. s5-scrub-femit pins the same for a unit with a live float local, so which V registers are spared is checked (m-twinall, sparing the dead twins of live slots too), and s5-scrub-flive reads live float locals, a held float operand and a float call argument back after scrub (m-twinnone, zeroing V0-V31). s5-scrub-pin reads a pinned global base and a pinned length back after scrub (m-pinlo, the pins not set back: trap 3), and s5-scrub-lateglob reads a global declared after a scrubbing function (m-pinshut, that global pinned anyway: its register is cleared and not restored, trap 3). s5-scrub-chain reaches the scrub through two calls compiled before a long global (pinned anyway: trap 3), s5-scrub-latebase writes and reads a short global (a base pin only) declared after the scrubbing function (pinned anyway: a store through base 0, SIGSEGV), and s5-scrub-inl reads a global declared after an inline scrubbing function. pinshut is set when the body pass begins any fn, an inline one too, so that global takes no pin and the case checks the MOVZ/MOVK path; without pinshut the inline body, compiled at its call site after the global, restored the pin.

9.15 Run-time pools (omc only, seed/omc/gate-pools.sh; design docs/RUNTIME-POOLS.md)

Decision 3 of 2026-11-11 (omega-mv #793 RM4, #795 RM6): a region whose length is known at run time, obtained from the host as zero pages, bounds-checked like every array, with no free and no general allocator. Program mode on AArch64 Linux only.

9.14 Compiler error codes (omc, registry seed/omc/error-codes.reg)

A refusal prints one line, omc: line L: error C, on stderr, writes no program and exits with C. The single source of the codes is seed/omc/error-codes.reg (issue #797): one row per code with its status (emitted, io or unused), the seed/omc/gate15.sh case that must refuse with it, and the meaning below. seed/omc/codereg.om (run by gate15) fails when a fail, nfail, unkfail, lenval or exit int site in omc.om has no row, when an emitted row has no site, when a row of this table differs from the registry, or when a registry case did not refuse with its code at its expected line. Codes 1 and 2 are I/O errors on the compiler's own stdin/stdout (line 0 when the input cannot be read). In IR mode (section 11) the same codes apply; a contract line (requires, ensures, invariant not followed by =) is error 30 there. irwasm exit codes are a separate namespace (section 11.1).

CodeMeaning
omc 1the compiler's standard input could not be read
omc 2the compiler's standard output could not be written
omc 3unknown name or field, or a word this mode does not provide
omc 4the line ends where a word or value is needed
omc 5extra words after a complete statement
omc 6malformed number or token
omc 7type mismatch
omc 8number out of range for its type or place
omc 9word or declaration in a place that does not allow it
omc 10duplicate name
omc 11bare number without a type from its context
omc 12register pool exhausted
omc 13name too long (63 bytes; 8 for an abstract, a layout, a layout field, or any name in IR mode)
omc 14capacity exceeded (the host refused to grow the compiler's arena or its memory ceiling OMC_MEMORY_MAX was reached, value nesting past omc's own stack, the program image, or an OM-2 expansion bound)
omc 15missing end
omc 16syntax: unknown or misplaced word
omc 17line after ret, break, continue, trap or exit in the same block
omc 18a function with a result can reach its end
omc 19global passed as an argument, or one array twice in a call
omc 20write to a view or a text
omc 21constant index outside the array
omc 22malformed text literal
omc 23size capacity
omc 24AArch64 branch displacement out of range
omc 25unknown target, an AArch64-only path on another target, or an x86efi refusal (bare unit, Linux host word, efi OP literal outside 0..14)
omc 26the compiler's environment entry OMC_MEMORY_MAX is not empty, 0 or 1 to 19 decimal digits below 2^63, or an entry is too long to read whole
omc 27fresh element read before it is definitely written, or fresh array passed on
omc 28abstract type: seal outside its constructor, or an unsupported holds
omc 29external layout out of bounds or misplaced
omc 30contract syntax misplaced or not supported here (IR mode included)

10. Native host extension (2026-10-23)

Implemented by the Omega-written compiler in seed/omc/omc.om. The original om4 parent builds this extended compiler; the extended compiler reproduces itself byte for byte. The original subset retains its machine code. The new words are reserved and require program mode (error 9 in function mode), with one exception: an OM-2 function unit (first line om2, no fn main) may use the file and identity subset fopen, fclose, fstat, stat, lstat, getuid, geteuid, getgid and getegid, the clocks monons, realns and sleepns, and the device subset devctl, mapnew, mapdrop, mapread, mapwrite, devcall, uvmctl, mapaddr, mapget, mapset, maphold and mapbind (seed/host/MAPPING.md) on the AArch64 target. Each of these is an inline svc with its arguments saved and restored around it; none reads argv, the x28 stack floor or a global, and none writes x7 or x19-x28, so a unit called through the omega-bridge native ABI keeps its frame. In function mode entry31 points at a32-byte header followed by1..4098 owned32-byte mapping slots. The header supplies capacity and nonwrapping generation limits; handles have13 low slot bits. The bridge selects an explicit context and serializes its calls. Fixed bind replaces only an entire live PROT_NONE reservation in that table. Failed bind retires its token on successful cleanup; a cleanup failure traps3 and leaves an inaccessible, un-rebindable owner for mapdrop only (mapaddr may inspect it). The bridge refuses destroy while it is live. Program mode retains its raw128 slots and eight slot bits. Every other host word, every OM-1 function unit and other targets stay error9. This context-format contract is a draft requiring Drake approval before merge (PROPOSED spec/omegese-om3.md section1, gate seed/omc/om2/fnhost/fnhost.cases).

All results below have type long. Successful kernel results are nonnegative; failures return minus the Linux error number. Programs must check errors. These operations do not form a sandbox: they operate with the process's existing permissions. They expose no pointer values and no arbitrary syscall.

In signatures, fd, flags, mode, pid, signal, events, domain, kind, protocol, backlog, target, options, level, option, whence and op are int. Offsets, byte counts, capacities and argument indices are ulong. File offsets and time intervals are long. A is a uchar array. Every slice checks n <= len A and off <= len A - n before kernel access, otherwise trap 3 (program exit 103). Writable operations reject view and text (error 20). Non-byte arrays and mismatched scalar types are error 7.

ExpressionMeaning
fopen A off n flags modeOpen a length-delimited path relative to the current directory. Return descriptor.
fclose fdClose descriptor.
fsync fdSync file data and metadata.
fdsync fdSync file data only (fdatasync).
memfd A off n flagsCreate an anonymous in-memory file and return its descriptor (memfd_create).
fchmod fd modeSet permissions on an open descriptor.
chmod A off n modeSet permissions on a checked path (fchmodat, flags 0).
chown A off n uid gidSet ownership on a checked path (fchownat, flags 0).
faccess A off n modeCheck access to a checked path (faccessat, flags 0): mode 0/1/2/4.
getuid / geteuid / getgid / getegidProcess identity (syscalls 174-177).
fchdir fdChange the working directory to an open directory descriptor.
getppidParent process id.
setsidCreate a session and become its leader.
getpgid pidProcess group id of pid (0 = self).
getsid pidSession id of pid (0 = self).
syncfs fdSync the filesystem containing an open descriptor.
shutdown fd howShut down part of a connected socket.
flock fd opAdvisory whole-file lock (Linux flock, ARM64 syscall 32; keyword id 197). op is passed unchanged: 1 LOCK_SH, 2 LOCK_EX, 8 LOCK_UN, plus 4 LOCK_NB for no wait. Returns 0 or -errno: -11 when a LOCK_NB request is held by another open file, -22 for any other op, -9 for a closed fd. The lock belongs to the open file, so it is released when the last descriptor sharing that open file is closed. Fixture seed/host/tests/flock.om.
setpgid pid pgidSet a process's group (0 = self/own pid).
umask maskSet the file-mode mask; return the previous mask.
fseek fd offset whenceSeek and return the resulting signed file offset.
ftrunc fd lengthSet an open descriptor's length (Linux ftruncate).
truncate A off n lengthSet a checked path's length (Linux truncate).
unlink A off nRemove the named file.
makedir A off n modeCreate a directory.
rmdir A off nRemove an empty directory.
cwd A off capacityWrite the current directory into writable bytes. Return the kernel byte count including the trailing zero byte. A short buffer returns a negative error.
chdir A off nChange the working directory to a checked, nonempty path. Return 0 or -errno.
readlnk PATH off n OUT off capacityRead a symbolic link through a checked, nonempty path into writable output bytes. Return the byte count without a terminator. A result equal to capacity may be truncated.
getdnts fd A off nWrite raw Linux getdents64 records; return bytes written.
fstat fd A off nWrite the 128-byte Linux ARM64 stat structure; requires capacity at least 128.
stat A off n B off capacityMetadata for a checked path via newfstatat; writes the same 128-byte ARM64 structure; a short output traps 3.
lstat A off n B off capacityAs stat, but does not follow a final symbolic link (AT_SYMLINK_NOFOLLOW).
renames A off n flagsRename the two paths in a packed list using renameat2; flag 1 refuses replacement.
link A off nCreate a hard link from a packed two-path list (old, new).
symlnk A off nCreate a symbolic link from a packed two-path list (target text, link path).
mononsMonotonic nanoseconds, suitable for elapsed-time measurement.
realnsRealtime nanoseconds since the Unix epoch, suitable for timestamps.
sleepns intervalSleep for nonnegative nanoseconds. Negative intervals trap 3. Interruptions return the kernel error.
socknew domain kind protocolCreate a socket.
bind fd A off nBind the socket to the address bytes in the slice.
connect fd A off nConnect using the address bytes in the slice.
listen fd backlogListen for connections.
accept fd flagsAccept a connection with accept4; return descriptor, without peer-address output.
sockname fd A off nWrite socket address bytes; return the full address length, which may exceed capacity when truncated.
peername fd A off nQuery the connected peer of an existing descriptor into a writable byte slice; return full peer-address length, or negative errno. A result greater than n truthfully indicates truncation.
sockopt fd level option A off nSet one allowlisted scalar transport option from a readonly four-byte slice; see the allowlist below.
recv fd A off n flagsReceive into a writable slice.
send fd A off n flagsSend a slice with MSG_NOSIGNAL added, so a closed peer returns an error.
waitio fd events intervalPoll one descriptor. Return readiness bits, zero on timeout, or negative errno. Interval is nanoseconds; negative means infinite. Events outside 0..65535 trap 3.
peercred fd A off capacityRead Linux SO_PEERCRED into a writable slice of at least 12 bytes: little-endian 32-bit PID, UID, GID; return zero or negative errno.
pollfds A off n intervalPoll a writable slice of packed eight-byte Linux pollfd records. n is bytes, a multiple of eight, at most 8192. Return ready-entry count, zero on timeout, or negative errno. Interval is nanoseconds; negative means infinite.
sendmsg fd A off n flagsSend one checked payload using a private msghdr and single iovec, without ancillary data or destination-address override. Adds MSG_NOSIGNAL; returns a possibly partial byte count or negative errno.
forkCopy the current process: zero in the child, child PID in the parent, negative errno on failure.
getpidReturn the current process ID.
killpid pid signalSend a signal; zero signal checks existence/permission.
waitpid pid A off n optionsWait with wait4; write a four-byte status, return PID or zero for an unfinished nonblocking wait. Capacity at least four.
pipefds A off n flagsCreate a pipe with pipe2; write two little-endian 32-bit descriptors. Capacity at least eight.
dupfd fd target flagsDuplicate onto a chosen descriptor using dup3.
execprog A off nReplace the process using a packed argument list. Only returns on failure.
execpure A off nKeyword id 198, AArch64 only (x86 emission refuses with error 25). As execprog, then pin the executable as descriptor 3 and apply the fixed strict stdio profile below before execveat(AT_EMPTY_PATH). Only returns on failure, with the first failing step's negative errno.
execenv A off n B off mKeyword id 233, AArch64 and x86linux. As execprog A off n, but the child's environment is exactly packet B (u16 count 1..64, nonempty u16-length records, 2..4096 bytes, no embedded zero, no trailing bytes) instead of an empty one. Both packets are checked (trap 3) before descriptors above 2 close. Only returns on failure, with a negative errno; refused in function mode (error 9) and in contracts (error 30). Gate: seed/host/execenv/.
prlimit pid res A off nKeyword id 235, AArch64 and x86linux: Linux prlimit64 (syscall 261 / 302). pid and res are int (0 = this process), A a writable byte array, off and n ulong. n 16 reads: the old {rlim_cur, rlim_max} is written to A[off..off+16) as two little-endian u64. n 32 sets: the new pair is read from A[off..off+16) and the old pair is written to A[off+16..off+32). Any other n returns -22 without a kernel call; with n 32 the kernel also returns -22 (EINVAL) when the new soft value is above the new hard value, which does not mean a bad n. The slice A[off..off+n) is checked first (trap 3). Returns 0 or a negative errno. Limits are inherited across fork and kept across execprog (the gate checks RLIMIT_AS in an exec'd child). Refused in function mode (error 9), in contracts (error 30) and under target x86efi (error 25). Gate: seed/host/prlimit/.
cpuset pid A off nid 236: Linux sched_setaffinity (AArch64 122, x86linux 203). int pid (0 calling thread), checked byte mask slice, returns long 0 or minus errno; an empty permitted mask is -22.
cpuget pid A off nid 237: sched_getaffinity (123 / 204), same operands but writable bytes; long count of bytes copied or minus errno.
cpunowid 238: getcpu (168 / 309), no operands; long CPU number snapshot or minus errno.
setprio which who priorityid 239: setpriority (140 / 141), three int operands; long 0 or minus errno. which 0, who 0 selects this thread. Linux privilege checks remain.
getprio which whoid 240: getpriority (141 / 140), two int operands; long raw kernel result 20 minus nice, or minus errno. All five scheduler words are program-only; function mode error 9, contracts 30, x86efi 25. Draft: spec/omegese-cpu-workers.md.
argcntReturn argument count, including the executable name.
argread index A off capacityCopy argument bytes without a terminator; return byte length. An invalid index traps 3. Insufficient capacity returns -105 without changing the slice.
envcntReturn the number of entries in the process environment (the envp the kernel supplied).
envread index A off capacityCopy one environment entry without its terminator; return its byte length. An index at or past envcnt traps 3; insufficient capacity returns -105 without changing the slice.
random A off n flagsFill a writable byte slice from Linux getrandom. Return the bytes written or -errno. flags is int: 0 blocks until the pool is ready, 1 GRND_NONBLOCK, 2 GRND_RANDOM, 4 GRND_INSECURE; other flags return -EINVAL.

Path and process boundaries

Paths are at most 4095 bytes. Embedded zero bytes and longer paths trap 3 before a kernel operation. The compiler privately copies and terminates paths at the Linux boundary; Omega array lengths remain explicit. Private stack space is checked against the existing stack floor before writing.

readlnk additionally rejects an empty path with trap 3. Its path may be a readonly slice; its output must be writable. Both slices receive the ordinary array bounds and byte-type checks. The private path copy is complete before the kernel writes the output, so overlapping path and output slices are safe. cwd requires writable bytes. It preserves the kernel's count convention: the returned count includes its trailing zero byte. readlnk never appends a zero byte. These operations are Linux getcwd and readlinkat(AT_FDCWD). sockopt is Linux setsockopt, restricted to SOL_SOCKET (level 1) SO_REUSEADDR (2), SO_REUSEPORT (15), SO_KEEPALIVE (9), SO_SNDBUF (7), SO_RCVBUF (8), and IPPROTO_TCP (level 6) TCP_NODELAY (1). Each value is exactly four little-endian bytes. An unlisted level/option returns -92 (ENOPROTOOPT) without invoking the kernel; an allowed option with a different length returns -22 (EINVAL). Kernel errors for listed operations are preserved, including -9 (EBADF) and -95 (EOPNOTSUPP) when a socket family does not support a listed option. No pointer-bearing option is exposed.

peername uses Linux AArch64 getpeername (syscall 205), not getsockname (204); under target x86linux it uses x86-64 getpeername (52), not getsockname (51). It shares sockname's checked writable slice and private 32-bit length convention. Zero capacity is allowed, including at the array end; success still returns the full address length without writing address bytes. The checked array capacity fits the kernel's signed 32-bit length. No descriptor is created or connected. The descriptor is an existing process descriptor; callers must control its lifetime, including close/reuse races. Consume output only after success and after checking length and address family. The native Linux sockaddr describes the transport endpoint, not an authenticated user or an original client behind a proxy. Forwarding headers gain no authority. Existing trusted-proxy policy remains a separate caller responsibility.

peercred is kernel-attested local peer identity, not application authorization. Use it only on a connected Unix socket and compare the returned identity with the service's explicit policy. Unavailable or unexpected credentials must fail closed. Capacity below 12 traps 3 before the syscall; extra capacity is untouched.

Each pollfds record is fd:int32, events:uint16, revents:uint16, in little-endian byte order. The kernel updates revents in place. Misaligned byte lengths and lengths above 8192 trap 3. A zero-length slice is a timed sleep. Applications must inspect error/hangup bits and every syscall result.

Networking errors use the existing stable Linux-arm64 negative-errno contract: -4 interrupted, -11 would block, -32 broken pipe, -110 timeout, -111 refused, and -115 connect in progress. read, write, send, recv, and sendmsg may complete partially. The library must advance by the actual count, distinguish EOF from errors, retry interruptions within a monotonic deadline, and wait for readiness on nonblocking sockets rather than spin. Never retry fclose after an error: the descriptor may already be released.

A packed list is a little-endian u16 count followed by that many records, each a little-endian u16 byte length and those bytes. There is no padding or terminator in the public format. An exec argument packet (execprog, execpure and the first packet of execenv) is at most 65536 bytes with count 1..1024; every other packed list (renames, link, symlnk, the execenv environment) is at most 4096 bytes with count 1..64. Embedded zero bytes, truncated records, extra trailing bytes and out-of-range counts trap 3. execprog uses the first record as both the executable path and argument zero; it must be nonempty. Other arguments may be empty. renames requires exactly two nonempty path records.

The compiler constructs private, bounded pointer lists for the kernel. They are never exposed as language values. execprog supplies an empty environment, preserves the working directory and standard streams (descriptors 0, 1 and 2), and does not search PATH or invoke a shell. Before execution it closes every descriptor at or above 3 using Linux close_range(3, UINT_MAX, CLOSE_RANGE_UNSHARE) (AArch64 and x86-64 emission alike). If that kernel operation fails or is unavailable, execution is refused with the kernel's negative error result; no descriptor-loop fallback is used. After a successful close, an executable-path failure still leaves those descriptors closed. Malformed packets trap before descriptor closure. Callers must explicitly bind intended streams before invoking execprog; higher-numbered descriptor inheritance is unsupported. This prevents accidental descriptor inheritance; it does not restrict filesystem paths, network creation, current-directory access, subprocesses or arbitrary native code. Existing authority/launcher integration is still required for those effects. Forked children are independent processes and must be reaped; this extension does not add shared-memory threads.

execpure (word 198) decodes and closes descriptors exactly as execprog, then applies a fixed strict stdio profile before entering the program: it opens the executable path O_PATH|O_CLOEXEC as descriptor 3; creates a Landlock ruleset that handles every ABI-3 filesystem right and allows only execute and read-file beneath that inode; sets PR_SET_NO_NEW_PRIVS; restricts itself to the ruleset; sets seven prlimit64 ceilings (CPU 1/2 s, file size 1 MiB, stack 8 MiB, core 0, processes 0, descriptors 4, address space 128 MiB); installs a seccomp filter that kills the process on a non-AArch64 audit architecture and allows only read on descriptor 0, write on descriptors 1 and 2, exit, exit_group and execveat on descriptor 3 with flags AT_EMPTY_PATH, returning EPERM for everything else; and finally calls execveat(3, "", argv, empty envp, AT_EMPTY_PATH). The first step that returns a negative value restores the private stack and returns that negative errno without executing. There is no weaker fallback. This is a fixed profile, not a general sandbox; output and wall-clock budgets still need a trusted supervisor. Qualification is seed/qualification/security673/gate669.om (pure-*.om fixtures). The x86-64 emitter has no strict-profile lowering and refuses the word with error 25.

Clock results require nonnegative seconds and a signed nanosecond total; values outside that range trap 1. argread bounds its internal string scan at 1 MiB; reaching that bound traps 3. Linux ARM64 is the only qualified host. OS flags, address layouts and metadata layouts are host-specific; portable library contracts remain separate work.

Qualification is sh seed/host/check.sh; see seed/host/README.md. The seed loader and shell test coordinator do not implement these operations. No foreign-language compiler or runtime is on the new implementation path.

The proposed device/memory extension adds checked devctl, mapnew, mapdrop, mapread and mapwrite to this same compiler, plus the VFIO words vfioctl (literal allowlisted request, exact size, argsz forced; IOMMU_MAP_DMA takes an owned mapping handle, never an address), eventfd (uint initial value, CLOEXEC|NONBLOCK, existing read/write/poll/close), vfioirq (acquired-device/eventfd kinds, exact argsz, bounded IRQ forms), vfiomap (read-only shared map of exactly one reported VFIO region) and vfiomapw (the same map read/write, for device registers). Its exact type, ownership, range and refusal contract is seed/host/MAPPING.md. The VFIO/event words use keywords228..232 respectively as vfioctl, vfiomap, vfiomapw, eventfd, vfioirq. They are AArch64 program-mode words; function mode refuses them, and hosted x86 VFIO is not implemented. Descriptor-kind tracking remains program-local: existing OM-2 unit fclose/dupfd emission does not access that standalone-program table. The draft devctl boundary also admits five exact aien-gpu ABI1 request numbers, not arbitrary type-A ioctls; changing their direction or encoded payload size is refused. See the pinned UAPI and Wolfram-derived matrix there. Drake must approve this trust-surface extension before merge. It adds process-local mapped resources while the compiler's own storage remains fixed pools. GPU launch and model execution are separate, still-unqualified gates.

devcall (keyword 171)

devcall fd request H hoff 32 P poff n returns long, the ioctl result or negative Linux errno. fd is int, request a literal uint RM_ALLOC or RM_CONTROL request, H and P writable uchar arrays, and hoff, poff and n are ulong. The header span must be exactly 32 bytes and the parameter span at most 1048576 bytes (inclusive, the RM default copy-in cap). Both slices must fit their arrays, must not overlap, and the header's caller pointer bytes must be zero; violations trap 3 (exit 103). The checked parameter span is bound directly, not copied onto the stack; only a private 32-byte header is stack-backed. See MAPPING.md for the ABI and upstream cap source. seed/host/tests/devcall.om checks harmless memfd ioctls at 16384, 55888 and 1048576 bytes, and refusal at 1048577 bytes. devctl retains its request-encoded size limit.

KFD device words

Program-mode Linux only: native AArch64 and target x86linux. Function mode, including OM-2 functions, refuses these words with error 9; firmware targets refuse them with error 25. Results are long: a handle or syscall result on success, negative Linux errno otherwise. No device is opened implicitly.

The allowlist covers GET_VERSION, ACQUIRE_VM, GET_PROCESS_APERTURES_NEW, CREATE_QUEUE, DESTROY_QUEUE, ALLOC_MEMORY_OF_GPU, FREE_MEMORY_OF_GPU, MAP_MEMORY_TO_GPU, UNMAP_MEMORY_FROM_GPU, CREATE_EVENT, DESTROY_EVENT and WAIT_EVENTS. It also covers SET_SCRATCH_BACKING_VA: Linux kfd_ioctl.h defines its record at lines 355–359 and its ioctl macro at 1516–1517 in the installed header used by tests/kfd/check.py. That test compiles every AMDKFD_IOC request macro as an independent C UAPI oracle, compares emitted immediates for admitted requests and requires compile error 9 for every sibling, including RUNTIME_ENABLE, DBG_TRAP and SET_TRAP_HANDLER. The compiler includes no C.

The suffix depends on the request:

RequestSuffix and binding
GET_PROCESS_APERTURES_NEWP poff pn: writable byte array span or live writable owned mapping handle; offset + length must not wrap and must fit the mapping, and count × 56 must fit pn; count zero and pn zero are legal
MAP_MEMORY_TO_GPU, UNMAP_MEMORY_FROM_GPUP poff pn: device IDs, count × 4 must fit
WAIT_EVENTSP poff pn: event records, count × 48 must fit; every extension pointer must be zero
ALLOC_MEMORY_OF_GPUR: live reservation handle; requested size must fit; USERPTR flag refused
SET_SCRATCH_BACKING_VAR: live reservation handle
CREATE_QUEUEring wptr rptr eop ctx: live read/write handles; ring size at least 1024 and a power of two, ring/eop/context declared sizes fit; distinct wptr and rptr handles each hold at least 8 bytes and bind at their base; the same handle in both positions selects the AMD queue object (queue type 2, at least 2304 bytes, write pointer at base+56, read pointer at base+128); zero eop/context handles require zero declared sizes
Other requestsNo suffix; ACQUIRE_VM verifies its drm_fd with fstat as a DRM render character descriptor (major 226, minor at least 128)

Address-binding rule: every caller-supplied address field must be zero. The compiler copies the header privately, validates each handle's generation, liveness, access kind and size (or each span's bounds), then writes only checked addresses into the private ioctl record. Header and payload spans must not overlap. Copy-out excludes address fields, so those bytes remain zero even when the kernel returns an error. Invalid handles, kinds, sizes, addresses, overlapping spans, USERPTR and event extensions trap 3 (exit 103). Opaque kernel allocation handles and mmap offsets are values, not pointers. For the aperture mapping form, the private pointer is the checked mapping base plus poff; the header's num_of_nodes is copied back, including on a zero-count query, while its address bytes remain zero.

AMD queue object. Naming one handle as both wptr and rptr selects the AMD queue layout. The positions come from the compiler, never from caller bytes: write_dispatch_id at base+56 and read_dispatch_id at base+128. The request must have queue type 2 (COMPUTE_AQL), and the whole 2304-byte amd_queue_v2_t must lie inside the writable mapping, so every field the firmware may read or write is inside checked memory. Any other queue type with a shared handle traps 3. Distinct handles keep base-only binding with 8 bytes each. Ring, EOP and context addresses are always the handle's base. The numbers come from ROCm's amd_hsa_queue.h (64-byte aligned; both versions place write_dispatch_id after the 40-byte hsa_queue_t, caps and three reserved words, and read_dispatch_id after reserved2). The v1 amd_queue_t is 256 bytes; CP firmware reads the v2 fields past it when the caps word, which is caller data and can change after the ioctl, carries AMD_QUEUE_CAPS_SW_ASYNC_RECLAIM. Requiring the v2 extent (256 bytes plus scratch_last_used_index[MAX_NUM_XCC], MAX_NUM_XCC 128, 16 bytes each; measured with a C build of that header: sizeof 2304) keeps the firmware inside the mapping whatever the caps word holds.

Use one reservation per GPU allocation. After ALLOC, existing mapbind R renderfd mmap_offset 3 replaces the entire owned reservation with a shared mapping at exactly the same address, keeping R usable as a read/write handle; failure retires it. mapaddr R gives the checked base as a ulong for AQL/kernarg data, never as an unchecked ioctl address. mapget, mapset, mapdrop and cpufence retain their existing contracts. The existing program mapping table's handle capacity is unchanged. GPU VM mappings require 4096-byte alignment: upstream amdgpu_gart.h defines AMDGPU_GPU_PAGE_SIZE, and amdgpu_vm.c rejects a start, offset or size with bits in AMDGPU_GPU_PAGE_MASK. The 2 MiB reservation alignment is a stronger compiler guarantee for large pages, not a claim that every KFD allocation requires 2 MiB. Actual mapping offsets and sizes remain subject to the target kernel. No raw virtual address operand exists, so an unaligned caller address cannot reach ALLOC or SCRATCH.

CPU acceptance: python3 tests/kfd/check.py. /dev/kfd absence is fopen errno -2. Native invalid-fd ioctl calls return -9; QEMU-user currently returns -25 for its unsupported KFD ioctl translation before looking up that fd. Both are checked separately. CPU/emulator acceptance is not AMD device qualification; all device rows remain NOT_RUN until an authorized device run. The native AArch64 ptrace oracle observes every bound address at the syscall boundary and poisons private output pointer fields after a real EBADF; caller pointer bytes must remain zero. Independently compiled compiler mutants remove request, literal/dynamic size, address, kind, fd-class or function-mode refusals and must be detected. --record-history appends measured compiler facts to the existing size ledger only after the CPU gate passes; it never rewrites historical rows.

Host CPU ordering words (#939)

StatementMeaning
cpufencePublication barrier (keyword id 199). Every load and store before it completes before any load or store after it. AArch64: DSB SY (d5033f9f), the barrier mapget/mapset already bracket their access with. x86-64 (target x86linux): MFENCE (0f ae f0), the fence the x86 mapget/mapset use.
cpurelaxSpin-wait hint, no ordering (keyword id 200). AArch64: YIELD (d503203f). x86-64: PAUSE (f3 90). Use it inside a bounded poll loop and pair it with cpufence when order matters.

Both are statements with no operands and no value. Unlike the other host words they are accepted in function mode as well as program mode, because they make no system call. An operand is error 5, use as a value or outside a function is error 16, use as the name on the left of = is error 5, and a statement after ret is error 17. IR mode (ir first line) refuses them with error 16. seed/host/cpufence.sh (run by seed/host/check.sh) checks each refusal except the IR one, plus a function-mode unit, on the host. The fixture seed/host/tests/cpufence.om exits 42 natively on AArch64 and under qemu-x86_64. GNU objdump, used only as a referee, finds exactly one added dsb sy/mfence per cpufence and one yield/pause per cpurelax, compared with the same program with the words deleted. The script also checks the refusals above and builds a compiler whose cpufence emits NOPs. That compiler still runs the fixture to exit 42, and the instruction count catches it. These are host results only. Ordering against a GPU is not qualified here.

11. OSC IR output (omc only, experimental checkpoint)

A leading line ir, before any other line, puts omc in IR mode: it writes OSC IR version 1 (spec/one-layer-format.md) for a unit of up to 32 functions instead of AArch64 machine words, and the AArch64 path is not taken. Every function is encoded in source order. A function may call an earlier function (self and forward calls are error 3) with at most six arguments; a value-returning call composes as a value, a void call is a statement, and using one where the other is needed is error 7. Argument types are checked at compile time (error 7). break lowers to a BR to the innermost loop's exit and marks the path dead; continue is still refused (error 3). A TYPE value cast reads its operand at the operand's own type and converts it, exactly as the AArch64 path does: ret ulong sub c 48 with c a uchar lowers to a sub then a cast. A bare number in the cast is range-checked against the cast's type (error 8), a bare number inside the operand against the operand's type (error 8), and a bool converts to or from a number only by comparison (error 9). A same-type cast of a constant is the constant itself; any other same-type value is a mov.

The producer validates complete statement lines rather than discarding trailing words (error 5); missing operands are error 4 and untyped bare expressions error 11. Locals and loop counters obey block scope, including the else boundary; redeclaring an in-scope name is error 10, and reading an out-of-scope name is error 3. Locals and parameters retain the native eight-byte name limit (13), while function names retain full matching up to 63 bytes. A reachable non-void function end is error 18; a void end emits an implicit return. Missing function end is error 15. Unsupported float parameter/result types are refused with error 9 before serialization. Typed literals are range-checked (8). Parentheses remain unsupported in this scalar IR checkpoint, rather than being silently discarded.

seed/omc/gate-ir.sh compares 10 dev programs, nine hand-written multi-function call units and 30 randomized two-function call units byte-for-byte with the C-built omegese + omega_emit oracle, requires checker2 to ACCEPT every unit, requires a mul-to-add mutant to differ, and pins refusal cases. Its validation regressions cover trailing/missing words, scopes, scalar types, literal bounds and name limits; positive controls include implicit void returns, sequential for counters, scope reuse and functions sharing a name prefix. Those C tools are referees only; they never write omc's bytes.

Boolean and, or and xor lower to the IR bitwise sub-operations, just as on the native path. gate-ir.sh checks all three against the C encoder and checker2. Arithmetic (add through rem) and shifts of booleans remain error 7.

Limits, said plainly: scalar values, calls to earlier functions, at most 32 functions and 6 parameters. IR mode refuses a struct, global or text declaration with error 9 and refuses a float word, a host word, continue, sizeof or offsetof with error 3, and a contract line (requires, ensures, invariant; section 12 is native only) with error 30 on that line (#791); it never skips a declaration it cannot lower or reads a contract clause as a local. A contract word followed by = (ensures = ulong 1) assigns a local of that name, as the C oracle and native mode do. note lines are skipped. Struct IR remains open. The gate needs the C-built oracles, so seed/host/check.sh runs it only when build/omegese/omegese, build/omega_emit/omega_emit and build/checker2/checker2 exist, and says SKIP otherwise.

11.1 WebAssembly MVP from seeded Omega

seed/wasm/irwasm.om reads OSC IR v1 from stdin and emits a deterministic, import-free WebAssembly MVP module to stdout. The implementation and binary writer are seeded Omega; neither C nor Node participates in generation:

seed/out/omc < seed/wasm/irwasm.om > irwasm
chmod +x irwasm
{ printf 'ir\n'; cat functions.om; } | seed/out/omc > functions.ir
./irwasm < functions.ir > functions.wasm
nice -n 19 sh seed/wasm/gate-irwasm.sh

The path is a backend for the existing OSC scalar wire format, not a universal source converter. Every IR function is exported under its original, unique ASCII name. For a v1 unit no memory, table, start function, imports, WASI or JavaScript runtime is required, and the sections are type, function, export and code, in that order (v7 additions below). Fixed-width five-byte unsigned LEB section/body lengths are valid MVP encodings; all other LEB fields use minimal encodings.

IR scalar tagWasm parameter/resultInternal representation and operations
0 voidno resultno value register may have tag 0
1 booli32canonical 0/1 in an i64 local; logical not and bitwise AND/OR/XOR
2 u8, 3 u16, 4 u32i32zero-extended i64; unsigned operations, mask after wrapping arithmetic
5 u64i64all bits preserved; unsigned compare/div/rem/right shift
6 i8, 7 i16, 8 i32i32sign-extended i64; signed compare/div/rem/right shift, checked arithmetic
9 i64i64signed compare/div/rem/right shift; checked arithmetic

CONST/MOV preserve canonical bits. BIN subcodes 1..10 map to add/sub/mul/div/rem/and/or/xor/shl/shr; UN 1..3 map to negation, bitwise not and logical not; CMP 1..6 map to eq/ne/lt/le/gt/ge with the operand's signedness. Signed add/sub/mul/neg/left-shift overflow traps rather than wrapping; unsigned results wrap at their declared width. Shift counts are checked before wasm can mask them. Division by zero traps; signed MIN/-1 division traps, while MIN%-1 is zero. CAST checks the destination range before changing width/signedness. CALLs name earlier functions and preserve each declared ABI type, including void. RET converts the internal local to the declared ABI. TRAP and every failed numeric check become wasm traps (WebAssembly.RuntimeError); MVP does not preserve the numeric Omega trap code.

BR/CBR lower through an i32 block-dispatch local inside block/loop, with per-block if, br and br_if. This handles loops, joins, nested conditionals and break without assuming reducible input. The original lowered loop-bound instructions remain in the stream. Arbitrary IR cycles are not independently proven bounded here: this is a backend, not checker2.

Limits are OSC v1 only: at most 32 functions, 6 parameters, 480 registers, 512 blocks and 4096 instructions per function; names at most 63 ASCII bytes; contract texts at most 255 bytes; input at most 2,620,251 bytes, buffered output at most 8,388,608 bytes. Tags 10..12, versions 2..5, allocation, memory/arena/pool/slice operations and all unknown opcodes are refused. Blocks must partition instructions and end in BR/CBR/RET; scalar types, call signatures, constant canonicality and definite assignment are checked. Contract text is retained only as input metadata: its executable checks must already be present as IR instructions.

CodeNamed stderr refusal
irwasm 20MAGIC
irwasm 21VERSION (anything except v1 and v7; v7 with no v7 feature)
irwasm 22TRUNCATED
irwasm 23CAPACITY
irwasm 24UNSUPPORTED_OP
irwasm 25UNSUPPORTED_TAG
irwasm 26INVALID (typing, register, block, text, or definite assignment)
irwasm 27TRAILING
irwasm 28IO

Every parse/type/capacity refusal writes no stdout: the module is buffered until the complete unit and code generation succeed. As with any stream writer, a later stdout I/O failure cannot retract bytes already written. The gate pins the compiler digest and compares every export on a fixed input table with full-width results from real AArch64 Omega drivers. Node v24.21.0 is solely the read-only validation/execution oracle and is not in the build path; it can be replaced by another conforming wasm validator. The gate also compares two translations byte-for-byte, substitutes an add-to-sub IR-byte mutant into the parity check (must fail), and pins named refusal exits with empty stdout. This is host evidence, not browser integration, hardware qualification or a deployment.

Numeric bounds were checked with WolframLanguageEvaluator: Table[{w,2^w-1,-2^(w-1),2^(w-1)-1},{w,{1,8,16,32,64}}]; the unsigned masks are 1, 255, 65535, 4294967295 and 18446744073709551615. The definite-assignment iteration bound was checked with 512*480+1 -> 245761 (a monotone bit-removal fixed point).

OSC IR v7 (spec section 10). irwasm also accepts wire version 7: module, local and text regions, tags 13 f32 and 14 f64, and opcodes 30 RLOAD, 31 RSTORE, 32 BITCAST and 33 RINIT. A v1 unit translates to exactly the bytes it did before (the gate checks every v1 fixture). A v7 module adds, in order: a memory section after the function section (limits flag 1, min = max = the exact page count, no growth); immutable i32 globals holding the byte offset of each module and text region; exports for the functions, then memory, then region.NAME for each module and text region; one active data segment per non-empty text region after the code section; and a final custom section osc.v7.abi (function count; per function its name, parameter tags and result tag; module-region count; per region its name, tag, class and count; all unsigned LEB) so a host can tell u8 from i32 behind an i32. No imports.

v7 elementLowering
13 f32, 14 f64wasm f32/f64 at the ABI; inside, the bit pattern in an i64 local (wrap/reinterpret on use, so NaN payloads move exactly through CONST, MOV, regions and BITCAST)
BIN add/sub/mul/div, UN neg, CMP 1..6 on floatsIEEE f32/f64 operations; CMP gives canonical 0/1
CAST int to float, f32 to f64, f64 to f32convert_s/u, promote, demote
CAST float to intsaturating: NaN gives 0, values beyond the range give its nearest end, others truncate toward zero; written without the non-MVP trunc_sat opcodes
BITCASTsame width class: no code beyond renormalizing integer signedness
RLOAD/RSTOREfull-width index compared unsigned against the region count before any address arithmetic (a negative index is a huge unsigned value), trap if not below it; then i64 to i32 wrap, shift by the element width, static region offset in the memarg
RINITa bounded loop storing the value into every element of the function's local region

Every region, local ones included, gets static storage in table order, aligned to its element width. A text region's bytes come from its data segment and are read-only to Omega code (RSTORE and RINIT to text are refused), though not to a host holding memory. Local regions are owned by one function and only ever seen after that call's RINIT; the validator computes definite initialization of local regions on every path (unreachable blocks start with no region initialized), like registers. The memory is at most 2^31 bytes: 2^31 -> 2147483648 bytes = 32768 pages of 65536 (WolframLanguageEvaluator); a larger layout is CAPACITY. At most 1024 regions, 16777216 elements each; a v7 input may be up to 8,388,608 bytes (the v1 limit of 2,620,251 bytes stays for v1 headers). The region-bit fixed point is bounded by 512*1024+1 -> 524289 iterations.

Refusals keep the table above. v7 adds: a nonempty struct table is UNSUPPORTED_TAG (more than 16 structs CAPACITY); region class 3 and opcodes 9/10 are UNSUPPORTED_OP; tags 13/14 or opcodes 30..33 in a v1 unit are UNSUPPORTED_TAG/UNSUPPORTED_OP; a v7 header on a unit that uses no v7 feature is VERSION, reported after a complete parse; duplicate function names, duplicate or shadowing region names and an export collision with memory or region.NAME are INVALID.

The float-to-int boundaries were computed with WolframLanguageEvaluator as IEEE bit patterns: f32 2^63 5f000000 (1593835520), -2^63 df000000, 2^64 5f800000 (1602224128); f64 2^63 43e0000000000000 (4890909195324358656), -2^63 c3e0000000000000, 2^64 43f0000000000000 (4895412794951729152).

The gate's v7 section takes its units from the independent hand writer seed/wasm/v7/writer.js plus seed/wasm/v7cases.js, and its verdicts and expected outputs from the independent oracle seed/wasm/v7/oracle.js. Every accepted unit must translate twice to identical, valid wasm; every refused unit must exit with the oracle's class and empty stdout. For each run case, node seed/wasm/v7run.js MODULE SCRIPT (a read-only executor that reads osc.v7.abi) must print exactly what oracle.js run prints. The RGBX case fills a 16x8 uint framebuffer whose byte lanes follow a text "RGBX" table; its sha256 must agree, and a one-channel mutant and a BGRX mutant must hash differently. The out-of-bounds case (index = count, count + 1, negative i8/i32/i64, u64 with an in-range low 32 bits, all-ones u64) must trap in both, and an irwasm compiled with its two bounds-check calls deleted must be caught.

Equivalence of scalar IR functions (seed/equiv, issue 826)

seed/equiv/irequiv.om is a seeded-Omega interpreter for the same OSC IR v1 units (its reader is irspirv's v1 reader byte for byte; irwasm's v7 reader is that reader plus the edits recorded in seed/equiv/irwasm-v7.sed). irequiv check A B runs both functions on every input of a signature of at most 24 bits (all 256 for one uchar, all 65536 for a ushort or two uchars) and prints EQUIV PASS ... checked=N differing=0, or EQUIV FAIL ... differing=K first=<input> with both results; equal means the same bits or the same trap code. Wider signatures are only sampled (irequiv sample), printed as NOT_A_PROOF with exit 10. A PASS covers the IR both functions lowered to under src/compiler/osc_interp.c semantics, not native words. seed/equiv/gate-irequiv.sh runs the fixture pairs (repo functions js_hexv/hhexv, clamp_add, bitrev8, r8 against refactors and single-input mutants), then checks irequiv eval against native AArch64 programs on the 140 rows of seed/wasm/cases.tsv, seed/spirv/regression.tsv and seed/spirv/demo.tsv (same bits, same trap code); seed/equiv/README.md has the command line and exit codes.

11.2 Memory profile contract (IR v7)

The backend half of this contract is implemented by seed/wasm/irwasm.om (section 11.1). The producer half (omc's IR mode writing version 7) is separate work: on this compiler IR mode still writes version 1 only, so the v7 units the gate translates come from the hand writer seed/wasm/v7/writer.js. The authoritative wire allocation and validation rules are in spec/one-layer-format.md section 10. The milestone name does not repurpose OSC wire version 2.

The source spelling reuses native arrays:

global pixels uint 4096
text palette "RGBX"
fn frame phase uint to uint
scratch = new uint 4 phase
put pixels 0 get scratch 0
ret get pixels 0
end

global creates mutable per-instance storage; text creates a read-only byte table; new creates a function-local fixed-size array whose initializer is evaluated once at its declaration and copied to every element on each invocation. len is a compile-time element count. A one-element global is the scalar-state spelling. Mutable globals start at zero and persist between exported calls. Local storage never exposes a previous call.

get and put retain exact element typing and bounds behavior: a constant out-of-range index is error 21, a dynamic negative or high index is trap 3, and writing text is error 20. All accesses are checked before address arithmetic; there is no unchecked form. Integer indices do not become valid by wrapping to a wasm32 address. Elements are naturally aligned and packed at their scalar width; struct-cell layout is a separate contract. Type/context/capacity refusals remain errors 7/9/14/23 respectively.

The first memory profile names globals directly from functions. It does not add array parameters, raw pointers, dynamic allocation or GPU synchronization. Function/Workgroup storage distinctions are wire contracts, not permission to lower persistent state to per-work-item temporary storage. The wasm ABI exports memory, original scalar function names, and immutable region.NAME offset globals for module regions. JavaScript can form a typed framebuffer view and invoke frame explicitly; Omega does not install a browser loop or import JavaScript services. A read-only source table is not protected from a JavaScript caller that holds the exported memory.

12. Executable native contracts, version 1 (OM-2 extension)

This section extends the seeded native compiler, not the OSC v1 metadata in section 11.1. om2 and om2 debug check contracts. om2 release erases their runtime evaluation after the same syntax, scope, type and purity checks. om2 diag debug and om2 diag release combine the policy with diagnostic records. om2 fmt keeps its existing canonical profile and checks contracts. OM-1 does not reserve any new words. No environment variable selects policy.

om2
fn step x uint to uint
requires lt x 10
ensures eq result add x 1
ret add x 1
end
fn main to int
i = uint 0
while lt i 3
invariant le i 3
i = step i
end
ret int sub i 3
end

Declaration and observation points

requires BOOL and ensures BOOL form a function's prefix, before its first executable statement. Blanks and note lines may separate clauses. A function has at most 64 prefix clauses. Preconditions execute in declaration order on entry, after parameter binding, including inline calls.

Postconditions execute in declaration order on every normal return: explicit value/void ret, implicit void fallthrough, and inline returns. They do not execute on exit, a trap or abnormal process termination. The return expression is evaluated exactly once and preserved while checks run. The read-only name result is available only in value postconditions. It has the declared return type. The caller receives that same value after the checks.

Function predicates bind globals and parameters visible at their declaration, not names introduced later in the body. A parameter in a postcondition means its current value at return; array reads likewise observe current contents. There is no implicit entry snapshot and no old operator. Reads of fresh output arrays are checked for definite initialization at every return.

invariant BOOL forms the prefix of a while or for body, before any body statement. There are at most 64 clauses per loop. It sees loop-entry names and, for for, its counter. Clauses run at the loop head, before the condition: on entry even for zero trips, on every backedge, and before the final false condition. continue reaches that head; for increments first. break bypasses the next check and makes no promise about the break-exit state. A return from inside a loop runs function postconditions, not an extra invariant. Unrolled loops preserve these observation points, including their final counter value. Their diagnostic iter can therefore equal the loop limit.

Purity, proofs and failure

Predicates have type bool. Their bounded, recursive expression grammar permits integer/bool literals and names, integer/bool operations and checked conversions, grouping, len, and ordinary checked array/struct/layout reads. It excludes user calls (including inline calls), floats and abstract values, host operations, mapped-device operations, allocation, writes and ownership operations. The exclusion is recursive, including in release and under a constant expression. and and or remain eager, never short-circuit bounds guards.

The checker proves literal true and safely folded constant predicates using the existing checked integer folder. A proof erases evaluation only when the whole predicate is known to return true without trapping. It does not assume that arbitrary reflexive expressions are safe. Constant false remains a runtime failure in debug; release erases it by policy, not by proof.

False requires uses existing trap 9 (program exit 109); false ensures or invariant uses existing trap 10 (exit 110). Function-mode callers receive those same trap codes through OscRt.trap. An arithmetic, conversion or bounds failure while evaluating a predicate retains its original trap code. Compiler error 30 means misplaced contract syntax, unavailable result, or a forbidden predicate operation. Existing type, unknown-name, initialization and capacity errors retain their codes. Diagnostic trap sites name the predicate's source line. Error 30 has diagnostic obligation contract. Each emitted contract site also has an omc-check 1 kept|erased line=N rule=RULE kind=KIND record in diagnostic mode: runtime for kept checks, constant-true for a proof, or release for policy erasure; KIND is requires, ensures or invariant. Deferred postconditions are reported at their actual return sites, not during entry validation.

Release erasure removes predicate instructions, trap records and diagnostic sites, and restores temporary allocation and branch bookkeeping. It never uses the predicate as an optimizer assumption and never erases the body's arithmetic, bounds, initialization, stack or loop-fuel protection. Contract sources still must fit the compiler's validation capacities in release.

Fixtures and exact expected outcomes are in seed/omc/contracts/contracts.cases, using the existing pinned seed/qualification/om2/gate.om conductor. The example above is exercised by seed/omc/contracts/ok.om; release/erased and proved/plain pairs require byte-identical output, not just equal exit statuses.

Native object output (experimental, outside frozen OM-2)

A first line object, followed by om2 or om2 release, requests an AArch64 function-mode object instead of an executable or bare callable unit. The payload uses the existing function ABI and preserves its trap behavior. extern fn NAME ... to TYPE declares a typed imported function without a body. Imports must be resolved by the native module linker before execution. Exports use export fn; the existing profiles retain their own behavior.

Objects carry compiler-generated symbols, typed interfaces, call relocations and stack-cost records. The object format and separate source-digest/compiler-pin identity checks are specified in spec/omegese-modules.md. This first format accepts scalar and array interfaces. It refuses nominal and struct/layout interfaces, inline imports, imported fresh scratch contracts, globals and text literals. Function-mode call cycles still refuse.

Host effects (DRA-542): an object takes read, write, exit and the OM-2 function-mode host subset that needs no program image: fopen, fclose, fstat, stat, lstat, getuid, geteuid, getgid, getegid, monons, realns and sleepns. Each compiles to the same code as in function mode, so a program linked from modules reads, writes, opens files and exits. The device words 166..177 stay error 9 in an object (their table lives in a runtime context the module linker does not set up), as do program-only host words (error 9, function-mode subset). A host word's transient stack (its save area and, for a path, a private 4096-byte buffer) is charged to the function's stack record: the record is stkbytes (the whole frame) plus the largest transient push, an upper bound on the deepest SP the function's own code reaches below its entry (callees excluded; equal to it when no transient push precedes a frame allocation, as in the gate's one-statement bodies), and a call's record is the frame plus everything pushed at that call. omc counts every SP push and pop it emits; an object function whose count would go below zero or does not return to zero at its end is refused (error 9, site 628) instead of being under-reported. Checked by seed/omc/gate-objhost.sh. A function named main has no special meaning inside an object.

The object is not an executable. Its linker must validate identities, interfaces, relocations, whole-program cycles and stack demand before publishing a final image. Compiler parse refusals leave stdout empty. A failed output write can leave a partial object, which consumers must reject. Existing OM-1/OM-2 output does not change unless the explicit object line is present.