Files
hakorune/tools/snapshot_mir.sh
Moe Charm bf4b87526e phase(9.78h): stabilize MIR/VM pipeline
- Add MIR26 doc≡code sync test (tests/mir_instruction_set_sync.rs)
- Quiet snapshots; filter plugin/net logs; golden all green
- Delegate VM phi selection to LoopExecutor (borrow-safe)
- ResultBox migration: remove legacy box_trait::ResultBox paths
- VM BoxRef arithmetic fallbacks via toString().parse::<i64>()
- Bridge BoxCall(InstanceBox) to Class.method/arity in VM
- Fix Effects purity (READ -> readonly, not pure)
- Mark Catch as CONTROL to prevent DCE; Try/Catch test green
- Add env-gated debug logs (effects, verifier, mir-printer, trycatch, ref, bin)
- Update CURRENT_TASK with progress and next steps
2025-08-26 05:49:23 +09:00

40 lines
1.0 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
echo "Usage: $0 <input.nyash> [output.txt]" >&2
echo "Dumps Builder-only MIR (--no-optimize) for reproducible snapshots." >&2
exit 2
fi
INPUT="$1"
OUTFILE="${2:-}"
if [ ! -f "$INPUT" ]; then
echo "Input not found: $INPUT" >&2
exit 1
fi
BIN="${NYASH_BIN:-./target/release/nyash}"
if [ ! -x "$BIN" ]; then
echo "nyash binary not found at $BIN. Build first: cargo build --release" >&2
exit 1
fi
CMD=("$BIN" --dump-mir --mir-verbose --no-optimize "$INPUT")
if [ -n "${NYASH_MIR_VERBOSE_EFFECTS:-}" ]; then
CMD=("$BIN" --dump-mir --mir-verbose --mir-verbose-effects --no-optimize "$INPUT")
fi
if [ -n "$OUTFILE" ]; then
mkdir -p "$(dirname "$OUTFILE")"
# Filter noisy plugin/runtime banners to stabilize snapshots
NYASH_CLI_VERBOSE=1 "${CMD[@]}" \
| grep -Ev '^(\[PluginLoaderV2\]|\[FileBox\]|Net plugin:)' \
| sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' > "$OUTFILE"
echo "Wrote MIR snapshot: $OUTFILE"
else
NYASH_CLI_VERBOSE=1 "${CMD[@]}"
fi