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
omega-mv / evidence / OM2-COMPILER / s3 / layout / ir-trap / repair.patch
| 1 | --- /home/drakestapleton/workspace/omega-in-omega/seed/omc/omc.om 2026-10-22 07:02:14.540523908 -0500 |
| 2 | +++ seed/omc/omc.om 2026-10-22 14:45:59.040184305 -0500 |
| 3 | @@ -4044,7 +4044,11 @@ |
| 4 | p = add p 1 |
| 5 | end |
| 6 | emitb uchar get ir_npar 0 |
| 7 | +if eq get ir_ret 0 76 |
| 8 | +emitb 0 |
| 9 | +else |
| 10 | emitb uchar get ir_ret 0 |
| 11 | +end |
| 12 | ir_w16 get ir_nreg 0 |
| 13 | i = ulong 0 |
| 14 | while lt i get ir_nreg 0 |
| 15 | @@ -4374,12 +4378,49 @@ |
| 16 | end |
| 17 | end |
| 18 | |
| 19 | +note ir_trap: OMEGESE section 4. A trap ends the path but the IR still |
| 20 | +note needs an unreachable ret terminator (zero of the return type, or void). |
| 21 | +note trap is packed little endian 1885434484; independently checked in Wolfram. |
| 22 | +fn ir_trap to void |
| 23 | +tok |
| 24 | +if ne get tk 0 2 |
| 25 | +fail 4 |
| 26 | +end |
| 27 | +code = get tw 0 |
| 28 | +if or lt code 1 gt code 14 |
| 29 | +fail 8 |
| 30 | +end |
| 31 | +tok |
| 32 | +if not or eq get tk 0 0 eq get tk 0 3 |
| 33 | +fail 4 |
| 34 | +end |
| 35 | +ir_op 12 code 0 0 0 |
| 36 | +z = ulong 65535 |
| 37 | +if ne get ir_ret 0 76 |
| 38 | +z = ir_lit 0 get ir_ret 0 |
| 39 | +end |
| 40 | +ir_op 15 z 0 0 0 |
| 41 | +put ir_dead 0 1 |
| 42 | +end |
| 43 | + |
| 44 | fn ir_stmt to ulong |
| 45 | tok |
| 46 | if or eq get tk 0 0 eq get tk 0 3 |
| 47 | ret 0 |
| 48 | end |
| 49 | c = kw get tw 0 |
| 50 | +if and ne c 66 ne c 68 |
| 51 | +if ne get ir_dead 0 0 |
| 52 | +fail 17 |
| 53 | +end |
| 54 | +end |
| 55 | +if eq c 77 |
| 56 | +if eq get tw 0 1885434484 |
| 57 | +ir_trap |
| 58 | +ret 0 |
| 59 | +end |
| 60 | +fail 9 |
| 61 | +end |
| 62 | if eq c 66 |
| 63 | ir_end |
| 64 | ret 0 |