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 / IR-BOOL-20261026 / gate5-scratch.sh
| 1 | #!/bin/sh |
| 2 | # gate5.sh -- the checks of rung 5, omc (seed/README.md). Run from the repo root: sh seed/omc/gate5.sh |
| 3 | # Needs seed/rung4/om4.bin (rung 4) and what gate4 needs: build/omegese/omegese and build/omega_emit/omega_emit |
| 4 | # (the C path), cc for the reference runner, gcc for the C twins. Oracles only, named where used: none of them |
| 5 | # writes a byte of seed/; omc is built by om4 and then by itself. Results: evidence/SEED-0/omc/. |
| 6 | set -eu |
| 7 | R=seed/omc; R4=seed/rung4; B=build/seed/r5; E=build/seed/wasm/gate5-evidence |
| 8 | TAB="seed/rung2/table.s2 seed/rung3/table3.s2 $R4/table4.s2" |
| 9 | mkdir -p "$B" "$E" |
| 10 | fail=0; cases=0 |
| 11 | say() { printf '%s\n' "$*" | tee -a "$E/gate5.log"; } |
| 12 | bad() { say "FAIL: $*"; fail=1; } |
| 13 | : > "$E/gate5.log" |
| 14 | say "gate5 $(date -u +%FT%TZ) at $(git rev-parse HEAD)" |
| 15 | sha() { sha256sum "$1" | cut -d' ' -f1; } |
| 16 | |
| 17 | # fix: stage1 = om4(src); stage2 = stage1(src); stage3 = stage2(src), in directory $1 (any stage may fail) |
| 18 | fix() { # dir src compiler |
| 19 | rm -f $1/stage1 $1/stage2 $1/stage3 |
| 20 | $3 < $2 > $1/stage1 2> $1/err1 && chmod +x $1/stage1 && |
| 21 | ./$1/stage1 < $2 > $1/stage2 2> $1/err2 && chmod +x $1/stage2 && |
| 22 | ./$1/stage2 < $2 > $1/stage3 2> $1/err3 && chmod +x $1/stage3 |
| 23 | } |
| 24 | |
| 25 | # 1. (a) fixpoint |
| 26 | mkdir -p $B/fix; fix $B/fix $R/omc.om $R4/om4.bin || bad "a stage did not build: $(cat $B/fix/err* )" |
| 27 | s1=$(sha $B/fix/stage1); s2=$(sha $B/fix/stage2); s3=$(sha $B/fix/stage3) |
| 28 | say "stage1 = om4(omc.om) $s1" |
| 29 | say "stage2 = stage1(omc.om) $s2" |
| 30 | say "stage3 = stage2(omc.om) $s3" |
| 31 | [ "$s2" = "$s3" ] && say "PASS (a) fixpoint: sha256(stage2) = sha256(stage3)" || bad "(a) stage2 != stage3" |
| 32 | cases=$((cases + 1)) |
| 33 | S=$B/fix/stage2 |
| 34 | |
| 35 | # 2. (b) the second route. The C path (omegese + omega_emit, an oracle) cannot express omc.om; its own refusal |
| 36 | # and the probes below say what is missing. So the fallback, which is not independent of this author's |
| 37 | # design: two different compilers of omc.om, om4 (asm2 language) and stage1 (omc, Omegese), and the stage |
| 38 | # each one's output builds from omc.om must be the same bytes. |
| 39 | build/omegese/omegese emit $R/omc.om $B/omc.json > $B/cpath.out 2>&1 || true |
| 40 | say "C path on omc.om: $(head -1 $B/cpath.out)" |
| 41 | probe() { # what must-name text: refused, and the refusal names what is missing |
| 42 | printf '%b' "$3" > $B/probe.om |
| 43 | m=$(build/omegese/omegese emit $B/probe.om $B/probe.json 2>&1 | head -1) |
| 44 | case "$m" in REFUSED*"$2"*) say " C path lacks $1: $m";; *) bad "C path probe for $1 changed: $m (rethink (b))";; esac |
| 45 | } |
| 46 | probe "global pools" "'global'" 'global g uchar 4\nfn f a ulong to ulong\nret a\nend\n' |
| 47 | probe "a self-call" "cannot call itself" 'fn f a ulong to ulong\nif eq a 0\nret 0\nend\nret f sub a 1\nend\n' |
| 48 | probe "arrays over 64 cells" "must be 1..64" 'fn f a ulong to ulong\nx = new uchar 100 0\nret a\nend\n' |
| 49 | probe "text literals" "character '\"'" 'text t "ab"\nfn f a ulong to ulong\nret a\nend\n' |
| 50 | probe "read" "'read' is not a name" 'fn f a ulong to ulong\nx = new uchar 4 0\nn = read int 0 x ulong 0 ulong 4\nret a\nend\n' |
| 51 | probe "write" "'write' is not a name" 'fn f a ulong to ulong\nx = new uchar 4 0\nn = write int 1 x ulong 0 ulong 4\nret a\nend\n' |
| 52 | probe "exit (it reads exit as a new name)" "'exit' is written but never read" 'fn f a ulong to ulong\nexit int 3\nret a\nend\n' |
| 53 | probe "a colon in a note" "character ':'" 'note a: b\nfn f a ulong to ulong\nret a\nend\n' |
| 54 | say " (and it writes .oscir for a runner, not a program that reads stdin and writes stdout)" |
| 55 | cmp -s $B/fix/stage1 $B/fix/stage2 && say "PASS (b) om4 and omc build the same omc from omc.om (stage1 = stage2)" || bad "(b) stage1 != stage2" |
| 56 | cmp -s $B/fix/stage2 $B/fix/stage3 && say "PASS (b) the stage from each parent is bit-identical (om4-built -> stage2, omc-built -> stage3)" || bad "(b) stage2 != stage3" |
| 57 | cases=$((cases + 2)) |
| 58 | |
| 59 | # 3. every input gate4 gives om4, plus every .om / .omegese file in the repo and omc.om: om4 and stage2 |
| 60 | # give the same output bytes, exit status and error number (and line); gate4 is run with om4 wrapped |
| 61 | # so each input is kept (gate4's own results go to $B, not to evidence/) |
| 62 | CODES=""; C=$B/corpus; for d in "$C" "$B/g4cap" "$B/g4cape"; do if test -d "$d"; then find "$d" -depth -delete; fi; done; mkdir -p "$C" |
| 63 | cat > $B/cap.sh << EOF |
| 64 | #!/bin/sh |
| 65 | n=\$(ls $C | wc -l); f=$C/\$(printf '%04d' \$n).in; cat > \$f; exec $R4/om4.bin < \$f |
| 66 | EOF |
| 67 | chmod +x $B/cap.sh |
| 68 | g4() { # compiler build-dir evidence-dir -> gate4 with the compiler in om4's place |
| 69 | sed -e "s|^R=seed/rung4; B=build/seed/r4; E=evidence/SEED-0/rung4|R=seed/rung4; B=$2; E=$3|" \ |
| 70 | -e "s#\\\$R/om4\\.bin < #$1 < #g" -e "s#| \\\$R/om4\\.bin #| $1 #g" $R4/gate4.sh > $2.sh |
| 71 | [ "$(grep -c "$1" $2.sh)" = 5 ] || { bad "gate4 changed shape: the compiler is not in its 5 places"; return 1; } |
| 72 | NF_N=0 sh $2.sh > $2.out 2>&1 && tail -1 $2.out | grep -q "^GATE4 PASS$" # section 10 (next fuzz of om4 alone) is run by gate4 itself |
| 73 | } |
| 74 | g4 $B/cap.sh $B/g4cap $B/g4cape || bad "gate4 (capturing) did not pass: $(grep FAIL $B/g4cap.out | head -3)" |
| 75 | for f in $(find $R4/tests tests/one_layer/omegese tools/exp445/arms/examples -name '*.om' -o -name '*.omegese' | sort) $R/omc.om; do |
| 76 | cp $f $C/$(printf '%04d' $(ls $C | wc -l)).in |
| 77 | done |
| 78 | # om4 = stage2 on every input, or the input is a row of $R/tests/om4-superset.tsv: a program using words omc |
| 79 | # added beyond om4 (OMEGESE.md section 9), listed by the sha256 of its text with om4's refusal and omc's exit; |
| 80 | # the C path (the language oracle) must accept it. An unlisted difference, a listed row that no longer differs, |
| 81 | # a listed row the corpus does not reach, or a listed program the C path refuses is a FAIL. |
| 82 | X=$R/tests/om4-superset.tsv; same=0; ext=0; n=0; seen="" |
| 83 | for f in $C/*.in; do n=$((n + 1)) |
| 84 | set +e; $R4/om4.bin < $f > $B/c.a 2> $B/c.ae; ra=$?; $S < $f > $B/c.b 2> $B/c.be; rb=$?; set -e |
| 85 | CODES="$CODES $ra" |
| 86 | sed -i 's/^om4:/X:/' $B/c.ae; sed -i 's/^omc:/X:/' $B/c.be |
| 87 | h=$(sha $f); row=$(grep "^$h[[:space:]]" $X || true) |
| 88 | if [ $ra = $rb ] && cmp -s $B/c.a $B/c.b && cmp -s $B/c.ae $B/c.be; then same=$((same + 1)) |
| 89 | [ -z "$row" ] || bad "om4-superset row $(echo "$row" | cut -f2) no longer differs from om4: drop the row" |
| 90 | elif [ -z "$row" ]; then bad "corpus $(basename $f): om4 exit $ra $(cat $B/c.ae), stage2 exit $rb $(cat $B/c.be)" |
| 91 | else seen="$seen $h"; src=$(echo "$row" | cut -f2); xa=$(echo "$row" | cut -f4); xe=$(echo "$row" | cut -f5); xb=$(echo "$row" | cut -f6) |
| 92 | if [ $ra = $xa ] && [ "$(cat $B/c.ae)" = "X: $xe" ] && [ $rb = $xb ] && [ -s $B/c.b ] && [ ! -s $B/c.be ] && build/omegese/omegese emit $f $B/c.json > /dev/null 2>&1 |
| 93 | then ext=$((ext + 1)); say " beyond om4: $src ($(echo "$row" | cut -f3)): om4 $xe, omc exit $xb, the C path accepts it" |
| 94 | else bad "om4-superset $src: om4 exit $ra $(cat $B/c.ae) (row: $xa $xe), stage2 exit $rb $(cat $B/c.be) (row: $xb), C path: $(build/omegese/omegese emit $f $B/c.json 2>&1 | head -1)"; fi |
| 95 | fi |
| 96 | done |
| 97 | for h in $(grep -v '^#' $X | tail -n +2 | cut -f1); do case "$seen" in *" $h"*) ;; *) bad "om4-superset row $h is not in the corpus: stale row";; esac; done |
| 98 | refused=$(for f in $C/*.in; do $R4/om4.bin < $f > /dev/null 2>&1 || echo x; done | wc -l) |
| 99 | [ $((same + ext)) = $n ] && say "PASS corpus: om4 = stage2 on $same inputs ($refused of them refused, same error number and line); $ext inputs beyond om4 are listed in seed/omc/tests/om4-superset.tsv, each accepted by omc and the C path" |
| 100 | cases=$((cases + n)) |
| 101 | |
| 102 | # 3b. what the corpus does not reach. A program that writes a text with every escape, checked against fixed |
| 103 | # bytes and a fixed exit value (97 + 9 + 98, worked by hand), not only against om4. One input for each |
| 104 | # error number the corpus and the fuzz do not reach: 1 (stdin is a folder), 2 (stdout is full), 4, 11, |
| 105 | # 12, 13, 14 (input over 8 MiB); om4 and stage2 must both give it, with the same message |
| 106 | for c in om4:$R4/om4.bin stage2:$S; do n=${c%%:*}; cc=${c#*:} |
| 107 | $cc < $R/tests/text.om > $B/text.$n; chmod +x $B/text.$n |
| 108 | set +e; ./$B/text.$n > $B/text.$n.out; rc=$?; set -e |
| 109 | [ $rc = $(cat $R/tests/text.want) ] && cmp -s $B/text.$n.out $R/tests/text.out && say "PASS text program built by $n: writes its 9 bytes, exit $rc" || bad "text program built by $n: exit $rc" |
| 110 | done |
| 111 | cmp -s $B/text.om4 $B/text.stage2 && say "PASS text program: om4 and stage2 make the same bytes" || bad "text program: om4 and stage2 differ" |
| 112 | ecase() { # error input stdout |
| 113 | set +e; $R4/om4.bin < $2 > $3 2> $B/e.a; ra=$?; $S < $2 > $3 2> $B/e.b; rb=$?; set -e |
| 114 | sed -i 's/^om[4c]:/X:/' $B/e.a $B/e.b |
| 115 | [ $ra = $1 ] && [ $rb = $1 ] && cmp -s $B/e.a $B/e.b && say "PASS error $1 from both:$(sed 's/^X://' $B/e.a)" || bad "error $1: om4 exit $ra, stage2 exit $rb" |
| 116 | CODES="$CODES $ra" |
| 117 | } |
| 118 | printf 'fn f a uint to uint\nret a\nend\n' > $B/ok.om; ecase 1 / $B/e.out; ecase 2 $B/ok.om /dev/full |
| 119 | printf 'fn f to uint\nret add\nend\n' > $B/e4.om; ecase 4 $B/e4.om $B/e.out |
| 120 | printf 'fn f to uint\nret add 1 2\nend\n' > $B/e11.om; ecase 11 $B/e11.om $B/e.out |
| 121 | { echo 'fn f to uint'; for i in $(seq 1 17); do echo "v$i = uint $i"; done; echo 'ret 0'; echo 'end'; } > $B/e12.om; ecase 12 $B/e12.om $B/e.out |
| 122 | printf 'fn f to uint\nabcdefghi = uint 1\nret 0\nend\n' > $B/e13.om; ecase 13 $B/e13.om $B/e.out |
| 123 | yes 'note filler' | head -c 9000000 > $B/e14.om; ecase 14 $B/e14.om $B/e.out |
| 124 | cases=$((cases + 10)) |
| 125 | |
| 126 | # 4. (c) gate4 with stage2 in om4's place: the 10 dev tasks and 9 function-mode tests against the C path |
| 127 | # on the reference runner (raw x0, traps), the program-mode tests against gcc twins and their exits, |
| 128 | # every refusal number |
| 129 | g4ok=1; g4 $S $B/g4omc $B/g4omce || g4ok=0 |
| 130 | if [ $g4ok = 0 ] || grep -q "^FAIL" $B/g4omc.out; then bad "(c) gate4 with stage2: $(grep FAIL $B/g4omc.out | head -3)" |
| 131 | else say "PASS (c) gate4 with stage2 in om4's place: $(grep -c '^PASS' $B/g4omc.out) checks, 0 FAIL"; fi |
| 132 | cp $B/g4omce/words.tsv $E/corpus-words.tsv |
| 133 | sed 's/om4_words/omc_words/' $E/corpus-words.tsv > $B/t && mv $B/t $E/corpus-words.tsv |
| 134 | say "(c) table: evidence/SEED-0/omc/corpus-words.tsv"; cat $E/corpus-words.tsv >> "$E/gate5.log" |
| 135 | cases=$((cases + 1)) |
| 136 | |
| 137 | # 5. (d) negative controls |
| 138 | # A: a one-word mutation omc itself uses (or compiled as and): the fixpoint must break, and the corpus |
| 139 | mk() { sed "$1" $R/omc.om > $2; cmp -s $2 $R/omc.om && { bad "mutation did nothing: $1"; return 1; }; return 0; } |
| 140 | diffs() { # compiler -> how many corpus inputs differ from om4 (by output, exit or error) |
| 141 | k=0; for f in $C/*.in; do |
| 142 | set +e; $R4/om4.bin < $f > $B/d.a 2>&1; ra=$?; timeout 10 $1 < $f > $B/d.b 2>&1; rb=$?; set -e |
| 143 | sed -i 's/^om[4c]:/X:/' $B/d.a $B/d.b |
| 144 | { [ $ra = $rb ] && cmp -s $B/d.a $B/d.b; } || k=$((k + 1)); done; echo $k; } |
| 145 | mkdir -p $B/ma; mk 's/^if eq op 39$/if eq op 40/' $B/ma/omc.om |
| 146 | if fix $B/ma $B/ma/omc.om $R4/om4.bin && cmp -s $B/ma/stage2 $B/ma/stage3; then bad "(d) A: fixpoint kept" |
| 147 | else say "PASS (d) A caught by the fixpoint: or -> and in omc.om (a stage failed, or stage2 != stage3)"; fi |
| 148 | k=$(diffs $B/ma/stage1); [ $k -gt 0 ] && say "PASS (d) A caught by the corpus: $k inputs differ from om4" || bad "(d) A: corpus blind" |
| 149 | # B: a one-word mutation omc does not use (signed div compiled as unsigned): the fixpoint stays, the |
| 150 | # corpus catches it |
| 151 | mkdir -p $B/mb; mk 's/^bo_w3 2596277248 rd ra rb 0$/bo_w3 2596276224 rd ra rb 0/' $B/mb/omc.om |
| 152 | fix $B/mb $B/mb/omc.om $R4/om4.bin && cmp -s $B/mb/stage2 $B/mb/stage3 && say "PASS (d) B keeps the fixpoint (a fixpoint proves determinism, not correctness)" || bad "(d) B: fixpoint broke" |
| 153 | k=$(diffs $B/mb/stage2); [ $k -gt 0 ] && say "PASS (d) B caught by the corpus: $k inputs differ from om4" || bad "(d) B: corpus blind" |
| 154 | # C: the same wrong word in om4.s and omc.om (signed div as unsigned): fixpoint and om4 = omc both stay; |
| 155 | # only the C path oracle catches it (fm2: -7 / 2) |
| 156 | mkdir -p $B/mc; mk 's/^bo_w3 2596277248 rd ra rb 0$/bo_w3 2596276224 rd ra rb 0/; s/^e3 2596277248 t ra rb$/e3 2596276224 t ra rb/' $B/mc/omc.om |
| 157 | sed 's/^ movz.x x0 0x0c00 0$/ movz.x x0 0x0800 0/' $R4/om4.s > $B/mc/om4.s |
| 158 | cat $TAB $B/mc/om4.s | seed/rung2/asm2.bin > $B/mc/om4.bin; chmod +x $B/mc/om4.bin |
| 159 | fix $B/mc $B/mc/omc.om $B/mc/om4.bin && cmp -s $B/mc/stage2 $B/mc/stage3 && say "PASS (d) C keeps the fixpoint" || bad "(d) C: fixpoint broke" |
| 160 | sed '/^free /d' $R4/tests/fm2.omegese > $B/mc/fm2.om |
| 161 | $B/mc/om4.bin < $B/mc/fm2.om > $B/mc/fm2.a; ./$B/mc/stage2 < $B/mc/fm2.om > $B/mc/fm2.b |
| 162 | cmp -s $B/mc/fm2.a $B/mc/fm2.b && say "PASS (d) C keeps om4 = omc on fm2" || bad "(d) C: om4' != omc' on fm2" |
| 163 | g4 $B/mc/stage2 $B/g4mc $B/g4mce || true |
| 164 | if ! grep -q "^FAIL: fm2 differs from the C path$" $B/g4mc.out; then bad "(d) C: the C path comparison of fm2 did not catch it" |
| 165 | else say "PASS (d) C caught only by the C path: $(grep '^FAIL' $B/g4mc.out | head -2 | tr '\n' ' ')"; fi |
| 166 | # D: a malformed program is refused with an error number |
| 167 | printf 'fn f a uint to uint\nret add a q\nend\n' > $B/bad.om |
| 168 | set +e; $S < $B/bad.om > /dev/null 2> $B/bad.err; rc=$?; set -e |
| 169 | [ $rc = 3 ] && grep -q '^omc: line 2: error 3$' $B/bad.err && say "PASS (d) refusal: $(cat $B/bad.err), exit 3" || bad "(d) refusal: exit $rc $(cat $B/bad.err)" |
| 170 | cases=$((cases + 7)) |
| 171 | |
| 172 | # 6. output does not depend on addresses or time: stage2 run twice, with a different environment size (so |
| 173 | # a different stack address) and a second later, gives the same bytes |
| 174 | env -i X=$(printf '%0999d' 0) $S < $R/omc.om > $B/det1; sleep 1; $S < $R/omc.om > $B/det2 |
| 175 | cmp -s $B/det1 $B/det2 && cmp -s $B/det1 $S && say "PASS deterministic: same bytes under another environment and a second later" || bad "output depends on the run" |
| 176 | cases=$((cases + 1)) |
| 177 | |
| 178 | # 6b. decision 22 for omc: the next-word fuzz (seed/check/nextfuzz.sh) with om4 as the reference and |
| 179 | # stage2 as the other: every generated program, every cut and every changed word gives the same bytes, |
| 180 | # exit status and error number from both, and neither crashes |
| 181 | if NFW=$B/nextfuzz sh seed/check/nextfuzz.sh 20 $R4/om4.bin $S > $B/nextfuzz.out 2>&1; then say "PASS om4 = stage2 in the $(tail -1 $B/nextfuzz.out)" |
| 182 | else bad "next fuzz: $(grep -v '^nextfuzz:' $B/nextfuzz.out | head -3) $(tail -1 $B/nextfuzz.out)"; fi |
| 183 | cases=$((cases + 1)) |
| 184 | # every error number 1..23 is reached somewhere above (corpus, the cases of 3b, the fuzz), with om4 = stage2 |
| 185 | miss=""; all=" $CODES $(sed 's/:[0-9]*//g' $B/nextfuzz/codes 2>/dev/null) " |
| 186 | for e in $(seq 1 23); do case "$all" in *" $e "*) ;; *) miss="$miss $e";; esac; done |
| 187 | [ -z "$miss" ] && say "PASS every error number 1..23 is reached, om4 = stage2 on each" || bad "error numbers never reached:$miss" |
| 188 | cases=$((cases + 1)) |
| 189 | |
| 190 | # 7. sizes and speed. omc's size at this self-rewrite; words per function of omc (from compiling each prefix |
| 191 | # of omc.om with a 2-word main appended); compile time of stage2 against the C path on the dev tasks |
| 192 | lines=$(wc -l < $R/omc.om); nfn=$(grep -c '^fn ' $R/omc.om); bytes=$(stat -c %s $S) |
| 193 | printf 'rewrite\tbuilt_by\tsource_lines\tfunctions\tbytes\twords\tsha256\n' > $E/size.tsv |
| 194 | for st in 1 2 3; do by=om4; [ $st -gt 1 ] && by=stage$((st - 1)) |
| 195 | printf 'stage%s\t%s\t%s\t%s\t%s\t%s\t%s\n' $st $by $lines $nfn $(stat -c %s $B/fix/stage$st) $(( ($(stat -c %s $B/fix/stage$st) - 176) / 4 )) $(sha $B/fix/stage$st) >> $E/size.tsv |
| 196 | done |
| 197 | say "omc: $lines lines, $nfn functions, $bytes bytes = 176-byte header + $(( (bytes - 176) / 4 )) words (evidence/SEED-0/omc/size.tsv)" |
| 198 | # size-history.tsv is kept by hand, one row per self-rewrite; its last row must be this build |
| 199 | tail -1 $E/size-history.tsv | grep -q " $(sha $S)\$" && say "PASS size history: its last row is this omc ($(tail -1 $E/size-history.tsv | cut -f1))" || bad "size-history.tsv has no row for this omc: add one" |
| 200 | printf 'fn main to int\nret 0\nend\n' > $B/m.om; printf 'fn zz to int\nret 0\nend\nfn main to int\nret 0\nend\n' > $B/zm.om |
| 201 | dm=$(( ($(./$S < $B/zm.om | wc -c) - $(./$S < $B/m.om | wc -c)) / 4 )) |
| 202 | awk '/^fn /{d=1; name=$2; next} d>0 && /^(if|while|for) /{d++} d>0 && /^end$/{d--; if(d==0) print NR, name}' $R/omc.om > $B/fnends |
| 203 | printf 'function\twords\n' > $E/omc-words.tsv; prev=$(./$S < $B/m.om | wc -c); start=1 |
| 204 | while read end name; do |
| 205 | if [ "$name" = main ]; then sz=$(./$S < $R/omc.om | wc -c); w=$(( (sz - prev) / 4 + dm )) |
| 206 | else sz=$(sed -n "1,${end}p" $R/omc.om | cat - $B/m.om | ./$S | wc -c); w=$(( (sz - prev) / 4 )); fi |
| 207 | printf '%s\t%s\n' $name $w >> $E/omc-words.tsv; prev=$sz |
| 208 | done < $B/fnends |
| 209 | tw=$(awk 'NR>1{s+=$2} END{print s}' $E/omc-words.tsv) |
| 210 | say "omc words per function: evidence/SEED-0/omc/omc-words.tsv ($nfn functions, $tw words in all, mean $((tw / nfn)))" |
| 211 | ns() { date +%s%N; } |
| 212 | N=200; printf 'program\tomc_us\tc_path_us\n' > $E/compile-time.tsv |
| 213 | for d in $(ls tests/one_layer/omegese/dev/dev*.omegese $R4/tests/fm*.omegese); do p=$(basename $d .omegese) |
| 214 | sed '/^free /d' $d > $B/t.om |
| 215 | t0=$(ns); i=0; while [ $i -lt $N ]; do $S < $B/t.om > /dev/null; i=$((i + 1)); done; t1=$(ns) |
| 216 | i=0; while [ $i -lt $N ]; do build/omegese/omegese emit $d $B/t.json > /dev/null |
| 217 | build/omega_emit/omega_emit emit $B/t.json $B/t.oscir > /dev/null; i=$((i + 1)); done; t2=$(ns) |
| 218 | printf '%s\t%s\t%s\n' $p $(( (t1 - t0) / N / 1000 )) $(( (t2 - t1) / N / 1000 )) >> $E/compile-time.tsv |
| 219 | done |
| 220 | N=20; t0=$(ns); i=0; while [ $i -lt $N ]; do $S < $R/omc.om > /dev/null; i=$((i + 1)); done; t1=$(ns) |
| 221 | say "compile time per program (10 dev tasks, 9 fm), microseconds, 200 runs each, process start included (evidence/SEED-0/omc/compile-time.tsv); omc compiling itself: $(( (t1 - t0) / N / 1000 )) us" |
| 222 | cat $E/compile-time.tsv $E/size.tsv >> "$E/gate5.log" |
| 223 | |
| 224 | cp $S $E/omc.elf; sha $S > $E/omc.sha256 |
| 225 | say "cases run: $cases" |
| 226 | [ $fail = 0 ] && say "GATE5 PASS" || say "GATE5 FAIL" |
| 227 | exit $fail |