dev: add selfhosting/cranelift workspaces; jit: add return materialization, ret_slot, hostcall arity pad, and dbg imports for diagnosis

This commit is contained in:
Tomoaki
2025-09-06 10:59:33 +09:00
parent f6e0d5111e
commit d631beba37
17 changed files with 539 additions and 25 deletions

26
dev/cranelift/README.md Normal file
View File

@ -0,0 +1,26 @@
Cranelift JIT/AOT Dev
Focus: Cranelift JITdirect and AOT (object emit + link with `libnyrt.a`).
Quick AOT Smoke
- Build core (once):
- `cargo build --release --features cranelift-jit`
- Lower to object + link with NyRT:
- `NYASH_DISABLE_PLUGINS=1 tools/aot_smoke_cranelift.sh apps/smokes/jit_aot_string_min.nyash app_str`
- Run app:
- `./app_str`
Useful env toggles
- `NYASH_JIT_DUMP=1`: show JIT lowering summary
- `NYASH_JIT_TRACE_LOCAL=1`: trace local slot loads/stores
- `NYASH_JIT_TRACE_RET=1`: trace return path
- `NYASH_JIT_TRACE_LEN=1`: trace string/any len thunks
- `NYASH_JIT_DISABLE_LEN_CONST=1`: disable early constfold for String.length
Notes
- For AOT linking: requires `libnyrt.a` from `crates/nyrt` (built by `cargo build --release`).
- Use `target/aot_objects/` as scratch; keep perexperiment subfolders if needed.