Major changes:
- Removed 617 lines of duplicate/legacy code from mod.rs (lines 351-967)
- All BoxCall handling now properly delegated to instructions::lower_boxcall
- Updated CURRENT_TASK.md with new findings:
- String concatenation issue (BinOp type mismatch)
- Plugin return value smoke test added
- Clear next steps for fixing return value display
Key improvements:
- Clean separation between dispatch (mod.rs) and implementation (instructions.rs)
- Legacy code marked as unreachable and ready for removal
- Better error visibility with modularized code structure
- llvm_smoke.sh updated with new plugin return value tests
Next steps:
1. Fix BinOp string concatenation type handling
2. Investigate MIR value_types for BoxCall returns
3. Further split lower_boxcall function (still 260+ lines)
- Split 2522-line codegen.rs into modular structure:
- mod.rs (1330 lines) - main compilation flow and instruction dispatch
- instructions.rs (1266 lines) - all MIR instruction implementations
- types.rs (189 lines) - type conversion and classification helpers
- helpers.rs retained for shared utilities
- Preserved all functionality including:
- Plugin return value handling (BoxCall/ExternCall)
- Handle-to-pointer conversions for proper value display
- Type-aware return value processing based on MIR metadata
- All optimization paths (ArrayBox fast-paths, string concat, etc.)
- Benefits:
- Better code organization and maintainability
- Easier to locate specific functionality
- Reduced cognitive load when working on specific features
- Cleaner separation of concerns
No functional changes - pure refactoring to improve code structure.
- Keep essential information within 500 lines (now 395 lines)
- Maintain important syntax examples and development principles
- Move detailed information to appropriate docs files:
- Development practices → docs/guides/development-practices.md
- Testing guide → docs/guides/testing-guide.md
- Claude issues → docs/tools/claude-issues.md
- Add proper links to all referenced documentation
- Balance between minimal entry point and practical usability