- Add comprehensive design discussion with Gemini about unified BoxFactory
- Define Phase 9.78 implementation plan with 6 sub-phases (9.78a-f)
- Include clone_box/share_box semantics clarification and fixes
- Update CURRENT_TASK.md with specific misimplementation details
- Archive Gemini's deep technical analysis endorsing the approach
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Major achievements:
- Fixed TLV encoding format to match plugin expectations
- Header: version(2 bytes) + argc(2 bytes)
- Entry: tag(1) + reserved(1) + size(2) + data
- Removed duplicate implementation in method_dispatch.rs
- All FileBox methods working: open/read/write/close
- Successfully tested file I/O operations
This completes the v2 plugin system integration for FileBox.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Extend plugin-tester to support multi-box plugins with v2 API
- Add nyash_plugin_get_box_count/get_box_info/get_type_id functions
- Create test multi-box plugin providing TestBoxA and TestBoxB
- Update plugin-system.md documentation for v2 format
- Add nyash.toml v2 specification for multi-box support
- Successfully tested multi-box plugin lifecycle and type resolution
This enables one plugin to provide multiple Box types, solving the
dependency issue where HTTPServerBox needs SocketBox.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
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>
- Discovered that nyash.toml already contains comprehensive type information
- Shifted strategy from new BID YAML files to extending existing nyash.toml
- Updated Phase 9.8 plan to integrate with Phase 9.9 permissions model
- Set goal: FileBox working on VM backend with permission controls
- Documented the revolutionary discovery that simplifies the entire approach
This change reflects the strategic decision to leverage existing infrastructure
rather than creating new file formats, making the system more maintainable.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
🎊 Phase 9.75g-0 COMPLETE - Revolutionary Plugin System Achievement\!
✅ Major Completions:
- plugin-tester type validation: nyash.toml integration & method signature verification
- Duplicate method name detection: Enforces Nyash no-overloading policy
- Comprehensive developer guide: 200+ line technical documentation
- Memory safety: HostVtable lifetime issues resolved with LazyLock
- Type information system: External nyash.toml configuration eliminates hardcoded conversions
🚀 Revolutionary Impact:
Nyash now supports dynamic Box type extension via plugins:
```nyash
local file = new FileBox() // Plugin-provided
local db = new PostgreSQLBox() // Future: Plugin-provided
local gpu = new CudaBox() // Future: Plugin-provided
```
📊 Technical Achievements:
- plugin-tester: 4 comprehensive validation modes (check/lifecycle/io/typecheck)
- BID-FFI Protocol: Production-ready with valgrind-verified memory safety
- Type conversion: Automatic string→bytes mapping via nyash.toml
- Method validation: Prevents overloading conflicts in plugin development
🎯 Next Priority: Phase 8.6 VM Performance Improvement
Current issue: VM is 0.9x slower than interpreter (regression\!)
Target: 2x+ speedup for practical VM execution
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
🚨 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>
Day 5 achievements:
- Created independent FileBox plugin crate with C FFI exports
- Integrated plugin loading into Nyash interpreter startup
- Implemented transparent builtin/plugin Box switching via nyash.toml
- Successfully loaded plugin library (385KB .so) at runtime
- Confirmed PluginBox proxy creation for FileBox instances
Architecture changes:
- Added plugins/ directory with .gitignore for build artifacts
- Modified runner.rs to load plugins from nyash.toml on startup
- Updated objects.rs to use BoxFactoryRegistry for FileBox creation
- Fixed bid module visibility between lib.rs and main.rs
Remaining work (10%):
- Complete PluginBox proxy method implementations (toString, etc.)
- Test actual file operations through plugin interface
- Finalize error handling and edge cases
Build status: All tests passing, plugin loading confirmed
- Day 3 marked as 100% complete
- Day 4 FileBox plugin marked as 50% complete
- Updated timestamp to 22:00
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- Add FutureBox BID bridge implementation for async Box types
- Support FutureBox in box_to_bid_handle conversion
- Add comprehensive FutureBox BID round-trip test
- Update CURRENT_TASK.md to reflect Day 3 completion (100%)
Day 3 fully completed! All Box types (String/Integer/Future) now integrated with BID-FFI.
Everything is Box philosophy proven through unified handle management! 🎉🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Mark metadata API implementation as complete
- Add implementation details:
- HostVtable for host function integration
- Plugin metadata structures (NyashPluginInfo, NyashMethodInfo)
- C FFI function signatures
- Plugin lifecycle management
- Note test results: 7/7 tests passing
Day 2 objectives achieved! Ready for Day 3 existing Box integration.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Mark BID-1 foundation implementation as complete
- Add implementation details (src/bid/ module, TLV, types, errors)
- Note test results: 4/4 tests passing
Day 1 objectives achieved! Ready for Day 2 metadata API.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Update ffi-abi-specification.md to BID-1 Enhanced Edition
- Add efficient Handle design (type_id + instance_id)
- Define BID-1 TLV unified format for arguments/results
- Add Plugin API with NyashHostVtable and metadata support
- Include complete FileBox plugin example in C
- Standardize error codes (NYB_SUCCESS, NYB_E_*)
- Support 8-byte alignment and platform-dependent usize
- Add phase_9_75g_0_chatgpt_enhanced_final.md as the final design
- Incorporates all ChatGPT-5 recommendations
- Confirms 1-week implementation feasibility
- Aligns with Everything is Box philosophy
- Update CURRENT_TASK.md to reflect Day 1 progress
- Mark specification finalization as complete
- Ready to start actual implementation
Everything is Box philosophy meets practical FFI/ABI design\!
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Create comprehensive type definitions for all future features
- Adopt FFI ABI v0 compliance with platform-aware pointers (usize)
- Implement 8-byte alignment for cross-platform compatibility
- Design single entry point: nyash_plugin_invoke
- Target Linux x86-64 for initial implementation
- Use unimplemented!() for gradual feature addition
Key decisions from AI review:
- Pointer width: platform-dependent (not fixed 32-bit)
- Early addition of Option/Result types
- Clear ownership rules for strings/arrays
- Extensible BoxHeader with magic number
Phase 9.75g-0: Build it simple, make it work, then extend!
- Marked all phases as completed
- Added project statistics:
- 9 instructions removed (25.7% reduction)
- Completed in 1 day instead of 5 weeks
- 95% success rate (RefNew display issue remains)
- Code quality improved with unified architecture
This documents the successful completion of the MIR instruction reduction project.
Phase 5.4 of MIR 35→26 reduction project:
- Create MIR 26-instruction specification document
- Update CURRENT_TASK.md with Phase 5 progress
- Update phase_8_5_mir_35_to_26_reduction.md with completion status
- Document amazing progress: 90% completion in 1 day vs 5 weeks estimate
Documentation updates:
- docs/説明書/reference/mir-26-specification.md: Complete specification
- docs/CURRENT_TASK.md: Phase 5-4 in progress
- docs/予定/native-plan/issues/phase_8_5_mir_35_to_26_reduction.md: Status updates
Next: Update test files to remove deprecated instructions
- 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>
- Implement C ABI plugin system with workspace configuration
- Create FileBox plugin with full read/write/exists/toString support
- Fix critical memory management issues (double free) with Arc
- Add comprehensive test suite for dynamic FileBox functionality
- Achieve 98% build time improvement for plugin (2.87s vs 2-3min)
- Maintain full backward compatibility with feature flags
FileBox now loads dynamically, drastically reducing build times while
maintaining all functionality. Next: Math/Time dynamic migration.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Change from compile_module() to compile_to_wat() to fix UTF-8 error
- WASM compilation now outputs WAT text format directly
- Successfully generates WAT file for simple test case
- Note: Debug build still has issues (separate bug)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- List 5 target files for refactoring with expected reduction rates
- interpreter/expressions.rs (1457 lines) as highest priority
- mir/builder.rs, interpreter/objects.rs, ast.rs, box_trait.rs as next targets
- Document module split strategy for each file
- Document parser refactoring completion (1530→227 lines, 85% reduction)
- Add final module structure and achievements
- Mark all parser refactoring steps as completed