smokes: add PHI/core/integration tests; parity uses Python LLVM harness; test runner noise filter\nparser: add opt-in TokenCursor bridge (NYASH_PARSER_TOKEN_CURSOR=1) for expressions\nmir: fix PHI incoming preds to use exit blocks; add debug PHI verification\nplugins(net/filebox): warning cleanup (dead_code), no behavior change\ndocs: smokes v2 README – add test accumulation policy and LLVM harness note\nCURRENT_TASK: Phase 15.5 newline refactor resume + plan

This commit is contained in:
Selfhosting Dev
2025-09-25 06:15:22 +09:00
parent 8fbbe2b3a0
commit d1041f4e22
36 changed files with 812 additions and 58 deletions

View File

@ -3,6 +3,7 @@
// ============ Error Codes (BID-1 alignment) ============
pub const NYB_SUCCESS: i32 = 0;
pub const NYB_E_SHORT_BUFFER: i32 = -1;
#[allow(dead_code)]
pub const NYB_E_INVALID_TYPE: i32 = -2;
pub const NYB_E_INVALID_METHOD: i32 = -3;
pub const NYB_E_INVALID_ARGS: i32 = -4;
@ -23,6 +24,7 @@ pub const METHOD_FINI: u32 = u32::MAX; // Destructor
// ============ TLV Tags ============
pub const TLV_TAG_BOOL: u8 = 1;
pub const TLV_TAG_I32: u8 = 2;
#[allow(dead_code)]
pub const TLV_TAG_I64: u8 = 3;
pub const TLV_TAG_STRING: u8 = 6;
pub const TLV_TAG_BYTES: u8 = 7;
@ -30,4 +32,5 @@ pub const TLV_TAG_HANDLE: u8 = 8;
pub const TLV_TAG_VOID: u8 = 9;
// ============ FileBox Type ID ============
#[allow(dead_code)]
pub const FILEBOX_TYPE_ID: u32 = 6;

View File

@ -4,6 +4,7 @@ use std::os::raw::c_char;
// ============ FFI Types ============
#[allow(dead_code)]
#[repr(C)]
pub struct NyashMethodInfo {
pub method_id: u32,
@ -11,6 +12,7 @@ pub struct NyashMethodInfo {
pub signature: u32,
}
#[allow(dead_code)]
#[repr(C)]
pub struct NyashPluginInfo {
pub type_id: u32,

View File

@ -24,6 +24,7 @@ impl FileBoxInstance {
}
}
#[allow(dead_code)]
pub fn with_path(path: String) -> Self {
Self {
file: None,
@ -41,11 +42,13 @@ pub static INSTANCES: Lazy<Mutex<HashMap<u32, FileBoxInstance>>> =
pub static INSTANCE_COUNTER: AtomicU32 = AtomicU32::new(1);
/// Allocate a new instance ID
#[allow(dead_code)]
pub fn allocate_instance_id() -> u32 {
INSTANCE_COUNTER.fetch_add(1, Ordering::Relaxed)
}
/// Store an instance with the given ID
#[allow(dead_code)]
pub fn store_instance(id: u32, instance: FileBoxInstance) -> Result<(), &'static str> {
match INSTANCES.lock() {
Ok(mut map) => {
@ -57,6 +60,7 @@ pub fn store_instance(id: u32, instance: FileBoxInstance) -> Result<(), &'static
}
/// Remove an instance by ID
#[allow(dead_code)]
pub fn remove_instance(id: u32) -> Option<FileBoxInstance> {
match INSTANCES.lock() {
Ok(mut map) => map.remove(&id),
@ -65,6 +69,7 @@ pub fn remove_instance(id: u32) -> Option<FileBoxInstance> {
}
/// Get mutable access to an instance
#[allow(dead_code)]
pub fn with_instance_mut<F, R>(id: u32, f: F) -> Result<R, &'static str>
where
F: FnOnce(&mut FileBoxInstance) -> R,
@ -79,6 +84,7 @@ where
}
/// Get access to an instance
#[allow(dead_code)]
pub fn with_instance<F, R>(id: u32, f: F) -> Result<R, &'static str>
where
F: FnOnce(&FileBoxInstance) -> R,

View File

@ -45,10 +45,12 @@ pub fn write_tlv_bool(v: bool, result: *mut u8, result_len: *mut usize) -> i32 {
write_tlv_result(&[(TLV_TAG_BOOL, &b)], result, result_len)
}
#[allow(dead_code)]
pub fn write_tlv_string(s: &str, result: *mut u8, result_len: *mut usize) -> i32 {
write_tlv_result(&[(TLV_TAG_STRING, s.as_bytes())], result, result_len)
}
#[allow(dead_code)]
pub fn write_tlv_handle(
type_id: u32,
instance_id: u32,
@ -164,6 +166,7 @@ pub fn tlv_parse_string(data: &[u8]) -> Result<String, ()> {
tlv_parse_string_at(data, &mut pos)
}
#[allow(dead_code)]
pub fn tlv_parse_bytes(data: &[u8]) -> Result<Vec<u8>, ()> {
let (_, argc, mut pos) = tlv_parse_header(data)?;
if argc < 1 {
@ -197,6 +200,7 @@ pub fn tlv_parse_handle(data: &[u8]) -> Result<(u32, u32), ()> {
Ok((type_id, instance_id))
}
#[allow(dead_code)]
pub fn tlv_parse_one_string(data: &[u8]) -> Result<String, ()> {
let (_, argc, mut pos) = tlv_parse_header(data)?;
if argc < 1 {
@ -205,6 +209,7 @@ pub fn tlv_parse_one_string(data: &[u8]) -> Result<String, ()> {
tlv_parse_string_at(data, &mut pos)
}
#[allow(dead_code)]
pub fn tlv_parse_string_and_bytes(data: &[u8]) -> Result<(String, Vec<u8>), ()> {
let (_, argc, mut pos) = tlv_parse_header(data)?;
if argc < 2 {