nyash-codex
647ee05d06
fix(emit): stabilize Stage-B wrapper with temp file approach
Root Cause:
- Subshell CODE expansion became path literal "/cat/tmp/matmul.hako"
- Variable lost in nested subshell with cd command
- All benchmark cases (matmul, arraymap, etc.) failed emit
Solution:
- Temp file approach with trap cleanup (CODE_TMP=$(mktemp))
- 3-tier fallback extraction (Python→awk→ruby)
- Enhanced diagnostics with HAKO_SELFHOST_TRACE=1
- Pre-check SKIP logic in microbench for unstable emit
Changes:
- tools/hakorune_emit_mir.sh
- Temp file approach eliminates subshell variable issues
- extract_program_json now has 3 fallback strategies
- Detailed trace output for debugging
- Variable scope fixes (local → script level)
- tools/perf/microbench.sh
- matmul pre-check with SKIP + diagnostic hint
- Prevents false benchmark results on emit failure
Test Results:
✅ loop: 936 bytes rc=0
✅ call: 330 bytes rc=0
✅ stringchain: 313 bytes rc=0
✅ arraymap: 422 bytes rc=0
✅ matmul: 7731 bytes rc=0 (FIXED!)
✅ CI guard: emit_provider_no_jsonfrag_canary PASS
Impact:
- All benchmark cases now emit MIR successfully
- Stable execution without subshell variable bugs
- Comprehensive diagnostics for future debugging
- Foundation for provider-first optimization
Next: Apply AotPrep to optimize Array/Map hot paths
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-13 22:52:25 +09:00
..
2025-11-13 22:52:25 +09:00
2025-11-04 16:33:04 +09:00
2025-11-13 20:16:20 +09:00
2025-11-13 16:40:58 +09:00
2025-11-04 16:33:04 +09:00
2025-11-04 16:33:04 +09:00
2025-11-04 16:33:04 +09:00
2025-10-31 20:45:46 +09:00
2025-11-10 23:17:46 +09:00
2025-10-31 20:45:46 +09:00
2025-11-09 15:11:18 +09:00
2025-11-10 19:42:42 +09:00
2025-10-31 20:45:46 +09:00