feat(phase21.5/22.1): MirBuilder JsonFrag refactor + FileBox ring-1 + registry tests
Phase 21.5 (AOT/LLVM Optimization Prep) - FileBox ring-1 (core-ro) provider: priority=-100, always available, no panic path - src/runner/modes/common_util/provider_registry.rs: CoreRoFileProviderFactory - Auto-registers at startup, eliminates fallback panic structurally - StringBox fast path prototypes (length/size optimization) - Performance benchmarks (C/Python/Hako comparison baseline) Phase 22.1 (JsonFrag Unification) - JsonFrag.last_index_of_from() for backward search (VM fallback) - Replace hand-written lastIndexOf in lower_loop_sum_bc_box.hako - SentinelExtractorBox for Break/Continue pattern extraction MirBuilder Refactor (Box → JsonFrag Migration) - 20+ lower_*_box.hako: Box-heavy → JsonFrag text assembly - MirBuilderMinBox: lightweight using set for dev env - Registry-only fast path with [registry:*] tag observation - pattern_util_box.hako: enhanced pattern matching Dev Environment & Testing - Dev toggles: SMOKES_DEV_PREINCLUDE=1 (point-enable), HAKO_MIR_BUILDER_SKIP_LOOPS=1 - phase2160: registry opt-in tests (array/map get/set/push/len) - content verification - phase2034: rc-dependent → token grep (grep -F based validation) - run_quick.sh: fast smoke testing harness - ENV documentation: docs/ENV_VARS.md Test Results ✅ quick phase2034: ALL GREEN (MirBuilder internal patterns) ✅ registry phase2160: ALL GREEN (array/map get/set/push/len) ✅ rc-dependent tests → content token verification complete ✅ PREINCLUDE policy: default OFF, point-enable only where needed Technical Notes - No INCLUDE by default (maintain minimalism) - FAIL_FAST=0 in Bring-up contexts only (explicit dev toggles) - Tag-based route observation ([mirbuilder/min:*], [registry:*]) - MIR structure validation (not just rc parity) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -24,15 +24,18 @@ TARGET=""
|
||||
NYRT_DIR=""
|
||||
VERIFY=0
|
||||
QUIET=0
|
||||
# Backend selection (21.11): default to 'crate' when ny-llvmc is available, otherwise fallback to llvmlite.
|
||||
# Explicit env NYASH_LLVM_BACKEND overrides this auto-detection.
|
||||
# Backend selection (21.13): default to 'crate' when ny-llvmc is available,
|
||||
# otherwise use 'native' when llc exists. llvmlite is deprecated from auto-select
|
||||
# and must be requested explicitly via NYASH_LLVM_BACKEND=llvmlite.
|
||||
if [[ -n "${NYASH_LLVM_BACKEND:-}" ]]; then
|
||||
BACKEND="${NYASH_LLVM_BACKEND}"
|
||||
else
|
||||
if [[ -x "./target/release/ny-llvmc" ]]; then
|
||||
BACKEND="crate"
|
||||
elif command -v llc >/dev/null 2>&1; then
|
||||
BACKEND="native"
|
||||
else
|
||||
BACKEND="llvmlite"
|
||||
BACKEND="crate" # keep for downstream case handling; will error gracefully later
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -61,7 +64,7 @@ if [[ -z "$OUT" ]]; then
|
||||
esac
|
||||
fi
|
||||
|
||||
# Require LLVM18 only for llvmlite backend
|
||||
# Require LLVM18 only for llvmlite backend (deprecated from auto-select)
|
||||
if [[ "${NYASH_LLVM_BACKEND:-$BACKEND}" == "llvmlite" ]]; then
|
||||
if ! command -v llvm-config-18 >/dev/null 2>&1; then
|
||||
echo "error: llvm-config-18 not found (install LLVM 18 dev)" >&2
|
||||
@ -144,6 +147,17 @@ case "$EMIT" in
|
||||
echo "error: llc not found (install LLVM tools)" >&2; exit 4
|
||||
fi
|
||||
rm -f "$OUT"
|
||||
# Optional verify: dump IR first and reject if PHI appears (simple guard)
|
||||
if [[ "${NYASH_LLVM_VERIFY_IR:-0}" == "1" ]]; then
|
||||
_TMP_LL=$(mktemp)
|
||||
if ! python3 "$PWD/tools/native_llvm_builder.py" --in "$IN_FILE" --emit ll --out "$_TMP_LL" >/dev/null 2>&1; then
|
||||
echo "error: native builder failed (ll)" >&2; rm -f "$_TMP_LL"; exit 4
|
||||
fi
|
||||
if grep -qE "[^a-zA-Z]phi[^a-zA-Z]" "$_TMP_LL"; then
|
||||
echo "error: IR verify failed (phi present)" >&2; rm -f "$_TMP_LL"; exit 4
|
||||
fi
|
||||
rm -f "$_TMP_LL"
|
||||
fi
|
||||
if ! python3 "$PWD/tools/native_llvm_builder.py" --in "$IN_FILE" --emit obj --out "$OUT" >/dev/null 2>&1; then
|
||||
echo "error: native builder failed" >&2; exit 4
|
||||
fi
|
||||
@ -179,6 +193,16 @@ case "$EMIT" in
|
||||
if ! command -v llc >/dev/null 2>&1; then
|
||||
echo "error: llc not found (install LLVM tools)" >&2; exit 4
|
||||
fi
|
||||
if [[ "${NYASH_LLVM_VERIFY_IR:-0}" == "1" ]]; then
|
||||
_TMP_LL=$(mktemp)
|
||||
if ! python3 "$PWD/tools/native_llvm_builder.py" --in "$IN_FILE" --emit ll --out "$_TMP_LL" >/dev/null 2>&1; then
|
||||
echo "error: native builder failed (ll)" >&2; rm -f "$_TMP_LL"; exit 4
|
||||
fi
|
||||
if grep -qE "[^a-zA-Z]phi[^a-zA-Z]" "$_TMP_LL"; then
|
||||
echo "error: IR verify failed (phi present)" >&2; rm -f "$_TMP_LL"; exit 4
|
||||
fi
|
||||
rm -f "$_TMP_LL"
|
||||
fi
|
||||
if ! python3 "$PWD/tools/native_llvm_builder.py" --in "$IN_FILE" --emit obj --out "$OBJ" >/dev/null 2>&1; then
|
||||
echo "error: native builder failed to produce object $OBJ" >&2; exit 4
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user