code wiki / (root) / nx_compile_field_candidate_t280.nx

nx_compile_field_candidate_t280.nx

buildroot/runtime/nx_compile_field_candidate_t280.nx

42427 B664 linesdepth 9pulls 32 transitivereach 0 importersview sourcekind tooltopic compile
docsdependenciesstructsconstsfunctions

about

nx_compile_x86.nx -- source-file driver for the NishiLang x86_64 backend. Reads .nx source on stdin (pre-expanded; imports already inlined), runs: lex_source -> parse_module -> opt_run (per function) -> x86ctx_emit_module and writes the AT&T x86_64 asm to stdout. The bash wrapper (bench/nx_compile_x86.sh) drives the source -> native ELF pipeline: nxc2.exe --target asm runtime/nx_compile_x86.nx (build driver) riscv64-as + ld -> nx_compile_x86.elf cat source.nx | qemu-riscv64-static nx_compile_x86.elf -> x86_64 asm on stdout gcc -nostdlib -static asm -o native.elf run natively Per cardinal feedback-no-nxc2-c-extension-only-nishilang-forward: this driver is the NishiLang counterpart of nxc2.exe's --target x86_64 path. No C-side modifications. nx_safety_envelope: intended_use: "Compile a .nx source (pre-import-expanded) to native x86_64 SysV asm via the IR-driven x86_64 backend." sil_target: SIL3 asil_target: QM dal_target: DAL B iec_62304_class: NONE evidence: [no_floating_point, bounded_stdin_read_per_jpl_rule_2, sealed_pipeline_verdict_codes, opt_optional_via_env] hazard_register: [bug-tape-source-exceeds-cap-silently-truncated, bug-tape-opcode-not-yet-wired-passes-through] residual_risk: "Hard 2 MiB source cap; pasting larger files truncates silently. Streaming follow-up when needed." verdict: NOT_YET_EVALUATED

dependencies 16 imports · 0 importers

nx_syscalls.nx nx_types.nx nx_lex_kinds.nx nx_outbuf.nx nx_ir.nx nx_tokenizer.nx nx_parse_field_candidate_t280.nx nx_opt.nx nx_x86_64.nx nx_ir_dump.nx nx_compile_field_candidate_t28

diagram shows first 10 each side; +6 more imports, +0 more importers in the complete lists below.

imports: nx_syscalls.nxnx_types.nxnx_lex_kinds.nxnx_outbuf.nxnx_ir.nxnx_tokenizer.nxnx_parse_field_candidate_t280.nxnx_opt.nxnx_x86_64.nxnx_ir_dump.nxnx_ir_validate.nxnx_x86_regalloc.nxnx_x86_64_ctx.nxnx_import.nxnx_crash.nxnx_comparetree_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_crash_guard nxcr_mmap nxcr_install_one nxcr_mmap ↻ nxcx_is_mode_flag nxcx_expand_mode sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ ct_readall_2dir sys_mmap ↻ ct_build_path ct_cat sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close sys_free_file sys_munmap ↻ ct_pick nxcx_log sys_write ↻ nx_diag_puts sys_exit ↻

structs

none

consts

64const NX_MAGIC_4096: i64 = 4096
66const NX_COMPILE_X86_SRC_CAP: i64 = 2097152 // 2 MiB
67const NX_COMPILE_X86_OUT_CAP: i64 = 16777216 // 16 MiB
68const NX_COMPILE_X86_EXPAND_CAP: i64 = 4194304 // 4 MiB import-expanded
70const NX_COMPILE_X86_OK: i64 = 0
71const NX_COMPILE_X86_EMPTY: i64 = 1
72const NX_COMPILE_X86_LEX_FAIL: i64 = 2
73const NX_COMPILE_X86_PARSE_FAIL: i64 = 3
74const NX_COMPILE_X86_NO_FN: i64 = 4
122const NX_COMPILE_X86_BAD_MODE: i64 = 9
123const NXCX_MODE_PREFIX_LEN: i64 = 7 // "--mode="
124const NXCX_MODE_MAX_TOKENS: i64 = 32
136const NXCX_MODES_DIR_1: *u8 = "knowledge/"
137const NXCX_MODES_DIR_2: *u8 = "buildroot/knowledge/"
138const NXCX_MODES_STEM: *u8 = "lang_modes"
139const NXCX_MODES_SUF: *u8 = ".conf"

functions

76func nxcx_read_stdin(buf: *u8, cap: i64) -> i64 {
called by 1: main calls 1: sys_read
106func nxcx_log(msg: *u8, n: i64) -> i64 {
called by 2: nxcx_expand_modemain calls 1: sys_write
140func nxcx_is_mode_flag(a: *u8) -> i64 {
called by 1: main
150func nxcx_streq(a: *u8, b: *u8) -> i64 {
called by 1: nxcx_expand_mode
159func nxcx_expand_mode(argc: i64, argv: *i64, mi: i64, marg: *u8) -> *i64 {
240func main(argc: i64, argv: *i64) -> i64 {