code wiki / _hdl_build / nx_js_jit_keystone.nx
nx_js_jit_keystone.nx
buildroot/runtime/_hdl_build/nx_js_jit_keystone.nx
about
nx_js_jit_keystone.nx -- P5 BASELINE-JIT KEYSTONE (SOTA ladder, after P4 ICs; mirrors how the VM
arc itself began: nx_js_vm_bench proved 376x BEFORE the compiler was built). QUESTION: can the
sovereign stack EMIT x86-64 at runtime and EXECUTE it as the third engine tier, and which class
band does native code hit on the SAME kernel the SOTA bench measures? Machinery already probed
GREEN by nx_nxe_exec_probe (RWX mmap prot=7; SysV: arg0 rdi, ret rax; cast fn-ptr call).
This emits the K1 dispatch kernel (sum 0..N-1, a REAL counted loop) as 18 bytes of x86-64:
31 c0 xor eax, eax ; sum = 0
31 c9 xor ecx, ecx ; i = 0
48 39 f9 loop: cmp rcx, rdi ; i vs N
7d 08 jge end
48 01 c8 add rax, rcx ; sum += i
48 ff c1 inc rcx ; i++
eb f3 jmp loop
c3 end: ret
and races it against the SAME semantics through the bytecode VM (compile_run) and the tree-walker.
HONEST FRAME: this is a KEYSTONE -- a hand-templated kernel proving emission+execution+the band --
NOT a JIT. The Sparkplug-tier build (per-opcode x86 templates off our bytecode) rides this proof.
expect_exit: 0 license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_js_vm.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 20 | const K_MAGIC_4096: i64 = 4096 |
| 21 | const K_MAGIC_499500: i64 = 499500 |
| 22 | const K_MAGIC_10000000: i64 = 10000000 |
| 23 | const K_MAGIC_49999995000000: i64 = 49999995000000 |
| 24 | const K_MAGIC_1000000: i64 = 1000000 |
| 25 | const K_MAGIC_499999500000: i64 = 499999500000 |
| 26 | const K_MAGIC_199990000: i64 = 199990000 |
| 27 | const K_MAGIC_20000: i64 = 20000 |
| 28 | const K_MAGIC_500000000: i64 = 500000000 |
| 29 | const K_MAGIC_100000000: i64 = 100000000 |
functions
| 32 | func jk_mmap_rwx(size: i64) -> *u8 { let r: i64 = __syscall(SYS_MMAP, 0, size, 7, 0x22, -1, 0); return r as *u8 } called by 1: main |
| 34 | func main(argc: i64, argv: *i64) -> i64 |