feat(llvm): Phase 131-15 - print/concat segfault 根治修正
## P1-1/P1-2: TypeFacts 優先化 - binop.py: operand facts が dst_type ヒントより優先 - mir_json_emit.rs: Unknown 時に dst_type を出さない - function_lower.py: value_types を metadata から読み込み ## P2: handle concat 統一(根治) - print シグネチャ修正: i64(i64) → void(i8*) - Mixed concat を handle ベースに統一: - concat_si/concat_is → concat_hh - box.from_i64 で integer を handle 化 - Everything is Box 哲学に統一 - legacy 関数は互換性のために保持 ## 結果 - ✅ print("Result: " + 3) → Result: 3 - ✅ segfault 解消 - ✅ Everything is Box 統一 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
| A | `apps/tests/phase87_llvm_exe_min.hako` | ✅ | ✅ | ✅ | **PASS** - Simple return 42, no BoxCall, exit code verified |
|
||||
| B | `apps/tests/loop_min_while.hako` | ✅ | ✅ | ✅ | **PASS** - Loop/PHI path runs end-to-end (Phase 131-10): prints `0,1,2` and exits |
|
||||
| B2 | `/tmp/case_b_simple.hako` | ✅ | ✅ | ✅ | **PASS** - Simple print(42) without loop works |
|
||||
| C | `apps/tests/llvm_stage3_loop_only.hako` | ✅ | ✅ | ⚠️ | **TAG-RUN** - Runs but result mismatch (VM ok / LLVM wrong) |
|
||||
| C | `apps/tests/llvm_stage3_loop_only.hako` | ✅ | ✅ | ⚠️ | **TAG-RUN** - Loop ok; print/concat path segfaults |
|
||||
|
||||
## Root Causes Identified
|
||||
|
||||
@ -202,15 +202,18 @@ static box Main {
|
||||
- A loop-carrier PHI type-cycle bug was fixed by seeding the PHI type from the entry(init) value (Phase 131-11 H).
|
||||
- Root cause report: `docs/development/current/main/phase-131-11-g-phi-type-bug-report.md`
|
||||
|
||||
**Current issue**: **TAG-RUN (wrong result)**
|
||||
VM and MIR look correct, but LLVM output does not match expected result for Case C.
|
||||
**Current issue**: **TAG-RUN (segfault in print/concat)**
|
||||
Loop/carrier propagation is now consistent enough to run iterations, but the post-loop `print("Result: " + counter)` path segfaults.
|
||||
|
||||
**Next actions**:
|
||||
- Dump LLVM IR (`NYASH_LLVM_DUMP_IR=...`) and trace PHI/value resolution (`NYASH_LLVM_TRACE_PHI=1`, `NYASH_LLVM_TRACE_VALUES=1`).
|
||||
- Reduce Case C to isolate whether the bug is “loop value” or “string concat/print path”:
|
||||
- `return counter` (no string concat)
|
||||
- `print(counter)` (no `"Result: " + ...`)
|
||||
- Compare with VM and inspect the IR use-sites.
|
||||
- Use strict mode + traces to catch the first wrong value/ABI boundary:
|
||||
- `NYASH_LLVM_STRICT=1`, `NYASH_LLVM_TRACE_VALUES=1`, `NYASH_LLVM_TRACE_PHI=1`
|
||||
- Reduce to isolate the failing segment:
|
||||
- `return counter` (no print)
|
||||
- `print(counter)` (no concat)
|
||||
- `print("Result: " + counter)` (concat + print)
|
||||
- Dump IR around concat/externcall:
|
||||
- `NYASH_LLVM_DUMP_IR=/tmp/case_c.ll`
|
||||
|
||||
**Update (Phase 131-13)**:
|
||||
- snapshot-only + strict resolver により、Case C の不一致が “LLVM の値解決バグ” ではなく
|
||||
|
||||
Reference in New Issue
Block a user