447d4ea246
feat(llvm): Phase 132 - Pattern 1 exit value parity fix + Box-First refactoring
...
## Phase 132: Exit PHI Value Parity Fix
### Problem
Pattern 1 (Simple While) returned 0 instead of final loop variable value (3)
- VM: RC: 3 ✅ (correct)
- LLVM: Result: 0 ❌ (wrong)
### Root Cause (Two Layers)
1. **JoinIR/Boundary**: Missing exit_bindings → ExitLineReconnector not firing
2. **LLVM Python**: block_end_values snapshot dropping PHI values
### Fix
**JoinIR** (simple_while_minimal.rs):
- Jump(k_exit, [i_param]) passes exit value
**Boundary** (pattern1_minimal.rs):
- Added LoopExitBinding with carrier_name="i", role=LoopState
- Enables ExitLineReconnector to update variable_map
**LLVM** (block_lower.py):
- Use predeclared_ret_phis for reliable PHI filtering
- Protect builder.vmap PHIs from overwrites (SSOT principle)
### Result
- ✅ VM: RC: 3
- ✅ LLVM: Result: 3
- ✅ VM/LLVM parity achieved
## Phase 132-Post: Box-First Refactoring
### Rust Side
**JoinModule::require_function()** (mod.rs):
- Encapsulate function search logic
- 10 lines → 1 line (90% reduction)
- Reusable for Pattern 2-5
### Python Side
**PhiManager Box** (phi_manager.py - new):
- Centralized PHI lifecycle management
- 47 lines → 8 lines (83% reduction)
- SSOT: builder.vmap owns PHIs
- Fail-Fast: No silent overwrites
**Integration**:
- LLVMBuilder: Added phi_manager
- block_lower.py: Delegated to PhiManager
- tagging.py: Register PHIs with manager
### Documentation
**New Files**:
- docs/development/architecture/exit-phi-design.md
- docs/development/current/main/investigations/phase132-llvm-exit-phi-wrong-result.md
- docs/development/current/main/phases/phase-132/
**Updated**:
- docs/development/current/main/10-Now.md
- docs/development/current/main/phase131-3-llvm-lowering-inventory.md
### Design Principles
- Box-First: Logic encapsulated in classes/methods
- SSOT: Single Source of Truth (builder.vmap for PHIs)
- Fail-Fast: Early explicit failures, no fallbacks
- Separation of Concerns: 3-layer architecture
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-15 03:17:31 +09:00
35f5a48eb0
docs(joinir): Phase 33 Completion - Box Theory Modularization Summary
...
## Phase 33: Complete JoinIR Modularization via Box Theory (3 Phases)
This commit consolidates the comprehensive modularization work across three phases:
- Phase 33-10: Exit Line Modularization (ExitLineReconnector + ExitMetaCollector Boxes)
- Phase 33-11: Quick Wins (Pattern 4 stub clarification, unused imports cleanup)
- Phase 33-12: Large Module Modularization (split mod.rs, loop_patterns.rs restructuring)
### Phase 33-10: Exit Line Modularization (Boxes P0-P1)
**New Files**:
- `exit_line/reconnector.rs` (+130 lines): ExitLineReconnector Box
- Responsibility: Update host variable_map with remapped exit values
- Design: Phase 197-B multi-carrier support (each carrier gets specific remapped value)
- Pure side effects: Only updates builder.variable_map
- Testing: Independent unit testing possible without full merge machinery
- `exit_line/meta_collector.rs` (+102 lines): ExitMetaCollector Box
- Responsibility: Construct exit_bindings from ExitMeta + variable_map lookup
- Design: Pure function philosophy (no side effects except variable_map reads)
- Reusability: Pattern-agnostic (works for Pattern 1, 2, 3, 4)
- Algorithm: For each carrier in exit_meta, lookup host ValueId, create binding
- `exit_line/mod.rs` (+58 lines): ExitLineOrchestrator facade
- Coordination: Orchestrates Phase 6 boundary reconnection
- Architecture: Delegates to ExitLineReconnector (demonstrates Box composition)
- Documentation: Comprehensive header explaining Box Theory modularization benefits
**Modified Files**:
- `merge/mod.rs` (-91 lines): Extracted reconnect_boundary() → ExitLineReconnector
- Made exit_line module public (was mod, now pub mod)
- Phase 6 delegation: Local function call → ExitLineOrchestrator::execute()
- Added exit_bindings' join_exit_values to used_values for remapping (Phase 172-3)
- `patterns/pattern2_with_break.rs` (-20 lines): Uses ExitMetaCollector
- Removed: Manual exit_binding construction loop
- Added: Delegated ExitMetaCollector::collect() for cleaner caller code
- Benefit: Reusable collector for all pattern lowerers (Pattern 1-4)
**Design Philosophy** (Exit Line Module):
Each Box handles one concern:
- ExitLineReconnector: Updates host variable_map with exit values
- ExitMetaCollector: Constructs exit_bindings from ExitMeta
- ExitLineOrchestrator: Orchestrates Phase 6 reconnection
### Phase 33-11: Quick Wins
**Pattern 4 Stub Clarification** (+132 lines):
- Added comprehensive header documentation (106 lines)
- Made `lower()` return explicit error (not silent stub)
- Migration guide: Workarounds using Pattern 1-3
- New file: `docs/development/proposals/phase-195-pattern4.md` (implementation plan)
- Status: Formal documentation that Pattern 4 is deferred to Phase 195
**Cleanup**:
- Removed unused imports via `cargo fix` (-10 lines, 11 files)
- Files affected: generic_case_a/ (5 files), if_merge.rs, if_select.rs, etc.
### Phase 33-12: Large Module Modularization
**New Files** (Modularization):
- `if_lowering_router.rs` (172 lines): If-expression routing
- Extracted from mod.rs lines 201-423
- Routes if-expressions to appropriate JoinIR lowering strategies
- Single responsibility: If expression dispatch
- `loop_pattern_router.rs` (149 lines): Loop pattern routing
- Extracted from mod.rs lines 424-511
- Routes loop patterns to Pattern 1-4 implementations
- Design: Dispatcher pattern for pattern selection
- `loop_patterns/mod.rs` (178 lines): Pattern dispatcher + shared utilities
- Created as coordinator for per-pattern files
- Exports all pattern functions via pub use
- Utilities: Shared logic across pattern lowerers
- `loop_patterns/simple_while.rs` (225 lines): Pattern 1 lowering
- `loop_patterns/with_break.rs` (129 lines): Pattern 2 lowering
- `loop_patterns/with_if_phi.rs` (123 lines): Pattern 3 lowering
- `loop_patterns/with_continue.rs` (129 lines): Pattern 4 stub
**Modified Files** (Refactoring):
- `lowering/mod.rs` (511 → 221 lines, -57%):
- Removed try_lower_if_to_joinir() (223 lines) → if_lowering_router.rs
- Removed try_lower_loop_pattern_to_joinir() (88 lines) → loop_pattern_router.rs
- Result: Cleaner core module with routers handling dispatch
- `loop_patterns.rs` → Re-export wrapper (backward compatibility)
**Result**: Clearer code organization
- Monolithic mod.rs split into focused routers
- Large loop_patterns.rs split into per-pattern files
- Better maintainability and testability
### Phase 33: Comprehensive Documentation
**New Architecture Documentation** (+489 lines):
- File: `docs/development/architecture/phase-33-modularization.md`
- Coverage: All three phases (33-10, 33-11, 33-12)
- Content:
- Box Theory principles applied
- Complete statistics table (commits, files, lines)
- Code quality analysis
- Module structure diagrams
- Design patterns explanation
- Testing strategy
- Future work recommendations
- References to implementation details
**Source Code Comments** (+165 lines):
- `exit_line/mod.rs`: Box Theory modularization context
- `exit_line/reconnector.rs`: Design notes on multi-carrier support
- `exit_line/meta_collector.rs`: Pure function philosophy
- `pattern4_with_continue.rs`: Comprehensive stub documentation + migration paths
- `if_lowering_router.rs`: Modularization context
- `loop_pattern_router.rs`: Pattern dispatch documentation
- `loop_patterns/mod.rs`: Per-pattern structure benefits
**Project Documentation** (+45 lines):
- CLAUDE.md: Phase 33 completion summary + links
- CURRENT_TASK.md: Current state and next phases
### Metrics Summary
**Phase 33 Total Impact**:
- Commits: 5 commits (P0, P1, Quick Wins×2, P2)
- Files Changed: 15 files modified/created
- Lines Added: ~1,500 lines (Boxes + documentation + comments)
- Lines Removed: ~200 lines (monolithic extractions)
- Code Organization: 2 monolithic files → 7 focused modules
- Documentation: 1 comprehensive architecture guide created
**mod.rs Impact** (Phase 33-12 P2):
- Before: 511 lines (monolithic)
- After: 221 lines (dispatcher + utilities)
- Reduction: -57% (290 lines extracted)
**loop_patterns.rs Impact** (Phase 33-12 P2):
- Before: 735 lines (monolithic)
- After: 5 files in loop_patterns/ (178 + 225 + 129 + 123 + 129)
- Improvement: Per-pattern organization
### Box Theory Principles Applied
1. **Single Responsibility**: Each Box handles one concern
- ExitLineReconnector: variable_map updates
- ExitMetaCollector: exit_binding construction
- if_lowering_router: if-expression dispatch
- loop_pattern_router: loop pattern dispatch
- Per-pattern files: Individual pattern lowering
2. **Clear Boundaries**: Public/private visibility enforced
- Boxes have explicit input/output contracts
- Module boundaries clearly defined
- Re-exports for backward compatibility
3. **Replaceability**: Boxes can be swapped/upgraded independently
- ExitLineReconnector can be optimized without affecting ExitMetaCollector
- Per-pattern files can be improved individually
- Router logic decoupled from lowering implementations
4. **Testability**: Smaller modules easier to unit test
- ExitMetaCollector can be tested independently
- ExitLineReconnector mockable with simple boundary
- Pattern lowerers isolated in separate files
### Design Patterns Introduced
1. **Facade Pattern**: ExitLineOrchestrator
- Single-entry point for Phase 6 reconnection
- Hides complexity of multi-step process
- Coordinates ExitLineReconnector + other steps
2. **Dispatcher Pattern**: if_lowering_router + loop_pattern_router
- Centralized routing logic
- Easy to add new strategies
- Separates dispatch from implementation
3. **Pure Function Pattern**: ExitMetaCollector::collect()
- No side effects (except reading variable_map)
- Easy to test, reason about, parallelize
- Reusable across all pattern lowerers
### Testing Strategy
- **Unit Tests**: Can test ExitMetaCollector independently
- **Integration Tests**: Verify boundary reconnection works end-to-end
- **Regression Tests**: Pattern 2 simple loop still passes
- **Backward Compatibility**: All existing imports still work
### Future Work
- **Phase 33-13**: Consolidate whitespace utilities (expected -100 lines)
- **Phase 34**: Extract inline_boundary validators (expected 3h effort)
- **Phase 35**: Mark loop_patterns_old.rs as legacy and remove (Phase 35+)
- **Phase 195**: Implement Pattern 4 (continue) fully
- **Phase 200+**: More complex loop patterns and optimizations
🧱 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-07 04:03:42 +09:00
466e636af6
Span trace utilities and runner source hint
2025-11-24 14:17:02 +09:00
3d5979c78e
refactor(joinir): Phase 27.9 - Modular separation of join_ir.rs into directory structure
...
Phase 27.9 で join_ir.rs (~1,336行) を以下のモジュール構造に分離:
## 新規ディレクトリ構造:
```
src/mir/join_ir/
├── mod.rs # 型定義・共通ユーティリティ (~330行)
└── lowering/
├── mod.rs # lowering インターフェース
├── min_loop.rs # lower_min_loop_to_joinir (~140行)
├── skip_ws.rs # skip_ws lowering 3関数 (~390行)
└── funcscanner_trim.rs # trim lowering (~480行)
```
## 技術的変更:
- **型定義統一**: JoinFuncId, JoinInst, JoinModule 等を mod.rs に集約
- **lowering 分離**: 3つの lowering 関数を個別モジュールに移動
- **後方互換性**: pub use で lowering 関数を re-export(既存コード影響なし)
- **削除**: src/mir/join_ir.rs (旧単一ファイル)
## テスト結果:
- **385 passed** (+1 from 384)
- **9 failed** (-1 from 10)
- **ビルド成功**: 0 errors, 18 warnings (変化なし)
## 効果:
- **保守性向上**: 1,336行 → 4ファイル(各300-500行)で可読性向上
- **モジュール境界明確化**: 型定義 vs lowering 実装の責務分離
- **将来の拡張容易**: 新 lowering 関数追加が簡単に
Phase 27.8 で実装した MIR 自動解析 lowering の基盤整備完了。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-23 16:49:49 +09:00
8750186e55
chore: Phase 26-H セッション完了 - 全ドキュメント更新
...
Phase 26-H 完了内容:
✅ JoinIR 型定義実装(src/mir/join_ir.rs)
✅ MIR → JoinIR 自動変換実装(lower_min_loop_to_joinir)
✅ 自動変換テスト実装(mir_joinir_min_auto_lowering)
✅ PHI/Loop箱 → JoinIR 移行対応表追加(loopform_ssot.md)
ドキュメント更新:
- Phase 27 JoinIR タスク計画追加
- Phase 26-H タスク完了記録
- 各種 README 更新(進捗反映)
- CURRENT_TASK.md 更新
コミット統計: $(git status --short | wc -l) files changed
次のステップ: Phase 27 一般化 MIR → JoinIR 変換
2025-11-23 05:53:27 +09:00
9a5cec394c
docs(loopform): PHI/Loop箱→JoinIR移行対応表追加
...
実装内容:
- loopform_ssot.md に Phase 26-H 以降の移行戦略追加
- 全17箱の将来的な扱いを3カテゴリに分類:
🔄 JoinIR に吸収(6箱): Header/Exit/Snapshot系
❌ 削除候補(4箱): PhiBuilder/IfPhi/LoopPhi系
✅ 残す(7箱): 前処理/検証/ユーティリティ系
移行戦略:
- Phase 27: 一般化 MIR → JoinIR 変換実装
- Phase 28: JoinIR 実行器実装(VM/LLVM)
- Phase 29: レガシー PHI 箱の段階的削除
これで「今の箱が最終的にどう片付くか」一目瞭然!🎉
2025-11-23 04:52:37 +09:00
2692eafbbf
feat(mir): Phase 26-H JoinIR型定義実装完了 - ChatGPT設計
...
## 実装内容(Step 1-3 完全達成)
### Step 1: src/mir/join_ir.rs 型定義追加
- **JoinFuncId / JoinContId**: 関数・継続ID型
- **JoinFunction**: 関数(引数 = φノード)
- **JoinInst**: Call/Jump/Ret/Compute 最小命令セット
- **MirLikeInst**: 算術・比較命令ラッパー
- **JoinModule**: 複数関数保持コンテナ
- **単体テスト**: 型サニティチェック追加
### Step 2: テストケース追加
- **apps/tests/joinir_min_loop.hako**: 最小ループ+breakカナリア
- **src/tests/mir_joinir_min.rs**: 手書きJoinIR構築テスト
- MIR → JoinIR手動構築で型妥当性確認
- #[ignore] で手動実行専用化
- NYASH_JOINIR_EXPERIMENT=1 トグル制御
### Step 3: 環境変数トグル実装
- **NYASH_JOINIR_EXPERIMENT=1**: 実験モード有効化
- **デフォルト挙動**: 既存MIR/LoopForm経路のみ(破壊的変更なし)
- **トグルON時**: JoinIR手書き構築テスト実行
## Phase 26-H スコープ遵守
✅ 型定義のみ(変換ロジックは未実装)
✅ 最小限の命令セット
✅ Debug 出力で妥当性確認
✅ 既存パイプライン無影響
## テスト結果
```
$ NYASH_JOINIR_EXPERIMENT=1 cargo test --release mir_joinir_min_manual_construction -- --ignored --nocapture
[joinir/min] MIR module compiled, 3 functions
[joinir/min] JoinIR module constructed:
[joinir/min] ✅ JoinIR型定義は妥当(Phase 26-H)
test result: ok. 1 passed; 0 failed
```
## JoinIR理論の実証
- **φノード = 関数引数**: `fn loop_step(i, k_exit)`
- **merge = join関数**: 分岐後の合流点
- **ループ = 再帰関数**: `loop_step` 自己呼び出し
- **break = 継続呼び出し**: `k_exit(i)`
## 次フェーズ (Phase 27.x)
- LoopForm v2 → JoinIR 自動変換実装
- break/continue ハンドリング
- Exit PHI の JoinIR 引数化
🌟 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
Co-Authored-By: ChatGPT <noreply@openai.com >
2025-11-23 04:10:12 +09:00
c344451087
fix(mir-builder): static method arity mismatch根治 - Phase 25.x
...
**問題**:
- ParserStmtBox.parse_using/4 に5引数が渡される
- me.method呼び出しで instance/static 判別なし
- static method に誤って receiver 追加
**修正**:
- MeCallPolicyBox: params[0]の型で instance/static 判別
- Instance method: receiver 追加
- Static method: receiver なし
- Arity検証(NYASH_ME_CALL_ARITY_STRICT=1)
**ドキュメント**:
- docs/reference/environment-variables.md 新規作成
- docs/development/architecture/mir-logs-observability.md 更新
**テスト**:
- src/tests/mir_stage1_cli_emit_program_min.rs 追加
- 既存 stage1 テスト全てパス
Phase: 25.x
2025-11-21 11:16:38 +09:00
b92d9f335d
docs(mir-logs): MIRログ観測リスト完成 - __mir__.log 全箇所を分類
...
Phase 25.4-C: MIR ログ観測リスト作成
## 📋 実装内容
### 1. ログ呼び出し全14箇所を列挙
- `rg "__mir__\\.log" lang/src -n` で全箇所を調査
- ファイル・行番号・タグ・用途を完全文書化
### 2. 3分類に整理
#### Dev専用(11箇所)- 削除候補
- **Stage-1 CLI Debug** (10箇所): entry/config/argc debug
- 制御: `STAGE1_CLI_DEBUG=1`
- MIR Builder type confusion デバッグ用
- **StringHelpers Debug** (1箇所): to_i64 input debug
- 制御: `NYASH_TO_I64_DEBUG=1`
- Void → Integer 型崩れデバッグ用
#### 観測用(3箇所)- 残す候補
- **FuncScanner Debug** (3箇所): skip_ws loop iteration
- LoopForm v2 / PHI 生成検証
- Region+next_i SSA 安定性確認
- 将来的な「MIR 観測 API」の代表例
#### コメント(1箇所)
- Test file comment
### 3. 将来構想
- `MirLogBox` 箱化構想を記載
- ログレベル制御・構造化ログ・パフォーマンストレース機能
- MIR デバッガー統合の下地
## 技術的成果
- **全箇所可視化**: 14箇所のログ用途を完全把握
- **分類明確化**: Dev専用 vs 観測用を明示
- **将来設計**: MIR 観測 API 構想を文書化
## 文書作成
- 新規: `docs/development/architecture/mir-logs-observability.md`
## 方針
- **Phase 25.4**: ドキュメント整理のみ(コード変更なし)
- **後続フェーズ**: Dev専用ログ削除・観測用ログ API化を検討
## 参考
- Phase 25.4 全体: docs/development/roadmap/phases/phase-25.4-naming-cli-cleanup/README.md
🎉 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-21 09:48:08 +09:00
28a312ea0d
feat(naming): Phase 25.4-A - NamingBox SSOT化完了
...
🎯 目的: static/global 呼び出しの名前決定を src/mir/naming.rs に一本化
✅ 実装完了:
- NamingBox(src/mir/naming.rs)実装
- encode_static_method(box, method, arity)
- normalize_static_global_name(func_name)
- static/global 名前の正規化ロジック統一
- MIR Builder統合(SSOT使用)
- src/mir/builder/decls.rs: build_static_main_box
- src/mir/builder/exprs.rs: 静的メソッド呼び出し
- src/mir/builder/metadata/propagate.rs: メタデータ伝播
- src/mir/builder/observe/mod.rs: Observe機能
- src/mir/builder/observe/types.rs: 型観測(新規)
- VM実行器統合(SSOT使用)
- src/backend/mir_interpreter/handlers/calls/global.rs
- normalize_static_global_name使用
- レガシーフォールバック削除済み確認
- テスト追加
- src/tests/mir_static_box_naming.rs
- encode/normalize の動作検証
📚 ドキュメント:
- docs/development/architecture/mir-naming-box.md
- NamingBoxの設計思想
- SSOT原則の説明
- 使用例
🎯 効果:
- 名前決定ロジックが1箇所に集約
- Builder/VM で同じ正規化ルールを使用
- 将来の名前空間拡張が容易
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-21 09:01:43 +09:00
baf028a94f
docs(phi): Phase 25.1 - LoopForm v2 コメント整備 + ケース表完成
...
- ✅ [LoopForm] タグで統一コメント追加
- src/mir/loop_builder.rs
- header-cond: Case A/B分岐説明
- exit-break path / continue-backedge path
- exit PHI for Case A/B
- src/mir/phi_core/loop_snapshot_merge.rs
- Case A/B分岐: header ∈ exit_preds判定ロジック
- src/mir/phi_core/exit_phi_builder.rs
- LoopForm Process ステップバイステップ説明
- ✅ UsingCollectorBox Region+next_i化
- lang/src/compiler/parser/using/using_collector_box.hako
- 全ループをLoopForm v2形式に統一
- next_i, next_j, next_k, next_t パターン導入
- SSA安全化(未定義変数撲滅)
- ✅ LoopForm v2 ケース表完成
- docs/development/architecture/loops/loopform_ssot.md
- Case A/B/C/D の完全な表
- テスト対応マッピング
- 実装ファイル対応表
🎯 成果: LoopForm v2の「形」をソース・テスト・ドキュメントで完全固定
2025-11-21 06:22:21 +09:00
bc06fc61df
feat(mir): Phase 26-A-1 ValueId型安全化 - MirValueKind導入
...
## 🎯 目的
GUARDバグのような「ValueIdの意味的曖昧性」から生じるバグを根絶
## ✅ 実装内容
- **新規**: `src/mir/value_kind.rs` (442行)
- `MirValueKind` 列挙型(6種類の型分類)
- Parameter(u32): 関数パラメータ
- Local(u32): ローカル変数
- Constant: 定数値
- Temporary: 一時値
- Pinned: ブロック跨ぎ変数
- LoopCarrier: ループ内再定義変数
- `TypedValueId` 構造体(型安全ラッパー)
- ValueId + MirValueKind のペア
- is_parameter(), is_local() 等の型安全判定メソッド
## ✅ テスト結果
- **全12テストPASS** (0.00s)
- ✅ test_guard_check_bug_prevention: GUARDバグ再現防止
- ✅ test_parameter_detection: ValueId(0)でもParameter判定可能
- ✅ test_loop_carrier_detection: LoopCarrier型検出
- ✅ その他9テスト全PASS
## 📊 効果
- **型安全性**: ValueId(0)がParameterかLocalか判定可能
- **バグ予防**: 同種のバグ80%削減見込み
- **自己文書化**: 型情報で意味が明確
- **後方互換性**: From<TypedValueId> for ValueId実装
## 📋 次のステップ
- Phase 26-A-2: MirBuilder統合(value_kindsフィールド追加)
- Phase 26-A-3: パラメータ登録修正
- Phase 26-A-4: loop_builder.rs修正(is_parameter根本治療)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-20 09:29:23 +09:00
30aa39f50b
hv1 verify: add direct route (env JSON) and clean inline path; fix v1 phi incoming order; make test_runner use hv1 direct; add phase2037 phi canaries; load modules.workspace exports for alias; update docs (phase-20.38, source extensions) and CURRENT_TASK
2025-11-04 16:33:04 +09:00
c331296552
P0/P1/P2: quick緑化と境界/検証強化\n\n- P0: json_lint_vm を quick で opt-in 化(既定は SKIP)し、builder デバッグノイズは filter_noise で抑制\n- P1: ArrayBox に OOB Strict タグを導入(HAKO_OOB_STRICT/NYASH_OOB_STRICT)+ Stage‑B OOB 観測カナリア整備\n- P2: Bridge/LLVM self まわりの検証を opt-in スモークで拡充(self_param_*)。ドキュメント/PLAN/CHECKLIST/SSOT を更新
2025-11-01 17:39:36 +09:00
eef6fca8cd
docs(loops): LoopForm SSOT設計ノートを追加し、Bridge側ループ降下にPHI到達検証を導入(debug時)。\n\n- 新規: docs/development/architecture/loops/loopform_ssot.md\n- 修正: src/runner/json_v0_bridge/lowering/loop_.rs に debug_verify_phi_inputs 呼び出しを追加\n- 方針: Direct MIR は既に phi_core を使用。Bridge は段階的に LoopPhiOps アダプタでSSOTに寄せる
2025-11-01 16:37:16 +09:00
01b4417c5d
docs(llvm/vm): 静的Box(self)規約を明文化 + Bridgeトグル追記; Gate‑C/Core 現状反映; CURRENT_TASK 更新。\n\n- 新規: docs/development/architecture/llvm/static_box_singleton.md\n- 追記: lang/src/vm/README.md に self 先頭規約/互換トグルを明記\n- 追記: CURRENT_TASK に本更新を記録\n- phase-20.33/CHECKLIST にドキュメント完了チェックを追加\n- bak フォルダはリポジトリ直下に存在せず(削除対象なし)\n\n併せて未コミット差分をスナップショット(Rust 層の前作業含む)
2025-11-01 16:31:48 +09:00
34be7d2d79
vm/router: minimal special-method extension (equals/1); toString mapping kept
...
mir: add TypeCertainty to Callee::Method (diagnostic only); plumb through builder/JSON/printer; backends ignore behaviorally
using: confirm unified prelude resolver entry for all runner modes
docs: update Callee architecture with certainty; update call-instructions; CURRENT_TASK note
tests: quick 40/40 PASS; integration (LLVM) 17/17 PASS
2025-09-28 01:33:58 +09:00
81211c22ad
feat: MIR Call命令統一Phase 3.1-3.2完了!統一Call実装進行中
...
✨ Phase 3.1-3.2実装完了
- build_indirect_call_expressionでCallTarget::Value使用
- print関数をcall_global print()として統一
- build_function_callでemit_unified_call使用
- ExternCall(env.console.log)→Callee::Global(print)完全移行
🏗️ MIR統一基盤構築
- src/mir/definitions/call_unified.rs: 統一定義(297行)
- emit_unified_call()と便利メソッド3種実装
- NYASH_MIR_UNIFIED_CALL=1で段階移行制御
- VM実行器でCallee対応実装済み
📊 進捗状況(26%削減見込み)
- Phase 1-2: ✅ 基盤構築完了
- Phase 3.1-3.2: ✅ 基本関数統一完了
- Phase 3.3: 🔄 BoxCall統一中
- Phase 4: 📅 Python LLVM(最優先・63%削減)
- Phase 5: 📅 PyVM/VM統一
📚 ドキュメント更新
- CLAUDE.md: テストスクリプト参考集追加
- CURRENT_TASK.md: Phase 3進捗更新
- python-llvm-priority-rationale.md: 優先順位戦略文書化
- mir-call-unification-master-plan.md: スケジュール最新化
🎯 6種類→1種類: Call/BoxCall/PluginInvoke/ExternCall/NewBox/NewClosure → MirCall統一へ
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-24 01:05:44 +09:00
0ac22427e5
docs: Architecture decision - Box/ExternCall boundary design
...
Documented the architectural decision for Nyash runtime design:
1. Core boxes (String/Integer/Array/Map/Bool) built into nyrt
- Essential for self-hosting
- Available at boot without plugin loader
- High performance (no FFI overhead)
2. All other boxes as plugins (File/Net/User-defined)
- Extensible ecosystem
- Clear separation of concerns
3. Minimal ExternCall (only 5 functions)
- print/error (output)
- panic/exit (process control)
- now (time)
Key principle: Everything goes through BoxCall interface
- No special fast paths
- Unified architecture
- "Everything is Box" philosophy maintained
This design balances self-hosting requirements with architectural purity.
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-11 20:58:18 +09:00