🚀 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:
Selfhosting Dev
2025-09-12 12:07:07 +09:00
parent 1f5ba5f829
commit 4fe1212d36
9 changed files with 203 additions and 14 deletions

View File

@ -153,6 +153,15 @@ pub extern "C" fn nyash_env_box_new(type_name: *const i8) -> i64 {
let arc: std::sync::Arc<dyn NyashBox> = std::sync::Arc::new(MapBox::new());
return handles::to_handle(arc) as i64;
}
if ty == "ArrayBox" {
use nyash_rust::boxes::array::ArrayBox;
let arc: std::sync::Arc<dyn NyashBox> = std::sync::Arc::new(ArrayBox::new());
let h = handles::to_handle(arc) as i64;
if std::env::var("NYASH_CLI_VERBOSE").ok().as_deref() == Some("1") {
eprintln!("nyrt: env.box.new ArrayBox -> handle={}", h);
}
return h;
}
let reg = get_global_registry();
match reg.create_box(ty, &[]) {
Ok(b) => {