vm(hako): add v1 reader/dispatcher (flagged), commonize mir_call handler, share block scan; smokes: add v1 hakovm canary; docs: 20.37/20.38 plans, OOB policy; runner: v1 hakovm toggle; include SKIP summary

This commit is contained in:
nyash-codex
2025-11-03 23:21:48 +09:00
parent a4f30ae827
commit 06a729ff40
67 changed files with 3340 additions and 1520 deletions

44
src/abi/nyrt_shim.rs Normal file
View File

@ -0,0 +1,44 @@
// CABI shim (PoC). These functions are noops for 20.36/20.37.
// Kept tiny and isolated. Linkage names match include/nyrt.h.
#[no_mangle]
pub extern "C" fn nyrt_init() -> i32 { 0 }
#[no_mangle]
pub extern "C" fn nyrt_teardown() { }
#[no_mangle]
pub extern "C" fn nyrt_load_mir_json(_json_text: *const ::std::os::raw::c_char) -> u64 { 1 }
#[no_mangle]
pub extern "C" fn nyrt_exec_main(_module_handle: u64) -> i32 { 0 }
#[no_mangle]
pub extern "C" fn nyrt_hostcall(
_name: *const ::std::os::raw::c_char,
_method: *const ::std::os::raw::c_char,
_payload_json: *const ::std::os::raw::c_char,
_out_buf: *mut ::std::os::raw::c_char,
_out_buf_len: u32,
) -> i32 { 0 }
#[cfg(test)]
mod tests {
use super::*;
use std::ffi::CString;
#[test]
fn load_and_exec_noop_returns_zero() {
// init/teardown are no-ops but should stay callable
assert_eq!(unsafe { nyrt_init() }, 0);
let json = CString::new("{}").expect("CString");
let handle = unsafe { nyrt_load_mir_json(json.as_ptr()) };
assert_eq!(handle, 1);
assert_eq!(unsafe { nyrt_exec_main(handle) }, 0);
// ensure teardown does not panic even when called after exec
unsafe { nyrt_teardown() };
}
}