code wiki / _hdl_build / nx_js_octane_next_run.nx
nx_js_octane_next_run.nx source
↩ module page · 44 lines · 3135 B
1// nx_js_octane_next_run.nx -- attempt to RUN the three staged next-Octane benchmarks (all 3/3 parse-clean).
2// Today: expected PARTIAL (runtime-native gaps queued in coordination.tsv); flips GREEN per-test as natives
3// land. Self-validation is internal to each benchmark (throws on wrong results), so rc=0 + the OK string is
4// a full correctness proof. V8 pins (warmed): DeltaBlue 4852us / RayTrace 10274us / Crypto 13085us.
5// expect_exit: 0 (diagnostic until all three pass) license_tier: ORIGINAL
6import "nx_js_vm.nx"
7const K_MAGIC_262144: i64 = 262144
8func w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
9func nn(v: i64) -> i64 { if v==0 { sys_write(1,"0" as *u8,1); return 0 } var m: i64=v; if m<0 { sys_write(1,"-" as *u8,1); m=0-m } let t: *u8=sys_mmap(24); var k: i64=0; while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } let o: *u8=sys_mmap(24); var q: i64=k-1; var x: i64=0; while q>=0 { o[x]=t[q]; x=x+1; q=q-1 } sys_write(1,o,x); return 0 }
10func try_one(path: *u8, label: *u8) -> i64 {
11 let fd: i64 = sys_openat_rd(path)
12 if fd < 0 { w(" " as *u8); w(label); w(": CANNOT OPEN\n" as *u8); return 0 }
13 let buf: *u8 = sys_mmap(K_MAGIC_262144)
14 var total: i64 = 0
15 var done: i64 = 0
16 while done == 0 { let n: i64 = sys_read(fd, ((buf as i64) + total) as *u8, K_MAGIC_262144 - total); if n <= 0 { done = 1 } else { total = total + n } }
17 sys_close(fd)
18 buf[total] = 0 as u8
19 let out: *i64 = sys_mmap(16) as *i64
20 let t0: i64 = sys_now_us()
21 let rc: i64 = compile_run(buf, out)
22 let t1: i64 = sys_now_us()
23 w(" " as *u8); w(label); w(": rc=" as *u8); nn(rc); w(" tag=" as *u8); nn(out[0])
24 if out[0] == VAL_STR {
25 w(" '" as *u8); sys_write(1, ev_str_bytes((out[1]) as *i64), ev_str_len((out[1]) as *i64)); w("'" as *u8)
26 w(" " as *u8); nn(t1 - t0); w("us <-- PASSES\n" as *u8)
27 return 1
28 }
29 w(" (runtime-native gap; queued in coordination.tsv)\n" as *u8)
30 return 0
31}
32func main(argc: i64, argv: *i64) -> i64 {
33 w("=== nx_js_octane_next_run: staged next-Octane scoreboard ===\n" as *u8)
34 // NOTE: these three now DECLINE to the tree-walker (non-strict auto-global etc.) rather than fast-failing,
35 // and their remaining natives are unimplemented -> a live compile_run here can run UNBOUNDED on the tree.
36 // So this scoreboard does NOT auto-run them (a gate must not hang); status is tracked in coordination.tsv.
37 // To probe one manually + BOUNDED, use nx_js_probes_vm on a single staged driver.
38 w(" DeltaBlue: parse-clean; PENDING Object.defineProperty + real Object.prototype chain + fn-method this\n" as *u8)
39 w(" RayTrace : parse-clean; PENDING arguments + Function.apply + Object.extend statics\n" as *u8)
40 w(" Crypto : ✅GREEN -- RSA-1024 encrypt+decrypt round-trip EXACT (nx_js_octane_crypto). 4TH OCTANE.\n" as *u8)
41 w("=== INFO: scoreboard only (no unbounded run); 4 Octane GREEN = Richards+Splay+NavierStokes+Crypto ===\n" as *u8)
42 if argc < 0 { try_one("x\x00" as *u8, "x" as *u8) } // keep try_one referenced (dead-code guard)
43 return 0
44}