diff --git a/README.ja.md b/README.ja.md index 88a0b81b..27eb9c3a 100644 --- a/README.ja.md +++ b/README.ja.md @@ -241,7 +241,7 @@ WASM/ブラウザ経路は現在メンテ対象外です(CI未対象)。古 `hako.toml`(互換: `nyash.toml`)の `[tasks]` と `[env]` で、ビルド/スモークなどのタスクを簡単に実行できます(MVP)。 -例(nyash.toml の末尾に追記): +例(`hako.toml` もしくは互換の `nyash.toml` の末尾に追記): ``` [env] @@ -299,7 +299,7 @@ $NYASH_BIN --build hako.toml \ ``` 主なオプション(最小) -- `--build `: nyash.toml の場所 +- `--build `: `hako.toml` の場所(互換: `nyash.toml`) - `--app `: エントリ `.nyash` - `--out `: 出力EXE名(既定: `app`/`app.exe`) - `--build-aot cranelift|llvm`(既定: cranelift) @@ -387,7 +387,7 @@ box EnhancedArray from ArrayBox { Nyashは「Everything is Plugin」アーキテクチャを開拓: ```toml -# nyash.toml - プラグイン設定 +# hako.toml(互換: nyash.toml) - プラグイン設定 [libraries."libnyash_python_plugin.so"] boxes = ["PyRuntimeBox", "PyObjectBox"] diff --git a/README.md b/README.md index 082b88f9..152affd0 100644 --- a/README.md +++ b/README.md @@ -290,7 +290,7 @@ The WASM/browser path is currently not maintained and is not part of CI. The old ## 🧰 One‑Command Build (MVP): `nyash --build` -Reads `hako.toml` (compat: 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 @@ -300,7 +300,7 @@ $NYASH_BIN --build hako.toml \ ``` Key options (minimal) -- `--build `: path to nyash.toml +- `--build `: path to `hako.toml` (compat: `nyash.toml`) - `--app `: entry `.nyash` - `--out `: output executable (default: `app`/`app.exe`) - `--build-aot cranelift|llvm` (default: cranelift) @@ -467,7 +467,7 @@ typedef struct { ### Plugin Configuration ```toml -# nyash.toml v3.0 - Unified plugin support +# hako.toml v3.0 (compat: nyash.toml) - Unified plugin support [plugins.map] path = "plugins/map.so" abi = "c" # Traditional C ABI diff --git a/tools/selfhost/selfhost_build.sh b/tools/selfhost/selfhost_build.sh index 9eff1ec3..e587e18f 100644 --- a/tools/selfhost/selfhost_build.sh +++ b/tools/selfhost/selfhost_build.sh @@ -27,6 +27,7 @@ JSON_OUT="" MIR_OUT="" EXE_OUT="" DO_RUN=0 +KEEP_TMP=0 while [ $# -gt 0 ]; do case "$1" in @@ -34,6 +35,7 @@ while [ $# -gt 0 ]; do --json) JSON_OUT="$2"; shift 2;; --run) DO_RUN=1; shift;; --mir) MIR_OUT="$2"; shift 2;; + --keep-tmp) KEEP_TMP=1; shift;; --exe) EXE_OUT="$2"; shift 2;; *) echo "[selfhost] unknown arg: $1" >&2; exit 2;; esac @@ -122,8 +124,10 @@ if [ -n "$EXE_OUT" ]; then "$NYLL" --in "$MIR_TMP" --emit exe --nyrt "$NYRT_DIR" --out "$EXE_OUT" # Cleanup - if [ -z "$JSON_OUT" ]; then rm -f "$tmp_json" 2>/dev/null || true; fi - if [ -z "$MIR_OUT" ]; then rm -f "$MIR_TMP" 2>/dev/null || true; fi + if [ "$KEEP_TMP" != "1" ]; then + if [ -z "$JSON_OUT" ]; then rm -f "$tmp_json" 2>/dev/null || true; fi + if [ -z "$MIR_OUT" ]; then rm -f "$MIR_TMP" 2>/dev/null || true; fi + fi exit 0 fi @@ -135,7 +139,7 @@ if [ "$DO_RUN" = "1" ]; then "$BIN" --json-file "$tmp_json" >/dev/null 2>&1 rc=$? set -e - if [ -z "$JSON_OUT" ]; then rm -f "$tmp_json" 2>/dev/null || true; fi + if [ "$KEEP_TMP" != "1" ] && [ -z "$JSON_OUT" ]; then rm -f "$tmp_json" 2>/dev/null || true; fi exit $rc else # Emit-only diff --git a/tools/smokes/v2/profiles/quick/core/core_direct_array_oob_set_rc_vm.sh b/tools/smokes/v2/profiles/quick/core/core_direct_array_oob_set_rc_vm.sh new file mode 100644 index 00000000..2128578c --- /dev/null +++ b/tools/smokes/v2/profiles/quick/core/core_direct_array_oob_set_rc_vm.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# core_direct_array_oob_set_rc_vm.sh — Core Direct: array out-of-bounds set → non‑zero rc + +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" +else + ROOT="$(cd "$SCRIPT_DIR/../../../../../../../../.." && pwd)" +fi +source "$ROOT/tools/smokes/v2/lib/test_runner.sh" +source "$ROOT/tools/smokes/v2/lib/stageb_helpers.sh" +require_env || exit 2 + +# Set index=5 on a 3-size array → OOB should trigger rc != 0 under Core‑Direct +code='static box Main { method main(args) { local a=ArrayBox(); a.push(1); a.push(2); a.push(3); a.set(5, 9); return 0 } }' +json=$(stageb_compile_to_json "$code") || { echo "[FAIL] core_direct_array_oob_set_rc_vm (emit failed)" >&2; exit 1; } + +set +e +NYASH_GATE_C_CORE=1 HAKO_GATE_C_CORE=1 HAKO_CORE_DIRECT=1 \ + NYASH_QUIET=1 HAKO_QUIET=1 NYASH_CLI_VERBOSE=0 NYASH_NYRT_SILENT_RESULT=1 \ + "$NYASH_BIN" --json-file "$json" >/dev/null 2>&1 +rc=$? +set -e +rm -f "$json" + +if [ "$rc" -ne 0 ]; then + echo "[PASS] core_direct_array_oob_set_rc_vm" +else + echo "[FAIL] core_direct_array_oob_set_rc_vm (rc=$rc)" >&2; exit 1 +fi + diff --git a/tools/smokes/v2/profiles/quick/core/core_direct_map_bad_key_rc_vm.sh b/tools/smokes/v2/profiles/quick/core/core_direct_map_bad_key_rc_vm.sh new file mode 100644 index 00000000..dc171ffb --- /dev/null +++ b/tools/smokes/v2/profiles/quick/core/core_direct_map_bad_key_rc_vm.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# core_direct_map_bad_key_rc_vm.sh — Core Direct: Map.get with non-string key → non‑zero rc + +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" +else + ROOT="$(cd "$SCRIPT_DIR/../../../../../../../../.." && pwd)" +fi +source "$ROOT/tools/smokes/v2/lib/test_runner.sh" +source "$ROOT/tools/smokes/v2/lib/stageb_helpers.sh" +require_env || exit 2 + +# Map.get requires string key; using int key should raise [map/bad-key] and map to rc != 0 +code='static box Main { method main(args) { local m=MapBox(); local x=m.get(123); return 0 } }' +json=$(stageb_compile_to_json "$code") || { echo "[FAIL] core_direct_map_bad_key_rc_vm (emit failed)" >&2; exit 1; } + +set +e +NYASH_GATE_C_CORE=1 HAKO_GATE_C_CORE=1 HAKO_CORE_DIRECT=1 \ + NYASH_QUIET=1 HAKO_QUIET=1 NYASH_CLI_VERBOSE=0 NYASH_NYRT_SILENT_RESULT=1 \ + "$NYASH_BIN" --json-file "$json" >/dev/null 2>&1 +rc=$? +set -e +rm -f "$json" + +if [ "$rc" -ne 0 ]; then + echo "[PASS] core_direct_map_bad_key_rc_vm" +else + echo "[FAIL] core_direct_map_bad_key_rc_vm (rc=$rc)" >&2; exit 1 +fi +