440f8646b1
feat(joinir): Phase 183 LoopBodyLocal role separation + test fixes
...
Phase 183 Implementation:
- Added is_var_used_in_condition() helper for AST variable detection
- Implemented LoopBodyLocal filtering in TrimLoopLowerer
- Created 4 test files for P1/P2 patterns
- Added 5 unit tests for variable detection
Test Fixes:
- Fixed test_is_outer_scope_variable_pinned (BasicBlockId import)
- Fixed test_pattern2_accepts_loop_param_only (literal node usage)
Refactoring:
- Unified pattern detection documentation
- Consolidated CarrierInfo initialization
- Documented LoopScopeShape construction paths
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-08 23:43:26 +09:00
f9d100ce01
chore: Phase 25.1 完了 - LoopForm v2/Stage1 CLI/環境変数削減 + Phase 26-D からの変更
...
Phase 25.1 完了成果:
- ✅ LoopForm v2 テスト・ドキュメント・コメント完備
- 4ケース(A/B/C/D)完全テストカバレッジ
- 最小再現ケース作成(SSAバグ調査用)
- SSOT文書作成(loopform_ssot.md)
- 全ソースに [LoopForm] コメントタグ追加
- ✅ Stage-1 CLI デバッグ環境構築
- stage1_cli.hako 実装
- stage1_bridge.rs ブリッジ実装
- デバッグツール作成(stage1_debug.sh/stage1_minimal.sh)
- アーキテクチャ改善提案文書
- ✅ 環境変数削減計画策定
- 25変数の完全調査・分類
- 6段階削減ロードマップ(25→5、80%削減)
- 即時削除可能変数特定(NYASH_CONFIG/NYASH_DEBUG)
Phase 26-D からの累積変更:
- PHI実装改善(ExitPhiBuilder/HeaderPhiBuilder等)
- MIRビルダーリファクタリング
- 型伝播・最適化パス改善
- その他約300ファイルの累積変更
🎯 技術的成果:
- SSAバグ根本原因特定(条件分岐内loop変数変更)
- Region+next_iパターン適用完了(UsingCollectorBox等)
- LoopFormパターン文書化・テスト化完了
- セルフホスティング基盤強化
Co-Authored-By: Claude <noreply@anthropic.com >
Co-Authored-By: ChatGPT <noreply@openai.com >
Co-Authored-By: Task Assistant <task@anthropic.com >
2025-11-21 06:25:17 +09:00
9bdf2ff069
chore: Phase 25.2関連ドキュメント更新&レガシーテストアーカイブ整理
...
## ドキュメント更新
- CURRENT_TASK.md: Phase 25.2完了記録
- phase-25.1b/e/q/25.2 README更新
- json_v0_bridge/README.md新規追加
## テストファイル整理
- vtable_*テストをtests/archive/に移動(6ファイル)
- json_program_loop.rsテスト追加
## コード整理
- プラグイン(egui/python-compiler)微修正
- benchmarks.rs, instance_v2.rs更新
- MIR関連ファイル微調整
## 全体成果
Phase 25.2完了により:
- LoopSnapshotMergeBox統一管理実装
- ValueId(1283)バグ根本解決
- ~35行コード削減(目標210行の16%)
- 11テスト全部PASS、3実行テストケースPASS
2025-11-20 03:56:12 +09:00
dda65b94b7
Phase 21.7 normalization: optimization pre-work + bench harness expansion
...
- Add opt-in optimizations (defaults OFF)
- Ret purity verifier: NYASH_VERIFY_RET_PURITY=1
- strlen FAST enhancement for const handles
- FAST_INT gate for same-BB SSA optimization
- length cache for string literals in llvmlite
- Expand bench harness (tools/perf/microbench.sh)
- Add branch/call/stringchain/arraymap/chip8/kilo cases
- Auto-calculate ratio vs C reference
- Document in benchmarks/README.md
- Compiler health improvements
- Unify PHI insertion to insert_phi_at_head()
- Add NYASH_LLVM_SKIP_BUILD=1 for build reuse
- Runtime & safety enhancements
- Clarify Rust/Hako ownership boundaries
- Strengthen receiver localization (LocalSSA/pin/after-PHIs)
- Stop excessive PluginInvoke→BoxCall rewrites
- Update CURRENT_TASK.md, docs, and canaries
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-13 16:40:58 +09:00
301b1d212a
Phase 21.2 Complete: VM Adapter正規実装 + devブリッジ完全撤去
...
## 🎉 Phase 21.2完全達成
### ✅ 実装完了
- VM static box 永続化(singleton infrastructure)
- devブリッジ完全撤去(adapter_dev.rs削除、by-name dispatch削除)
- .hako正規実装(MirCallV1Handler, AbiAdapterRegistry等)
- text-merge経路完全動作
- 全phase2120 adapter reps PASS(7テスト)
### 🐛 バグ修正
1. strip_local_decl修正
- トップレベルのみlocal削除、メソッド内は保持
- src/runner/modes/common_util/hako.rs:29
2. static box フィールド永続化
- MirInterpreter singleton storage実装
- me parameter binding修正(1:1マッピング)
- getField/setField string→singleton解決
- src/backend/mir_interpreter/{mod,exec,handlers/boxes_object_fields}.rs
3. Map.len alias rc=0修正
- [map/missing]パターン検出でnull扱い(4箇所)
- lang/src/vm/boxes/mir_call_v1_handler.hako:91-93,131-133,151-153,199-201
### 📁 主要変更ファイル
#### Rust(VM Runtime)
- src/backend/mir_interpreter/mod.rs - static box singleton storage
- src/backend/mir_interpreter/exec.rs - parameter binding fix
- src/backend/mir_interpreter/handlers/boxes_object_fields.rs - singleton resolution
- src/backend/mir_interpreter/handlers/calls.rs - dev bridge removal
- src/backend/mir_interpreter/utils/mod.rs - adapter_dev module removal
- src/backend/mir_interpreter/utils/adapter_dev.rs - DELETED (7555 bytes)
- src/runner/modes/vm.rs - static box declaration collection
- src/runner/modes/common_util/hako.rs - strip_local_decl fix
- src/instance_v2.rs - Clone implementation
#### Hako (.hako実装)
- lang/src/vm/boxes/mir_call_v1_handler.hako - [map/missing] detection
- lang/src/vm/boxes/abi_adapter_registry.hako - NEW (adapter registry)
- lang/src/vm/helpers/method_alias_policy.hako - method alias support
#### テスト
- tools/smokes/v2/profiles/quick/core/phase2120/s3_vm_adapter_*.sh - 7 new tests
### 🎯 テスト結果
```
✅ s3_vm_adapter_array_len_canary_vm.sh
✅ s3_vm_adapter_array_len_per_recv_canary_vm.sh
✅ s3_vm_adapter_array_length_alias_canary_vm.sh
✅ s3_vm_adapter_array_size_alias_canary_vm.sh
✅ s3_vm_adapter_map_len_alias_state_canary_vm.sh
✅ s3_vm_adapter_map_length_alias_state_canary_vm.sh
✅ s3_vm_adapter_map_size_struct_canary_vm.sh
```
環境フラグ: HAKO_ABI_ADAPTER=1 HAKO_ABI_ADAPTER_DEV=0
### 🏆 設計品質
- ✅ ハードコード禁止(AGENTS.md 5.1)完全準拠
- ✅ 構造的・一般化設計(特定Box名のif分岐なし)
- ✅ 後方互換性保持(既存コード破壊ゼロ)
- ✅ text-merge経路(.hako依存関係正しくマージ)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-07 19:32:44 +09:00
cdf826cbe7
public: publish selfhost snapshot to public repo (SSOT using + AST merge + JSON VM fixes)
...
- SSOT using profiles (aliases/packages via nyash.toml), AST prelude merge
- Parser/member guards; Builder pin/PHI and instance→function rewrite (dev on)
- VM refactors (handlers split) and JSON roundtrip/nested stabilization
- CURRENT_TASK.md updated with scope and acceptance criteria
Notes: dev-only guards remain togglable via env; no default behavior changes for prod.
2025-09-26 14:34:42 +09:00
e5f6d51b3c
refactor: レガシーコード大掃除完了!ChatGPT効率化のため
...
✅ 削除完了(約700行のレガシー削除)
- src/jit_stub.rs 完全削除(134行の何もしないスタブ)
- src/backend/llvm_legacy/ アーカイブ化(壊れたLLVMバックエンド)
- vm-legacy feature全削除(5ファイルの混乱する二重パス)
- コメントアウトされたインタープリター削除
- JIT関連の巨大コメントブロック削除(350行以上)
✅ ChatGPTへの効果
- 完璧主義による掃除タイム削減
- 本質的な実装に集中可能
- 混乱する二重パスの排除
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-24 21:57:12 +09:00
73b90a7c28
feat: スモークテストv2実装&Phase 15.5後のプラグイン対応
...
Phase 15.5 Core Box削除後の新テストシステム構築:
## 実装内容
- スモークテストv2システム完全実装(3段階プロファイル)
- 共通ライブラリ(test_runner/plugin_manager/result_checker/preflight)
- インタープリター層完全削除(約350行)
- PyVM重要インフラ特化保持戦略(JSON v0ブリッジ専用)
- nyash.tomlパス修正(13箇所、プラグイン正常ロード確認)
## 動作確認済み
- 基本算術演算(+, -, *, /)
- 制御構文(if, loop, break, continue)
- 変数代入とスコープ
- プラグインロード(20個の.soファイル)
## 既知の問題
- StringBox/IntegerBoxメソッドが動作しない
- オブジェクト生成は成功するがメソッド呼び出しでエラー
- Phase 15.5影響でプラグイン実装が不完全な可能性
## ドキュメント
- docs/development/testing/smoke-tests-v2.md 作成
- docs/reference/pyvm-usage-guidelines.md 作成
- CODEX_QUESTION.md(Codex相談用)作成
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-24 09:30:42 +09:00
adbb0201a9
chore(fmt): add legacy stubs and strip trailing whitespace to unblock cargo fmt
2025-09-17 07:43:07 +09:00
edf5ccfcb4
Docs: Add phase_9_79b_3_vm_vtable_thunks_and_pic.md\n- Plan to formalize TypeMeta+Thunk and upgrade PIC to poly\n- Diagnostics, risks, milestones, exit criteria, and Phase 10 readiness
2025-08-27 00:03:48 +09:00
4f360e0fbb
fix: Replace static mut with Lazy for thread safety in FileBoxRegistry
...
- Eliminate static_mut_refs warnings by using once_cell::sync::Lazy
- Make FileMode enum public to fix private_interfaces warning
- Reduce warnings from 6 to 3
- Prepare for Rust 2024 edition compatibility
2025-08-21 12:14:33 +09:00
bab57e7c07
🎉 feat: ChatGPT5による奇跡の全テスト修復完了!
...
- instance_v2移行で破綻していた440個のテストを30分で全修正
- git巻き戻しレベルの状況から完全復活
- 人間には不可能な速度での大規模整合性修正
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-08-20 04:45:26 +09:00
5582ad45c0
feat: Phase 9.78e complete - instance_v2 migration with legacy compatibility
...
- instance_v2 now includes legacy compatibility layer
- All interpreter code migrated to use instance_v2
- Added legacy field access methods (get_fields, set_field_legacy, etc.)
- Fixed type conversion issues (NyashValue vs SharedNyashBox)
- instance.rs still exists but no longer used in interpreter
- TODO: Remove instance.rs completely in next phase
- TODO: Implement proper SharedNyashBox -> NyashValue conversion
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-08-19 22:35:34 +09:00
03e4de6ad7
feat: Phase 9.78d完全達成 - InstanceBox統合 + type_name委譲実装成功
...
🎉 Phase 9.78d 主要マイルストーン達成!
主要成果:
✅ Rustスコープ問題完全解決 - use crate::instance_v2::InstanceBox;
✅ StringBox → InstanceBox統合完成 - BuiltinBoxFactory経由で成功
✅ type_name()委譲実装 - 内包Boxの型名を正しく返す修正完了
✅ 基本機能完全動作 - 文字列作成・連結・基本操作すべて正常
✅ 統一レジストリ確認 - 🏭 Unified registry created動作確認
✅ デバッグ情報改善 - type_name='StringBox'正確表示
技術的達成:
- InstanceBox::from_any_box()によるビルトインBox統合
- 内包Boxへの透過的type_name()委譲実装
- BuiltinBoxFactory経由での統一Box生成確立
- 全体Progress: 44% → 85%完了に大幅進展
次期課題:
⚠️ メソッド呼び出し統合 - str.type_name()等の動的ディスパッチ
🎯 Phase 9.78e - Gemini提案のcall_method設計実装予定
ファイル変更:
- src/instance_v2.rs: type_name()内包Box委譲実装
- src/box_factory/builtin.rs: InstanceBox統合実装
- docs/CURRENT_TASK.md: 進捗85%完了に更新
- local_tests/: Gemini設計相談ファイル追加
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-08-19 20:00:16 +09:00
9f3a7c62f7
fix: Phase 9.78d重要修正 - 重複StringBox定義問題を解決
...
🐛 重大なレガシー問題修正:
- StringBox重複定義による文字列演算子破綻を修正
- operators.rs: 統一レジストリStringBoxに変更
- 全アプリケーションの文字列連結(+)演算子が復旧
🎯 Phase 9.78d InstanceBox簡素化実装:
- instance_v2.rs: 統一trait object設計
- from_any_box/from_declaration統一コンストラクタ
- レガシーfiniシステム簡素化対応
📋 ドキュメント更新:
- CURRENT_TASK.md: レガシー問題詳細記録
- 今後の対策・検証結果を文書化
🧪 検証結果:
✅ TinyProxy, KiloEditor等全アプリで文字列演算正常動作
✅ InstanceBox v2統一実装テスト成功
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-08-19 18:32:11 +09:00