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 / seed / qualification / om2 / candidates / s4 / mutants / part-order.to
| 1 | note arrpart mutant: `part A o k` keeps its operands and bounds checks, but evaluates k before o. |
| 2 | note The source expressions are still parsed in their original order. partord emits branch trampolines |
| 3 | note rather than moving instruction spans, so trap sites, deferred calls, inline fixups, global addresses |
| 4 | note and diagnostic source records retain their original emitted positions without relocation changes. |
| 5 | fn arrpart f ulong pi ulong md ulong to void |
| 6 | p = add mul sub f 1 6 pi |
| 7 | e = arrname |
| 8 | i = sub e 1 |
| 9 | k = ulong get nm_kind i |
| 10 | if ge k 6 |
| 11 | fail 7 |
| 12 | end |
| 13 | if eq k 4 |
| 14 | fail 19 |
| 15 | end |
| 16 | fz_arg e |
| 17 | if eq get fn_pk p 3 |
| 18 | if eq md 57 |
| 19 | fail 20 |
| 20 | end |
| 21 | if and ne k 1 ne k 3 |
| 22 | fail 20 |
| 23 | end |
| 24 | else |
| 25 | if eq md 58 |
| 26 | fail 7 |
| 27 | end |
| 28 | end |
| 29 | if ne ulong get nm_type i ulong get fn_pt p |
| 30 | fail 7 |
| 31 | end |
| 32 | if ne get fn_pl p 0 |
| 33 | fail 7 |
| 34 | end |
| 35 | rn = alloc |
| 36 | ro = partord rn |
| 37 | d = partck i ro rn |
| 38 | ux = add mul get depth 0 6 pi |
| 39 | put ul_k ux 1 |
| 40 | put ul_v ux rn |
| 41 | put rt 0 e |
| 42 | put rk 0 5 |
| 43 | put rv 0 d |
| 44 | end |
| 45 | |
| 46 | note partord: emitted layout is B length; offset; B checks; length; B offset; checks. |
| 47 | note Reserve rn before lowering offset, so offset temporaries cannot overwrite it and offset calls save |
| 48 | note and restore it through the existing register-save machinery. No new runtime stack convention is used. |
| 49 | note Force the length result into rn before jumping back to offset; ro remains the offset result. |
| 50 | fn partord rn ulong to ulong |
| 51 | first = get oc 0 |
| 52 | emit 335544320 |
| 53 | head = get oc 0 |
| 54 | rdval 0 5 255 0 |
| 55 | if ne get rt 0 5 |
| 56 | fail 7 |
| 57 | end |
| 58 | ro = matreg get rk 0 get rv 0 5 |
| 59 | done = get oc 0 |
| 60 | emit 335544320 |
| 61 | patch26 first get oc 0 |
| 62 | rdval 0 5 255 0 |
| 63 | if ne get rt 0 5 |
| 64 | fail 7 |
| 65 | end |
| 66 | force get rk 0 get rv 0 5 rn |
| 67 | back head |
| 68 | patch26 done get oc 0 |
| 69 | ret ro |
| 70 | end |