feat(phase-9.75f-1): Complete FileBox dynamic library implementation

- 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>
This commit is contained in:
Moe Charm
2025-08-17 09:31:35 +09:00
parent bd20c91b67
commit 2b2dcc5647
19 changed files with 347 additions and 207 deletions

View File

@ -350,13 +350,13 @@ impl NyashInterpreter {
// 2. local変数をチェック
if let Some(local_value) = self.local_vars.get(name) {
eprintln!("🔍 DEBUG: Found '{}' in local_vars", name);
eprintln!("🔍 DEBUG: Found '{}' in local_vars, type: {}", name, local_value.type_name());
// 🔧 修正clone_box() → Arc::clone() で参照共有
let shared_value = Arc::clone(local_value);
eprintln!("✅ RESOLVE_VARIABLE shared reference: {} id={}",
name, shared_value.box_id());
eprintln!("✅ RESOLVE_VARIABLE shared reference: {} id={}, type: {}",
name, shared_value.box_id(), shared_value.type_name());
return Ok(shared_value);
}
@ -478,7 +478,12 @@ impl NyashInterpreter {
/// local変数を宣言関数内でのみ有効
pub(super) fn declare_local_variable(&mut self, name: &str, value: Box<dyn NyashBox>) {
self.local_vars.insert(name.to_string(), Arc::from(value));
eprintln!("🔍 DEBUG: declare_local_variable '{}' with type: {}, id: {}",
name, value.type_name(), value.box_id());
let arc_value: Arc<dyn NyashBox> = Arc::from(value);
eprintln!("🔍 DEBUG: After Arc::from, type: {}, id: {}",
arc_value.type_name(), arc_value.box_id());
self.local_vars.insert(name.to_string(), arc_value);
}
/// outbox変数を宣言static関数内で所有権移転