Files
hakorune/crates
tomoaki 798c193cbe refactor(kernel): Extract weak reference FFI to ffi/weak.rs module
**Problem**:
- nyash_kernel/src/lib.rs is 1295 lines (monolithic FFI functions)
- Hard to navigate and maintain
- No clear module boundaries

**Solution** (Task 2 - Medium Priority):
- Create `ffi/` module structure
- Extract weak reference functions to `ffi/weak.rs` (74 lines)
  - nyrt_weak_new
  - nyrt_weak_to_strong
  - nyrt_weak_drop
- lib.rs: 1295 → 1221 lines (-74 lines, -5.7%)
- Re-export via `pub use ffi::weak::*` for ABI compatibility

**Architecture**:
- Box-First: Clear module boundaries (SSOT for weak refs)
- Reversible: Can merge back if needed (small, safe step)
- ABI stable: #[no_mangle] exports preserved

**Verification**:
-  Build successful (cargo build -p nyash_kernel)
-  phase285_p2_weak_upgrade_success_llvm: PASS
-  phase285_p2_weak_upgrade_fail_llvm: PASS
-  Quick profile: 154/154 PASS

**Next steps** (deferred to future):
- Extract string FFI (~11 functions)
- Extract memory management FFI
- Extract box operations FFI

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-26 17:29:15 +09:00
..