Files
hakorune/tools/cross_backend_smoke.sh
Moe Charm 11506cee3b Phase 11-12: LLVM backend initial, semantics layer, plugin unification
Major changes:
- LLVM backend initial implementation (compiler.rs, llvm mode)
- Semantics layer integration in interpreter (operators.rs)
- Phase 12 plugin architecture revision (3-layer system)
- Builtin box removal preparation
- MIR instruction set documentation (26→Core-15 migration)
- Cross-backend testing infrastructure
- Await/nowait syntax support

New features:
- LLVM AOT compilation support (--backend llvm)
- Semantics layer for interpreter→VM flow
- Tri-backend smoke tests
- Plugin-only registry mode

Bug fixes:
- Interpreter plugin box arithmetic operations
- Branch test returns incorrect values

Documentation:
- Phase 12 README.md updated with new plugin architecture
- Removed obsolete NYIR proposals
- Added LLVM test programs documentation

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 23:44:34 +09:00

51 lines
1.1 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
if [ $# -lt 1 ]; then
echo "usage: $0 <path/to/app.nyash>" >&2
exit 1
fi
APP="$1"
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
BIN="$ROOT_DIR/target/release/nyash"
echo "[cross] build VM/JIT binary"
cargo build --release --features cranelift-jit >/dev/null
run_vm() {
echo "[cross] VM: $APP"
"$BIN" --backend vm "$APP" | tee /tmp/ny_vm.out
}
run_aot() {
if [ ! -x "$ROOT_DIR/tools/build_llvm.sh" ]; then
echo "[cross] skip AOT (tools/build_llvm.sh not found)"; return 0; fi
echo "[cross] AOT emit+link: $APP"
pushd "$ROOT_DIR" >/dev/null
tools/build_llvm.sh "$APP" -o /tmp/ny_app >/dev/null
echo "[cross] EXE: /tmp/ny_app"
/tmp/ny_app | tee /tmp/ny_exe.out || true
popd >/dev/null
}
extract_result() {
rg -n "^Result: " -N "$1" | sed -E 's/.*Result: //' || true
}
run_vm
run_aot
VM_RES=$(extract_result /tmp/ny_vm.out)
EXE_RES=$(extract_result /tmp/ny_exe.out)
echo "[cross] VM Result: $VM_RES"
if [ -n "$EXE_RES" ]; then echo "[cross] EXE Result: $EXE_RES"; fi
if [ -n "$EXE_RES" ] && [ "$VM_RES" != "$EXE_RES" ]; then
echo "[cross] mismatch between VM and EXE" >&2
exit 2
fi
echo "[cross] OK"