aboutsummaryrefslogtreecommitdiffstats
path: root/research/experiments/045-proof-compiler/variants
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-19 12:06:33 +0100
committereunhhu <[email protected]>2026-10-19 12:06:33 +0100
commitbbe04c13e58f884d25a933b785b052558c66118b (patch)
tree47320a5304f297c3bb31da6782a870900d934866 /research/experiments/045-proof-compiler/variants
parent3b127e6193026188939f0c8b06fb769518deaef5 (diff)
downloadpure-bbe04c13e58f884d25a933b785b052558c66118b.tar.gz
pure-bbe04c13e58f884d25a933b785b052558c66118b.zip
045: where the machine instructions go, by mechanism (where.c samples the address every 100,003 user instructions from perf_event_open's ring, the answers checked first; where.py names each by addr2line's inlined chain: the step() case its line is in, or the function outside): the app's 40,236 a code point are dispatch 30.6% (the switch and run_calls' loop), lists built 17.3%, numbers 13.5%, lists read 13.0%, moves 9.0%, calls 7.1%, malloc 4.0%; no mechanism near most; range()'s binary search alone 14,489 a point (36%, variant v0r): 11.4 rounds of about 1,270, of which floor division with fmod 186 and a stored read 240
Diffstat (limited to 'research/experiments/045-proof-compiler/variants')
-rw-r--r--research/experiments/045-proof-compiler/variants/v0r-range.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/research/experiments/045-proof-compiler/variants/v0r-range.patch b/research/experiments/045-proof-compiler/variants/v0r-range.patch
new file mode 100644
index 0000000..79b0636
--- /dev/null
+++ b/research/experiments/045-proof-compiler/variants/v0r-range.patch
@@ -0,0 +1,36 @@
+--- linebreak.aup
++++ v0r-range.aup
+@@ -153,30 +153,8 @@
+ }
+
+ on line {
+- let codes, cls, eff, start, nonspace, ri, at: list of number
+- let joined, numeric: list of bool
+- for p in line.points {
+- let i = codes.count
+- let r = range(p.code)
+- let c = ranges[r].class
+- let mark = c == CM || c == ZWJ
+- let previous = if i > 0 { eff[i - 1] } else { SP }
+- let joins = mark && i > 0 && !end(previous) && previous != SP && previous != ZW # LB9, LB10
+- let e = if joins { previous } else if mark { AL } else { c }
+- codes.append(p.code)
+- cls.append(c)
+- at.append(r)
+- joined.append(joins)
+- eff.append(e)
+- start.append(if joins { start[i - 1] } else { i })
+- nonspace.append(if e != SP { start[i] } else if i > 0 { nonspace[i - 1] } else { -1 })
+- numeric.append(if joins { numeric[i - 1] } else { e == NU || ((e == SY || e == IS) && i > 0 && numeric[i - 1]) })
+- ri.append(if joins { ri[i - 1] } else if e == RI { (if i > 0 { ri[i - 1] } else { 0 }) + 1 } else { 0 })
+- }
+- let t = Text { codes: codes, cls: cls, eff: eff, joined: joined, start: start, nonspace: nonspace, numeric: numeric, ri: ri,
+- at: at }
+- let out: list of i64 = [0] # LB2
+- for i in 1 .. codes.count { out.append(i64(decide(t, i))) }
+- if codes.count > 0 { out.append(2) } # LB3
++ let s = 0
++ for p in line.points { s = s + range(p.code) }
++ let out: list of i64 = [i64(s % 2)]
+ breaks = bytes(out)
+ }