|
|
d8a1d97222
|
feat(joinir): Phase 41-4.1 Add NestedIfMerge JoinInst variant
Add structural support for nested if patterns with PHI-sensitive variables:
1. JoinInst::NestedIfMerge in mod.rs
- conds: Vec<VarId> (outer to inner conditions)
- merges: Vec<MergePair> (variable updates at deepest level)
- k_next: Option<JoinContId> (continuation after merge)
2. JSON serialization in json.rs
- Type: "nested_if_merge"
- Fields: conds[], merges[], k_next
3. Runner/Bridge stubs
- JoinIR Runner: Returns error (use VM Bridge instead)
- VM Bridge: panic placeholder (41-4.3 will implement)
Target: ParserControlBox.parse_loop() (4-level nested if)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-28 12:32:25 +09:00 |
|
|
|
588129db65
|
feat(joinir): Phase 34-6 MethodCall 構造と本物の substring 意味論
**Phase 34-6 実装完了**: MethodCall 構造を JoinIR に追加し、本物の substring
呼び出しを通すことに成功。
## 主要変更
### 1. MethodCall 構造追加 (34-6.1)
- `src/mir/join_ir/mod.rs`: JoinInst::MethodCall バリアント (+8 lines)
- 構造: `{ dst, receiver, method, args }`
- 設計原則: JoinIR は構造のみ、意味論は MIR レベル
### 2. extract_value 更新 (34-6.2)
- `src/mir/join_ir/frontend/ast_lowerer.rs`: Method 処理本物化 (+37 lines)
- receiver/args を extract_value で再帰処理
- ダミー Const(0) 削除 → 本物の MethodCall 生成
- cond 処理修正: ValueId(0) ハードコード → extract_value で取得
### 3. JoinIR→MIR 変換実装 (34-6.3)
- `src/mir/join_ir_vm_bridge.rs`: MethodCall → BoxCall 変換 (+12 lines)
- `src/mir/join_ir/json.rs`: MethodCall JSON シリアライゼーション (+16 lines)
- `src/mir/join_ir_runner.rs`: MethodCall 未対応エラー (+7 lines)
### 4. テスト更新 (34-6.4)
- `docs/.../fixtures/json_shape_read_value.program.json`: 本物の substring 構造
- `src/tests/joinir_frontend_if_select.rs`: run_joinir_via_vm 使用
- テスト成功: v="hello", at=3 → "hel" ✅
## 成果
- ✅ テスト全通過(1 passed; 0 failed)
- ✅ 設計原則確立: JoinIR = 構造 SSOT、意味論 = MIR レベル
- ✅ Phase 33-10 原則との整合性: Method でも同じ原則適用
**ドキュメント更新**: CURRENT_TASK.md + TASKS.md(Phase 34-6 完了記録)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-27 17:05:46 +09:00 |
|
|
|
35cd93a37a
|
Phase 33-2: JoinInst::Select implementation + minimal If JoinIR lowering
Implementation:
- Add JoinInst::Select variant to JoinIR schema
- Implement Select execution in JoinIR Runner (Bool/Int cond support)
- Add Select handling in JoinIR→MIR Bridge (4-block structure)
- Create test cases (joinir_if_select_simple/local.hako)
- Add dev toggle NYASH_JOINIR_IF_SELECT=1
- Create lowering infrastructure (if_select.rs, stub for Phase 33-3)
Tests:
- 3/3 unit tests pass (test_select_true/false/int_cond)
- Integration tests pass (RC: 0)
- A/B execution verified (existing if_phi vs JoinIR Select)
Files changed:
- New: apps/tests/joinir_if_select_{simple,local}.hako
- New: src/mir/join_ir/lowering/if_select.rs
- Modified: src/mir/join_ir/{mod,json,runner,vm_bridge}.rs
- Modified: src/config/env.rs (joinir_if_select_enabled)
- Modified: docs/reference/environment-variables.md
Phase 33-3 ready: MIR pattern recognition + auto-lowering pending
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-27 02:58:38 +09:00 |
|
|
|
51ff558904
|
feat(phase32): L-2.1 Stage-1 UsingResolver JoinIR integration + cleanup
Phase 32 L-2.1 complete implementation:
1. Stage-1 UsingResolver main line JoinIR connection
- CFG-based LoopForm construction for resolve_for_source/5
- LoopToJoinLowerer integration with handwritten fallback
- JSON snapshot tests 6/6 PASS
2. JoinIR/VM Bridge improvements
- Simplified join_ir_vm_bridge.rs dispatch logic
- Enhanced json.rs serialization
- PHI core boxes cleanup (local_scope_inspector, loop_exit_liveness, loop_var_classifier)
3. Stage-1 CLI enhancements
- Extended args.rs, groups.rs, mod.rs for new options
- Improved stage1_bridge module (args, env, mod)
- Updated stage1_cli.hako
4. MIR builder cleanup
- Simplified if_form.rs control flow
- Removed dead code from loop_builder.rs
- Enhanced phi_merge.rs
5. Runner module updates
- json_v0_bridge/lowering.rs improvements
- dispatch.rs, selfhost.rs, modes/vm.rs cleanup
6. Documentation updates
- CURRENT_TASK.md, AGENTS.md
- Various docs/ updates
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-26 10:17:37 +09:00 |
|
|
|
e9c7d27a7f
|
feat(joinir): Phase 30.x jsonir v0 - JoinIR JSON serialization
Implement JSON serialization for JoinIR module.
Implementation:
- src/mir/join_ir/json.rs: JSON serializer (~250 lines, no external deps)
- src/tests/joinir_json_min.rs: Integration tests (8 unit + 2 integration)
- 10 tests total, all passing
Features:
- JoinModule → JSON serialization
- All instruction types: Call, Jump, Ret, Compute
- All MirLikeInst types: Const, BinOp, Compare, BoxCall
- Full ConstValue support: Integer, Bool, String, Null
- Full operator coverage: Add/Sub/Mul/Div/Or/And, Lt/Le/Gt/Ge/Eq/Ne
- JSON string escaping for special characters
Usage:
use crate::mir::join_ir::json::join_module_to_json_string;
let json = join_module_to_json_string(&module);
Non-goals (this phase):
- CLI flag (--emit-joinir-json)
- JSON → JoinIR reverse conversion
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-25 09:53:26 +09:00 |
|