16 Commits

Author SHA1 Message Date
811dfebf98 fix(joinir): Phase 241-EX - Remove hardcoded 'sum' check from Pattern3
Remove legacy hardcoded 'sum' carrier validation that was blocking
array_filter patterns with different accumulator names (e.g., 'out').

Before: Pattern3 required carrier named 'sum' to exist
After: Pattern3 uses carrier_info generically (any carrier name works)

Test results:
- phase49_joinir_array_filter_smoke: PASS 
- phase49_joinir_array_filter_fallback: PASS 
- phase49_joinir_array_filter_ab_comparison: PASS 
- Full suite: 909/909 PASS, 0 FAIL

Also: Archive old roadmap documentation (67k lines moved to docs/archive/)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 00:48:42 +09:00
a7dbc15878 feat(joinir): Phase 240-EX - Pattern2 header condition ExprLowerer integration
Implementation:
- Add make_pattern2_scope_manager() helper for DRY
- Header conditions use ExprLowerer for supported patterns
- Legacy fallback for unsupported patterns
- Fail-Fast on supported patterns that fail

Tests:
- 4 new tests (all pass)
- test_expr_lowerer_supports_simple_header_condition_i_less_literal
- test_expr_lowerer_supports_header_condition_var_less_var
- test_expr_lowerer_header_condition_generates_expected_instructions
- test_pattern2_header_condition_via_exprlowerer

Also: Archive old phase documentation (34k lines removed)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 00:33:04 +09:00
192c29efb1 docs: Pattern 4 stub clarification (Phase 195 deferred)
Phase 33-11 Quick Wins - Task 2

Clarified that Pattern 4 (continue statements) is intentionally
not implemented, with explicit error message and migration guide.

Changes:
1. Added clear STUB IMPLEMENTATION header to module docs
2. Updated lower() to return explicit error (not silent stub)
3. Added #[doc(hidden)] and #[allow(dead_code)] annotations
4. Created comprehensive migration guide (phase-195-pattern4.md)

Status:
- Not implemented: Pattern 4 (continue)
- Use instead: Pattern 1-3 (simple/break/if+phi)
- Reason: Continue requires complex PHI analysis, lower priority
- Build:  Success (no errors, no new warnings)

Migration path:
- Pattern 1: Simple while loops (no break/continue)
- Pattern 2: Loops with break
- Pattern 3: Loops with if + PHI (workaround for continue)
- Pattern 4: (FUTURE) Loops with continue statements
2025-12-07 03:13:05 +09:00
8fe0babf01 docs: Add comprehensive code refactoring discovery analysis
Analyze entire codebase for refactoring opportunities:
- 110 files > 400 lines (72,936 lines total)
- Identified 6 critical files blocking Pattern 4/5 implementation
- Created Phase 1-3 refactoring roadmap (95-105 hours total)

Key findings:

**Critical Path (Phase 1): 26.5 hours**
- control_flow.rs: 1,632 lines → 6 modules (12.5h)
  - Blocks: Pattern 4/5 implementation
  - 714-line function, 168 control flow branches
  - Cognitive complexity: 5/5 (EXTREME)

- loopform_builder.rs: 1,166 lines → 6 modules (8h)
  - 4-pass split (prepare/preheader/header/seal)
  - 330+ lines of tests needing organization

- Quick wins: 5 files, 14 hours total
  - mir_json_emit.rs: v0/v1 format split (3h)
  - generic_case_a.rs: EntryFunctionBuilder extract (3h)
  - config_joinir.rs: JoinIR config extract (3h)
  - join_ir_runner.rs: Pattern handlers (3h)
  - box_factory.rs: Factory policy (2h)

**High Priority (Phase 2): 29 hours**
- builder.rs: 322 commits in 2025 (highest churn)
- strip.rs: using module handling (1,081 lines)
- Other large files

**Optional (Phase 3): 40-50 hours**
- Remaining 600-800 line files
- Code health improvements

**ROI Analysis**:
- Phase 1 investment: 26.5 hours
- Time saved on Pattern 4/5: 15-20 hours
- Maintenance savings: 5h/month long-term
- Breakeven: < 2 months

**Prioritization Strategy**:
1. Unblocks future development (Pattern 4/5)
2. Reduces cognitive load (5/5 → avg 2/5)
3. Improves testability
4. Zero breaking changes (fully reversible)

Document includes:
- Detailed analysis of 110 files
- Refactoring plans for each critical file
- Before/after code examples
- Complete prioritization matrix
- Risk assessment and mitigation

Next step: Execute Phase 1 starting with control_flow.rs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 20:23:59 +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
51359574d9 feat(stage1): Phase 25.1 - Stage1 CLI デバッグ改善 + 環境変数削減計画
-  Stage1 CLI デバッグログ追加
  - lang/src/runner/stage1_cli.hako: STAGE1_CLI_DEBUG対応
  - 各関数でentry/exit/状態ログ出力
  - SSAバグ調査を容易化

-  Rust bridge 実装
  - src/runner/stage1_bridge.rs: 子プロセス起動・環境変数配線
  - NYASH_ENTRY設定、モジュールリスト生成

-  デバッグヘルパースクリプト
  - tools/stage1_debug.sh: 環境変数自動診断・詳細ログ
  - tools/stage1_minimal.sh: 推奨5変数のみで実行

-  環境変数削減計画(25個→5個)
  - docs/development/proposals/env-var-reduction-report.md
    - 使用箇所マトリックス、依存関係グラフ
    - 6段階削減ロードマップ(80%削減目標)
  - docs/development/proposals/stage1-architecture-improvement.md
    - 他言語事例調査(Rust/Go/Nim)
    - アーキテクチャ統一案、実装ロードマップ

-  LoopForm v2 設計ドキュメント
  - docs/development/roadmap/phases/phase-25.1/stage1-usingresolver-loopform.md

🎯 成果: Stage1起動の複雑さを可視化、80%削減計画確立
2025-11-21 06:22:02 +09:00
d2d76694af docs(phi): Phase 26-B完了記録 - リファクタリング計画更新
Phase 1 (Phase 26-B) 完了を記録:
- PhiInputCollector実装完了 
- BodyLocalPhiBuilder実装完了 
- 既存コード統合完了(loopform_builder/loop_builder/json_v0_bridge)
- テスト全PASS(mir_loopform_exit_phi 4/4)
- ドキュメント完備

次のステップ: Phase 2 (LoopSnapshotManager + HeaderPhiBuilder)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 20:18:33 +09:00
38155fbb75 docs: PHI箱化リファクタリング完全計画書作成
📦 箱理論による段階的リファクタリング計画

 現状分析完了
  - 既存Box: 1,246行(3つのBox完璧実装)
  - 問題箇所: loopform_builder.rs 1,075行(責任混在)

🎯 提案6つのBox
  Phase 1(最優先):
    - PhiInputCollector: PHI入力収集統一(80行削減)
    - BodyLocalPhiBuilder: BodyLocal処理専門(60行削減)
  Phase 3(最重要):
    - ExitPhiBuilder: Exit PHI完全分離(220行削減)

📊 削減効果
  - 合計削減: 620行
  - 最大関数: 173行→50行以下(71%削減)
  - テストカバレッジ: 60%→90%(+50%向上)

📚 完全ドキュメント内容
  - 詳細設計(責任・インターフェース・実装例)
  - 段階的実装計画(Phase 1-4)
  - テスト戦略・リスク分析
  - Before/After比較図・依存関係図

🎓 箱理論4原則完全準拠
  - 分離・境界・可逆性・テスト容易性

Task先生による徹底分析完了!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 17:26:47 +09:00
77d4fd72b3 phase: 20.49 COMPLETE; 20.50 Flow+String minimal reps; 20.51 selfhost v0/v1 minimal (Option A/B); hv1-inline binop/unop/copy; docs + run_all + CURRENT_TASK -> 21.0 2025-11-06 15:41:52 +09:00
b3a96faccb smokes: add JSON nested/invalid cases; force VM backend; temp nyash.toml with json_native package for resolution 2025-09-26 00:38:14 +09:00
6ce06501e1 json-native: enable float roundtrip in parser (NUMBER => float by '.'/exp); expand roundtrip smoke with more numeric cases 2025-09-26 00:32:20 +09:00
85084664c2 docs+runner+parser: SSOT+AST using finalized (legacy text inlining removed); provider verify reads nyash.toml; preflight warn hook; method-body guard removed; CURRENT_TASK updated for next JSON work 2025-09-26 00:27:02 +09:00
11506cee3b Phase 11-12: LLVM backend initial, semantics layer, plugin unification
Major changes:
- LLVM backend initial implementation (compiler.rs, llvm mode)
- Semantics layer integration in interpreter (operators.rs)
- Phase 12 plugin architecture revision (3-layer system)
- Builtin box removal preparation
- MIR instruction set documentation (26→Core-15 migration)
- Cross-backend testing infrastructure
- Await/nowait syntax support

New features:
- LLVM AOT compilation support (--backend llvm)
- Semantics layer for interpreter→VM flow
- Tri-backend smoke tests
- Plugin-only registry mode

Bug fixes:
- Interpreter plugin box arithmetic operations
- Branch test returns incorrect values

Documentation:
- Phase 12 README.md updated with new plugin architecture
- Removed obsolete NYIR proposals
- Added LLVM test programs documentation

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 23:44:34 +09:00
f1a4a78379 Docs: mark PoC features as deprecated (unified ops are default)
- mir_typeop_poc / mir_refbarrier_unify_poc are no-op now; Builder emits
  TypeOp/WeakRef/Barrier by default; Optimizer normalizes legacy ops.
- Update CURRENT_TASK and architecture/proposal docs accordingly.
2025-08-26 06:41:30 +09:00
fffbac9aac feat: MIR TypeOp/WeakRef/Barrier PoC implementation
- Add TypeOpKind, WeakRefOp, BarrierOp enums for unified instructions
- Implement TypeOp instruction combining TypeCheck/Cast
- Implement WeakRef instruction combining WeakNew/WeakLoad
- Implement Barrier instruction combining BarrierRead/BarrierWrite
- Update VM to handle new unified instructions
- Update MIR printer for new instruction formats
- Add feature flags mir_typeop_poc and mir_refbarrier_unify_poc
- Maintain backward compatibility with legacy instructions

This is Phase 8.5 MIR instruction diet PoC implementation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 19:27:02 +09:00
cc2a820af7 feat(plugin): Fix plugin BoxRef return and Box argument support
- Fixed deadlock in FileBox plugin copyFrom implementation (single lock)
- Added TLV Handle (tag=8) parsing in calls.rs for returned BoxRefs
- Improved plugin loader with config path consistency and detailed logging
- Fixed loader routing for proper Handle type_id/fini_method_id resolution
- Added detailed logging for TLV encoding/decoding in plugin_loader_v2

Test docs/examples/plugin_boxref_return.nyash now works correctly:
- cloneSelf() returns FileBox Handle properly
- copyFrom(Box) accepts plugin Box arguments
- Both FileBox instances close and fini correctly

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-21 00:41:26 +09:00