Phase 285LLVM-1.1 to 1.4 + weak reference infrastructure: **LLVM Harness** (Phase 285LLVM-1.x): - 285LLVM-1.1: User Box registration & debug output - 285LLVM-1.2: WeakRef basic operations (identity deferred) - 285LLVM-1.3: InstanceBox field access (getField/setField) - 285LLVM-1.4: print Handle resolution (type tag propagation) **VM Runtime** (nyash_kernel): - FFI functions: nyrt_weak_new, nyrt_weak_to_strong, nyrt_weak_drop (crates/nyash_kernel/src/lib.rs: +209 lines) - WeakRef plugin invoke support (crates/nyash_kernel/src/plugin/invoke.rs: +250 lines) - weak_handles.rs: WeakRef handle registry (NEW) **LLVM Python Backend**: - WeakRef instruction lowering (weak.py: NEW) - Entry point integration (entry.py: +93 lines) - Instruction lowering (instruction_lower.py: +13 lines) - LLVM harness runner script (tools/run_llvm_harness.sh: NEW) **MIR & Runtime**: - WeakRef emission & validation - MIR JSON export for weak instructions - Environment variable support (NYASH_WEAK_*, HAKO_WEAK_*) **Documentation**: - CLAUDE.md: Phase 285 completion notes - LANGUAGE_REFERENCE_2025.md: Weak reference syntax - 10-Now.md & 30-Backlog.md: Phase 285 status updates Total: +864 lines, 24 files changed SSOT: docs/reference/language/lifecycle.md Related: Phase 285W-Syntax-0, Phase 285W-Syntax-0.1
56 lines
1.4 KiB
Bash
56 lines
1.4 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
usage() {
|
|
cat << USAGE
|
|
Usage: tools/run_llvm_harness.sh <input.hako> [-- <args...>]
|
|
|
|
Builds LLVM-harness prerequisites and runs the program via:
|
|
NYASH_LLVM_USE_HARNESS=1 ./target/release/hakorune --backend llvm <input.hako>
|
|
USAGE
|
|
}
|
|
|
|
if [[ $# -lt 1 ]]; then
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
INPUT="$1"
|
|
shift || true
|
|
|
|
if [[ "$INPUT" == "-h" || "$INPUT" == "--help" ]]; then
|
|
usage
|
|
exit 0
|
|
fi
|
|
|
|
if [[ ! -f "$INPUT" ]]; then
|
|
echo "error: input file not found: $INPUT" >&2
|
|
exit 1
|
|
fi
|
|
|
|
CARGO_TARGET_DIR_EFFECTIVE="${CARGO_TARGET_DIR:-$PWD/target}"
|
|
BIN_DEFAULT="$CARGO_TARGET_DIR_EFFECTIVE/release/hakorune"
|
|
BIN="${NYASH_BIN:-$BIN_DEFAULT}"
|
|
|
|
echo "[1/4] Building hakorune (llvm feature)..."
|
|
cargo build --release -p nyash-rust --features llvm --bin hakorune -j 24
|
|
|
|
echo "[2/4] Building ny-llvmc..."
|
|
cargo build --release -p nyash-llvm-compiler -j 24
|
|
|
|
echo "[3/4] Building nyash_kernel..."
|
|
cargo build --release -p nyash_kernel -j 24
|
|
|
|
if [[ ! -x "$BIN" ]]; then
|
|
if [[ -x "$CARGO_TARGET_DIR_EFFECTIVE/release/nyash" ]]; then
|
|
BIN="$CARGO_TARGET_DIR_EFFECTIVE/release/nyash"
|
|
else
|
|
echo "error: compiler binary not found/executable after build: $BIN" >&2
|
|
echo "hint: ensure NYASH_BIN points to an existing binary or set CARGO_TARGET_DIR correctly" >&2
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
echo "[4/4] Running LLVM harness..."
|
|
NYASH_LLVM_USE_HARNESS=1 "$BIN" --backend llvm "$INPUT" "$@"
|