Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/seed/ng/a64/rgate.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / ng / a64 / rgate.om` 1790 lines · 50364 bytes Raw Blame History 1 note rgate.om: the ng-a64 back-end gate (allocator and full pipeline). Run from the omega-mv root: 2 note seed/out/omc < seed/ng/a64/rgate.om > rgate && ./rgate, with stdin one line naming an existing scratch directory. 3 note 1. Build mkir (seed/ng/src/ir.om + seed/ng/a64/tests/mkir.om), ngcheck (seed/ng/sha256.om + seed/ng/ngcheck.om, 4 note ng-ir's witness), ng (the units of seed/ng/ng.units, in order; their sha256s are ngbuild's check), ngas 5 note (seed/ng/ngtxt.om + seed/ng/ngas.om) and ngrun (seed/ng/src/ir.om + seed/ng/ngrun.om) with seed/out/omc; ngrand 6 note (seed/ng/src/ir.om + seed/ng/ngrand.om) is built at step 7, frand (seed/ng/a64/tests/frand.om) at step 8. 7 note 2. For each fixture N of mkir: mkir writes its ΩIR, which ngcheck must accept (exit 0); ng compiles it with 8 note `@ng a64` (save pairs) and with `@ng a64 split` (separate saves); each ELF runs. The omc build of 9 note seed/ng/a64/tests/ref/N.om runs. Both ng statuses must equal the fixture's expected status (fixed below: 10 note computed independently with Wolfram, or the trap code of the fixture's check) and omc's status its omc 11 note expectation: the same, except tsum, where omc traps 6 (106) a million calls deep and ng's E loop shape has no 12 note recursion (BEYOND_OMC, IR.md s7.9 and D9: trap 6 is compared only when both trap). tsum's 32 is the Omega 13 note value of `int and ts `1000000` 255` (Wolfram: ts(`1000000`) = `500000500000`, low byte 32); without the & 255, 14 note `int` would trap 5. The stdout of the split 15 note run and of omc's run must equal the pairs run's byte for byte (bcopy writes 65536 bytes, sort four lines). 16 note 3. For each ngrun fixture (text tdx: ng-ir's integer run pairs seed/ng/tests/ir/x-*.oir and the float ones 17 note x-float, x-convlo and x-minnan, and 18 note seed/ng/a64/tests/oir/*.oir: every check op with its trap code on narrow and 64-bit types, calls past eight 19 note arguments, globals, loads and stores, block-parameter loops, the E loop shape, the bench kernels, SLICE values 20 note and their checks; r-rot: u8 and u16 rotl/rotr, amounts past the width; r-s12: ngrand seed 12 shrunk to its 21 note `rotr u8`, the first random refusal; ng-ir's n-s7821 and n-s10623: ngrand seeds 7821 and 10623 shrunk to a 22 note u64 chk.conv i32 that traps 5, where ngrun before `26f67fbb` read the u64 as signed): ngas 23 note assembles it, ngcheck accepts it, ngrun (the reference interpreter, D9) runs it; its status must be a 24 note program's (not 125, an op outside ngrun) and both ng forms must exit with it and write its stdout and stderr 25 note byte for byte. 26 note Refusal fixtures (text tdu: seed/ng/a64/tests/oir/u-*.oir, a select of SLICE values fused into its compare in 27 note eq, ne-zero, signed lt and single-bit forms, true and false, passed to a call, and once not fused): ngas 28 note assembles, ngcheck accepts and ngrun runs each (a program's status, not 125); both ng forms must refuse it with 29 note exit 5 and stderr exactly `a64: unsupported 2` (bay 11 F1 on `3ad3ef7b`: the fused select ran with a wrong value). 30 note 4. Every BL target in each `@ng a64` ELF must be a multiple of 64 (function entries aligned, D13). 31 note 5. Mutants of seed/ng/src/a64.om, each one equal-length text change that must occur exactly once; ng is rebuilt 32 note with it and every fixture runs with `@ng a64`. A mutant is caught when some fixture's status differs from 33 note its expected (mkir) or ngrun's (ngrun fixtures) status (or ng refuses, or the program is killed after 30 s) 34 note or a BL target is misaligned; ngrun fixtures also compare stdout/stderr byte for byte. Every mutant must be caught: 35 note 1 spill reload reads the next slot 2 values crossing a call may take caller-saved registers 36 note 3 live-out values end at the block start 4 parallel moves ignore pending reads (block-argument cycles) 37 note 5 callee-saved registers are never saved 6 frame of 4 bytes per slot (slots overlap the saves) 38 note 7 function entries aligned to 16 bytes, not 64 39 note 8 the E loop shape never matches (tsum recurses and traps 6) 9 the E tail site adds acc to itself, not a 40 note 10 chk.bounds compares i with len, not len - e (oob stores past g) 11 alloca zero-fills half its area (zf) 41 note 12 write passes off as the count (mem) 13 u64 loads read one byte (mem) 14 a frame above 4095 bytes drops 42 note its LSL 12 part (the zero fill runs over the globals: mem) 15 i8 loads zero-extend (wid) 43 note 16 a wrong trap code: chk.divovf exits 102, not 101 17 stack parameters all read the first incoming slot 44 note 18 stack arguments are stored one slot low 19 a slice's length wire takes its offset, not n 45 note 20 block arguments of slice type keep the target's own length (a shrinking loop slice never shrinks) 46 note 21 slice offsets are not scaled by the element size (u32 and u64 slices start at the wrong element) 47 note 22 monons (host 109) selects on GE, not LT: a successful clock read returns 0 (h-mono exits 1, ngrun 7) 48 note 23 the fill byte count is not scaled by the element size (f-fill and f-fills: u32/u16/u64 elements; since the 49 note block fill of ham/ng-a64-fill the count, not each store's index, carries the scale) 50 note 24 realns reads CLOCK_MONOTONIC (h-real: the reading must lie between 2023-11-14 and 2100 and exceed monons) 51 note 25 a u8 rotate's second copy shifts by 24, not 16 (bits 16..23 stay zero: r-rot) 52 note 26 a u16 rotate's copy shifts by 8, not 16 (it overlaps itself: r-rot; u8 stays right) 53 note 27 the allocator hands out x15, the scratch of the checked ops (lv: v_14 sits in x15 across chk.add) 54 note 28 fused B.cond condition, 29 CBNZ, 30 CBZ, 31 TBNZ, 32 TBZ, 33 bit packing, 34 CSEL operands, 55 note 35 the select-of-SLICE refusal never fires (caught when a refusal fixture compiles or its stderr differs). 56 note 6. Front phase (needs ng-front's front.om in ng.units: `@ng front-ir`). For each source of text tfr (ng-ir's 57 note x-*.om run pairs without x-float, and ng-front's integer bench kernels seed/ng/front/kernels/*.om at full size): 58 note ng reads `@ng front-ir` and the source and must exit 0; ngcheck must accept its ΩIR; ng compiles that ΩIR with 59 note `@ng a64` and `@ng a64 split` and both ELFs run; omc builds the same source and it runs. Both ng statuses must 60 note equal omc's, both stdouts omc's byte for byte, and both stderrs omc's byte for byte, except that when omc's 61 note stderr is exactly one line of decimal digits (OMC-EFF-2: the kernel's elapsed nanoseconds, different on every 62 note run) ng's must be one such line too. Every BL target of the `@ng a64` ELF must be a multiple of 64. 63 note x-float (f64 arithmetic, fsqrt and conversions) and the linear kernel (f32 arrays filled by `fill`) are among 64 note these sources. For each source of text tfz (none since the fill head: no front case is outside the slice) 65 note front-ir and ngcheck must accept and both a64 forms must refuse (exit 5); counted as refused, never compared. 66 note Negative control (text tfd): fib40's front-ir and a64 build against omc's build of 67 note seed/ng/a64/tests/front/fib39.om must be sound (same statuses, ngcheck accepts, BL aligned) and must differ 68 note in stdout (Wolfram: Fibonacci[39] = `63245986`, Fibonacci[40] = `102334155`); a comparison that cannot tell 69 note those apart fails the gate. 70 note 7. Random phase (D9): for each seed k in 1..nrd, ngrand (ng-ir's generator: a ΩIR unit valid by construction from 71 note seed k) writes the unit, which then goes through step 3's checks with ngrand's status in place of ngas's: 72 note ngcheck accepts, ngrun's status is a program's, both ng forms exit with it and write its stdout and stderr byte 73 note for byte, BL targets aligned. A refusal by ng fails the seed. Mutants do not run this phase. Negative control: 74 note ngrun's run of seed 1 against the `@ng a64` ELF of seed 2 must be sound and differ in status or stdout. 75 note 8. Float phase (scalar f32/f64, DESIGN.md section 9): frand writes the canonical ΩIR text of its edge programs 76 note 1..nfe (`frand edge K`: every binary op, compare and fma over every pair of the f32 and f64 edge tables, unary 77 note ops, conversions in every mode and to every integer type, bitcasts, integer edges to floats, every chk.conv 78 note boundary of every integer type from both float widths with the trap past each end, and a register-pressure 79 note program with stack arguments of both banks and recursion, and the fill programs of every element type: 80 note lengths 0..257 for u8 and i8, block and tail boundary lengths for the wider types, offsets 0..31, nested 81 note slices, sentinels, NaN and -0 patterns) and of the random seeds 1..nfl (`frand K`), ngas 82 note assembles it, and each goes through step 3's checks with frand's (or ngas's) status in place of ngas's: 83 note ngcheck accepts, ngrun's status is a program's, both ng forms exit with it and write its stdout and stderr byte 84 note for byte (arithmetic NaNs are printed with sign and payload masked, quiet bit kept), BL targets aligned. 85 note Negative control: ngrun's run of float seed 1 against the `@ng a64` ELF of float seed 2 must be sound and 86 note differ in status or stdout. Packed 16B float vector mutants (80..85, DESIGN.md s12) and v-*/u-selvec fixtures run in 87 note dxrun/durun. Float and fill mutants (36..79; 70..79 are the fill ones) also run the edge programs 88 note and float seeds 1..nfm. 89 note Output: one line per fixture and per mutant, then PASS or FAIL. Exit 0 PASS, 1 FAIL, 2 a step could not run 90 note (`cannot run step K`; steps 1 and 2, opening a file, add its path; step 9, an omc build, adds spawn's status, 91 note the source path and the first line of build.err: see fail9; step 18, a float program frand or ngas did not 92 note give during a mutant). 93 om2 94 95 global mem uchar `16777216` 96 global pb uchar 4096 97 global pn ulong 1 98 global sd uchar 1024 99 global sn ulong 1 100 global av uchar 4096 101 global ap ulong 2 102 global stb uchar 4 103 global ob uchar 65536 104 global on ulong 1 105 global ex ulong 16 106 global eo ulong 16 107 global rg ulong 4 108 global dq ulong 128 109 global fv ulong 24 110 global du ulong 1 111 112 note regions of mem: sources [0, 8 MiB), ΩIR [8, 12), ELF [12, 14), units [14, 15), stdin [15, 16) 113 const rir ulong `8388608` 114 const relf ulong `12582912` 115 const runit ulong `14680064` 116 const rin ulong `15728640` 117 note ngrun's stderr is kept at mem[rerr, rerr + 65536), after its stdout (savout keeps at most 983040 bytes) 118 const rerr ulong `15663104` 119 120 text tx "seed/out/omc\nseed/ng/ng.units\nseed/ng/src/ir.om\nseed/ng/a64/tests/mkir.om\nseed/ng/a64/tests/ref/\n.om\n/ng.om\n/ng.bin\n/mkir.om\n/mkir.bin\n/fx.name\n/fx.ir\n/fx.in\n/fx.elf\n/ref.bin\n/run.out\n/run.err\nseed/ng/src/a64.om\n@ng a64\n@ng a64 split\n/build.err\nseed/ng/sha256.om\nseed/ng/ngcheck.om\n/ngcheck.om\n/ngcheck.bin\nseed/ng/ngtxt.om\nseed/ng/ngas.om\nseed/ng/ngrun.om\n/ngas.om\n/ngas.bin\n/ngrun.om\n/ngrun.bin\n.oir\n@ng front-ir\nseed/ng/ngrand.om\n/ngrand.om\n/ngrand.bin\nseed/ng/a64/tests/frand.om\n/frand.om\n/frand.bin\n/fr.oir\nedge\n" 121 text tdx "seed/ng/tests/ir/x-bits\nseed/ng/tests/ir/x-conv\nseed/ng/tests/ir/x-divmin\nseed/ng/tests/ir/x-fib\nseed/ng/tests/ir/x-fuel\nseed/ng/tests/ir/x-fuelok\nseed/ng/tests/ir/x-hello\nseed/ng/tests/ir/x-i8\nseed/ng/tests/ir/x-index\nseed/ng/tests/ir/x-indexok\nseed/ng/tests/ir/x-ovf64\nseed/ng/tests/ir/x-ovf64ok\nseed/ng/tests/ir/x-remmin\nseed/ng/tests/ir/x-shift\nseed/ng/a64/tests/oir/c-add-u8\nseed/ng/a64/tests/oir/c-add-i16\nseed/ng/a64/tests/oir/c-add-i32\nseed/ng/a64/tests/oir/c-add-u64\nseed/ng/a64/tests/oir/c-sub-u8\nseed/ng/a64/tests/oir/c-sub-i8\nseed/ng/a64/tests/oir/c-sub-u32\nseed/ng/a64/tests/oir/c-sub-i64\nseed/ng/a64/tests/oir/c-mul-i8\nseed/ng/a64/tests/oir/c-mul-u32\nseed/ng/a64/tests/oir/c-mul-i64\nseed/ng/a64/tests/oir/c-mul-u64\nseed/ng/a64/tests/oir/c-neg-i8\nseed/ng/a64/tests/oir/c-neg-u16\nseed/ng/a64/tests/oir/c-neg-i64\nseed/ng/a64/tests/oir/c-divz-u8\nseed/ng/a64/tests/oir/c-divz-u32\nseed/ng/a64/tests/oir/c-divz-i64\nseed/ng/a64/tests/oir/c-divovf-i8\nseed/ng/a64/tests/oir/c-divovf-i32\nseed/ng/a64/tests/oir/c-divovf-i64\nseed/ng/a64/tests/oir/c-shl-i8\nseed/ng/a64/tests/oir/c-shl-i16\nseed/ng/a64/tests/oir/c-shl-i32\nseed/ng/a64/tests/oir/c-shl-i64\nseed/ng/a64/tests/oir/c-shift-u8\nseed/ng/a64/tests/oir/c-shift-i32\nseed/ng/a64/tests/oir/c-shift-u32\nseed/ng/a64/tests/oir/c-shift-u64\nseed/ng/a64/tests/oir/c-conv-i64-u8\nseed/ng/a64/tests/oir/c-conv-i32-u16\nseed/ng/a64/tests/oir/c-conv-u64-i64\nseed/ng/a64/tests/oir/c-conv-i64-i8\nseed/ng/a64/tests/oir/c-conv-u8-i8\nseed/ng/a64/tests/oir/c-conv-i64-u32\nseed/ng/a64/tests/oir/c-bounds-n\nseed/ng/a64/tests/oir/c-bounds-e0\nseed/ng/a64/tests/oir/c-bounds-ld\nseed/ng/a64/tests/oir/c-slice-n\nseed/ng/a64/tests/oir/c-slice-off\nseed/ng/a64/tests/oir/c-fuel\nseed/ng/a64/tests/oir/c-true-1\nseed/ng/a64/tests/oir/c-true-9\nseed/ng/a64/tests/oir/c-true-10\nseed/ng/a64/tests/oir/c-true-13\nseed/ng/a64/tests/oir/wide\nseed/ng/a64/tests/oir/mem2\nseed/ng/a64/tests/oir/eloop\nseed/ng/a64/tests/oir/b-fib\nseed/ng/a64/tests/oir/b-bcopy\nseed/ng/a64/tests/oir/b-sort\nseed/ng/a64/tests/oir/s-slice\nseed/ng/a64/tests/oir/s-tb\nseed/ng/a64/tests/oir/s-te\nseed/ng/a64/tests/oir/s-ts\nseed/ng/a64/tests/oir/s-ts2\nseed/ng/a64/tests/oir/b-chacha\nseed/ng/a64/tests/oir/h-mono\nseed/ng/a64/tests/oir/f-fill\nseed/ng/a64/tests/oir/f-fills\nseed/ng/a64/tests/oir/h-real\nseed/ng/a64/tests/oir/r-rot\nseed/ng/a64/tests/oir/r-s12\nseed/ng/a64/tests/oir/f-fusion\nseed/ng/tests/ir/n-s7821\nseed/ng/tests/ir/n-s10623\nseed/ng/tests/ir/x-float\nseed/ng/tests/ir/x-convlo\nseed/ng/tests/ir/x-minnan\nseed/ng/a64/tests/oir/v-f32-ops\nseed/ng/a64/tests/oir/v-f64-ops\nseed/ng/a64/tests/oir/v-fma-alias\nseed/ng/a64/tests/oir/v-call-clobber\nseed/ng/a64/tests/oir/v-spill-loop\nseed/ng/a64/tests/oir/v-spill-swap\nseed/ng/a64/tests/oir/v-swap-nocall\nseed/ng/tests/ir/x-pool\nseed/ng/tests/ir/x-pool-widths\nseed/ng/tests/ir/x-pool-bound\n" 122 text tfx "fib\ndeep\npress\nrot\nck\nar\ntsum\nmem\noob\nzf\nwid\nbcopy\nsort\nlv\n" 123 text tmp "a6_ew a_ldrx s 31 sub get ar_m add get ar_rb 96 w 1 0 0\nx = ne uchar get ar_m add get ar_rb 94 w 0\nget ar_m add get ar_rb 102 add mul x lw i get a_ben x\nif not a6_isrc d\nif ge r 19\nf = mul 8 add get a_fs 4 n\nwhile ne and get a_cn 0 63 0 bound 16\nif ne get i_oop m 10\na6_tsum l a\na6_cmpk i sub l e\na6_movi 17 shr get a_asz k 4\na6_mvadd 2 a6_loc a6_arg o 4\nret a_ldrxr\na6_ew a_subxi 31 31 h 1 0\nconst a_lsbx ulong 82\na6_fx a_cbzx 15 add a_tlab c\na6_ew a_ldrx d 17 j 0 0\na6_ew a_strx l 31 sub k 8 0 0\na6_mov 15 n\na6_mvadd a6_wloc a6_lw d a6_wloc a6_lw s\na6_ew a_addx 16 b f 0 a6_lsz e\na6_ew a_cselx 0 0 2 11 0\nsz = a6_lsz t\nck = ulong 0\na6_ew a_orrx 16 16 16 0 16\na6_ew a_orrx 16 a a 0 w\nwhile lt r 15 bound 15\na6_fx a_bcond cc l\nf = a_cbnzx\nf = a_cbzx\nf = 111\nf = 110\na6_fx f add r shl bit 5 l\na6_ew a_cselx d u v cc 0\nif and ne op 54 a6_issl r\nret and shr ulong 0xac9410 mul 4 sub op 30 15\nret and shr ulong 0xac9410 mul 4 sub op 30 15\nret and shr ulong 0xac9410 mul 4 sub op 30 15\nret and shr ulong 0xac9410 mul 4 sub op 30 15\nconst a_faddd ulong 117\nconst a_fadds ulong 125\na6_ew a6_ff t a_fcseld a_fcsels d a b 1 0\nfm = a6_ff t a_fnegd a_fnegs\na6_ew a_movzx 15 0xc0 1 0 0\na6_ew a_msrfpcr 31 0 0 0 0\nfz = ulong 31\na6_ew a_cselx d 17 d 12 0\na6_ew a_cselx d 17 d 8 0\na6_ew a6_ff s a_fcvtzsxd a_fcvtzsxs d a 0 0 0\na6_fx a_bcond 6 add a_tlab 5\nhi = shl add ulong 1022 w 52\nif eq a6_vty v 13\na6_ew a6_ff t a_ldrdr a_ldrsr d b i 1 0\na6_ew a6_ff t a_strdr a_strsr x b i 1 0\na6_mvadd get a_mal k p\na6_mvfrom r a6_rloc r\nif or lt r 28 and ge r 40 lt r 48\na6_ew a_ldrd s 31 sub get ar_m add get ar_rb 96 w 1 0 0\nconst a_fminnmd ulong 124\nconst a_fmaxnms ulong 131\nfm = a6_ff t a_scvtfdx a_scvtfsx\na6_ew a_subx 16 16 15 0 0\na6_ew a6_ff t a_fmovdx a_fmovsw d 16 0 0 0\na6_ew a_fmovd sub d 32 sub s 32 0 0 0\na6_ew a_strd sub l 32 31 sub k 8 0 0\na6_ew a_ldrd sub d 32 17 j 0 0\na6_ew a6_ff t a_fmaddd a_fmadds d a b c 0\na6_ew a_fcvtds d a 0 0 0\na6_ew a_strd r 31 sub get ar_m add get ar_rb 96 w 1 0 0\na6_ew a_subsxi 31 15 16 0 0\na6_ew a_tbz 15 3 3 0 0\na6_ew a_tbz 15 2 3 0 0\na6_ew a_tbz 15 1 3 0 0\na6_ew a_tbz 15 0 3 0 0\na6_ew a_bcond 3 4 0 0 0\na6_ew a_strqr 31 b 15 0 0\na6_ew a_orrx 17 17 17 0 8\na6_ew a_andxi 17 x sub shl ulong 1 shl ulong 8 sz 1 0 0\na6_ew a6_ff t a_fmovxd a_fmovws 17 x 0 0 0\nif and x eq uchar get ar_m add get ar_rb 99 w 2\nfm = a6_vf t a_fadd2d a_fadd4s\nif or eq d a eq d b\na6_ew a6_vf vt a_dupd a_dups d a m 0 0\na6_ew a_strq r 31 shr sub get ar_m add get ar_rb 96 w 1 1 0 0\na6_ew a_ldrq 30 31 sub s 700 0 0\na6_fx a_bcond 2 add a_tlab 3\na6_emitw `4177528106`\na6_ew a6_ff t a_ldrdr a_ldrsr d 16 i 1 0\na6_envbr small a_bcond 8\na6_ew a_addx 3 18 3 0 3\na6_ew a_strbr 6 1 0 0 0\n" 124 text tmr "a6_ew a_ldrx s 31 add get ar_m add get ar_rb 96 w 0 0 0\nx = eq uchar get ar_m add get ar_rb 94 w 9\nget ar_m add get ar_rb 102 add mul x lw i get a_bst x\nif not a6_isrc 0\nif ge r 99\nf = mul 4 add get a_fs 4 n\nwhile ne and get a_cn 0 15 0 bound 16\nif ne get i_oop m 99\na6_tsum l l\na6_cmpk i sub l 0\na6_movi 17 shr get a_asz k 5\na6_mvadd 2 a6_loc a6_arg o 3\nret a_ldrbr\na6_ew a_subxi 31 31 h 0 0\nconst a_lsbx ulong 81\na6_fx a_cbzx 15 add a_tlab 9\na6_ew a_ldrx d 17 0 0 0\na6_ew a_strx l 31 sub k 7 0 0\na6_mov 15 f\na6_mvadd a6_wloc a6_lw d a6_wloc a6_lw d\na6_ew a_addx 16 b f 0 a6_lsz 2\na6_ew a_cselx 0 0 2 10 0\nsz = a6_lsz 2\nck = ulong 1\na6_ew a_orrx 16 16 16 0 24\na6_ew a_orrx 16 a a 0 8\nwhile lt r 16 bound 16\na6_fx a_bcond 14 l\nf = a_cbzx \nf = a_bl \nf = 110\nf = 111\na6_fx f add r shl bit 4 l\na6_ew a_cselx d v u cc 0\nif and eq op 99 a6_issl r\nret and shr ulong 0xac9b10 mul 4 sub op 30 15\nret and shr ulong 0xacd410 mul 4 sub op 30 15\nret and shr ulong 0xa89410 mul 4 sub op 30 15\nret and shr ulong 0x2c9410 mul 4 sub op 30 15\nconst a_faddd ulong 118\nconst a_fadds ulong 117\na6_ew a6_ff t a_fcseld a_fcsels d b a 1 0\nfm = a6_ff t a_fabsd a_fnegs\na6_ew a_movzx 15 0x40 1 0 0\na6_ew a_msrfpcr 15 0 0 0 0\nfz = ulong 16\na6_ew a_cselx d 17 d 13 0\na6_ew a_cselx d 17 d 9 0\na6_ew a6_ff s a_fcvtzuxd a_fcvtzsxs d a 0 0 0\na6_fx a_bcond 7 add a_tlab 5\nhi = shl add ulong 1021 w 52\nif eq a6_vty v 99\na6_ew a6_ff t a_ldrdr a_ldrsr d b i 0 0\na6_ew a6_ff t a_strsr a_strsr x b i 1 0\na6_mvadd get a_mal k k\na6_mvfrom r a6_rloc 0\nif or lt r 28 and ge r 48 lt r 48\na6_ew a_ldrd s 31 add get ar_m add get ar_rb 96 w 0 0 0\nconst a_fminnmd ulong 122\nconst a_fmaxnms ulong 132\nfm = a6_ff t a_ucvtfdx a_scvtfsx\na6_ew a_addx 16 16 15 0 0\na6_ew a6_ff t a_fmovdx a_fmovsw d 17 0 0 0\na6_ew a_fmovd sub d 32 sub s 33 0 0 0\na6_ew a_strd sub l 32 31 sub k 7 0 0\na6_ew a_ldrd sub d 32 17 0 0 0\na6_ew a6_ff t a_fmaddd a_fmadds d a c b 0\na6_ew a_fcvtsd d a 0 0 0\na6_ew a_strd r 31 sub get ar_m add get ar_rb 96 w 0 0 0\na6_ew a_subsxi 31 15 32 0 0\na6_ew a_tbz 15 4 3 0 0\na6_ew a_tbz 15 4 3 0 0\na6_ew a_tbz 15 4 3 0 0\na6_ew a_tbz 15 4 3 0 0\na6_ew a_bcond 2 4 0 0 0\na6_ew a_strqr 31 b 15 1 0\na6_ew a_orrx 17 17 17 0 9\na6_ew a_andxi 17 x sub shl ulong 1 shl ulong 9 sz 1 0 0\na6_ew a6_ff t a_fmovxd a_fmovws 16 x 0 0 0\nif and x eq uchar get ar_m add get ar_rb 99 w 9\nfm = a6_vf t a_fadd4s a_fadd4s\nif eq add d 1 99999\na6_ew a6_vf vt a_dupd a_dups d a 0 0 0\na6_ew a_strd r 31 shr sub get ar_m add get ar_rb 96 w 1 0 0 0\na6_ew a_ldrq 31 31 sub s 700 0 0\na6_fx a_bcond 3 add a_tlab 3\na6_emitw `4177528105`\na6_ew a6_ff t a_ldrdr a_ldrsr d 16 i 0 0\na6_envbr small a_bcond 2\na6_ew a_addx 3 18 3 0 2\na6_ew a_strbr 5 1 0 0 0\n" 125 text tmsg "a64 rgate: fixture\npairs\nsplit\nomc\nexpected\nmutant\ncaught\nMISSED\nPASS\nFAIL\ncannot run step\nfixtures ok\nmutants caught\nngcheck\nmisaligned\nomc-expected\nstdout-same\na64 rgate: ngrun-fixture\nngas\nngrun\nstderr-same\nngrun fixtures ok\na64 rgate: front\nfront-ir\nstderr-ok\nfront cases ok\na64 rgate: front-refused\na64 rgate: front-control (ng: fib40, omc: fib39)\nfront refused ok\nfront control differs\na64 rgate: random seed\nngrand\nrandom seeds ok\na64 rgate: random-control (ng: seed 2, ngrun: seed 1)\nrandom control differs\na64 rgate: refusal-fixture\nrefusal fixtures ok\na64: unsupported 2\nstderr-unsupported\na64 rgate: float edge\nfrand\nfloat edges ok\na64 rgate: float seed\nfloat seeds ok\na64 rgate: float-control (ng: float seed 2, ngrun: float seed 1)\nfloat control differs\n" 126 text tfr "seed/ng/tests/ir/x-bits\nseed/ng/tests/ir/x-conv\nseed/ng/tests/ir/x-divmin\nseed/ng/tests/ir/x-fib\nseed/ng/tests/ir/x-fuel\nseed/ng/tests/ir/x-fuelok\nseed/ng/tests/ir/x-hello\nseed/ng/tests/ir/x-i8\nseed/ng/tests/ir/x-index\nseed/ng/tests/ir/x-indexok\nseed/ng/tests/ir/x-ovf64\nseed/ng/tests/ir/x-ovf64ok\nseed/ng/tests/ir/x-remmin\nseed/ng/tests/ir/x-shift\nseed/ng/front/kernels/arith\nseed/ng/front/kernels/branch\nseed/ng/front/kernels/leafcall\nseed/ng/front/kernels/fib38\nseed/ng/front/kernels/fib40\nseed/ng/front/kernels/isort\nseed/ng/front/kernels/sieve\nseed/ng/front/kernels/sort\nseed/ng/front/kernels/matmul\nseed/ng/tests/ir/x-float\nseed/ng/front/kernels/linear\nseed/omc/tests/pools/g2a\nseed/omc/tests/pools/g2b\nseed/omc/tests/pools/g2c\nseed/omc/tests/pools/g2d\nseed/omc/tests/pools/g3\nseed/omc/tests/pools/g3i\nseed/omc/tests/pools/g4\nseed/omc/tests/pools/g5a\nseed/omc/tests/pools/g5b\nseed/omc/tests/pools/g5c\nseed/omc/tests/pools/g5ctl\nseed/omc/tests/pools/g5d\nseed/omc/tests/pools/g8b\nseed/omc/tests/pools/gf\nseed/omc/tests/pools/gr\nseed/ng/front/cases/pool-widths-order\nseed/ng/a64/tests/front/env-empty\nseed/host/tests/environment\nseed/host/tests/environment_trap\nseed/ng/a64/tests/front/env-slices\nseed/ng/a64/tests/front/env-huge\nseed/ng/a64/tests/front/env-bounds\n" 127 text tfz "" 128 text tfd "seed/ng/front/kernels/fib40\nseed/ng/a64/tests/front/fib39\n" 129 text tdu "seed/ng/a64/tests/oir/u-selslice-true\nseed/ng/a64/tests/oir/u-selslice-false\nseed/ng/a64/tests/oir/u-selslice-apart\nseed/ng/a64/tests/oir/u-selslice-lt\nseed/ng/a64/tests/oir/u-selslice-ne0\nseed/ng/a64/tests/oir/u-selslice-bit\nseed/ng/a64/tests/oir/u-selslice-call\nseed/ng/a64/tests/oir/u-selvec\n" 130 131 const nfx ulong 14 132 const ndx ulong 93 133 const nmut ulong 91 134 const nrd ulong 1000 135 const nfr ulong 47 136 const nenv ulong 5 137 const nfz ulong 0 138 const ndu ulong 8 139 note float phase (step 8): edge programs 1..nfe and seeds 1..nfl of frand; float mutants are those past mfl and run 140 note the edge programs and float seeds 1..nfm as well 141 const nfe ulong 66 142 const nfl ulong 1000 143 const nfm ulong 8 144 const mfl ulong 35 145 146 note Controlled environment for the final nenv front fixtures; no operator environment is copied. 147 text ev_one "OMTEST=hello" 148 text ev_two "OMEGA_ENV_SECOND=two" 149 text ev_three "OMEGA_ENV_EMPTY=" 150 global ev_buf uchar 256 151 global ev_ctl ulong 1 152 global ev_len ulong 1 153 fn envrec p ulong s view uchar * to ulong 154 put ev_buf p uchar len s 155 put ev_buf add p 1 0 156 for i ulong len s 157 put ev_buf add add p 2 i get s i 158 end 159 ret add add p 2 len s 160 end 161 fn envinit to void 162 put ev_buf 0 3 163 put ev_buf 1 0 164 p = envrec 2 ev_one 165 p = envrec p ev_two 166 put ev_len 0 envrec p ev_three 167 end 168 169 note ---- text lines: line k of text t (0 tx, 1 tfx, 2 tmp, 3 tmr, 4 tmsg, 5 tdx, 6 tfr, 7 tfz, 8 tfd, 9 tdu) ---- 170 fn tlen t ulong to ulong 171 if eq t 0 172 ret len tx 173 end 174 if eq t 1 175 ret len tfx 176 end 177 if eq t 2 178 ret len tmp 179 end 180 if eq t 3 181 ret len tmr 182 end 183 if eq t 5 184 ret len tdx 185 end 186 if eq t 6 187 ret len tfr 188 end 189 if eq t 7 190 ret len tfz 191 end 192 if eq t 8 193 ret len tfd 194 end 195 if eq t 9 196 ret len tdu 197 end 198 ret len tmsg 199 end 200 201 fn tch t ulong i ulong to ulong 202 if eq t 0 203 ret ulong get tx i 204 end 205 if eq t 1 206 ret ulong get tfx i 207 end 208 if eq t 2 209 ret ulong get tmp i 210 end 211 if eq t 3 212 ret ulong get tmr i 213 end 214 if eq t 5 215 ret ulong get tdx i 216 end 217 if eq t 6 218 ret ulong get tfr i 219 end 220 if eq t 7 221 ret ulong get tfz i 222 end 223 if eq t 8 224 ret ulong get tfd i 225 end 226 if eq t 9 227 ret ulong get tdu i 228 end 229 ret ulong get tmsg i 230 end 231 232 note tline t k: start of line k of text t (lines end with a newline) 233 fn tline t ulong k ulong to ulong 234 i = ulong 0 235 j = ulong 0 236 while lt j k bound 256 237 while ne tch t i 10 bound 4096 238 i = add i 1 239 end 240 i = add i 1 241 j = add j 1 242 end 243 ret i 244 end 245 246 fn tend t ulong i ulong to ulong 247 e = i 248 while ne tch t e 10 bound 4096 249 e = add e 1 250 end 251 ret e 252 end 253 254 note ---- output ---- 255 fn oput b ulong to void 256 n = get on 0 257 if lt n len ob 258 put ob n uchar b 259 put on 0 add n 1 260 end 261 end 262 263 fn oflush to void 264 n = get on 0 265 p = ulong 0 266 while lt p n bound 65536 267 k = write 1 ob p sub n p 268 if le k 0 269 p = n 270 else 271 p = add p ulong k 272 end 273 end 274 put on 0 0 275 end 276 277 fn otl t ulong k ulong to void 278 i = tline t k 279 e = tend t i 280 while lt i e bound 4096 281 oput tch t i 282 i = add i 1 283 end 284 end 285 286 fn omsg k ulong to void 287 otl 4 k 288 end 289 290 fn odec v ulong to void 291 d = ulong 1 292 while ge div v d 10 bound 20 293 d = mul d 10 294 end 295 x = v 296 while gt d 0 bound 20 297 oput add 48 div x d 298 x = rem x d 299 d = div d 10 300 end 301 end 302 303 fn okv k ulong v ulong to void 304 oput 32 305 omsg k 306 oput 32 307 odec v 308 end 309 310 fn fail k ulong to void 311 omsg 10 312 oput 32 313 odec k 314 oput 10 315 omsg 9 316 oput 10 317 oflush 318 exit 2 319 end 320 321 note ---- paths in pb ---- 322 fn pclr to void 323 put pn 0 0 324 end 325 326 fn pb1 b ulong to void 327 n = get pn 0 328 if ge n len pb 329 fail 0 330 end 331 put pb n uchar b 332 put pn 0 add n 1 333 end 334 335 fn ptl t ulong k ulong to void 336 i = tline t k 337 e = tend t i 338 while lt i e bound 4096 339 pb1 tch t i 340 i = add i 1 341 end 342 end 343 344 fn pset k ulong to void 345 pclr 346 ptl 0 k 347 end 348 349 fn pscr k ulong to void 350 pclr 351 i = ulong 0 352 while lt i get sn 0 bound 1024 353 pb1 ulong get sd i 354 i = add i 1 355 end 356 ptl 0 k 357 end 358 359 note pref f: pb = seed/ng/a64/tests/ref/.om 360 fn pref f ulong to void 361 pset 4 362 ptl 1 f 363 ptl 0 5 364 end 365 366 note failp k: like fail k (a step could not run), with the path in pb after the step number 367 fn failp k ulong to void 368 omsg 10 369 oput 32 370 odec k 371 oput 32 372 i = ulong 0 373 while lt i get pn 0 bound 4096 374 oput ulong get pb i 375 i = add i 1 376 end 377 oput 10 378 omsg 9 379 oput 10 380 oflush 381 exit 2 382 end 383 384 note ---- files ---- 385 fn openr to int 386 r = fopen pb 0 get pn 0 0 0 387 if lt r 0 388 failp 1 389 end 390 ret int r 391 end 392 393 note openw md: create or truncate pb for writing with mode md (O_WRONLY|O_CREAT|O_TRUNC = 577) 394 fn openw md int to int 395 r = fopen pb 0 get pn 0 577 md 396 if lt r 0 397 failp 2 398 end 399 ret int r 400 end 401 402 fn fclo fd int to void 403 r = fclose fd 404 end 405 406 note readin o c: all of file pb into mem at offset o (capacity c bytes); returns the byte count 407 fn readin o ulong c ulong to ulong 408 fd = openr 409 n = ulong 0 410 go = true 411 while go bound `1000000` 412 if ge n c 413 fail 3 414 end 415 k = read fd mem add o n sub c n 416 if lt k 0 417 fail 3 418 end 419 if eq k 0 420 go = false 421 else 422 n = add n ulong k 423 end 424 end 425 fclo fd 426 ret n 427 end 428 429 fn wall fd int o ulong n ulong to void 430 p = ulong 0 431 while lt p n bound `1000000` 432 k = write fd mem add o p sub n p 433 if le k 0 434 fail 4 435 end 436 p = add p ulong k 437 end 438 end 439 440 note wtl fd t k: line k of text t and a newline to fd (staged at mem[rin]) 441 fn wtl fd int t ulong k ulong to void 442 i = tline t k 443 e = tend t i 444 n = ulong 0 445 while le add i n e bound 4096 446 put mem add rin n uchar tch t add i n 447 n = add n 1 448 end 449 wall fd rin n 450 end 451 452 note ---- children: av = u16 count, then per argument u16 length and its bytes ---- 453 fn aclr to void 454 put ap 0 2 455 put ap 1 0 456 end 457 458 fn apb to void 459 n = get pn 0 460 p = get ap 0 461 if gt add add p n 2 len av 462 fail 5 463 end 464 put av p uchar and n 255 465 put av add p 1 uchar shr n 8 466 i = ulong 0 467 while lt i n bound 4096 468 put av add add p 2 i get pb i 469 i = add i 1 470 end 471 put ap 0 add add p 2 n 472 put ap 1 add get ap 1 1 473 end 474 475 fn redir s int d int to void 476 if ne s d 477 if ne dupfd s d 0 long d 478 exit 127 479 end 480 end 481 end 482 483 note spawn fi fo fe: run av with stdin, stdout, stderr fi, fo, fe; returns the exit status, 256 + signal, and kills 484 note the child (status 265) when it runs longer than 30 s 485 fn spawn fi int fo int fe int to ulong 486 put av 0 uchar and get ap 1 255 487 put av 1 uchar shr get ap 1 8 488 pid = fork 489 if lt pid 0 490 fail 6 491 end 492 if eq pid 0 493 redir fi 0 494 redir fo 1 495 redir fe 2 496 if ne get ev_ctl 0 0 497 r = execenv av 0 get ap 0 ev_buf 0 get ev_len 0 498 else 499 r = execprog av 0 get ap 0 500 end 501 exit 127 502 end 503 fclo fi 504 fclo fo 505 fclo fe 506 ret reap pid 507 end 508 509 fn reap pid long to ulong 510 t0 = monons 511 while true bound `1000000` 512 r = waitpid int pid stb 0 len stb 1 513 if eq r pid 514 ret wstat 515 end 516 if ne r 0 517 fail 7 518 end 519 if gt sub monons t0 `30000000000` 520 k = killpid int pid 9 521 end 522 s = sleepns `1000000` 523 end 524 fail 7 525 ret 0 526 end 527 528 fn wstat to ulong 529 sg = and ulong get stb 0 127 530 if ne sg 0 531 ret add 256 sg 532 end 533 ret ulong get stb 1 534 end 535 536 note ---- building ---- 537 note unitpath p q: pb = the path of the ng.units line mem[p, q) (`HEX PATH`, 64 hex digits and one space) 538 fn unitpath p ulong q ulong to void 539 if or le q add p 65 ne get mem add p 64 32 540 fail 17 541 end 542 pclr 543 i = add p 65 544 while lt i q bound 4096 545 pb1 ulong get mem i 546 i = add i 1 547 end 548 end 549 550 fn isa64 to bool 551 i = tline 0 17 552 e = tend 0 i 553 if ne get pn 0 sub e i 554 ret false 555 end 556 j = ulong 0 557 while lt j sub e i bound 64 558 if ne ulong get pb j tch 0 add i j 559 ret false 560 end 561 j = add j 1 562 end 563 ret true 564 end 565 566 note mkmut o n m: replace the one occurrence of mutant line m of tmp in mem[o, o+n) by line m of tmr 567 fn mkmut o ulong n ulong m ulong to void 568 p = tline 2 m 569 pl = sub tend 2 p p 570 r = tline 3 m 571 if ne pl sub tend 3 r r 572 fail 8 573 end 574 hits = ulong 0 575 hit = ulong 0 576 i = o 577 while le add i pl add o n bound `4194304` 578 if samepat i p pl 579 hits = add hits 1 580 hit = i 581 end 582 i = add i 1 583 end 584 if ne hits 1 585 fail 8 586 end 587 j = ulong 0 588 while lt j pl bound 128 589 put mem add hit j uchar tch 3 add r j 590 j = add j 1 591 end 592 end 593 594 fn samepat i ulong p ulong pl ulong to bool 595 j = ulong 0 596 while lt j pl bound 128 597 if ne ulong get mem add i j tch 2 add p j 598 ret false 599 end 600 j = add j 1 601 end 602 ret true 603 end 604 605 note srcng m: the units of ng.units concatenated at mem[0); mutant m (1..) applied to a64.om, 0 none; the length 606 fn srcng m ulong to ulong 607 pset 1 608 nu = readin runit `1048576` 609 s = ulong 0 610 p = runit 611 e = add runit nu 612 hit = ulong 0 613 while lt p e bound 128 614 q = untilnl p e 615 unitpath p q 616 k = readin s sub rir s 617 if and gt m 0 isa64 618 mkmut s k sub m 1 619 hit = add hit 1 620 end 621 s = add s k 622 p = add q 1 623 end 624 if and gt m 0 ne hit 1 625 fail 8 626 end 627 ret s 628 end 629 630 fn untilnl p ulong e ulong to ulong 631 q = p 632 while lt q e bound 4096 633 if eq get mem q 10 634 ret q 635 end 636 q = add q 1 637 end 638 ret q 639 end 640 641 note fail9 r s: step 9 (an omc build) could not run. Prints spawn's status r, the source path (scratch text s) 642 note and the first line of build.err. 127 with an empty build.err: the child could not redirect a descriptor or 643 note exec omc (spawn failed, omc never ran); 265: killed after 30 s; other values above 256: 256 + a signal; 644 note otherwise omc's exit status, with its message in build.err. Opening the files fails earlier (steps 1, 2). 645 text t9m "status\nsource\nbuild.err\nunreadable\n(empty)\n" 646 647 fn o9l k ulong to void 648 i = ulong 0 649 j = ulong 0 650 while lt j k bound 16 651 while ne ulong get t9m i 10 bound 256 652 i = add i 1 653 end 654 i = add i 1 655 j = add j 1 656 end 657 while ne ulong get t9m i 10 bound 256 658 oput ulong get t9m i 659 i = add i 1 660 end 661 end 662 663 fn fail9 r ulong s ulong to void 664 omsg 10 665 oput 32 666 odec 9 667 oput 32 668 o9l 0 669 oput 32 670 odec r 671 oput 32 672 o9l 1 673 oput 32 674 pscr s 675 i = ulong 0 676 while lt i get pn 0 bound 4096 677 oput ulong get pb i 678 i = add i 1 679 end 680 oput 32 681 o9l 2 682 oput 32 683 pscr 20 684 fd = fopen pb 0 get pn 0 0 0 685 if lt fd 0 686 o9l 3 687 else 688 k = read int fd mem rin 4096 689 fclo int fd 690 if le k 0 691 o9l 4 692 else 693 n = ulong k 694 i = ulong 0 695 while and lt i n ne get mem add rin i 10 bound 4096 696 oput ulong get mem add rin i 697 i = add i 1 698 end 699 end 700 end 701 oput 10 702 omsg 9 703 oput 10 704 oflush 705 exit 2 706 end 707 708 note compile mem[0, n) with omc: scratch text s (source) -> scratch text b (binary); omc must succeed 709 fn omcb n ulong s ulong b ulong to void 710 pscr s 711 fd = openw 420 712 wall fd 0 n 713 fclo fd 714 pscr s 715 fi = openr 716 pscr b 717 fo = openw 493 718 pscr 20 719 fe = openw 420 720 aclr 721 pset 0 722 apb 723 r = spawn fi fo fe 724 if ne r 0 725 fail9 r s 726 end 727 end 728 729 fn buildng m ulong to void 730 omcb srcng m 6 7 731 end 732 733 fn buildmk to void 734 pset 2 735 n = readin 0 rir 736 pset 3 737 n = add n readin n sub rir n 738 omcb n 8 9 739 end 740 741 fn buildck to void 742 pset 21 743 n = readin 0 rir 744 pset 22 745 n = add n readin n sub rir n 746 omcb n 23 24 747 end 748 749 note runck: ngcheck.bin < fx.ir; its exit status (0 accept, else the refusal class) 750 fn runck to ulong 751 pscr 11 752 fi = openr 753 pscr 15 754 fo = openw 420 755 pscr 16 756 fe = openw 420 757 aclr 758 pscr 24 759 apb 760 ret spawn fi fo fe 761 end 762 763 note ---- running a fixture ---- 764 note mkfx f: scratch/fx.name = fixture f's name; mkir.bin < fx.name > fx.ir; returns the ΩIR byte count (at rir) 765 fn mkfx f ulong to ulong 766 pscr 10 767 fd = openw 420 768 wtl fd 1 f 769 fclo fd 770 pscr 10 771 fi = openr 772 pscr 11 773 fo = openw 420 774 pscr 16 775 fe = openw 420 776 aclr 777 pscr 9 778 apb 779 if ne spawn fi fo fe 0 780 fail 11 781 end 782 pscr 11 783 ret readin rir `4194304` 784 end 785 786 note runng n md: fx.in = mode line md (18 pairs, 19 split) + the ΩIR at rir (n bytes); ng.bin < fx.in > fx.elf; 787 note returns the program's status, or 1000 + ng's exit status when ng refuses 788 fn runng n ulong md ulong to ulong 789 pscr 12 790 fd = openw 420 791 wtl fd 0 md 792 wall fd rir n 793 fclo fd 794 pscr 12 795 fi = openr 796 pscr 13 797 fo = openw 493 798 pscr 16 799 fe = openw 420 800 aclr 801 pscr 7 802 apb 803 c = spawn fi fo fe 804 if ne c 0 805 ret add 1000 c 806 end 807 ret runbin 13 808 end 809 810 note runbin k: run scratch text k with stdin fx.name, stdout run.out, stderr run.err; its status 811 fn runbin k ulong to ulong 812 pscr 10 813 fi = openr 814 pscr 15 815 fo = openw 420 816 pscr 16 817 fe = openw 420 818 aclr 819 pscr k 820 apb 821 ret spawn fi fo fe 822 end 823 824 fn runref f ulong to ulong 825 pref f 826 n = readin 0 rir 827 omcb n 8 14 828 ret runbin 14 829 end 830 831 note ---- main ---- 832 fn rdscr to void 833 pclr 834 n = read 0 mem rin 4096 835 if le n 0 836 fail 16 837 end 838 i = ulong 0 839 while lt i ulong n bound 4096 840 if eq get mem add rin i 10 841 i = add i 4096 842 else 843 put sd i get mem add rin i 844 i = add i 1 845 end 846 end 847 if ge i 4096 848 i = sub i 4096 849 end 850 if or eq i 0 ge i 1000 851 fail 16 852 end 853 put sn 0 i 854 end 855 856 fn expect f ulong to ulong 857 ret get ex f 858 end 859 860 note blbad: the number of BL instructions in scratch/fx.elf (code from byte 176) whose target is not a multiple of 64 861 fn blbad to ulong 862 pscr 13 863 m = readin relf `2097152` 864 c = ulong 0 865 pc = ulong 176 866 while le add pc 4 m bound 524288 867 w = le32 add relf pc 868 if eq and w 0xfc000000 0x94000000 869 if ne and bltgt pc and w 0x3ffffff 63 0 870 c = add c 1 871 end 872 end 873 pc = add pc 4 874 end 875 ret c 876 end 877 878 fn le32 o ulong to ulong 879 v = ulong get mem o 880 v = or v shl ulong get mem add o 1 8 881 v = or v shl ulong get mem add o 2 16 882 ret or v shl ulong get mem add o 3 24 883 end 884 885 note bltgt pc i: target byte offset of a BL at pc with imm26 i (signed, in words) 886 fn bltgt pc ulong i ulong to ulong 887 if ge i 0x2000000 888 ret sub pc mul 4 sub 0x4000000 i 889 end 890 ret add pc mul 4 i 891 end 892 893 note savout: scratch run.out into mem[runit] (the units region is used only while building ng); its byte count 894 fn savout to ulong 895 pscr 15 896 ret readin runit 983040 897 end 898 899 note saverr: scratch run.err into mem[rerr]; its byte count 900 fn saverr to ulong 901 pscr 16 902 ret readin rerr 65536 903 end 904 905 note samef k b n: scratch text k (read into the staging region mem[rin]) equals the n bytes kept at mem[b] 906 fn samef k ulong b ulong n ulong to bool 907 pscr k 908 m = readin rin `1048576` 909 if ne m n 910 ret false 911 end 912 i = ulong 0 913 while lt i n bound `1048576` 914 if ne get mem add b i get mem add rin i 915 ret false 916 end 917 i = add i 1 918 end 919 ret true 920 end 921 922 note ---- ngrun fixtures: ΩIR text through ngas and ngcheck; ngrun (IR.md s7, the D9 oracle) against both ng forms ---- 923 note pdx t d: pb = the text file of ΩIR text fixture d of list t (5 tdx, 9 tdu: its line and .oir) 924 fn pdx t ulong d ulong to void 925 pclr 926 ptl t d 927 ptl 0 32 928 end 929 930 fn buildas to void 931 pset 25 932 n = readin 0 rir 933 pset 26 934 n = add n readin n sub rir n 935 omcb n 28 29 936 end 937 938 fn buildrun to void 939 pset 2 940 n = readin 0 rir 941 pset 27 942 n = add n readin n sub rir n 943 omcb n 30 31 944 end 945 946 note dxas t d: ngas.bin < fixture d of list t's text > fx.ir; ngas's status 947 fn dxas t ulong d ulong to ulong 948 pdx t d 949 fi = openr 950 pscr 11 951 fo = openw 420 952 pscr 16 953 fe = openw 420 954 aclr 955 pscr 29 956 apb 957 ret spawn fi fo fe 958 end 959 960 note dxir t d: fixture d of list t's ΩIR at rir (its byte count), 0 bytes when ngas refuses; ngas's status in rg[0] 961 fn dxir t ulong d ulong to ulong 962 s = dxas t d 963 put rg 0 s 964 if ne s 0 965 ret 0 966 end 967 pscr 11 968 ret readin rir `4194304` 969 end 970 971 note runrun: ngrun.bin fx.ir with stdin fx.name, stdout run.out, stderr run.err; its status 972 fn runrun to ulong 973 pscr 10 974 fi = openr 975 pscr 15 976 fo = openw 420 977 pscr 16 978 fe = openw 420 979 aclr 980 pscr 31 981 apb 982 pscr 11 983 apb 984 ret spawn fi fo fe 985 end 986 987 note ngrun fixture d: ngas and ngcheck accept it; ngrun's status (kept in dq for the mutants) is a program's (below 988 note 256) and not 125 (an op outside ngrun); both ng forms exit with it and write its stdout and stderr byte for byte; 989 note the `@ng a64` ELF has every BL target aligned to 64 990 fn dxrun d ulong to bool 991 n = dxir 5 d 992 omsg 17 993 oput 32 994 otl 5 d 995 ok = dxcmp n 18 996 put dq d get rg 2 997 ret ok 998 end 999 1000 note refusal fixture u (text tdu): ngas and ngcheck accept it, ngrun runs it (a program's status below 256, not 125); 1001 note both ng forms refuse it with exit 5 and stderr exactly `a64: unsupported 2` (unsupe) 1002 fn durun u ulong to bool 1003 n = dxir 9 u 1004 s = get rg 0 1005 c = runck 1006 q = runrun 1007 a = runng n 18 1008 ea = unsupe 1009 b = runng n 19 1010 eb = unsupe 1011 omsg 35 1012 oput 32 1013 otl 9 u 1014 okv 18 s 1015 okv 13 c 1016 okv 19 q 1017 okv 1 a 1018 okv 2 b 1019 okv 38 bv and ea eb 1020 oput 10 1021 oflush 1022 ok = and and eq s 0 eq c 0 and ne q 125 lt q 256 1023 ret and ok and and eq a 1005 eq b 1005 and ea eb 1024 end 1025 1026 note unsupe: scratch run.err is exactly line 37 of tmsg (`a64: unsupported 2`) and a newline, kept at mem[rerr] 1027 fn unsupe to bool 1028 i = tline 4 37 1029 e = tend 4 i 1030 n = ulong 0 1031 while le add i n e bound 64 1032 put mem add rerr n uchar tch 4 add i n 1033 n = add n 1 1034 end 1035 ret samef 16 rerr n 1036 end 1037 1038 note durefs: refusal fixtures that ng no longer refuses as durun requires (mutants, `@ng a64` only) 1039 fn durefs to ulong 1040 c = ulong 0 1041 u = ulong 0 1042 while lt u ndu bound 16 1043 n = dxir 9 u 1044 a = runng n 18 1045 if or ne a 1005 not unsupe 1046 c = add c 1 1047 end 1048 u = add u 1 1049 end 1050 ret c 1051 end 1052 1053 note dxcmp n k: the ΩIR at rir (n bytes; its producer's status in rg[0], printed under message k) through ngcheck, 1054 note ngrun and both ng forms with dxrun's verdict; prints the rest of the line; ngrun's status in rg[2] 1055 fn dxcmp n ulong k ulong to bool 1056 s = get rg 0 1057 c = runck 1058 q = runrun 1059 put rg 2 q 1060 o1 = savout 1061 e1 = saverr 1062 a = runng n 18 1063 so = samef 15 runit o1 1064 se = samef 16 rerr e1 1065 al = blbad 1066 b = runng n 19 1067 so = and so samef 15 runit o1 1068 se = and se samef 16 rerr e1 1069 dxmsg k s c q a al 1070 okv 2 b 1071 okv 16 bv so 1072 okv 20 bv se 1073 oput 10 1074 oflush 1075 ok = and eq s 0 eq c 0 1076 ok = and ok and ne q 125 lt q 256 1077 ok = and ok and eq a q eq b q 1078 ret and ok and and so se eq al 0 1079 end 1080 1081 fn dxmsg k ulong s ulong c ulong q ulong a ulong al ulong to void 1082 okv k s 1083 okv 13 c 1084 okv 19 q 1085 okv 1 a 1086 okv 14 al 1087 end 1088 1089 fn bv b bool to ulong 1090 if b 1091 ret 1 1092 end 1093 ret 0 1094 end 1095 1096 note fixture f: ngcheck accepts its ΩIR; both ng forms and the omc reference give the expected status, and the 1097 note split and omc stdout equal the pairs stdout; the `@ng a64` ELF has every BL target aligned to 64 1098 fn fxrun f ulong to bool 1099 n = mkfx f 1100 c = runck 1101 a = runng n 18 1102 o1 = savout 1103 al = blbad 1104 b = runng n 19 1105 so = samef 15 runit o1 1106 r = runref f 1107 so = and so samef 15 runit o1 1108 e = expect f 1109 eom = get eo f 1110 omsg 0 1111 oput 32 1112 otl 1 f 1113 okv 13 c 1114 okv 1 a 1115 okv 14 al 1116 okv 2 b 1117 okv 3 r 1118 okv 4 e 1119 okv 15 eom 1120 okv 16 bv so 1121 oput 10 1122 oflush 1123 ok = and eq a e eq b e 1124 ok = and ok and eq r eom so 1125 ret and ok and eq c 0 eq al 0 1126 end 1127 1128 note mutant m (1..): rebuild ng with it; caught when some fixture's `@ng a64` status differs from the expected one 1129 note (mkir fixtures) or from ngrun's (ngrun fixtures), or a BL target is misaligned 1130 note Differential mutants must preserve every observable, not only the low-byte exit status. 1131 fn dxmut n ulong d ulong to bool 1132 q = runrun 1133 o = savout 1134 e = saverr 1135 s = runng n 18 1136 bb = blbad 1137 same = and samef 15 runit o samef 16 rerr e 1138 ret and and eq q get dq d eq s q and eq bb 0 same 1139 end 1140 1141 fn mutrun m ulong to bool 1142 buildng m 1143 c = ulong 0 1144 f = ulong 0 1145 while lt f nfx bound 16 1146 n = mkfx f 1147 s = runng n 18 1148 bb = blbad 1149 if or ne s expect f gt bb 0 1150 c = add c 1 1151 end 1152 f = add f 1 1153 end 1154 d = ulong 0 1155 while lt d ndx bound 128 1156 n = dxir 5 d 1157 if not dxmut n d 1158 c = add c 1 1159 end 1160 d = add d 1 1161 end 1162 c = add c durefs 1163 for j ulong nenv 1164 k = add sub nfr nenv j 1165 if ne frrun 6 k 6 k 22 0 1166 c = add c 1 1167 end 1168 end 1169 if and gt m mfl le m 79 1170 c = add c flmuts 1171 end 1172 omsg 5 1173 oput 32 1174 odec m 1175 oput 32 1176 if gt c 0 1177 omsg 6 1178 else 1179 omsg 7 1180 end 1181 oput 32 1182 odec c 1183 oput 10 1184 oflush 1185 ret gt c 0 1186 end 1187 1188 note ---- front phase: Omega source -> @ng front-ir -> ngcheck -> both a64 forms, against omc on a source ---- 1189 note frsrc t k: line k of text t and ".om" read to mem[0); its byte count 1190 fn frsrc t ulong k ulong to ulong 1191 pclr 1192 ptl t k 1193 ptl 0 5 1194 ret readin 0 rir 1195 end 1196 1197 note frir t k: fx.in = the `@ng front-ir` line and source (t, k); ng.bin < fx.in > fx.ir; ng's status in rg[1]; the 1198 note ΩIR at rir (its byte count; 0 when ng refuses) 1199 fn frir t ulong k ulong to ulong 1200 n = frsrc t k 1201 pscr 12 1202 fd = openw 420 1203 wtl fd 0 33 1204 wall fd 0 n 1205 fclo fd 1206 pscr 12 1207 fi = openr 1208 pscr 11 1209 fo = openw 420 1210 pscr 16 1211 fe = openw 420 1212 aclr 1213 pscr 7 1214 apb 1215 s = spawn fi fo fe 1216 put rg 1 s 1217 if ne s 0 1218 ret 0 1219 end 1220 pscr 11 1221 ret readin rir `4194304` 1222 end 1223 1224 note frref t k: omc builds source (t, k) into ref.bin, which runs (runbin); its status 1225 fn frref t ulong k ulong to ulong 1226 n = frsrc t k 1227 omcb n 8 14 1228 ret runbin 14 1229 end 1230 1231 note tmline b n: mem[b, b + n) is one line of decimal digits (OMC-EFF-2, a bench kernel's elapsed nanoseconds) 1232 fn tmline b ulong n ulong to bool 1233 if lt n 2 1234 ret false 1235 end 1236 if ne get mem add b sub n 1 10 1237 ret false 1238 end 1239 i = ulong 0 1240 while lt i sub n 1 bound 65536 1241 c = ulong get mem add b i 1242 if or lt c 48 gt c 57 1243 ret false 1244 end 1245 i = add i 1 1246 end 1247 ret true 1248 end 1249 1250 note errok e1: scratch run.err equals the e1 bytes kept at mem[rerr], or both are one timing line 1251 fn errok e1 ulong to bool 1252 if samef 16 rerr e1 1253 ret true 1254 end 1255 if not tmline rerr e1 1256 ret false 1257 end 1258 pscr 16 1259 m = readin rin 65536 1260 ret tmline rin m 1261 end 1262 1263 note frrun t k u j h: front-ir of source (t, k) through ngcheck and both a64 forms against omc's build of source 1264 note (u, j); one output line headed by message h. 0 when all agree; 1 when the pipeline is sound (ng exits 0, 1265 note ngcheck accepts, both statuses equal omc's, BL targets aligned) but stdout or stderr differs; 2 otherwise 1266 fn frrun t ulong k ulong u ulong j ulong h ulong to ulong 1267 put ev_ctl 0 0 1268 if and eq t 6 ge k sub nfr nenv 1269 put ev_ctl 0 1 1270 end 1271 put fv 0 frref u j 1272 put fv 1 savout 1273 put fv 2 saverr 1274 frcmp frir t k 1275 frout t k h 1276 put ev_ctl 0 0 1277 ret frverd 1278 end 1279 1280 note frcmp n: the comparisons for the n ΩIR bytes at rir into fv: 3 ng's status, 4 ngcheck's, 5 pairs, 6 split, 1281 note 7 stdout same, 8 stderr same (or both one timing line), 9 misaligned BL targets (omc's status in fv 0, its 1282 note stdout and stderr byte counts in fv 1 and 2) 1283 fn frcmp n ulong to void 1284 s = get rg 1 1285 put fv 3 s 1286 put fv 4 99 1287 put fv 5 9999 1288 put fv 6 9999 1289 put fv 7 0 1290 put fv 8 0 1291 put fv 9 0 1292 if ne s 0 1293 ret 1294 end 1295 put fv 4 runck 1296 put fv 5 runng n 18 1297 so = samef 15 runit get fv 1 1298 se = errok get fv 2 1299 put fv 9 blbad 1300 put fv 6 runng n 19 1301 so = and so samef 15 runit get fv 1 1302 se = and se errok get fv 2 1303 put fv 7 bv so 1304 put fv 8 bv se 1305 end 1306 1307 fn frout t ulong k ulong h ulong to void 1308 omsg h 1309 oput 32 1310 otl t k 1311 okv 23 get fv 3 1312 okv 13 get fv 4 1313 okv 1 get fv 5 1314 okv 14 get fv 9 1315 okv 2 get fv 6 1316 okv 3 get fv 0 1317 okv 16 get fv 7 1318 okv 24 get fv 8 1319 oput 10 1320 oflush 1321 end 1322 1323 fn frverd to ulong 1324 r = get fv 0 1325 ok = and and eq get fv 3 0 eq get fv 4 0 eq get fv 9 0 1326 if not and ok and eq get fv 5 r eq get fv 6 r 1327 ret 2 1328 end 1329 if and eq get fv 7 1 eq get fv 8 1 1330 ret 0 1331 end 1332 ret 1 1333 end 1334 1335 note frzero t k: a float source: front-ir exits 0, ngcheck accepts, both a64 forms refuse (exit 5); one output line 1336 fn frzero t ulong k ulong to bool 1337 n = frir t k 1338 s = get rg 1 1339 c = ulong 99 1340 a = ulong 0 1341 b = ulong 0 1342 if eq s 0 1343 c = runck 1344 a = runng n 18 1345 b = runng n 19 1346 end 1347 omsg 26 1348 oput 32 1349 otl t k 1350 okv 23 s 1351 okv 13 c 1352 okv 1 a 1353 okv 2 b 1354 oput 10 1355 oflush 1356 ret and and eq s 0 eq c 0 and eq a 1005 eq b 1005 1357 end 1358 1359 fn main to int 1360 envinit 1361 rdscr 1362 put ex 0 17 1363 put ex 1 106 1364 put ex 2 198 1365 put ex 3 191 1366 put ex 4 101 1367 put ex 5 245 1368 put ex 6 32 1369 put ex 7 163 1370 put ex 8 103 1371 put ex 9 0 1372 put ex 10 209 1373 put ex 11 0 1374 put ex 12 0 1375 put ex 13 165 1376 f = ulong 0 1377 while lt f nfx bound 16 1378 put eo f get ex f 1379 f = add f 1 1380 end 1381 put eo 6 106 1382 buildmk 1383 buildck 1384 buildng 0 1385 buildas 1386 buildrun 1387 okf = ulong 0 1388 f = ulong 0 1389 while lt f nfx bound 16 1390 if fxrun f 1391 okf = add okf 1 1392 end 1393 f = add f 1 1394 end 1395 okd = ulong 0 1396 d = ulong 0 1397 while lt d ndx bound 128 1398 if dxrun d 1399 okd = add okd 1 1400 end 1401 d = add d 1 1402 end 1403 duphase 1404 frphase 1405 rdphase 1406 flphase 1407 okm = ulong 0 1408 m = ulong 1 1409 while le m nmut bound 128 1410 if mutrun m 1411 okm = add okm 1 1412 end 1413 m = add m 1 1414 end 1415 omsg 11 1416 oput 32 1417 odec okf 1418 oput 47 1419 odec nfx 1420 oput 10 1421 omsg 21 1422 oput 32 1423 odec okd 1424 oput 47 1425 odec ndx 1426 oput 10 1427 put fv 13 bv allsum 1428 omsg 12 1429 oput 32 1430 odec okm 1431 oput 47 1432 odec nmut 1433 oput 10 1434 if and eq get fv 13 1 and and eq okf nfx eq okd ndx eq okm nmut 1435 omsg 8 1436 oput 10 1437 oflush 1438 ret 0 1439 end 1440 omsg 9 1441 oput 10 1442 oflush 1443 ret 1 1444 end 1445 1446 note duphase: the refusal fixtures (durun); the number that pass in du[0] 1447 fn duphase to void 1448 ok = ulong 0 1449 u = ulong 0 1450 while lt u ndu bound 16 1451 if durun u 1452 ok = add ok 1 1453 end 1454 u = add u 1 1455 end 1456 put du 0 ok 1457 end 1458 1459 note dusum: the refusal fixtures' summary line; true when every one was refused as durun requires 1460 fn dusum to bool 1461 omsg 36 1462 oput 32 1463 odec get du 0 1464 oput 47 1465 odec ndu 1466 oput 10 1467 ret eq get du 0 ndu 1468 end 1469 1470 note allsum: the refusal, front, random and float summary lines, in that order; true when all four phases passed 1471 fn allsum to bool 1472 a = dusum 1473 b = frsum 1474 c = rdsum 1475 d = flsum 1476 ret and and a b and c d 1477 end 1478 1479 note frphase: the front phase; front cases ok in fv 10, refused float sources in fv 11, the control (1: the 1480 note fib40 / fib39 comparison is sound and differs) in fv 12 1481 fn frphase to void 1482 okr = ulong 0 1483 k = ulong 0 1484 while lt k nfr bound 64 1485 if eq frrun 6 k 6 k 22 0 1486 okr = add okr 1 1487 end 1488 k = add k 1 1489 end 1490 put fv 10 okr 1491 okz = ulong 0 1492 k = ulong 0 1493 while lt k nfz bound 8 1494 if frzero 7 k 1495 okz = add okz 1 1496 end 1497 k = add k 1 1498 end 1499 put fv 11 okz 1500 put fv 12 bv eq frrun 8 0 8 1 27 1 1501 end 1502 1503 note frsum: the front phase's three summary lines; true when every case agreed, both floats were refused and the 1504 note control differed 1505 fn frsum to bool 1506 omsg 25 1507 oput 32 1508 odec get fv 10 1509 oput 47 1510 odec nfr 1511 oput 10 1512 omsg 28 1513 oput 32 1514 odec get fv 11 1515 oput 47 1516 odec nfz 1517 oput 10 1518 omsg 29 1519 oput 32 1520 odec get fv 12 1521 oput 10 1522 ret and and eq get fv 10 nfr eq get fv 11 nfz eq get fv 12 1 1523 end 1524 1525 note ---- random phase (step 7): ngrand's seeded ΩIR (ng-ir, D9) against ngrun in both ng forms ---- 1526 fn buildrd to void 1527 pset 2 1528 n = readin 0 rir 1529 pset 34 1530 n = add n readin n sub rir n 1531 omcb n 35 36 1532 end 1533 1534 note pdec v: the decimal digits of v appended to pb 1535 fn pdec v ulong to void 1536 d = ulong 1 1537 while ge div v d 10 bound 20 1538 d = mul d 10 1539 end 1540 x = v 1541 while gt d 0 bound 20 1542 pb1 add 48 div x d 1543 x = rem x d 1544 d = div d 10 1545 end 1546 end 1547 1548 note rdir k: ngrand.bin k > fx.ir (stdin fx.name, stderr run.err); ngrand's status in rg[0]; the ΩIR at rir (its 1549 note byte count, 0 when ngrand fails) 1550 fn rdir k ulong to ulong 1551 pscr 10 1552 fi = openr 1553 pscr 11 1554 fo = openw 420 1555 pscr 16 1556 fe = openw 420 1557 aclr 1558 pscr 36 1559 apb 1560 pclr 1561 pdec k 1562 apb 1563 s = spawn fi fo fe 1564 put rg 0 s 1565 if ne s 0 1566 ret 0 1567 end 1568 pscr 11 1569 ret readin rir `4194304` 1570 end 1571 1572 note rdphase: seeds 1..nrd, each with dxrun's verdict (ngrand's status in place of ngas's); the number of seeds that 1573 note pass in fv 14, the control in fv 15 1574 fn rdphase to void 1575 buildrd 1576 ok = ulong 0 1577 k = ulong 1 1578 while le k nrd bound 4096 1579 n = rdir k 1580 omsg 30 1581 oput 32 1582 odec k 1583 if dxcmp n 31 1584 ok = add ok 1 1585 end 1586 k = add k 1 1587 end 1588 put fv 14 ok 1589 put fv 15 bv rdctl 1590 end 1591 1592 note rdctl: the comparison tells programs apart: ngrun's run of seed 1 against the `@ng a64` ELF of seed 2 must be 1593 note sound (ngrand and ngcheck accept both, ngrun's and the ELF's statuses are a program's) and differ in status or 1594 note stdout 1595 fn rdctl to bool 1596 n = rdir 1 1597 s = get rg 0 1598 c = runck 1599 q = runrun 1600 o1 = savout 1601 n = rdir 2 1602 s = or s get rg 0 1603 c = or c runck 1604 a = runng n 18 1605 so = samef 15 runit o1 1606 omsg 33 1607 okv 19 q 1608 okv 1 a 1609 okv 16 bv so 1610 oput 10 1611 oflush 1612 ok = and and eq s 0 eq c 0 and lt q 256 lt a 256 1613 ret and ok or ne a q not so 1614 end 1615 1616 fn rdsum to bool 1617 omsg 32 1618 oput 32 1619 odec get fv 14 1620 oput 47 1621 odec nrd 1622 oput 10 1623 omsg 34 1624 oput 32 1625 odec get fv 15 1626 oput 10 1627 ret and eq get fv 14 nrd eq get fv 15 1 1628 end 1629 1630 note ---- float phase (step 8): frand's edge programs and seeded units against ngrun in both ng forms ---- 1631 fn buildfr to void 1632 pset 37 1633 n = readin 0 rir 1634 omcb n 38 39 1635 end 1636 1637 note flir e k: frand.bin K (e: frand.bin edge K) > fr.oir (stdin fx.name, stderr run.err), then ngas.bin < fr.oir > 1638 note fx.ir; the status of frand, or of ngas when frand exits 0, in rg[0]; the ΩIR at rir (its byte count, 0 when 1639 note either fails) 1640 fn flir e bool k ulong to ulong 1641 pscr 10 1642 fi = openr 1643 pscr 40 1644 fo = openw 420 1645 pscr 16 1646 fe = openw 420 1647 aclr 1648 pscr 39 1649 apb 1650 if e 1651 pset 41 1652 apb 1653 end 1654 pclr 1655 pdec k 1656 apb 1657 s = spawn fi fo fe 1658 put rg 0 s 1659 if ne s 0 1660 ret 0 1661 end 1662 pscr 40 1663 fi = openr 1664 pscr 11 1665 fo = openw 420 1666 pscr 16 1667 fe = openw 420 1668 aclr 1669 pscr 29 1670 apb 1671 s = spawn fi fo fe 1672 put rg 0 s 1673 if ne s 0 1674 ret 0 1675 end 1676 pscr 11 1677 ret readin rir `4194304` 1678 end 1679 1680 note flphase: edge programs 1..nfe and seeds 1..nfl, each with dxcmp's verdict; the edges that pass in fv 16, the 1681 note seeds in fv 17, the control in fv 18 1682 fn flphase to void 1683 buildfr 1684 ok = ulong 0 1685 k = ulong 1 1686 while le k nfe bound 128 1687 n = flir true k 1688 omsg 39 1689 oput 32 1690 odec k 1691 if dxcmp n 40 1692 ok = add ok 1 1693 end 1694 k = add k 1 1695 end 1696 put fv 16 ok 1697 ok = 0 1698 k = ulong 1 1699 while le k nfl bound 4096 1700 n = flir false k 1701 omsg 42 1702 oput 32 1703 odec k 1704 if dxcmp n 40 1705 ok = add ok 1 1706 end 1707 k = add k 1 1708 end 1709 put fv 17 ok 1710 put fv 18 bv flctl 1711 end 1712 1713 note flctl: the comparison tells float programs apart: ngrun's run of float seed 1 against the `@ng a64` ELF of 1714 note float seed 2 must be sound (frand, ngas and ngcheck accept both, both statuses a program's) and differ in status 1715 note or stdout 1716 fn flctl to bool 1717 n = flir false 1 1718 s = get rg 0 1719 c = runck 1720 q = runrun 1721 o1 = savout 1722 n = flir false 2 1723 s = or s get rg 0 1724 c = or c runck 1725 a = runng n 18 1726 so = samef 15 runit o1 1727 omsg 44 1728 okv 19 q 1729 okv 1 a 1730 okv 16 bv so 1731 oput 10 1732 oflush 1733 ok = and and eq s 0 eq c 0 and lt q 256 lt a 256 1734 ret and ok or ne a q not so 1735 end 1736 1737 fn flsum to bool 1738 omsg 41 1739 oput 32 1740 odec get fv 16 1741 oput 47 1742 odec nfe 1743 oput 10 1744 omsg 43 1745 oput 32 1746 odec get fv 17 1747 oput 47 1748 odec nfl 1749 oput 10 1750 omsg 45 1751 oput 32 1752 odec get fv 18 1753 oput 10 1754 ret and and eq get fv 16 nfe eq get fv 17 nfl eq get fv 18 1 1755 end 1756 1757 note flmut n: the ΩIR at rir (n bytes) under a mutant: ngrun runs it and `@ng a64` must give its status, stdout and 1758 note stderr byte for byte with BL targets aligned (dxmut with ngrun rerun, as there is no stored status) 1759 fn flmut n ulong to bool 1760 q = runrun 1761 o = savout 1762 e = saverr 1763 s = runng n 18 1764 bb = blbad 1765 same = and samef 15 runit o samef 16 rerr e 1766 ret and and eq s q eq bb 0 same 1767 end 1768 1769 note flmuts: the float programs (edges 1..nfe, seeds 1..nfm) that a float mutant changes; a program frand or ngas 1770 note does not give is step 18 (the float phase already passed them unmutated) 1771 fn flmuts to ulong 1772 c = ulong 0 1773 k = ulong 1 1774 while le k add nfe nfm bound 128 1775 n = ulong 0 1776 if le k nfe 1777 n = flir true k 1778 else 1779 n = flir false sub k nfe 1780 end 1781 if eq n 0 1782 fail 18 1783 end 1784 if not flmut n 1785 c = add c 1 1786 end 1787 k = add k 1 1788 end 1789 ret c 1790 end