🚀 Major LLVM breakthrough by ChatGPT5\!
PHI type coercion and core-first routing fixes: - Auto type conversion for PHI nodes (i64↔i8*↔i1↔f64) - Fixed ArrayBox.get misrouting to Map path - Core-first strategy for Array/Map creation - Added comprehensive debug logging ([PHI], [ARR], [MAP]) Results: ✅ Array smoke test: 'Result: 3' ✅ Map smoke test: 'Map: v=42, size=1' After 34+ minutes of battling Rust lifetime errors, ChatGPT5 achieved a major breakthrough\! Key insight: The bug wasn't in PHI/SSA logic but in Box type routing - ArrayBox.get was incorrectly caught by Map fallback due to missing annotations. We're SO CLOSE to Nyash self-hosting paradise\! 🌟 Once this stabilizes, everything can be written in simple, beautiful Nyash code instead of Rust complexity.
This commit is contained in:
@ -177,8 +177,19 @@ fn store_invoke_return<'ctx>(
|
||||
}
|
||||
}
|
||||
crate::mir::MirType::String => {
|
||||
// keep as i64 handle
|
||||
vmap.insert(dst, rv);
|
||||
// Normalize to i8* for String to align with PHI/type inference
|
||||
// Plugins return i64 handle; convert handle -> i8* here.
|
||||
let h = if let BVE::IntValue(iv) = rv {
|
||||
iv
|
||||
} else {
|
||||
return Err("invoke ret expected i64 for String".to_string());
|
||||
};
|
||||
let pty = codegen.context.ptr_type(inkwell::AddressSpace::from(0));
|
||||
let ptr = codegen
|
||||
.builder
|
||||
.build_int_to_ptr(h, pty, "ret_string_handle_to_ptr")
|
||||
.map_err(|e| e.to_string())?;
|
||||
vmap.insert(dst, ptr.into());
|
||||
}
|
||||
crate::mir::MirType::Box(_)
|
||||
| crate::mir::MirType::Array(_)
|
||||
|
||||
Reference in New Issue
Block a user