🚀 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

@ -96,7 +96,9 @@ pub(in super::super) fn lower_newbox<'ctx>(
.as_deref()
== Some("1");
let i64t = codegen.context.i64_type();
if type_id != 0 && !(box_type == "MapBox" && !force_plugin_map) {
// Core-first: avoid birth_h for built-ins we provide directly (MapBox/ArrayBox)
let is_core_builtin = box_type == "MapBox" || box_type == "ArrayBox";
if type_id != 0 && !(is_core_builtin && !force_plugin_map) {
// declare i64 @nyash.box.birth_h(i64)
let fn_ty = i64t.fn_type(&[i64t.into()], false);
let callee = codegen