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

14
dev/README.md Normal file
View File

@ -0,0 +1,14 @@
Nyash Dev Areas
This folder contains isolated development workspaces that do not interfere with the main source tree. Use these for experiments and focused bringup.
Areas
- selfhosting/: JIT selfhosting pipeline experiments (Ny → MIR → MIRInterp → VM/JIT). Includes quickstart notes and scripts references.
- cranelift/: Cranelift JIT/AOT bringup and AOT link experiments; smokes and env toggles.
Notes
- Keep experiments and artifacts inside each subfolder. Avoid modifying the core `src/` unless changes are ready to graduate.
- Prefer scripts under `tools/` and add thin wrappers here if needed.

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.

31
dev/selfhosting/README.md Normal file
View File

@ -0,0 +1,31 @@
SelfHosting Dev (JIT / VM)
Focus: Ny → MIR → MIRInterp → VM/JIT quick loops to validate semantics and bootstrap paths.
Quickstart
- Core build (JIT):
- `cargo build --release --features cranelift-jit`
- Core smokes (plugins disabled):
- `NYASH_CLI_VERBOSE=1 ./tools/jit_smoke.sh`
- Roundtrip (parser pipe + json):
- `./tools/ny_roundtrip_smoke.sh`
- Plugins smoke (optional gate):
- `NYASH_SKIP_TOML_ENV=1 ./tools/smoke_plugins.sh`
- Using/Resolver E2E sample (optional):
- `./tools/using_e2e_smoke.sh` (requires `--enable-using`)
- Bootstrap c0→c1→c1' (optional):
- `./tools/bootstrap_selfhost_smoke.sh`
Flags
- `NYASH_DISABLE_PLUGINS=1`: stabilize core path
- `NYASH_LOAD_NY_PLUGINS=1`: enable nyash.toml ny_plugins
- `NYASH_ENABLE_USING=1`: using/namespace enable
- `NYASH_SKIP_TOML_ENV=1`: suppress [env] mapping in nyash.toml
Tips
- For debug, set `NYASH_CLI_VERBOSE=1`.
- Keep temp artifacts under this folder (`dev/selfhosting/_tmp/`) to avoid polluting repo root.