feat(plugins): migrate Python family to TypeBox v2; complete first‑party v2 set (Regex/Net/Path/Math/Time/File)\n\nfeat(smoke): add Net round‑trip sample and wire to plugin v2 smoke\n\nfeat(cli): add --emit-mir-json and runner emit+exit path\n\nchore(config): register Python v2 boxes in nyash.toml\n\nchore(loader): improve v2 diagnostics and ensure v2 shim dispatch\n\nchore(build): integrate ny-llvmc env gate in build_llvm.sh\n\nchore(tasks): update CURRENT_TASK with v2 Python/Net/emit flag

This commit is contained in:
Selfhosting Dev
2025-09-17 22:01:29 +09:00
parent fcf8042622
commit 8aa01668ff
19 changed files with 1782 additions and 19 deletions

View File

@ -159,6 +159,16 @@ impl PluginLoaderV2 {
let abi_ok = st.abi_tag == 0x5459_4258
&& st.struct_size as usize >= std::mem::size_of::<NyashTypeBoxFfi>();
if !abi_ok {
if dbg_on() {
eprintln!(
"[PluginLoaderV2] WARN: invalid TypeBox ABI for {}.{} (abi_tag=0x{:08x} size={} need>={})",
lib_name,
box_type,
st.abi_tag,
st.struct_size,
std::mem::size_of::<NyashTypeBoxFfi>()
);
}
continue;
}
// Remember invoke_id in box_specs for (lib_name, box_type)
@ -172,7 +182,19 @@ impl PluginLoaderV2 {
invoke_id: None,
});
entry.invoke_id = Some(invoke_id);
} else if dbg_on() {
eprintln!(
"[PluginLoaderV2] WARN: TypeBox present but no invoke_id for {}.{} — plugin should export per-Box invoke",
lib_name, box_type
);
}
} else if dbg_on() {
eprintln!(
"[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')
);
}
}
}
@ -228,8 +250,24 @@ impl PluginLoaderV2 {
let (lib_name, box_type) = self.find_box_by_type_id(config, &toml_value, type_id)?;
let key = (lib_name.to_string(), box_type.to_string());
let map = self.box_specs.read().ok()?;
let spec = map.get(&key)?;
spec.invoke_id
let spec = map.get(&key);
if let Some(s) = spec {
if s.invoke_id.is_none() && dbg_on() {
eprintln!(
"[PluginLoaderV2] WARN: no per-Box invoke for {}.{} (type_id={}). Calls will fail with E_PLUGIN (-5) until plugin migrates to v2.",
lib_name, box_type, type_id
);
}
s.invoke_id
} else {
if dbg_on() {
eprintln!(
"[PluginLoaderV2] INFO: no TypeBox spec loaded for {}.{} (type_id={}).",
lib_name, box_type, type_id
);
}
None
}
}
pub fn metadata_for_type_id(&self, type_id: u32) -> Option<PluginBoxMetadata> {

View File

@ -25,7 +25,6 @@ pub fn box_invoke_for_type_id(type_id: u32) -> Option<super::enabled::host_bridg
}
/// Library-level shim to dispatch a v2 per-Box invoke function using type_id
#[no_mangle]
pub extern "C" fn nyash_plugin_invoke_v2_shim(
type_id: u32,
method_id: u32,