feat(runtime): Phase 103 CoreServices Optional化 - Memory Constraints対応
- Add CoreServicesConfig struct (from_env, minimal, all_enabled) - Implement with_core_from_registry_optional() for selective initialization - Update CoreBoxesImpl fields to Option<Arc<dyn XyzService>> - Maintain backward compatibility (with_core_from_registry calls all_enabled) - Add NYASH_CORE_DISABLE_* environment variable support - ConsoleBox remains mandatory (Graceful Degradation principle) - Add unit tests for optional initialization - Update console_println! macro to handle Option type - Fix direct console.println() calls in vm.rs and selfhost.rs - Create core_optional_design.md documentation Note: Phase 104 will extend ConsoleService to be optional as well with graceful fallback in console_println! macro. Files modified: - src/runtime/plugin_host.rs (CoreServicesConfig, with_core_from_registry_optional, tests) - src/runtime/core_services.rs (CoreBoxesImpl fields → Option type) - src/runtime/mod.rs (console_println! macro updated) - src/runner/modes/vm.rs (handle Option console) - src/runner/selfhost.rs (handle Option console) - docs/development/current/main/core_optional_design.md (new) - docs/development/current/main/ring0-inventory.md (Phase 103 entry) Test results: - Build: ✅ Success (0 errors, 7 warnings) - Unit tests: ✅ 3/3 passed (optional_core_tests) - Runtime tests: ✅ 63/63 passed - Smoke tests: ✅ 30/31 passed (1 pre-existing timeout)
This commit is contained in:
@ -3,6 +3,7 @@ use super::util::dbg_on;
|
||||
use super::PluginLoaderV2;
|
||||
use crate::bid::{BidError, BidResult};
|
||||
use crate::config::nyash_toml_v2::LibraryDefinition;
|
||||
use crate::runtime::get_global_ring0;
|
||||
use libloading::{Library, Symbol};
|
||||
use std::collections::HashMap;
|
||||
use std::path::{Path, PathBuf};
|
||||
@ -45,19 +46,19 @@ pub(super) fn load_plugin(
|
||||
}
|
||||
let lib_path = lib_path.unwrap_or_else(|| base.to_path_buf());
|
||||
if dbg_on() {
|
||||
eprintln!(
|
||||
get_global_ring0().log.debug(&format!(
|
||||
"[PluginLoaderV2] load_plugin: lib='{}' path='{}'",
|
||||
lib_name,
|
||||
lib_path.display()
|
||||
);
|
||||
));
|
||||
}
|
||||
let lib = unsafe { Library::new(&lib_path) }.map_err(|e| {
|
||||
eprintln!(
|
||||
get_global_ring0().log.error(&format!(
|
||||
"[plugin/init] dlopen failed for {} ({}): {}",
|
||||
lib_name,
|
||||
lib_path.display(),
|
||||
e
|
||||
);
|
||||
));
|
||||
BidError::PluginError
|
||||
})?;
|
||||
let lib_arc = Arc::new(lib);
|
||||
@ -90,12 +91,12 @@ pub(super) fn load_plugin(
|
||||
{
|
||||
specs::record_typebox_spec(loader, lib_name, box_type, &*tb_sym)?;
|
||||
} else if dbg_on() {
|
||||
eprintln!(
|
||||
get_global_ring0().log.debug(&format!(
|
||||
"[PluginLoaderV2] NOTE: TypeBox symbol not found for {}.{} (symbol='{}'). Migrate plugin to Nyash ABI v2 to enable per-Box dispatch.",
|
||||
lib_name,
|
||||
box_type,
|
||||
sym_name.trim_end_matches('\0')
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user