af32896574
fix: Fix NyashParser import path and improve BoxCall fallback
...
- Fix NyashParser import path in vm.rs tests
- Improve BoxCall fallback logic for plugin/builtin methods
- Add proper function existence checks before lowering to Call
This ensures plugin Box methods correctly fall back to BoxCall
when the corresponding user-defined function doesn't exist.
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-08-20 23:07:16 +09:00
b3ac83de36
feat(phase-9.78b): ChatGPT5 VM unified Box handling + MIR parameter fix
...
Phase 9.78b Step 1-2完了 + ChatGPT5による修正:
- ✅ MIRパラメータ解決修正(ValueId reset)
- ✅ VMでExternCall/Call実装
- ✅ プラグインローダーv2統合
- ✅ 3種類のBox完全動作(UserDefined/Builtin/Plugin)
- ✅ VM E2Eテスト成功
次期作業:
- Phase 9.78b Step 3: BoxFactory dyn化
- Phase 9.78b Step 4以降: アーキテクチャ改善
Co-authored-by: ChatGPT5 <noreply@openai.com >
2025-08-20 20:01:55 +09:00
8aef29eaef
🎉 feat: MIRパラメータ解決完全修正 + VM E2Eテスト成功!
...
Phase 9.78b関連修正:
- MirBuilder::lower_method_as_function でValueIdリセット実装
- me → %0, 引数 → %1... の正しいマッピング
- build_me_expression() で変数テーブル優先解決
- VM E2Eテスト test_vm_user_box_birth_and_method 成功
- new Person("Alice").greet() → "Hello, Alice"
ドキュメント:
- mir-unified-reference.md を正式MIRドキュメントとして配置
- 現在の35命令実装状態を正確に記載
- RefGet/RefSet仕様含む
ChatGPT5によるMIRビルダー修正で、VMバックエンドでのユーザー定義Box完全動作!
2025-08-20 19:34:09 +09:00
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
5b6cf828af
feat: Phase 9.78b完了 - UnifiedBoxRegistry統合とビルド最適化
...
🏭 **Phase 9.78b: 統合レジストリ実装完了**
**主要な変更:**
- execute_new()に統合レジストリを統合、レガシーmatch文への自動フォールバック
- 全importエラー解決(RuntimeError, モジュールパス修正)
- runner.rs起動時に統合レジストリ初期化
- 20+種類のビルトインBoxが統合ファクトリ経由で作成可能
**ビルド時間最適化:**
- wasmtime/wabt依存を"wasm-backend"フィーチャーでオプション化
- デフォルトビルド 4分 → 43秒の劇的高速化達成
**技術的達成:**
- 600+行match文 → 30行ファクトリパターンへの移行基盤完成
- プラグイン・ユーザー定義・ビルトインBox統一アーキテクチャ確立
- Everything is Box哲学の実装レベル体現
**次のステップ:**
Phase 9.78c: プラグインBox統合、Phase 9.78d: ユーザー定義Box統合
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-08-19 16:56:44 +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
9d78ecd089
feat(phase-9.78): Improve MIR generation for built-in Box types and enhance LLVM mock
...
- Fix MIR builder to handle built-in Box types (IntegerBox, StringBox, etc.) specially
- Generate MIR with actual constant values instead of ref_new instructions
- Enhance LLVM mock compiler with MIR interpreter foundation
- Add value storage HashMap for future MIR instruction interpretation
This enables proper MIR generation where 'new IntegerBox(42)' becomes '%0 = const 42'
instead of '%0 = ref_new "IntegerBox"'. This is essential for future LLVM code generation.
Example MIR improvement:
Before:
%1 = const "IntegerBox"
%0 = ref_new %1
After:
%0 = const 42
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com >
2025-08-18 19:29:24 +09:00
313ad2a46d
Complete LLVM PoC mock implementation - demonstrates integration structure
...
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com >
2025-08-18 09:25:57 +00:00
e74a9f621e
Implement LLVM backend basic structure - Phase 9.78 Week 1 foundation
...
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com >
2025-08-18 09:14:39 +00: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
c6c3c8e2f9
fix(bid-ffi): Fix HostVtable lifetime issue causing segfault
...
🚨 Critical memory safety fix:
- HostVtable was created on stack and destroyed after init
- Plugin stored reference to destroyed memory → NULL pointer access
- Changed to static LazyLock storage for lifetime safety
✅ Results:
- Segfault completely eliminated
- Plugin logging now works properly
- Type info system confirmed working
- Full E2E FileBox plugin operation successful
🔧 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-08-18 14:10:41 +09: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
cde961defc
feat(phase-9.77): Implement BoxCall instructions and fix wasmtime version
...
Phase 9.77 WASM Emergency Recovery Progress:
- ✅ Task 1.1: Implement BoxCall instruction for toString(), print(), equals(), clone(), log()
- ✅ Task 1.2: Update wasmtime 18.0 → 35.0.0 and add runtime imports
- 🔄 Task 1.3: Working on UTF-8 encoding error fix
Changes:
- Add generate_box_call() method in codegen.rs with 5 helper methods
- Update wasmtime dependency to 35.0.0 for AOT compatibility
- Add BoxCall runtime imports (box_to_string, box_print, box_equals, box_clone)
- Implement wat_to_wasm() with UTF-8 validation and debug output
- Update CURRENT_TASK.md with Copilot handoff notes
Current issue: 'Generated WASM is not valid UTF-8' error source unknown
Next: Copilot to investigate error origin and complete Task 1.3
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com >
2025-08-16 21:21:51 +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
85a5ce053d
Fix WASM Jump/Branch implementation and HTTPServer listen() functionality
...
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com >
2025-08-14 07:14:45 +00:00
626572a012
Fix WASM import expectations and validate complete implementation
...
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com >
2025-08-14 05:35:17 +00:00
c1ae84ce61
Implement basic WASM string constant support
...
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com >
2025-08-14 05:31:36 +00:00
db9bcd3b45
Implement AOT backend infrastructure with CLI integration
...
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com >
2025-08-14 04:38:20 +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
c7365d3dc9
feat(merge): integrate Phase 8.3 WASM Box Operations + Benchmark System
...
🎉 Successful merge of Copilot and Claude implementations:
**Copilot Contributions (Phase 8.3):**
- ✅ WASM Box Operations: RefNew/RefGet/RefSet complete implementation
- ✅ Memory management: BoxLayout, MemoryManager with standard types
- ✅ WASM codegen: Box allocation, field access, type-safe operations
- ✅ Runtime support: malloc, heap management, type ID system
**Claude Contributions (Benchmark System):**
- ✅ Comprehensive benchmark framework (src/benchmarks.rs)
- ✅ CLI integration: --benchmark, --iterations, --output options
- ✅ 3-backend performance comparison (Interpreter/VM/WASM)
- ✅ 280x WASM speedup verification system
- ✅ Golden dump testing infrastructure
**Unified Features:**
- 🔧 execute_wasm_mode: Supports both output file and stdout
- 🔧 CLI arguments: All options preserved and functional
- 🔧 Error handling: Improved MIR verification messages
- 🔧 Build system: All modules properly integrated
**Next Steps Ready:**
- 📊 MIR diet planning (35→20 instructions)
- 🚀 Phase 8.4: AOT WASM native compilation
- 🧪 Golden dump automation
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-08-14 08:12:36 +09:00
a0a97620b8
Complete Phase 8.3 WASM Box Operations - Everything is Box in WASM
...
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com >
2025-08-13 22:20:50 +00:00
8ec80a35c3
feat(benchmark): add comprehensive performance benchmarking system
...
🚀 Phase 8.2 PoC2 Achievement: 280x WASM performance boost proven\!
## New Features:
- Complete benchmark framework (src/benchmarks.rs)
- CLI integration: --benchmark --iterations options
- 3-backend comparison: Interpreter/VM/WASM
- Automated performance measurement & reporting
## Benchmark Results (100 iterations average):
- WASM: 0.17ms (280x faster than Interpreter\!)
- VM: 16.97ms (2.9x faster than Interpreter)
- Interpreter: 48.59ms (baseline)
## Added Files:
- benchmarks/bench_{light,medium,heavy}.nyash - Test cases
- benchmark_summary_20250814.md - Clean results
- wasm_demo/ - Browser execution environment
## Documentation Updates:
- docs/execution-backends.md - Added benchmark usage
- docs/CURRENT_TASK.md - Phase 8.3 Copilot coordination
- CLAUDE.md - Quick benchmark access
## Copilot Integration Ready:
- Phase 8.3 merge conflict avoidance strategy documented
- Benchmark framework ready for Box operation performance validation
- CLI integration preserved for future enhancements
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-08-14 07:19:23 +09:00
8a7532a77b
🎉 Phase 8.2 PoC1 COMPLETE: MIR→WASM basic arithmetic working end-to-end!
...
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com >
2025-08-13 13:19:43 +00:00
3335f26812
Phase 8.2 PoC1 Progress: WASM codegen mostly working, debugging Return instruction issue
...
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com >
2025-08-13 13:15:02 +00:00
8276eeeb64
Phase 8.1 Complete: WASM backend foundation implementation
...
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com >
2025-08-13 13:05:49 +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
9adb34ff58
Complete Phase 6.1: AST lowering for New/FieldAccess → MIR Ref ops with tests and VM field storage
...
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com >
2025-08-13 10:26:46 +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