code wiki / _hdl_build / nx_js_jit_keystone.nx

nx_js_jit_keystone.nx

buildroot/runtime/_hdl_build/nx_js_jit_keystone.nx

5901 B119 linesdepth 8pulls 24 transitivereach 0 importersview sourcekind tooltopic js
docsdependenciesstructsconstsfunctions

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

nx_js_vm.nx nx_js_jit_keystone.nx

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

main bw jk_mmap_rwx bn nxi_out nxi_fd sys_mmap ccz_cat_num sys_write sys_munmap sys_now_us sys_mmap ↻ sys_clock_gettime_mono compile_run cr_core jp_parse_source js_lex js_skip_trivia js_is_space js_lex_one js_is_idstart js_scan_ident js_is_keyword js_emit js_num_starts js_scan_number js_lex_string js_lex_template js_regex_context js_lex_regex js_punct_len jp_parse_program jp_tok_kind jp_pst jp_toks jp_cur jp_pst ↻ jp_err jp_pst ↻ jp_parse_stmt

structs

none

consts

20const K_MAGIC_4096: i64 = 4096
21const K_MAGIC_499500: i64 = 499500
22const K_MAGIC_10000000: i64 = 10000000
23const K_MAGIC_49999995000000: i64 = 49999995000000
24const K_MAGIC_1000000: i64 = 1000000
25const K_MAGIC_499999500000: i64 = 499999500000
26const K_MAGIC_199990000: i64 = 199990000
27const K_MAGIC_20000: i64 = 20000
28const K_MAGIC_500000000: i64 = 500000000
29const K_MAGIC_100000000: i64 = 100000000

functions

32func 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
34func main(argc: i64, argv: *i64) -> i64