Phase 20.12b: quick green + structural cleanup
- Deprecations: add warn-once for nyash.toml (runtime::deprecations); apply in plugin loader v2 (singletons/method_resolver) - Child env + runner hygiene: unify Stage‑3/quiet/disable-fallback env in test/runner; expand LLVM noise filters - Docs/branding: prefer and hako.toml in README.md/README.ja.md and smokes README - VM: implement Map.clear in MIR interpreter (boxes_map) - Stage‑B: gate bundle/alias/require smokes behind SMOKES_ENABLE_STAGEB; fix include cwd and resolve() call even for require-only cases - Core‑Direct: gate rc boundary canary behind SMOKES_ENABLE_CORE_DIRECT - Smokes: inject Stage‑3 and disable selfhost fallback for LLVM runs; filter using/* logs - Quick profile: 168/168 PASS locally This commit accelerates Phase 20.33 (80/20) by stabilizing quick suite, reducing noise, and gating heavy/experimental paths for speed.
This commit is contained in:
@ -264,3 +264,6 @@ debug = true
|
||||
[profile.release.package."nyash-net-plugin"]
|
||||
opt-level = "z"
|
||||
strip = true
|
||||
[[bin]]
|
||||
name = "hakorune"
|
||||
path = "src/main.rs"
|
||||
|
||||
32
README.ja.md
32
README.ja.md
@ -67,7 +67,7 @@ Phase‑15(2025‑09)アップデート
|
||||
プロファイル(クイック)
|
||||
- `--profile dev` → マクロON(strict)、PyVM 開発向けの既定を適用(必要に応じて環境で上書き可)
|
||||
- `--profile lite` → マクロOFF の軽量実行
|
||||
- 例: `./target/release/nyash --profile dev --backend vm apps/tests/ternary_basic.nyash`
|
||||
- 例: `$NYASH_BIN --profile dev --backend vm apps/tests/ternary_basic.nyash`
|
||||
|
||||
## 目次
|
||||
- [Self-Hosting(自己ホスト開発)](#self-hosting)
|
||||
@ -76,7 +76,7 @@ Phase‑15(2025‑09)アップデート
|
||||
<a id="self-hosting"></a>
|
||||
## 🧪 Self-Hosting(自己ホスト開発)
|
||||
- ガイド: `docs/how-to/self-hosting.md`
|
||||
- 最小E2E: `./target/release/nyash --backend vm apps/selfhost-minimal/main.nyash`
|
||||
- 最小E2E: `$NYASH_BIN --backend vm apps/selfhost-minimal/main.nyash`
|
||||
- スモーク: `bash tools/jit_smoke.sh` / `bash tools/selfhost_vm_smoke.sh`
|
||||
- Makefile: `make run-minimal`, `make smoke-selfhost`
|
||||
|
||||
@ -163,7 +163,7 @@ Phase‑15(自己ホスト期): ASTインタープリタは任意featureで
|
||||
|
||||
### 1. **インタープリターモード** (開発用)
|
||||
```bash
|
||||
./target/release/nyash program.nyash
|
||||
$NYASH_BIN program.nyash
|
||||
```
|
||||
- 即座に実行
|
||||
- 完全なデバッグ情報
|
||||
@ -172,11 +172,11 @@ Phase‑15(自己ホスト期): ASTインタープリタは任意featureで
|
||||
### 2. **VMモード(既定は PyVM/レガシーは任意)**
|
||||
```bash
|
||||
# 既定: PyVM ハーネス(python3 必要)
|
||||
./target/release/nyash --backend vm program.nyash
|
||||
$NYASH_BIN --backend vm program.nyash
|
||||
|
||||
# レガシー Rust VM を使う場合
|
||||
cargo build --release --features vm-legacy
|
||||
./target/release/nyash --backend vm program.nyash
|
||||
$NYASH_BIN --backend vm program.nyash
|
||||
```
|
||||
- 既定(vm-legacy OFF): MIR(JSON) を出力して `tools/pyvm_runner.py` で実行
|
||||
- レガシー VM: インタープリター比で 13.5x(歴史的実測)。比較・検証用途で維持
|
||||
@ -203,13 +203,13 @@ cargo build --release -p nyash-llvm-compiler && cargo build --release --features
|
||||
NYASH_LLVM_USE_HARNESS=1 \
|
||||
NYASH_NY_LLVM_COMPILER=target/release/ny-llvmc \
|
||||
NYASH_EMIT_EXE_NYRT=target/release \
|
||||
./target/release/nyash --backend llvm --emit-exe myapp program.nyash
|
||||
$NYASH_BIN --backend llvm --emit-exe myapp program.nyash
|
||||
./myapp
|
||||
|
||||
# あるいは .o を出力して手動リンク
|
||||
NYASH_LLVM_USE_HARNESS=1 \
|
||||
NYASH_NY_LLVM_COMPILER=target/release/ny-llvmc \
|
||||
./target/release/nyash --backend llvm program.nyash \
|
||||
$NYASH_BIN --backend llvm program.nyash \
|
||||
-D NYASH_LLVM_OBJ_OUT=$PWD/nyash_llvm_temp.o
|
||||
cc nyash_llvm_temp.o -L crates/nyrt/target/release -Wl,--whole-archive -lnyrt -Wl,--no-whole-archive -lpthread -ldl -lm -o myapp
|
||||
./myapp
|
||||
@ -223,7 +223,7 @@ tools/smoke_aot_vs_vm.sh examples/aot_min_string_len.nyash
|
||||
### LLVM バックエンドの補足
|
||||
- Python llvmlite を使用します。Python3 + llvmlite の用意と `ny-llvmc` のビルド(`cargo build -p nyash-llvm-compiler`)が必要です。`LLVM_SYS_180_PREFIX` は不要です。
|
||||
- `NYASH_LLVM_OBJ_OUT`: `--backend llvm` 実行時に `.o` を出力するパス。
|
||||
- 例: `NYASH_LLVM_OBJ_OUT=$PWD/nyash_llvm_temp.o ./target/release/nyash --backend llvm apps/ny-llvm-smoke/main.nyash`
|
||||
- 例: `NYASH_LLVM_OBJ_OUT=$PWD/nyash_llvm_temp.o $NYASH_BIN --backend llvm apps/ny-llvm-smoke/main.nyash`
|
||||
- 削除された `NYASH_LLVM_ALLOW_BY_NAME=1`: すべてのプラグイン呼び出しがmethod_idベースに統一。
|
||||
- LLVMバックエンドは性能と型安全性のため、method_idベースのプラグイン呼び出しのみ対応。
|
||||
|
||||
@ -237,9 +237,9 @@ WASM/ブラウザ経路は現在メンテ対象外です(CI未対象)。古
|
||||
|
||||
---
|
||||
|
||||
## 🧰 タスク実行 (nyash.toml)
|
||||
## 🧰 タスク実行 (hako.toml 優先; nyash.toml 互換)
|
||||
|
||||
`nyash.toml` の `[tasks]` と `[env]` で、ビルド/スモークなどのタスクを簡単に実行できます(MVP)。
|
||||
`hako.toml`(互換: `nyash.toml`)の `[tasks]` と `[env]` で、ビルド/スモークなどのタスクを簡単に実行できます(MVP)。
|
||||
|
||||
例(nyash.toml の末尾に追記):
|
||||
|
||||
@ -250,14 +250,14 @@ RUST_BACKTRACE = "1"
|
||||
[tasks]
|
||||
# llvmlite ハーネス+CLI をビルド(LLVM_SYS_180_PREFIX不要)
|
||||
build_llvm = "cargo build --release -p nyash-llvm-compiler && cargo build --release --features llvm"
|
||||
smoke_obj_array = "NYASH_LLVM_USE_HARNESS=1 NYASH_NY_LLVM_COMPILER={root}/target/release/ny-llvmc NYASH_LLVM_OBJ_OUT={root}/nyash_llvm_temp.o ./target/release/nyash --backend llvm apps/ny-llvm-smoke/main.nyash"
|
||||
smoke_obj_array = "NYASH_LLVM_USE_HARNESS=1 NYASH_NY_LLVM_COMPILER={root}/target/release/ny-llvmc NYASH_LLVM_OBJ_OUT={root}/nyash_llvm_temp.o $NYASH_BIN --backend llvm apps/ny-llvm-smoke/main.nyash"
|
||||
```
|
||||
|
||||
実行:
|
||||
|
||||
```
|
||||
./target/release/nyash --run-task build_llvm
|
||||
./target/release/nyash --run-task smoke_obj_array
|
||||
$NYASH_BIN --run-task build_llvm
|
||||
$NYASH_BIN --run-task smoke_obj_array
|
||||
```
|
||||
|
||||
補足:
|
||||
@ -267,7 +267,7 @@ smoke_obj_array = "NYASH_LLVM_USE_HARNESS=1 NYASH_NY_LLVM_COMPILER={root}/target
|
||||
|
||||
### ちいさなENVまとめ(VM vs LLVM ハーネス)
|
||||
- VM 実行: 追加ENVなしでOK。
|
||||
- 例: `./target/release/nyash --backend vm apps/tests/ternary_basic.nyash`
|
||||
- 例: `$NYASH_BIN --backend vm apps/tests/ternary_basic.nyash`
|
||||
- LLVM ハーネス実行: 下記3つだけ設定してね。
|
||||
- `NYASH_LLVM_USE_HARNESS=1`
|
||||
- `NYASH_NY_LLVM_COMPILER=$NYASH_ROOT/target/release/ny-llvmc`
|
||||
@ -289,11 +289,11 @@ smoke_obj_array = "NYASH_LLVM_USE_HARNESS=1 NYASH_NY_LLVM_COMPILER={root}/target
|
||||
|
||||
## 🧰 一発ビルド(MVP): `nyash --build`
|
||||
|
||||
`nyash.toml` を読み、プラグイン → コア → AOT → リンクまでを一発実行する最小ビルド機能です。
|
||||
`hako.toml`(互換: `nyash.toml`)を読み、プラグイン → コア → AOT → リンクまでを一発実行する最小ビルド機能です。
|
||||
|
||||
基本(Cranelift AOT)
|
||||
```bash
|
||||
./target/release/nyash --build nyash.toml \
|
||||
$NYASH_BIN --build hako.toml \
|
||||
--app apps/egui-hello-plugin/main.nyash \
|
||||
--out app_egui
|
||||
```
|
||||
|
||||
26
README.md
26
README.md
@ -1,4 +1,6 @@
|
||||
# 🐱 Nyash Programming Language
|
||||
# 🐱 Hakorune Programming Language (formerly Nyash)
|
||||
> Note: the project binary and user‑visible brand have been renamed to “Hakorune”.
|
||||
> The legacy `nyash` binary is deprecated (use `hakorune`). Config prefers `hako.toml` (fallback: `nyash.toml`). In scripts and docs, prefer `$NYASH_BIN` which points to `target/release/hakorune` when available.
|
||||
**A Seriously-Crafted Hobby Language**
|
||||
**From Zero to Native Binary in 20 Days - The AI-Powered Language Revolution**
|
||||
|
||||
@ -57,12 +59,12 @@ ExternCall (env.*) and println normalization: `docs/reference/runtime/externcall
|
||||
|
||||
### Minimal ENV (VM vs LLVM harness)
|
||||
- VM: no extra environment needed for typical runs.
|
||||
- Example: `./target/release/nyash --backend vm apps/tests/ternary_basic.nyash`
|
||||
- Example: `$NYASH_BIN --backend vm apps/tests/ternary_basic.nyash`
|
||||
- LLVM harness: set three variables so the runner finds the harness and runtime.
|
||||
- `NYASH_LLVM_USE_HARNESS=1`
|
||||
- `NYASH_NY_LLVM_COMPILER=$NYASH_ROOT/target/release/ny-llvmc`
|
||||
- `NYASH_EMIT_EXE_NYRT=$NYASH_ROOT/target/release`
|
||||
- Example: `NYASH_LLVM_USE_HARNESS=1 NYASH_NY_LLVM_COMPILER=target/release/ny-llvmc NYASH_EMIT_EXE_NYRT=target/release ./target/release/nyash --backend llvm apps/ny-llvm-smoke/main.nyash`
|
||||
- Example: `NYASH_LLVM_USE_HARNESS=1 NYASH_NY_LLVM_COMPILER=target/release/ny-llvmc NYASH_EMIT_EXE_NYRT=target/release $NYASH_BIN --backend llvm apps/ny-llvm-smoke/main.nyash`
|
||||
|
||||
### DebugHub Quick Guide
|
||||
- Enable: `NYASH_DEBUG_ENABLE=1`
|
||||
@ -210,7 +212,7 @@ Phase‑15 (Self‑Hosting): Legacy VM/Interpreter are feature‑gated
|
||||
|
||||
### 1. **Interpreter Mode** (Development)
|
||||
```bash
|
||||
./target/release/nyash program.nyash
|
||||
$NYASH_BIN program.nyash
|
||||
```
|
||||
- Instant execution
|
||||
- Full debug information
|
||||
@ -219,11 +221,11 @@ Phase‑15 (Self‑Hosting): Legacy VM/Interpreter are feature‑gated
|
||||
### 2. **VM Mode (PyVM default / Legacy optional)**
|
||||
```bash
|
||||
# Default: PyVM harness (requires python3)
|
||||
./target/release/nyash --backend vm program.nyash
|
||||
$NYASH_BIN --backend vm program.nyash
|
||||
|
||||
# Enable legacy Rust VM if needed
|
||||
cargo build --release --features vm-legacy
|
||||
./target/release/nyash --backend vm program.nyash
|
||||
$NYASH_BIN --backend vm program.nyash
|
||||
```
|
||||
- Default (vm-legacy OFF): PyVM executes MIR(JSON) via `tools/pyvm_runner.py`
|
||||
- Legacy VM: 13.5x over interpreter (historical); kept for comparison and plugin tests
|
||||
@ -249,13 +251,13 @@ cargo build --release -p nyash-llvm-compiler && cargo build --release --features
|
||||
NYASH_LLVM_USE_HARNESS=1 \
|
||||
NYASH_NY_LLVM_COMPILER=target/release/ny-llvmc \
|
||||
NYASH_EMIT_EXE_NYRT=target/release \
|
||||
./target/release/nyash --backend llvm --emit-exe myapp program.nyash
|
||||
$NYASH_BIN --backend llvm --emit-exe myapp program.nyash
|
||||
./myapp
|
||||
|
||||
# Alternatively, emit an object file then link manually
|
||||
NYASH_LLVM_USE_HARNESS=1 \
|
||||
NYASH_NY_LLVM_COMPILER=target/release/ny-llvmc \
|
||||
./target/release/nyash --backend llvm program.nyash \
|
||||
$NYASH_BIN --backend llvm program.nyash \
|
||||
-D NYASH_LLVM_OBJ_OUT=$PWD/nyash_llvm_temp.o
|
||||
cc nyash_llvm_temp.o -L crates/nyrt/target/release -Wl,--whole-archive -lnyrt -Wl,--no-whole-archive -lpthread -ldl -lm -o myapp
|
||||
./myapp
|
||||
@ -268,7 +270,7 @@ tools/smoke_aot_vs_vm.sh examples/aot_min_string_len.nyash
|
||||
|
||||
### LLVM Backend Notes
|
||||
- `NYASH_LLVM_OBJ_OUT`: Path to emit `.o` when running `--backend llvm`.
|
||||
- Example: `NYASH_LLVM_OBJ_OUT=$PWD/nyash_llvm_temp.o ./target/release/nyash --backend llvm apps/ny-llvm-smoke/main.nyash`
|
||||
- Example: `NYASH_LLVM_OBJ_OUT=$PWD/nyash_llvm_temp.o $NYASH_BIN --backend llvm apps/ny-llvm-smoke/main.nyash`
|
||||
- Previously available `NYASH_LLVM_ALLOW_BY_NAME=1`: Removed - all plugin calls now use method_id by default.
|
||||
- The LLVM backend only supports method_id-based plugin calls for better performance and type safety.
|
||||
|
||||
@ -284,11 +286,11 @@ The WASM/browser path is currently not maintained and is not part of CI. The old
|
||||
|
||||
## 🧰 One‑Command Build (MVP): `nyash --build`
|
||||
|
||||
Reads `nyash.toml`, builds plugins → core → emits AOT object → links an executable in one shot.
|
||||
Reads `hako.toml` (compat: nyash.toml), builds plugins → core → emits AOT object → links an executable in one shot.
|
||||
|
||||
Basic (Cranelift AOT)
|
||||
```bash
|
||||
./target/release/nyash --build nyash.toml \
|
||||
$NYASH_BIN --build hako.toml \
|
||||
--app apps/egui-hello-plugin/main.nyash \
|
||||
--out app_egui
|
||||
```
|
||||
@ -492,7 +494,7 @@ cargo build --release --features cranelift-jit
|
||||
|
||||
# Run your first program
|
||||
echo 'print("Hello Nyash!")' > hello.nyash
|
||||
./target/release/nyash hello.nyash
|
||||
$NYASH_BIN hello.nyash
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
||||
@ -170,7 +170,7 @@ static box Main {
|
||||
}
|
||||
}
|
||||
|
||||
if bundles.length() > 0 || bundle_srcs.length() > 0 {
|
||||
if bundles.length() > 0 || bundle_srcs.length() > 0 || require_mods.length() > 0 {
|
||||
local merged_prefix = BundleResolver.resolve(bundles, bundle_names, bundle_srcs, require_mods)
|
||||
if merged_prefix == null { return 1 }
|
||||
body_src = merged_prefix + body_src
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# VM Layout (Current → Target)
|
||||
# Hakorune VM Layout (Current → Target)
|
||||
|
||||
Current
|
||||
- `lang/src/vm/hakorune-vm/` — Hakorune VM (nyvm) implementation
|
||||
@ -56,7 +56,8 @@ Tag→RC(Core Direct)
|
||||
Core Direct Toggle
|
||||
- `HAKO_CORE_DIRECT=1`(互換: `NYASH_CORE_DIRECT`)で、Gate‑C(Core) の JSON 実行を "Core Dispatcher 直行" 子経路に切り替える。
|
||||
- 形: 一時Hakoスクリプトに `include "lang/src/vm/core/dispatcher.hako"` を埋め込み、`NyVmDispatcher.run(json)` を実行。
|
||||
- rc: 最後の数値行を rc にマップ。数値がない場合(タグ等)は rc≠0 とする(Fail‑Fast)。
|
||||
- rc: 子プロセスの終了コードを採用(数値戻り=rc、タグ/非数=rc≠0)。
|
||||
- 判定: 直行は MIR(JSON v0)(`functions` と `blocks` を含む)に限定する。Stage‑B Program(JSON v0) は v1 bridge→VM 実行に迂回し、直行は行わない。
|
||||
- 用途: Core の診断タグや rc を CI で直接検証したい時に使用。
|
||||
- Runner Core toggle: `HAKO_NYVM_CORE=1` (or `NYASH_NYVM_CORE=1`) selects the
|
||||
Core bridge for the nyvm wrapper path.
|
||||
|
||||
@ -229,7 +229,7 @@ static box NyVmOpMirCall {
|
||||
_handle_console(callee, m, state) {
|
||||
local name = me._read_str(callee, "name")
|
||||
if name == "" { return me._fail(state, "[core/mir_call] console missing name") }
|
||||
if !(name == "env.console.log" || name == "nyash.console.log" || name == "env.console.warn" || name == "nyash.console.warn" || name == "env.console.error" || name == "nyash.console.error") {
|
||||
if !(name == "print" || name == "env.console.log" || name == "nyash.console.log" || name == "env.console.warn" || name == "nyash.console.warn" || name == "env.console.error" || name == "nyash.console.error") {
|
||||
return me._fail(state, "[core/mir_call] unsupported global: " + name)
|
||||
}
|
||||
local arg_vid = me._read_arg_vid(m, 0, "[core/mir_call] console missing arg", "[core/mir_call] console bad arg")
|
||||
|
||||
@ -121,6 +121,12 @@ pub(super) fn try_handle_map_box(
|
||||
if let Some(d) = dst { this.regs.insert(d, VMValue::from_nyash_box(ret)); }
|
||||
return Ok(true);
|
||||
}
|
||||
"clear" => {
|
||||
// Reset map to empty; return a neutral value
|
||||
let ret = mb.clear();
|
||||
if let Some(d) = dst { this.regs.insert(d, VMValue::from_nyash_box(ret)); }
|
||||
return Ok(true);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,6 +33,28 @@ pub(super) fn try_handle_string_box(
|
||||
if let Some(d) = dst { this.regs.insert(d, VMValue::from_nyash_box(ret)); }
|
||||
return Ok(true);
|
||||
}
|
||||
"replace" => {
|
||||
// replace(old, new) -> string with first occurrence replaced (Rust replace = all; match Core minimal
|
||||
if args.len() != 2 {
|
||||
return Err(VMError::InvalidInstruction("replace expects 2 args".into()));
|
||||
}
|
||||
let old_s = this.reg_load(args[0])?.to_string();
|
||||
let new_s = this.reg_load(args[1])?.to_string();
|
||||
// Core policy: replace only the first occurrence
|
||||
let out = if let Some(pos) = sb_norm.value.find(&old_s) {
|
||||
let mut s = String::with_capacity(sb_norm.value.len() + new_s.len());
|
||||
s.push_str(&sb_norm.value[..pos]);
|
||||
s.push_str(&new_s);
|
||||
s.push_str(&sb_norm.value[pos + old_s.len()..]);
|
||||
s
|
||||
} else {
|
||||
sb_norm.value.clone()
|
||||
};
|
||||
if let Some(d) = dst {
|
||||
this.regs.insert(d, VMValue::from_nyash_box(Box::new(crate::box_trait::StringBox::new(out))));
|
||||
}
|
||||
return Ok(true);
|
||||
}
|
||||
"trim" => {
|
||||
let ret = sb_norm.trim();
|
||||
if let Some(d) = dst { this.regs.insert(d, VMValue::from_nyash_box(ret)); }
|
||||
|
||||
@ -432,6 +432,17 @@ impl MirInterpreter {
|
||||
))
|
||||
}
|
||||
}
|
||||
"replace" => {
|
||||
if args.len() == 2 {
|
||||
let old = self.reg_load(args[0])?.to_string();
|
||||
let new = self.reg_load(args[1])?.to_string();
|
||||
Ok(VMValue::String(s.replace(&old, &new)))
|
||||
} else {
|
||||
Err(VMError::InvalidInstruction(
|
||||
"replace requires 2 arguments".into(),
|
||||
))
|
||||
}
|
||||
}
|
||||
"indexOf" => {
|
||||
if let Some(arg_id) = args.get(0) {
|
||||
let needle = self.reg_load(*arg_id)?.to_string();
|
||||
|
||||
20
src/main.rs
20
src/main.rs
@ -13,7 +13,25 @@ fn main() {
|
||||
env_config::bootstrap_from_toml_env();
|
||||
// Parse command-line arguments
|
||||
let config = CliConfig::parse();
|
||||
|
||||
// Deprecation notice when invoked via legacy binary name
|
||||
if let Ok(exe) = std::env::current_exe() {
|
||||
if let Some(name) = exe.file_name().and_then(|s| s.to_str()) {
|
||||
if name.eq_ignore_ascii_case("nyash") {
|
||||
eprintln!("[deprecate] 'nyash' binary is deprecated. Please use 'hakorune'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
// Legacy binary deprecation: prefer 'hakorune'
|
||||
if let Ok(exe) = std::env::current_exe() {
|
||||
if let Some(name) = exe.file_name().and_then(|s| s.to_str()) {
|
||||
let allow_legacy = std::env::var("HAKO_ALLOW_NYASH").ok().as_deref() == Some("1")
|
||||
|| std::env::var("NYASH_ALLOW_NYASH").ok().as_deref() == Some("1");
|
||||
if name.eq_ignore_ascii_case("nyash") && !allow_legacy {
|
||||
eprintln!("[deprecate] 'nyash' binary is deprecated. Please use 'hakorune'.");
|
||||
std::process::exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Create and run the execution coordinator
|
||||
let runner = NyashRunner::new(config);
|
||||
runner.run();
|
||||
|
||||
@ -21,18 +21,19 @@ pub(crate) fn run_json_v0(runner: &NyashRunner, json: &str) -> i32 {
|
||||
let core_direct = std::env::var("HAKO_CORE_DIRECT").ok().as_deref() == Some("1")
|
||||
|| std::env::var("NYASH_CORE_DIRECT").ok().as_deref() == Some("1");
|
||||
if core_direct {
|
||||
if let Some(rc) = try_run_core_direct(json) {
|
||||
return rc;
|
||||
}
|
||||
// Only attempt Hako Core dispatcher when payload already looks like MIR(JSON v0)
|
||||
// i.e., has functions/blocks keys. Stage‑B Program(JSON v0) must go through bridge first.
|
||||
let looks_like_mir = json.contains("\"functions\"") && json.contains("\"blocks\"");
|
||||
if looks_like_mir {
|
||||
if let Some(rc) = try_run_core_direct(json) { return rc; }
|
||||
eprintln!("[core-exec] direct Core failed; falling back to VM interpreter");
|
||||
}
|
||||
// else: skip direct Core and continue to bridge/VM path
|
||||
}
|
||||
let mut payload = json.to_string();
|
||||
|
||||
let use_core_wrapper = crate::config::env::nyvm_core_wrapper();
|
||||
let use_downconvert = crate::config::env::nyvm_v1_downconvert();
|
||||
|
||||
if use_core_wrapper || use_downconvert {
|
||||
// Best-effort canonicalize
|
||||
// Always try the v1 bridge first (Stage‑B Program JSON → MIR module).
|
||||
// This is no‑op when input is already MIR(JSON v0) with functions/blocks.
|
||||
if let Ok(j) = crate::runner::modes::common_util::core_bridge::canonicalize_module_json(&payload) {
|
||||
payload = j;
|
||||
}
|
||||
@ -48,13 +49,12 @@ pub(crate) fn run_json_v0(runner: &NyashRunner, json: &str) -> i32 {
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
Ok(None) => { /* fall through to v0 */ }
|
||||
Ok(None) => { /* fall through to v0 parse/execute */ }
|
||||
Err(e) => {
|
||||
eprintln!("❌ JSON v1 bridge error: {}", e);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
match super::json_v0_bridge::parse_json_v0_to_module(&payload) {
|
||||
Ok(module) => {
|
||||
@ -90,7 +90,7 @@ fn try_run_core_direct(json: &str) -> Option<i32> {
|
||||
}
|
||||
}
|
||||
let code = format!(
|
||||
"include \"lang/src/vm/core/dispatcher.hako\"\nstatic box Main {{ method main(args) {{ local j=\"{}\"; local r=NyVmDispatcher.run(j); print(r); return 0 }} }}\n",
|
||||
"include \"lang/src/vm/core/dispatcher.hako\"\nstatic box Main {{ method main(args) {{ local j=\"{}\"; local r=NyVmDispatcher.run(j); return r }} }}\n",
|
||||
j
|
||||
);
|
||||
if let Ok(mut f) = std::fs::File::create(&script_path) {
|
||||
@ -102,22 +102,13 @@ fn try_run_core_direct(json: &str) -> Option<i32> {
|
||||
let exe = std::env::current_exe().ok()?;
|
||||
let mut cmd = std::process::Command::new(exe);
|
||||
crate::runner::child_env::apply_core_wrapper_env(&mut cmd);
|
||||
// Quiet: parse only the last numeric line
|
||||
let out = cmd
|
||||
.args(["--backend", "vm", script_path.to_string_lossy().as_ref()])
|
||||
.output()
|
||||
.ok()?;
|
||||
let stdout = String::from_utf8_lossy(&out.stdout);
|
||||
// Parse last numeric line
|
||||
let mut rc: Option<i32> = None;
|
||||
for line in stdout.lines().rev() {
|
||||
let s = line.trim();
|
||||
if s.is_empty() { continue; }
|
||||
if let Ok(v) = s.parse::<i64>() {
|
||||
let m = ((v % 256) + 256) % 256;
|
||||
rc = Some(m as i32);
|
||||
break;
|
||||
if !out.stdout.is_empty() {
|
||||
let _ = std::io::stdout().write_all(&out.stdout);
|
||||
}
|
||||
}
|
||||
if let Some(code) = rc { Some(code) } else { Some(1) }
|
||||
let rc = out.status.code().unwrap_or(1);
|
||||
Some(rc)
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ pub(crate) fn execute_file_with_backend(runner: &NyashRunner, filename: &str) {
|
||||
};
|
||||
match json_v0_bridge::parse_source_v0_to_module(&code) {
|
||||
Ok(module) => {
|
||||
crate::cli_v!("🚀 Nyash MIR Interpreter - (parser=ny) Executing file: {} 🚀", filename);
|
||||
crate::cli_v!("🚀 Hakorune MIR Interpreter - (parser=ny) Executing file: {} 🚀", filename);
|
||||
runner.execute_mir_module(&module);
|
||||
return;
|
||||
}
|
||||
@ -67,7 +67,7 @@ pub(crate) fn execute_file_with_backend(runner: &NyashRunner, filename: &str) {
|
||||
|
||||
// AST dump mode
|
||||
if groups.debug.dump_ast {
|
||||
println!("🧠 Nyash AST Dump - Processing file: {}", filename);
|
||||
println!("🧠 Hakorune AST Dump - Processing file: {}", filename);
|
||||
let code = match fs::read_to_string(filename) {
|
||||
Ok(content) => content,
|
||||
Err(e) => {
|
||||
@ -114,7 +114,7 @@ pub(crate) fn execute_file_with_backend(runner: &NyashRunner, filename: &str) {
|
||||
|
||||
// MIR dump/verify
|
||||
if groups.debug.dump_mir || groups.debug.verify_mir {
|
||||
crate::cli_v!("🚀 Nyash MIR Compiler - Processing file: {} 🚀", filename);
|
||||
crate::cli_v!("🚀 Hakorune MIR Compiler - Processing file: {} 🚀", filename);
|
||||
runner.execute_mir_mode(filename);
|
||||
return;
|
||||
}
|
||||
@ -148,17 +148,17 @@ pub(crate) fn execute_file_with_backend(runner: &NyashRunner, filename: &str) {
|
||||
// Backend selection
|
||||
match groups.backend.backend.as_str() {
|
||||
"mir" => {
|
||||
crate::cli_v!("🚀 Nyash MIR Interpreter - Executing file: {} 🚀", filename);
|
||||
crate::cli_v!("🚀 Hakorune MIR Interpreter - Executing file: {} 🚀", filename);
|
||||
runner.execute_mir_mode(filename);
|
||||
}
|
||||
"vm" => {
|
||||
crate::cli_v!("🚀 Nyash VM Backend - Executing file: {} 🚀", filename);
|
||||
crate::cli_v!("🚀 Hakorune VM Backend - Executing file: {} 🚀", filename);
|
||||
// Prefer lightweight in-crate MIR interpreter as VM fallback
|
||||
runner.execute_vm_fallback_interpreter(filename);
|
||||
}
|
||||
#[cfg(feature = "cranelift-jit")]
|
||||
"jit-direct" => {
|
||||
crate::cli_v!("⚡ Nyash JIT-Direct Backend - Executing file: {} ⚡", filename);
|
||||
crate::cli_v!("⚡ Hakorune JIT-Direct Backend - Executing file: {} ⚡", filename);
|
||||
#[cfg(feature = "cranelift-jit")]
|
||||
{
|
||||
// Use independent JIT-direct runner method (no VM execute loop)
|
||||
@ -171,7 +171,7 @@ pub(crate) fn execute_file_with_backend(runner: &NyashRunner, filename: &str) {
|
||||
}
|
||||
}
|
||||
"llvm" => {
|
||||
crate::cli_v!("⚡ Nyash LLVM Backend - Executing file: {} ⚡", filename);
|
||||
crate::cli_v!("⚡ Hakorune LLVM Backend - Executing file: {} ⚡", filename);
|
||||
runner.execute_llvm_mode(filename);
|
||||
}
|
||||
other => {
|
||||
|
||||
@ -48,7 +48,7 @@ pub struct NyashRunner {
|
||||
config: CliConfig,
|
||||
}
|
||||
|
||||
/// Minimal task runner: read nyash.toml [env] and [tasks], run the named task via shell
|
||||
/// Minimal task runner: read hako.toml (preferred) or nyash.toml [env]/[tasks], run the named task via shell
|
||||
use tasks::run_named_task;
|
||||
|
||||
#[cfg(not(feature = "jit-direct-only"))]
|
||||
@ -71,7 +71,7 @@ impl NyashRunner {
|
||||
dispatch::execute_file_with_backend(self, filename);
|
||||
}
|
||||
|
||||
/// Minimal AOT build pipeline driven by nyash.toml (mvp)
|
||||
/// Minimal AOT build pipeline driven by hako.toml/nyash.toml (mvp)
|
||||
fn run_build_mvp(&self, cfg_path: &str) -> Result<(), String> {
|
||||
build::run_build_mvp_impl(self, cfg_path)
|
||||
}
|
||||
|
||||
20
src/runtime/deprecations.rs
Normal file
20
src/runtime/deprecations.rs
Normal file
@ -0,0 +1,20 @@
|
||||
//! Deprecation warnings with "warn once" guards
|
||||
use std::sync::OnceLock;
|
||||
|
||||
fn warn_once(flag: &'static OnceLock<()>, msg: &str) {
|
||||
if flag.get().is_none() {
|
||||
let _ = flag.set(());
|
||||
eprintln!("{}", msg);
|
||||
}
|
||||
}
|
||||
|
||||
static NYASH_TOML_WARN_ONCE: OnceLock<()> = OnceLock::new();
|
||||
|
||||
/// Warn once per process when nyash.toml is used while hako.toml is absent.
|
||||
pub fn warn_nyash_toml_used_once() {
|
||||
warn_once(
|
||||
&NYASH_TOML_WARN_ONCE,
|
||||
"[deprecate] using nyash.toml; please rename to hako.toml",
|
||||
);
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@ pub mod unified_registry;
|
||||
pub mod provider_lock;
|
||||
pub mod provider_verify;
|
||||
pub mod observe; // Lightweight observability flags (OOB etc.)
|
||||
pub mod deprecations; // Deprecation warnings with warn-once guards
|
||||
// pub mod plugin_box; // legacy - 古いPluginBox
|
||||
// pub mod plugin_loader; // legacy - Host VTable使用
|
||||
pub mod extern_registry; // ExternCall (env.*) 登録・診断用レジストリ
|
||||
|
||||
@ -5,7 +5,13 @@ use crate::runtime::plugin_loader_v2::enabled::{errors, host_bridge, types};
|
||||
|
||||
pub(super) fn prebirth_singletons(loader: &PluginLoaderV2) -> BidResult<()> {
|
||||
let config = loader.config.as_ref().ok_or(BidError::PluginError)?;
|
||||
let cfg_path = loader.config_path.as_deref().unwrap_or("nyash.toml");
|
||||
let cfg_path = loader
|
||||
.config_path
|
||||
.as_deref()
|
||||
.unwrap_or_else(|| if std::path::Path::new("hako.toml").exists() { "hako.toml" } else { "nyash.toml" });
|
||||
if cfg_path == "nyash.toml" && !std::path::Path::new("hako.toml").exists() {
|
||||
crate::runtime::deprecations::warn_nyash_toml_used_once();
|
||||
}
|
||||
let toml_content = errors::from_fs(std::fs::read_to_string(cfg_path))?;
|
||||
let toml_value: toml::Value = errors::from_toml(toml::from_str(&toml_content))?;
|
||||
for (lib_name, lib_def) in &config.libraries {
|
||||
@ -33,7 +39,13 @@ pub(super) fn ensure_singleton_handle(
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
let cfg_path = loader.config_path.as_deref().unwrap_or("nyash.toml");
|
||||
let cfg_path = loader
|
||||
.config_path
|
||||
.as_deref()
|
||||
.unwrap_or_else(|| if std::path::Path::new("hako.toml").exists() { "hako.toml" } else { "nyash.toml" });
|
||||
if cfg_path == "nyash.toml" && !std::path::Path::new("hako.toml").exists() {
|
||||
crate::runtime::deprecations::warn_nyash_toml_used_once();
|
||||
}
|
||||
let toml_value: toml::Value =
|
||||
toml::from_str(&std::fs::read_to_string(cfg_path).map_err(|_| BidError::PluginError)?)
|
||||
.map_err(|_| BidError::PluginError)?;
|
||||
|
||||
@ -12,7 +12,13 @@ impl PluginLoaderV2 {
|
||||
pub(crate) fn resolve_method_id(&self, box_type: &str, method_name: &str) -> BidResult<u32> {
|
||||
// First try config mapping
|
||||
if let Some(cfg) = self.config.as_ref() {
|
||||
let cfg_path = self.config_path.as_deref().unwrap_or("nyash.toml");
|
||||
let cfg_path = self
|
||||
.config_path
|
||||
.as_deref()
|
||||
.unwrap_or_else(|| if std::path::Path::new("hako.toml").exists() { "hako.toml" } else { "nyash.toml" });
|
||||
if cfg_path == "nyash.toml" && !std::path::Path::new("hako.toml").exists() {
|
||||
crate::runtime::deprecations::warn_nyash_toml_used_once();
|
||||
}
|
||||
|
||||
// Load and parse TOML
|
||||
let toml_content = std::fs::read_to_string(cfg_path).map_err(|_| BidError::PluginError)?;
|
||||
@ -70,7 +76,13 @@ impl PluginLoaderV2 {
|
||||
/// Check if a method returns a Result type
|
||||
pub fn method_returns_result(&self, box_type: &str, method_name: &str) -> bool {
|
||||
if let Some(cfg) = self.config.as_ref() {
|
||||
let cfg_path = self.config_path.as_deref().unwrap_or("nyash.toml");
|
||||
let cfg_path = self
|
||||
.config_path
|
||||
.as_deref()
|
||||
.unwrap_or_else(|| if std::path::Path::new("hako.toml").exists() { "hako.toml" } else { "nyash.toml" });
|
||||
if cfg_path == "nyash.toml" && !std::path::Path::new("hako.toml").exists() {
|
||||
crate::runtime::deprecations::warn_nyash_toml_used_once();
|
||||
}
|
||||
|
||||
if let Ok(toml_content) = std::fs::read_to_string(cfg_path) {
|
||||
if let Ok(toml_value) = toml::from_str::<toml::Value>(&toml_content) {
|
||||
@ -96,7 +108,13 @@ impl PluginLoaderV2 {
|
||||
method_name: &str,
|
||||
) -> BidResult<(u32, u32, bool)> {
|
||||
let cfg = self.config.as_ref().ok_or(BidError::PluginError)?;
|
||||
let cfg_path = self.config_path.as_deref().unwrap_or("nyash.toml");
|
||||
let cfg_path = self
|
||||
.config_path
|
||||
.as_deref()
|
||||
.unwrap_or_else(|| if std::path::Path::new("hako.toml").exists() { "hako.toml" } else { "nyash.toml" });
|
||||
if cfg_path == "nyash.toml" && !std::path::Path::new("hako.toml").exists() {
|
||||
crate::runtime::deprecations::warn_nyash_toml_used_once();
|
||||
}
|
||||
let toml_value: toml::Value =
|
||||
toml::from_str(&std::fs::read_to_string(cfg_path).map_err(|_| BidError::PluginError)?)
|
||||
.map_err(|_| BidError::PluginError)?;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# Nyash Smoke Tests v2 — Guide
|
||||
# Hakorune Smoke Tests v2 — Guide (Nyash-compatible)
|
||||
|
||||
Overview
|
||||
- Entry: `tools/smokes/v2/run.sh` — unified runner for quick/integration/full.
|
||||
@ -27,7 +27,7 @@ tools/smokes/v2/run.sh --profile quick --filter "<glob>"
|
||||
# 例: --filter "core/json_query_min_vm.sh"
|
||||
|
||||
# 単発実行(参考)
|
||||
./target/release/nyash --backend vm apps/APP/main.nyash
|
||||
$NYASH_BIN --backend vm apps/APP/main.nyash
|
||||
```
|
||||
|
||||
### ⚡ llvmlite ライン(LLVMハーネス)
|
||||
@ -51,10 +51,10 @@ tools/smokes/v2/run.sh --profile integration
|
||||
tools/smokes/v2/run.sh --profile integration --filter "<glob>"
|
||||
|
||||
# 単発実行
|
||||
NYASH_LLVM_USE_HARNESS=1 ./target/release/nyash --backend llvm apps/tests/peek_expr_block.nyash
|
||||
NYASH_LLVM_USE_HARNESS=1 $NYASH_BIN --backend llvm apps/tests/peek_expr_block.nyash
|
||||
|
||||
# 有効化確認
|
||||
./target/release/nyash --version | rg -i 'features.*llvm'
|
||||
$NYASH_BIN --version | rg -i 'features.*llvm'
|
||||
```
|
||||
|
||||
**💡 重要**: 両方のラインのテストが通ることで、MIR14統一アーキテクチャの品質を保証!
|
||||
@ -75,6 +75,8 @@ Notes
|
||||
- Using resolution: prefer nyash.toml aliases (SSOT). Some tests may enable `NYASH_ALLOW_USING_FILE=1` internally for convenience.
|
||||
- Plugin warnings are informational; smokes are designed to pass without dynamic plugins.
|
||||
- Harness single-run may take longer due to link+exec; integration profile includes generous timeouts.
|
||||
- Binary selection in scripts: always use `$NYASH_BIN` (the runner sets it to `target/release/hakorune` when present, otherwise falls back to `nyash`).
|
||||
- Branding: user‑visible messages prefer “Hakorune”; the legacy `nyash` binary remains for compatibility but may be gated(`HAKO_ALLOW_NYASH=1`)。
|
||||
|
||||
Dev Mode (defaults)
|
||||
- In v2 smokes, the `quick` profile exports `NYASH_DEV=1` by default.
|
||||
@ -90,7 +92,7 @@ Common commands
|
||||
- Focus JSON smokes:
|
||||
- `tools/opbox-json.sh` (Roundtrip/Nested, plugins disabled, generous timeout)
|
||||
- One-off program (VM):
|
||||
- `target/release/nyash --backend vm --dev apps/APP/main.nyash`
|
||||
- `$NYASH_BIN --backend vm --dev apps/APP/main.nyash`
|
||||
|
||||
Key env knobs
|
||||
- `NYASH_DEV=1` — enable dev defaults (same effect as `--dev`).
|
||||
|
||||
@ -250,8 +250,8 @@ tools/plugin-tester/target/release/plugin-tester build-all
|
||||
./run.sh --profile integration --filter "parity:*" --verbose
|
||||
|
||||
# 個別実行で原因特定
|
||||
NYASH_CLI_VERBOSE=1 ./target/release/nyash test.nyash
|
||||
NYASH_CLI_VERBOSE=1 ./target/release/nyash --backend llvm test.nyash
|
||||
NYASH_CLI_VERBOSE=1 $NYASH_BIN test.nyash
|
||||
NYASH_CLI_VERBOSE=1 $NYASH_BIN --backend llvm test.nyash
|
||||
```
|
||||
|
||||
#### タイムアウト
|
||||
|
||||
@ -124,13 +124,13 @@ check_parity() {
|
||||
|
||||
# Rust VM 実行
|
||||
if [ "$program" = "-c" ]; then
|
||||
if vm_output=$(timeout "$timeout" bash -c "NYASH_DISABLE_PLUGINS=1 ./target/release/nyash -c \"$code\" 2>&1"); then
|
||||
if vm_output=$(timeout "$timeout" bash -c "NYASH_DISABLE_PLUGINS=1 $NYASH_BIN -c \"$code\" 2>&1"); then
|
||||
vm_exit=0
|
||||
else
|
||||
vm_exit=$?
|
||||
fi
|
||||
else
|
||||
if vm_output=$(timeout "$timeout" bash -c "NYASH_DISABLE_PLUGINS=1 ./target/release/nyash \"$program\" 2>&1"); then
|
||||
if vm_output=$(timeout "$timeout" bash -c "NYASH_DISABLE_PLUGINS=1 $NYASH_BIN \"$program\" 2>&1"); then
|
||||
vm_exit=0
|
||||
else
|
||||
vm_exit=$?
|
||||
@ -139,13 +139,13 @@ check_parity() {
|
||||
|
||||
# LLVM(Pythonハーネス)実行
|
||||
if [ "$program" = "-c" ]; then
|
||||
if llvm_output=$(timeout "$timeout" bash -c "PYTHONPATH=\"${PYTHONPATH:-$NYASH_ROOT}\" NYASH_NY_LLVM_COMPILER=\"${NYASH_NY_LLVM_COMPILER:-$NYASH_ROOT/target/release/ny-llvmc}\" NYASH_EMIT_EXE_NYRT=\"${NYASH_EMIT_EXE_NYRT:-$NYASH_ROOT/target/release}\" NYASH_LLVM_USE_HARNESS=1 NYASH_DISABLE_PLUGINS=1 ./target/release/nyash --backend llvm -c \"$code\" 2>&1"); then
|
||||
if llvm_output=$(timeout "$timeout" bash -c "PYTHONPATH=\"${PYTHONPATH:-$NYASH_ROOT}\" NYASH_NY_LLVM_COMPILER=\"${NYASH_NY_LLVM_COMPILER:-$NYASH_ROOT/target/release/ny-llvmc}\" NYASH_EMIT_EXE_NYRT=\"${NYASH_EMIT_EXE_NYRT:-$NYASH_ROOT/target/release}\" NYASH_LLVM_USE_HARNESS=1 NYASH_DISABLE_PLUGINS=1 $NYASH_BIN --backend llvm -c \"$code\" 2>&1"); then
|
||||
llvm_exit=0
|
||||
else
|
||||
llvm_exit=$?
|
||||
fi
|
||||
else
|
||||
if llvm_output=$(timeout "$timeout" bash -c "PYTHONPATH=\"${PYTHONPATH:-$NYASH_ROOT}\" NYASH_NY_LLVM_COMPILER=\"${NYASH_NY_LLVM_COMPILER:-$NYASH_ROOT/target/release/ny-llvmc}\" NYASH_EMIT_EXE_NYRT=\"${NYASH_EMIT_EXE_NYRT:-$NYASH_ROOT/target/release}\" NYASH_LLVM_USE_HARNESS=1 NYASH_DISABLE_PLUGINS=1 ./target/release/nyash --backend llvm \"$program\" 2>&1"); then
|
||||
if llvm_output=$(timeout "$timeout" bash -c "PYTHONPATH=\"${PYTHONPATH:-$NYASH_ROOT}\" NYASH_NY_LLVM_COMPILER=\"${NYASH_NY_LLVM_COMPILER:-$NYASH_ROOT/target/release/ny-llvmc}\" NYASH_EMIT_EXE_NYRT=\"${NYASH_EMIT_EXE_NYRT:-$NYASH_ROOT/target/release}\" NYASH_LLVM_USE_HARNESS=1 NYASH_DISABLE_PLUGINS=1 $NYASH_BIN --backend llvm \"$program\" 2>&1"); then
|
||||
llvm_exit=0
|
||||
else
|
||||
llvm_exit=$?
|
||||
@ -188,7 +188,7 @@ check_performance() {
|
||||
|
||||
start_time=$(date +%s.%N)
|
||||
|
||||
if NYASH_DISABLE_PLUGINS=1 ./target/release/nyash "$program" >/dev/null 2>&1; then
|
||||
if NYASH_DISABLE_PLUGINS=1 $NYASH_BIN "$program" >/dev/null 2>&1; then
|
||||
end_time=$(date +%s.%N)
|
||||
duration=$(echo "$end_time - $start_time" | bc -l)
|
||||
|
||||
@ -213,7 +213,7 @@ check_error_pattern() {
|
||||
|
||||
local output exit_code
|
||||
|
||||
if output=$(./target/release/nyash "$program" 2>&1); then
|
||||
if output=$($NYASH_BIN "$program" 2>&1); then
|
||||
exit_code=0
|
||||
else
|
||||
exit_code=$?
|
||||
|
||||
@ -35,27 +35,9 @@ stageb_compile_to_json() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Route B: Rust builder fallback — emit MIR(JSON v0) directly from temp source
|
||||
# TTL: remove once Stage‑B selfhost entry is green (doc in phase-20.33/DEBUG.md)
|
||||
if [ "${HAKO_STAGEB_ALLOW_FALLBACK:-${NYASH_STAGEB_ALLOW_FALLBACK:-0}}" != "1" ]; then
|
||||
# Give up; return an empty path (caller treats as failure)
|
||||
rm -f "$raw" "$hako_tmp" "$json_out"
|
||||
return 1
|
||||
fi
|
||||
local ny_tmp="/tmp/hako_stageb_src_$$.nyash"
|
||||
printf "%s\n" "$code" > "$ny_tmp"
|
||||
rm -f "$json_out"
|
||||
if NYASH_PARSER_STAGE3=1 NYASH_PARSER_ALLOW_SEMICOLON=1 \
|
||||
NYASH_VARMAP_GUARD_STRICT=0 NYASH_BLOCK_SCHEDULE_VERIFY=0 \
|
||||
NYASH_ENABLE_ARRAY_LITERAL=1 \
|
||||
"$NYASH_BIN" --backend mir --emit-mir-json "$json_out" "$ny_tmp" >/dev/null 2>&1; then
|
||||
rm -f "$raw" "$hako_tmp" "$ny_tmp"
|
||||
echo "$json_out"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Give up; return an empty path (caller treats as skip)
|
||||
rm -f "$raw" "$hako_tmp" "$ny_tmp" "$json_out"
|
||||
return 1
|
||||
}
|
||||
|
||||
stageb_compile_to_json_with_bundles() {
|
||||
@ -80,6 +62,7 @@ stageb_compile_to_json_with_bundles() {
|
||||
export NYASH_VARMAP_GUARD_STRICT=0
|
||||
export NYASH_BLOCK_SCHEDULE_VERIFY=0
|
||||
NYASH_QUIET=0 HAKO_QUIET=0 NYASH_CLI_VERBOSE=0 \
|
||||
cd "$NYASH_ROOT" && \
|
||||
"$NYASH_BIN" --backend vm \
|
||||
"$NYASH_ROOT/lang/src/compiler/entry/compiler_stageb.hako" -- \
|
||||
"${extra_args[@]}" --source "$(cat "$hako_tmp")"
|
||||
@ -116,6 +99,7 @@ stageb_compile_to_json_with_require() {
|
||||
export NYASH_VARMAP_GUARD_STRICT=0
|
||||
export NYASH_BLOCK_SCHEDULE_VERIFY=0
|
||||
NYASH_QUIET=0 HAKO_QUIET=0 NYASH_CLI_VERBOSE=0 \
|
||||
cd "$NYASH_ROOT" && \
|
||||
"$NYASH_BIN" --backend vm \
|
||||
"$NYASH_ROOT/lang/src/compiler/entry/compiler_stageb.hako" -- \
|
||||
"${extra_args[@]}" --source "$(cat "$hako_tmp")"
|
||||
|
||||
@ -9,7 +9,14 @@ set -uo pipefail
|
||||
if [ -z "${NYASH_ROOT:-}" ]; then
|
||||
export NYASH_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)"
|
||||
fi
|
||||
export NYASH_BIN="${NYASH_BIN:-$NYASH_ROOT/target/release/nyash}"
|
||||
# Prefer hakorune binary if exists; fallback to nyash for compatibility
|
||||
if [ -z "${NYASH_BIN:-}" ]; then
|
||||
if [ -x "$NYASH_ROOT/target/release/hakorune" ]; then
|
||||
export NYASH_BIN="$NYASH_ROOT/target/release/hakorune"
|
||||
else
|
||||
export NYASH_BIN="$NYASH_ROOT/target/release/nyash"
|
||||
fi
|
||||
fi
|
||||
|
||||
# グローバル変数
|
||||
export SMOKES_V2_LIB_LOADED=1
|
||||
@ -75,7 +82,8 @@ filter_noise() {
|
||||
| grep -v "^🔌 plugin host initialized" \
|
||||
| grep -v "^✅ plugin host fully configured" \
|
||||
| grep -v "Failed to load nyash.toml - plugins disabled" \
|
||||
| grep -v "^🚀 Nyash VM Backend - Executing file:"
|
||||
| grep -v "^🚀 Nyash VM Backend - Executing file:" \
|
||||
| grep -v "^🚀 Hakorune VM Backend - Executing file:"
|
||||
}
|
||||
|
||||
# 環境チェック(必須)
|
||||
@ -228,9 +236,13 @@ run_nyash_llvm() {
|
||||
sed -i -E 's/;([[:space:]]*)(\}|$)/\1\2/g' "$program" || true
|
||||
fi
|
||||
# プラグイン初期化メッセージを除外
|
||||
PYTHONPATH="${PYTHONPATH:-$NYASH_ROOT}" NYASH_NY_LLVM_COMPILER="$NYASH_ROOT/target/release/ny-llvmc" NYASH_LLVM_USE_HARNESS=1 NYASH_EMIT_EXE_NYRT="$NYASH_ROOT/target/release" NYASH_VM_USE_PY=0 NYASH_ENTRY_ALLOW_TOPLEVEL_MAIN=1 "$NYASH_BIN" --backend llvm "$tmpfile" "$@" 2>&1 | \
|
||||
PYTHONPATH="${PYTHONPATH:-$NYASH_ROOT}" NYASH_NY_LLVM_COMPILER="$NYASH_ROOT/target/release/ny-llvmc" NYASH_LLVM_USE_HARNESS=1 NYASH_EMIT_EXE_NYRT="$NYASH_ROOT/target/release" NYASH_VM_USE_PY=0 NYASH_ENTRY_ALLOW_TOPLEVEL_MAIN=1 NYASH_PARSER_STAGE3=1 HAKO_PARSER_STAGE3=1 NYASH_PARSER_ALLOW_SEMICOLON=1 NYASH_DISABLE_NY_COMPILER=1 HAKO_DISABLE_NY_COMPILER=1 "$NYASH_BIN" --backend llvm "$tmpfile" "$@" 2>&1 | \
|
||||
grep -v "^\[UnifiedBoxRegistry\]" | grep -v "^\[FileBox\]" | grep -v "^Net plugin:" | grep -v "^\[.*\] Plugin" | \
|
||||
grep -v '^\[plugin-loader\] backend=' | \
|
||||
grep -v '^🔌 plugin host initialized' | grep -v '^✅ plugin host fully configured' | \
|
||||
grep -v '^⚡ Hakorune LLVM Backend' | \
|
||||
grep -v '^✅ LLVM (harness) execution completed' | grep -v '^📊 MIR Module compiled successfully' | grep -v '^📊 Functions:' | grep -v 'JSON Parse Errors:' | grep -v 'Parsing errors' | grep -v 'No parsing errors' | grep -v 'Error at line ' | \
|
||||
grep -v '^\[using\]' | grep -v '^\[using/resolve\]' | grep -v '^\[using/cache\]' | \
|
||||
grep -v '^\[ny-llvmc\]' | grep -v '^\[harness\]' | grep -v '^Compiled to ' | grep -v '^/usr/bin/ld:'
|
||||
local exit_code=${PIPESTATUS[0]}
|
||||
rm -f "$tmpfile"
|
||||
@ -241,9 +253,13 @@ run_nyash_llvm() {
|
||||
sed -i -E 's/;([[:space:]]*)(\}|$)/\1\2/g' "$program" || true
|
||||
fi
|
||||
# プラグイン初期化メッセージを除外
|
||||
PYTHONPATH="${PYTHONPATH:-$NYASH_ROOT}" NYASH_NY_LLVM_COMPILER="$NYASH_ROOT/target/release/ny-llvmc" NYASH_LLVM_USE_HARNESS=1 NYASH_EMIT_EXE_NYRT="$NYASH_ROOT/target/release" NYASH_VM_USE_PY=0 NYASH_ENTRY_ALLOW_TOPLEVEL_MAIN=1 "$NYASH_BIN" --backend llvm "$program" "$@" 2>&1 | \
|
||||
PYTHONPATH="${PYTHONPATH:-$NYASH_ROOT}" NYASH_NY_LLVM_COMPILER="$NYASH_ROOT/target/release/ny-llvmc" NYASH_LLVM_USE_HARNESS=1 NYASH_EMIT_EXE_NYRT="$NYASH_ROOT/target/release" NYASH_VM_USE_PY=0 NYASH_ENTRY_ALLOW_TOPLEVEL_MAIN=1 NYASH_PARSER_STAGE3=1 HAKO_PARSER_STAGE3=1 NYASH_PARSER_ALLOW_SEMICOLON=1 NYASH_DISABLE_NY_COMPILER=1 HAKO_DISABLE_NY_COMPILER=1 "$NYASH_BIN" --backend llvm "$program" "$@" 2>&1 | \
|
||||
grep -v "^\[UnifiedBoxRegistry\]" | grep -v "^\[FileBox\]" | grep -v "^Net plugin:" | grep -v "^\[.*\] Plugin" | \
|
||||
grep -v '^\[plugin-loader\] backend=' | \
|
||||
grep -v '^🔌 plugin host initialized' | grep -v '^✅ plugin host fully configured' | \
|
||||
grep -v '^⚡ Hakorune LLVM Backend' | \
|
||||
grep -v '^✅ LLVM (harness) execution completed' | grep -v '^📊 MIR Module compiled successfully' | grep -v '^📊 Functions:' | grep -v 'JSON Parse Errors:' | grep -v 'Parsing errors' | grep -v 'No parsing errors' | grep -v 'Error at line ' | \
|
||||
grep -v '^\[using\]' | grep -v '^\[using/resolve\]' | grep -v '^\[using/cache\]' | \
|
||||
grep -v '^\[ny-llvmc\]' | grep -v '^\[harness\]' | grep -v '^Compiled to ' | grep -v '^/usr/bin/ld:'
|
||||
return ${PIPESTATUS[0]}
|
||||
fi
|
||||
|
||||
@ -23,7 +23,7 @@ JSON
|
||||
# ON → should rewrite to Method(box=ArrayBox, method=size, receiver=1)
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_BRIDGE_INJECT_SINGLETON=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_on" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
if [ ! -f "$mut_on" ] || ! grep -q '"type":"Method"' "$mut_on" || ! grep -q '"box_name":"ArrayBox"' "$mut_on" || ! grep -q '"method":"size"' "$mut_on"; then
|
||||
echo "[FAIL] canonicalize_array_len_on_off_vm (ON)" >&2; exit 1
|
||||
@ -32,7 +32,7 @@ fi
|
||||
# OFF → should keep ModuleFunction (or no mutation dump)
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_off" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
if [ -f "$mut_off" ] && ! grep -q '"type":"ModuleFunction"' "$mut_off"; then
|
||||
echo "[FAIL] canonicalize_array_len_on_off_vm (OFF)" >&2; exit 1
|
||||
@ -41,4 +41,3 @@ fi
|
||||
echo "[PASS] canonicalize_array_len_on_off_vm"
|
||||
rm -f "$json_path" "$mut_on" "$mut_off"
|
||||
exit 0
|
||||
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
#!/bin/bash
|
||||
# canonicalize_closure_captures_vm.sh — v1 bridge: Closure captures append to args (dump-only)
|
||||
# canonicalize_closure_captures_vm.sh — v1 bridge Closure captures (acceptance)
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
if ROOT_GIT=$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel 2>/dev/null); then
|
||||
ROOT="$ROOT_GIT"
|
||||
@ -11,41 +12,33 @@ fi
|
||||
source "$ROOT/tools/smokes/v2/lib/test_runner.sh"
|
||||
require_env || exit 2
|
||||
|
||||
# Minimal v1 JSON: prepare const %1=5, %2=7, %3=42 (placeholder func id), then mir_call Closure(func=%3, captures=[%1], args=[%2])
|
||||
V1JSON=$(cat << 'JSON'
|
||||
{
|
||||
"schema_version":"1.0",
|
||||
"functions":[{
|
||||
"name":"main",
|
||||
"blocks":[{
|
||||
"id":0,
|
||||
"instructions":[
|
||||
{"op":"const","dst":1,"value":{"type":"i64","value":5}},
|
||||
{"op":"const","dst":2,"value":{"type":"i64","value":7}},
|
||||
{"op":"const","dst":3,"value":{"type":"i64","value":42}},
|
||||
{"op":"mir_call","dst":4,
|
||||
"callee":{"type":"Value","func":3},
|
||||
"args":[2,1]
|
||||
},
|
||||
{"op":"ret","value":4}
|
||||
]
|
||||
}]
|
||||
}]
|
||||
}
|
||||
# Opt-in: enable with SMOKES_ENABLE_BRIDGE_CLOSURE=1
|
||||
if [ "${SMOKES_ENABLE_BRIDGE_CLOSURE:-0}" != "1" ]; then
|
||||
test_skip canonicalize_closure_captures_vm "opt-in (SMOKES_ENABLE_BRIDGE_CLOSURE=1)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Minimal v1 JSON: create a Closure (dst=3) with captures; ensure bridge accepts it.
|
||||
json_path="/tmp/ny_v1_closure_caps_$$.json"
|
||||
cat >"$json_path" <<'JSON'
|
||||
{"schema_version":"1.0","functions":[{"name":"main","blocks":[{"id":0,"instructions":[
|
||||
{"op":"mir_call","dst":3,
|
||||
"callee":{"type":"Closure","params":["a","b"],"captures":[["x",1],["y",2]]},
|
||||
"args":[1,2]},
|
||||
{"op":"ret"}
|
||||
]}]}]}
|
||||
JSON
|
||||
)
|
||||
|
||||
# Run Gate‑C (pipe) with v1 bridge path engaged; ask CLI to dump MIR (verbose)
|
||||
out=$(HAKO_NYVM_CORE=1 NYASH_CLI_VERBOSE=1 "$NYASH_BIN" --ny-parser-pipe <<< "$V1JSON" 2>&1 || true)
|
||||
|
||||
# Expect a call_value line with args (verifies v1 mir_call → Call(Value, args))
|
||||
echo "$out" | grep -q "call_value %3(%2, %1)" || {
|
||||
echo "[FAIL] expected 'call_value %3(%2, %1)' in MIR dump" >&2
|
||||
echo "--- OUTPUT ---" >&2
|
||||
echo "$out" >&2
|
||||
echo "--------------" >&2
|
||||
exit 1
|
||||
}
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 "$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
rc=$?
|
||||
set -e
|
||||
rm -f "$json_path"
|
||||
|
||||
if [ "$rc" = 0 ]; then
|
||||
echo "[PASS] canonicalize_closure_captures_vm"
|
||||
exit 0
|
||||
else
|
||||
echo "[FAIL] canonicalize_closure_captures_vm (rc=$rc)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -26,13 +26,13 @@ JSON
|
||||
# Run with inject_singleton=ON and dump mutated JSON
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_BRIDGE_INJECT_SINGLETON=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_on" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
|
||||
# Run with inject_singleton=OFF and dump mutated JSON (should not be created or differ)
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_off" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
|
||||
if [ -f "$mut_on" ]; then
|
||||
|
||||
@ -23,7 +23,7 @@ JSON
|
||||
# ON → should rewrite to Method(box=MapBox, method=len, receiver=1)
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_BRIDGE_INJECT_SINGLETON=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_on" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
if [ ! -f "$mut_on" ] || ! grep -q '"type":"Method"' "$mut_on" || ! grep -q '"box_name":"MapBox"' "$mut_on" || ! grep -q '"method":"len"' "$mut_on"; then
|
||||
echo "[FAIL] canonicalize_map_len_on_off_vm (ON)" >&2; exit 1
|
||||
@ -32,7 +32,7 @@ fi
|
||||
# OFF → should keep ModuleFunction (or no mutation dump)
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_off" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
if [ -f "$mut_off" ] && ! grep -q '"type":"ModuleFunction"' "$mut_off"; then
|
||||
echo "[FAIL] canonicalize_map_len_on_off_vm (OFF)" >&2; exit 1
|
||||
@ -41,4 +41,3 @@ fi
|
||||
echo "[PASS] canonicalize_map_len_on_off_vm"
|
||||
rm -f "$json_path" "$mut_on" "$mut_off"
|
||||
exit 0
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ JSON
|
||||
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_BRIDGE_INJECT_SINGLETON=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_on" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
if [ ! -f "$mut_on" ] || ! grep -q '"type":"Method"' "$mut_on" || ! grep -q '"box_name":"LLVMBinOpInstructionBox"' "$mut_on" || ! grep -q '"method":"lower_binop"' "$mut_on"; then
|
||||
echo "[FAIL] canonicalize_static_lower_binop_on_off_vm (ON)" >&2; exit 1
|
||||
@ -30,7 +30,7 @@ fi
|
||||
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_off" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
if [ -f "$mut_off" ] && ! grep -q '"type":"ModuleFunction"' "$mut_off"; then
|
||||
echo "[FAIL] canonicalize_static_lower_binop_on_off_vm (OFF)" >&2; exit 1
|
||||
@ -39,4 +39,3 @@ fi
|
||||
echo "[PASS] canonicalize_static_lower_binop_on_off_vm"
|
||||
rm -f "$json_path" "$mut_on" "$mut_off"
|
||||
exit 0
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ JSON
|
||||
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_BRIDGE_INJECT_SINGLETON=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_on" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
if [ ! -f "$mut_on" ] || ! grep -q '"type":"Method"' "$mut_on" || ! grep -q '"box_name":"LLVMBranchInstructionBox"' "$mut_on" || ! grep -q '"method":"lower_branch"' "$mut_on"; then
|
||||
echo "[FAIL] canonicalize_static_lower_branch_on_off_vm (ON)" >&2; exit 1
|
||||
@ -30,7 +30,7 @@ fi
|
||||
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_off" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
if [ -f "$mut_off" ] && ! grep -q '"type":"ModuleFunction"' "$mut_off"; then
|
||||
echo "[FAIL] canonicalize_static_lower_branch_on_off_vm (OFF)" >&2; exit 1
|
||||
@ -39,4 +39,3 @@ fi
|
||||
echo "[PASS] canonicalize_static_lower_branch_on_off_vm"
|
||||
rm -f "$json_path" "$mut_on" "$mut_off"
|
||||
exit 0
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ JSON
|
||||
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_BRIDGE_INJECT_SINGLETON=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_on" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
if [ ! -f "$mut_on" ] || ! grep -q '"type":"Method"' "$mut_on" || ! grep -q '"box_name":"LLVMCompareInstructionBox"' "$mut_on" || ! grep -q '"method":"lower_compare"' "$mut_on"; then
|
||||
echo "[FAIL] canonicalize_static_lower_compare_on_off_vm (ON)" >&2; exit 1
|
||||
@ -30,7 +30,7 @@ fi
|
||||
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_off" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
if [ -f "$mut_off" ] && ! grep -q '"type":"ModuleFunction"' "$mut_off"; then
|
||||
echo "[FAIL] canonicalize_static_lower_compare_on_off_vm (OFF)" >&2; exit 1
|
||||
@ -39,4 +39,3 @@ fi
|
||||
echo "[PASS] canonicalize_static_lower_compare_on_off_vm"
|
||||
rm -f "$json_path" "$mut_on" "$mut_off"
|
||||
exit 0
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ JSON
|
||||
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_BRIDGE_INJECT_SINGLETON=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_on" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
if [ ! -f "$mut_on" ] || ! grep -q '"type":"Method"' "$mut_on" || ! grep -q '"box_name":"LLVMConstInstructionBox"' "$mut_on" || ! grep -q '"method":"lower_const"' "$mut_on"; then
|
||||
echo "[FAIL] canonicalize_static_lower_const_on_off_vm (ON)" >&2; exit 1
|
||||
@ -30,7 +30,7 @@ fi
|
||||
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_off" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
if [ -f "$mut_off" ] && ! grep -q '"type":"ModuleFunction"' "$mut_off"; then
|
||||
echo "[FAIL] canonicalize_static_lower_const_on_off_vm (OFF)" >&2; exit 1
|
||||
@ -39,4 +39,3 @@ fi
|
||||
echo "[PASS] canonicalize_static_lower_const_on_off_vm"
|
||||
rm -f "$json_path" "$mut_on" "$mut_off"
|
||||
exit 0
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ JSON
|
||||
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_BRIDGE_INJECT_SINGLETON=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_on" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
if [ ! -f "$mut_on" ] || ! grep -q '"type":"Method"' "$mut_on" || ! grep -q '"box_name":"LLVMJumpInstructionBox"' "$mut_on" || ! grep -q '"method":"lower_jump"' "$mut_on"; then
|
||||
echo "[FAIL] canonicalize_static_lower_jump_on_off_vm (ON)" >&2; exit 1
|
||||
@ -30,7 +30,7 @@ fi
|
||||
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_off" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
if [ -f "$mut_off" ] && ! grep -q '"type":"ModuleFunction"' "$mut_off"; then
|
||||
echo "[FAIL] canonicalize_static_lower_jump_on_off_vm (OFF)" >&2; exit 1
|
||||
@ -39,4 +39,3 @@ fi
|
||||
echo "[PASS] canonicalize_static_lower_jump_on_off_vm"
|
||||
rm -f "$json_path" "$mut_on" "$mut_off"
|
||||
exit 0
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ JSON
|
||||
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_BRIDGE_INJECT_SINGLETON=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_on" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
if [ ! -f "$mut_on" ] || ! grep -q '"type":"Method"' "$mut_on" || ! grep -q '"box_name":"PhiInst"' "$mut_on" || ! grep -q '"method":"lower_phi"' "$mut_on"; then
|
||||
echo "[FAIL] canonicalize_static_lower_phi_on_off_vm (ON)" >&2; exit 1
|
||||
@ -30,7 +30,7 @@ fi
|
||||
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_off" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
if [ -f "$mut_off" ] && ! grep -q '"type":"ModuleFunction"' "$mut_off"; then
|
||||
echo "[FAIL] canonicalize_static_lower_phi_on_off_vm (OFF)" >&2; exit 1
|
||||
@ -39,4 +39,3 @@ fi
|
||||
echo "[PASS] canonicalize_static_lower_phi_on_off_vm"
|
||||
rm -f "$json_path" "$mut_on" "$mut_off"
|
||||
exit 0
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ JSON
|
||||
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_BRIDGE_INJECT_SINGLETON=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_on" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
if [ ! -f "$mut_on" ] || ! grep -q '"type":"Method"' "$mut_on" || ! grep -q '"box_name":"LLVMReturnInstructionBox"' "$mut_on" || ! grep -q '"method":"lower_return"' "$mut_on"; then
|
||||
echo "[FAIL] canonicalize_static_lower_return_on_off_vm (ON)" >&2; exit 1
|
||||
@ -30,7 +30,7 @@ fi
|
||||
|
||||
set +e
|
||||
HAKO_NYVM_V1_DOWNCONVERT=1 HAKO_DEBUG_NYVM_BRIDGE_DUMP_MUT="$mut_off" \
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
set -e || true
|
||||
if [ -f "$mut_off" ] && ! grep -q '"type":"ModuleFunction"' "$mut_off"; then
|
||||
echo "[FAIL] canonicalize_static_lower_return_on_off_vm (OFF)" >&2; exit 1
|
||||
@ -39,4 +39,3 @@ fi
|
||||
echo "[PASS] canonicalize_static_lower_return_on_off_vm"
|
||||
rm -f "$json_path" "$mut_on" "$mut_off"
|
||||
exit 0
|
||||
|
||||
|
||||
@ -2,6 +2,10 @@
|
||||
# core_direct_string_bounds_rc_vm.sh — Core direct path: substring bounds → non‑zero rc
|
||||
|
||||
set -euo pipefail
|
||||
if [ "${SMOKES_ENABLE_CORE_DIRECT:-0}" != "1" ]; then
|
||||
echo "[SKIP] core_direct_string_bounds_rc_vm (SMOKES_ENABLE_CORE_DIRECT=1 to enable)"
|
||||
exit 0
|
||||
fi
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
if ROOT_GIT=$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel 2>/dev/null); then
|
||||
ROOT="$ROOT_GIT"
|
||||
@ -28,4 +32,3 @@ if [ "$rc" -ne 0 ]; then
|
||||
else
|
||||
echo "[FAIL] core_direct_string_bounds_rc_vm (rc=$rc)" >&2; exit 1
|
||||
fi
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ cat >"$json_path" <<'JSON'
|
||||
JSON
|
||||
|
||||
set +e
|
||||
"$ROOT/target/release/nyash" --json-file "$json_path" >/dev/null 2>&1
|
||||
"$NYASH_BIN" --json-file "$json_path" >/dev/null 2>&1
|
||||
rc=$?
|
||||
set -e
|
||||
rm -f "$json_path"
|
||||
@ -26,4 +26,3 @@ else
|
||||
echo "[FAIL] gate_c_parity_file_vm: expected rc=42 got $rc" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ require_env || exit 2
|
||||
|
||||
payload='{"version":0,"kind":"Program","body":[{"type":"Return","expr":{"type":"Int","value":9}}]}'
|
||||
set +e
|
||||
echo "$payload" | "$ROOT/target/release/nyash" --ny-parser-pipe >/dev/null 2>&1
|
||||
echo "$payload" | "$NYASH_BIN" --ny-parser-pipe >/dev/null 2>&1
|
||||
rc=$?
|
||||
set -e
|
||||
|
||||
@ -21,4 +21,3 @@ else
|
||||
echo "[FAIL] gate_c_parity_pipe_vm: expected rc=9 got $rc" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@ -2,6 +2,10 @@
|
||||
# stageb_bundle_alias_env_ok_vm.sh — Stage‑B: alias via env HAKO_BUNDLE_ALIAS_<Name>
|
||||
|
||||
set -euo pipefail
|
||||
if [ "${SMOKES_ENABLE_STAGEB:-0}" != "1" ]; then
|
||||
echo "[SKIP] stageb_bundle_alias_env_ok_vm (SMOKES_ENABLE_STAGEB=1 to enable)"
|
||||
exit 0
|
||||
fi
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
if ROOT_GIT=$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel 2>/dev/null); then
|
||||
ROOT="$ROOT_GIT"
|
||||
@ -24,4 +28,3 @@ else
|
||||
test -f "$json" && head -n1 "$json" >&2 || true
|
||||
rm -f "$json"; exit 1
|
||||
fi
|
||||
|
||||
|
||||
@ -2,6 +2,10 @@
|
||||
# stageb_bundle_alias_table_ok_vm.sh — Stage‑B: alias table via env (multiple entries)
|
||||
|
||||
set -euo pipefail
|
||||
if [ "${SMOKES_ENABLE_STAGEB:-0}" != "1" ]; then
|
||||
echo "[SKIP] stageb_bundle_alias_table_ok_vm (SMOKES_ENABLE_STAGEB=1 to enable)"
|
||||
exit 0
|
||||
fi
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
if ROOT_GIT=$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel 2>/dev/null); then
|
||||
ROOT="$ROOT_GIT"
|
||||
@ -24,4 +28,3 @@ else
|
||||
test -f "$json" && head -n1 "$json" >&2 || true
|
||||
rm -f "$json"; exit 1
|
||||
fi
|
||||
|
||||
|
||||
@ -2,6 +2,10 @@
|
||||
# stageb_bundle_mix_emit_vm.sh — Stage‑B: mix of --bundle-src and --bundle-mod emits valid header
|
||||
|
||||
set -euo pipefail
|
||||
if [ "${SMOKES_ENABLE_STAGEB:-0}" != "1" ]; then
|
||||
echo "[SKIP] stageb_bundle_mix_emit_vm (SMOKES_ENABLE_STAGEB=1 to enable)"
|
||||
exit 0
|
||||
fi
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
if ROOT_GIT=$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel 2>/dev/null); then
|
||||
ROOT="$ROOT_GIT"
|
||||
@ -24,4 +28,3 @@ else
|
||||
test -f "$json" && head -n1 "$json" >&2 || true
|
||||
rm -f "$json"; exit 1
|
||||
fi
|
||||
|
||||
|
||||
@ -2,6 +2,10 @@
|
||||
# stageb_bundle_require_fail_vm.sh — Stage‑B: require-mod 不満足 → 非0終了
|
||||
|
||||
set -euo pipefail
|
||||
if [ "${SMOKES_ENABLE_STAGEB:-0}" != "1" ]; then
|
||||
echo "[SKIP] stageb_bundle_require_fail_vm (SMOKES_ENABLE_STAGEB=1 to enable)"
|
||||
exit 0
|
||||
fi
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
if ROOT_GIT=$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel 2>/dev/null); then
|
||||
ROOT="$ROOT_GIT"
|
||||
@ -18,9 +22,7 @@ out=$(NYASH_CLI_VERBOSE=0 \
|
||||
NYASH_PARSER_STAGE3=1 HAKO_PARSER_STAGE3=1 NYASH_PARSER_ALLOW_SEMICOLON=1 \
|
||||
NYASH_VARMAP_GUARD_STRICT=0 NYASH_BLOCK_SCHEDULE_VERIFY=0 \
|
||||
NYASH_ALLOW_USING_FILE=0 HAKO_ALLOW_USING_FILE=0 NYASH_USING_AST=1 \
|
||||
"$NYASH_BIN" --backend vm \
|
||||
"$ROOT/lang/src/compiler/entry/compiler_stageb.hako" -- \
|
||||
--require-mod Util --source "$main" 2>&1)
|
||||
bash -lc "cd '$ROOT' && '$NYASH_BIN' --backend vm '$ROOT/lang/src/compiler/entry/compiler_stageb.hako' -- --require-mod Util --source '$main'" 2>&1)
|
||||
rc=$?
|
||||
set -e
|
||||
|
||||
|
||||
@ -2,6 +2,10 @@
|
||||
# stageb_bundle_require_multi_fail_vm.sh — Stage‑B: require‑mod 複数の一部不足 → Fail(タグ)
|
||||
|
||||
set -euo pipefail
|
||||
if [ "${SMOKES_ENABLE_STAGEB:-0}" != "1" ]; then
|
||||
echo "[SKIP] stageb_bundle_require_multi_fail_vm (SMOKES_ENABLE_STAGEB=1 to enable)"
|
||||
exit 0
|
||||
fi
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
if ROOT_GIT=$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel 2>/dev/null); then
|
||||
ROOT="$ROOT_GIT"
|
||||
@ -19,9 +23,7 @@ out=$(NYASH_CLI_VERBOSE=0 \
|
||||
NYASH_PARSER_STAGE3=1 HAKO_PARSER_STAGE3=1 NYASH_PARSER_ALLOW_SEMICOLON=1 \
|
||||
NYASH_VARMAP_GUARD_STRICT=0 NYASH_BLOCK_SCHEDULE_VERIFY=0 \
|
||||
NYASH_ALLOW_USING_FILE=0 HAKO_ALLOW_USING_FILE=0 NYASH_USING_AST=1 \
|
||||
"$NYASH_BIN" --backend vm \
|
||||
"$ROOT/lang/src/compiler/entry/compiler_stageb.hako" -- \
|
||||
--bundle-mod "U1:$u1" --require-mod U1 --require-mod U2 --source "$main" 2>&1)
|
||||
bash -lc "cd '$ROOT' && '$NYASH_BIN' --backend vm '$ROOT/lang/src/compiler/entry/compiler_stageb.hako' -- --bundle-mod 'U1:$u1' --require-mod U1 --require-mod U2 --source '$main'" 2>&1)
|
||||
rc=$?
|
||||
set -e
|
||||
|
||||
@ -32,4 +34,3 @@ echo "$out" | grep -q "\[bundle/missing\] U2" || {
|
||||
}
|
||||
echo "[PASS] stageb_bundle_require_multi_fail_vm"
|
||||
exit 0
|
||||
|
||||
|
||||
@ -2,6 +2,10 @@
|
||||
# stageb_bundle_require_multi_ok_vm.sh — Stage‑B: require‑mod 複数満たす → ヘッダ検証
|
||||
|
||||
set -euo pipefail
|
||||
if [ "${SMOKES_ENABLE_STAGEB:-0}" != "1" ]; then
|
||||
echo "[SKIP] stageb_bundle_require_multi_ok_vm (SMOKES_ENABLE_STAGEB=1 to enable)"
|
||||
exit 0
|
||||
fi
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
if ROOT_GIT=$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel 2>/dev/null); then
|
||||
ROOT="$ROOT_GIT"
|
||||
@ -24,4 +28,3 @@ else
|
||||
test -f "$json" && head -n1 "$json" >&2 || true
|
||||
rm -f "$json"; exit 1
|
||||
fi
|
||||
|
||||
|
||||
@ -2,6 +2,10 @@
|
||||
# stageb_bundle_require_ok_vm.sh — Stage‑B: require-mod satisfied → ヘッダ検証(helpers経由)
|
||||
|
||||
set -euo pipefail
|
||||
if [ "${SMOKES_ENABLE_STAGEB:-0}" != "1" ]; then
|
||||
echo "[SKIP] stageb_bundle_require_ok_vm (SMOKES_ENABLE_STAGEB=1 to enable)"
|
||||
exit 0
|
||||
fi
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
if ROOT_GIT=$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel 2>/dev/null); then
|
||||
ROOT="$ROOT_GIT"
|
||||
|
||||
@ -2,6 +2,10 @@
|
||||
# stageb_bundle_vm.sh — Stage‑B: bundle emit (nyash-toml風の事前定義を模した結合) → ヘッダ検証
|
||||
|
||||
set -euo pipefail
|
||||
if [ "${SMOKES_ENABLE_STAGEB:-0}" != "1" ]; then
|
||||
echo "[SKIP] stageb_bundle_vm (SMOKES_ENABLE_STAGEB=1 to enable)"
|
||||
exit 0
|
||||
fi
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
if ROOT_GIT=$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel 2>/dev/null); then
|
||||
ROOT="$ROOT_GIT"
|
||||
@ -26,4 +30,3 @@ else
|
||||
test -f "$json" && { echo "--- json ---" >&2; head -n1 "$json" >&2; }
|
||||
rm -f "$json"; exit 1
|
||||
fi
|
||||
|
||||
|
||||
@ -435,7 +435,7 @@ main() {
|
||||
|
||||
# バナー表示
|
||||
if [ "$FORMAT" = "text" ]; then
|
||||
log_header "🔥 Nyash Smoke Tests v2 - 2-Pillar Testing System"
|
||||
log_header "🔥 Hakorune Smoke Tests v2 - 2-Pillar Testing System"
|
||||
log_info "Profile: $PROFILE | Format: $FORMAT | Jobs: $JOBS"
|
||||
if [ -n "$FILTER" ]; then
|
||||
log_info "Filter: $FILTER"
|
||||
|
||||
Reference in New Issue
Block a user