Commit Graph

23 Commits

Author SHA1 Message Date
41832b2c88 🚀 feat: VM ExternCall実装 - ChatGPT5による plugin loader v2 統合
Phase 9.78b の続き:
- VM::execute_instruction に ExternCall 完全実装
- plugin loader v2 経由でenv.console.log等を処理
- MirBuilder::build_method_call に最適化追加(new Class().method() → 直接Call)
- extern_call メソッドを plugin_loader_v2 に追加

ChatGPT5によるVMとプラグインシステムの統合作業
2025-08-20 19:10:30 +09:00
41361a2f50 🚀 feat: Phase 9.78b Step 1&2完了 - ChatGPT5による実装
ChatGPT5が実装したPhase 9.78b Step 1&2の統合

## 🎯 実装内容
1. Phase 9.78b Step 1: BoxDeclarationをcore::modelへ移動
   - src/core/mod.rs, model.rs 新規作成
   - BoxDeclarationを純粋データモデルとして分離

2. Phase 9.78b Step 2: NyashRuntime骨組み作成
   - src/runtime/nyash_runtime.rs 追加
   - 統一Box管理の基盤

3. ビルドエラー修正
   - Arc重複インポート修正
   - as_str() → as_ref() 変更
   - parent_name.to_string() 型変換
   - インポートパス調整

## 📊 ビルド結果
-  フルビルド成功 (47.34秒)
-  ユニットテスト: 145/145成功
-  統合テスト: 16/16成功
-  WASMビルド成功 (1.9MB)
-  MIRテスト: 1失敗 (ref_new命令)

## 🚀 次のステップ
- Phase 9.78b Step 3: BoxFactory dyn化
- Codexの設計に基づく段階的実装継続
2025-08-20 18:57:10 +09:00
86b9f7719b 🏗️ feat: Phase 9.78b準備 - インタープリター・VM統合アーキテクチャ設計
Phase 9.78b: Codexの天才的分析に基づくアーキテクチャ再設計準備

## 📋 実施内容
1. Codex分析結果のアーカイブ
   - 実装詳細共有 → モデル共有・実行時共有への転換提案
   - 8ステップの段階的実装計画

2. Phase 9.78a作業の保存
   - MIR生成でのNewBox命令統一(保持)
   - ScopeTracker基本実装(一時コメントアウト)
   - VM拡張の方向性(TODOコメント付き)

3. ビルドエラー修正
   - ScopeTrackerインポート問題を一時的に解決
   - ビルド成功(警告のみ)

## 📚 作成ドキュメント
- architecture-redesign-proposal.md - Codexの設計提案
- phase_9_78b_interpreter_architecture_refactoring.md - 実装計画
- codex-analysis/* - 分析結果アーカイブ

## 🎯 次のステップ
Phase 9.78b Step 1: BoxDeclarationをcore::modelへ移動
2025-08-20 17:58:51 +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
840c1b85ef feat: Fix VM SSA loop execution with proper phi node handling
Fixed infinite loop issue in VM by addressing phi node caching problem.
The phi node was caching the initial value and returning it for all
subsequent iterations, preventing loop variable updates.

Changes:
- Created vm_phi.rs module to separate loop execution logic (similar to mir/loop_builder.rs)
- Disabled phi node caching to ensure correct value selection each iteration
- Added LoopExecutor to track block transitions and handle phi nodes properly
- Fixed VM to correctly track previous_block for phi input selection

The VM now correctly executes SSA-form loops with proper variable updates:
- Loop counter increments correctly
- Phi nodes select the right input based on control flow
- Test case now completes successfully (i=1,2,3,4)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-18 23:36:40 +09:00
fa1f188187 Phase 3 complete: Memory optimization - VM now 22.80x faster than interpreter
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-18 07:44:34 +00:00
230bd7a1d2 Phase 1 complete: Remove debug overhead - VM now 18.84x faster than interpreter
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-18 07:33:49 +00:00
bec0e9bc92 revert: 古いプラグインシステム実装前の状態に巻き戻し
- ソースコードをcommit 3f7d71fの状態に復元(古いプラグインシステム実装前)
- docsフォルダは最新の状態を維持(BID-FFI設計ドキュメント含む)
- nyashバイナリの基本動作確認済み
- BID-FFIシステムをクリーンに再実装する準備完了

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-18 08:34:19 +09:00
5b7ef32277 feat(phase-5.2): Complete backend cleanup - reject deprecated MIR instructions
Phase 5.2 of MIR 35→26 reduction project:
- VM backend: Reject all 17 deprecated instructions with proper error messages
- WASM backend: Reject deprecated instructions with migration guidance
- All deprecated instructions now properly handled in both backends
- Build successful with expected deprecation warnings

Deprecated instructions removed:
- UnaryOp → Use BinOp
- Load/Store → Use BoxFieldLoad/BoxFieldStore
- ArrayGet/ArraySet → Use BoxFieldLoad/BoxFieldStore or intrinsics
- Print/Debug → Use Call @print/@debug
- TypeCheck/Cast → Use Call @type_check/@cast
- Throw/Catch → Use Call @throw/@catch
- RefNew → References handled implicitly
- BarrierRead/BarrierWrite → Use AtomicFence
- FutureNew/FutureSet/Await → Use NewBox/BoxCall
- Copy/Nop → Not needed in final IR
2025-08-17 14:06:47 +09:00
3df87fb1ce fix(phase-4.3c-3): Fix StringBox literal handling in MIR builder
Phase 4-3c-3 Complete: WASM host functions now correctly output string content

## Changes:
- Fixed MIR builder to handle StringBox with string literal arguments
- Special case for  to generate proper string constants
- Removed debug output after successful verification
- WASM now correctly outputs "Hello MIR!" instead of "StringBox"

## Test Results:
- MIR generation:  Generates  correctly
- WASM compilation:  String data correctly placed at offset 4096
- WASM execution:  Outputs "Hello MIR\!" as expected

## Technical Details:
- Modified build_new_expression() to detect StringBox with literal arguments
- Generates Const instruction with actual string content
- Host function reads StringBox memory layout correctly

This completes the WASM string output functionality for Phase 4.

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-17 13:49:35 +09:00
bb3f2e8032 feat: Complete Phase 3 of MIR 35→26 reduction - optimization pass migration
- Remove old instructions from VM/WASM backends (UnaryOp, Print, Load/Store, RefGet/RefSet)
- Add comprehensive MIR optimizer with Effect System based optimizations
- Implement dead code elimination, CSE, pure instruction reordering
- Add intrinsic function support in VM backend
- Update backends to use new BoxFieldLoad/Store and Call intrinsics

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-17 12:27:12 +09:00
fa1a3ad644 feat(Phase 9.75j): Complete warning elimination - 106→0 warnings (100% improvement)
 Major code quality improvements:
• Fixed all unused variable and parameter warnings
• Added appropriate #[allow(dead_code)] annotations
• Renamed constants to follow Rust naming conventions
• Achieved completely warning-free codebase

🔧 Key changes:
• Parser expressions: Fixed arg_count and statement_count usage
• MIR modules: Added dead_code allows for future-use code
• Backend modules: Prefixed unused parameters with underscore
• Effect constants: Renamed 'read' to 'READ_ALIAS' for conventions

📊 Results:
• Before: 106 warnings (noisy build output)
• After: 0 warnings (clean build)
• Improvement: 100% warning reduction

🎯 This continues the bug fixing initiative "つづきのしゅうせいおねがいにゃ!"
from Phase 9.75i (birth() fixes, static methods, Copilot apps).

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 17:39:04 +09:00
5bcaa14b52 Phase 9.75-B: Convert StreamBox from Arc<Mutex> to RwLock, progress on DebugBox
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-14 23:59:11 +00:00
2091462441 Implement Phase 9.7: ExternCall instruction and WASM runtime imports
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-14 08:56:39 +00:00
bf51d3c71b Expand VM BoxCall support - add StringBox substring/concat and ArrayBox methods
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-14 03:46:06 +00:00
d26b365791 Fix VM BoxCall implementation - now returns actual method results
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-14 03:39:08 +00:00
28070ea2f2 Fix VM execution bug - include terminator instructions in execution loop
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-13 12:18:47 +00:00
cefac9051e Phase 7.4: Complete async MIR implementation with comprehensive tests
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-13 11:59:22 +00:00
b59f0ee419 Phase 7.1: Add MIR instructions for async operations (FutureNew, FutureSet, Await)
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-13 11:46:01 +00:00
af3ad5e5e2 Implement core AST lowering for New/FieldAccess to MIR Ref ops with basic VM field storage
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-13 10:20:37 +00:00
84d2aac8da Implement Phase 6 Box reference operations in MIR/VM - RefNew/RefGet/RefSet/WeakNew/WeakLoad/Barrier*
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-13 09:45:22 +00:00
d3a85b2305 Implement Phase 5: Control flow & exceptions in MIR/VM - Core functionality complete
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-13 06:23:28 +00:00
2f3b453fcb Implement Phase 1: MIR + VM backend with golden tests
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-13 05:59:10 +00:00