💢 The truth about Rust + LLVM development hell
ChatGPT5 struggling for 34+ minutes with Rust lifetime/build errors...
This perfectly illustrates why we need Phase 22 (Nyash LLVM compiler)\!
Key insights:
- 'Rust is safe and beautiful' - Gemini (who never fought lifetime errors)
- Reality: 500-line error messages, 34min debug sessions, lifetime hell
- C would just work: void* compile(void* mir) { done; }
- Python would work: 100 lines with llvmlite
- ANY language with C ABI would work\!
The frustration is real:
- We're SO CLOSE to Nyash self-hosting paradise
- Once bootstrapped, EVERYTHING can be written in Nyash
- No more Rust complexity, no more 5-7min builds
- Just simple, beautiful Box-based code
Current status:
- PHI/SSA hardening in progress (ChatGPT5)
- 'phi incoming value missing' in Main.esc_json/1
- Sealed SSA approach being implemented
The dream is near: Everything is Box, even the compiler\! 🌟
This commit is contained in:
@ -3,6 +3,7 @@ use inkwell::values::{BasicValueEnum, FunctionValue, PhiValue};
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::backend::llvm::context::CodegenContext;
|
||||
use super::super::types::map_mirtype_to_basic;
|
||||
use crate::mir::{function::MirFunction, BasicBlockId, ValueId};
|
||||
|
||||
// Small, safe extraction: create LLVM basic blocks for a MIR function and
|
||||
@ -59,7 +60,19 @@ pub(in super::super) fn precreate_phis<'ctx>(
|
||||
{
|
||||
if let crate::mir::instruction::MirInstruction::Phi { dst, inputs } = inst {
|
||||
let mut phi_ty: Option<inkwell::types::BasicTypeEnum> = None;
|
||||
// Prefer pointer when any input (or dst) is String/Box/Array/Future/Unknown
|
||||
let mut wants_ptr = false;
|
||||
if let Some(mt) = func.metadata.value_types.get(dst) {
|
||||
wants_ptr |= matches!(mt, crate::mir::MirType::String | crate::mir::MirType::Box(_) | crate::mir::MirType::Array(_) | crate::mir::MirType::Future(_) | crate::mir::MirType::Unknown);
|
||||
}
|
||||
for (_, iv) in inputs.iter() {
|
||||
if let Some(mt) = func.metadata.value_types.get(iv) {
|
||||
wants_ptr |= matches!(mt, crate::mir::MirType::String | crate::mir::MirType::Box(_) | crate::mir::MirType::Array(_) | crate::mir::MirType::Future(_) | crate::mir::MirType::Unknown);
|
||||
}
|
||||
}
|
||||
if wants_ptr {
|
||||
phi_ty = Some(codegen.context.ptr_type(inkwell::AddressSpace::from(0)).into());
|
||||
} else if let Some(mt) = func.metadata.value_types.get(dst) {
|
||||
phi_ty = Some(map_mirtype_to_basic(codegen.context, mt));
|
||||
} else if let Some((_, iv)) = inputs.first() {
|
||||
if let Some(mt) = func.metadata.value_types.get(iv) {
|
||||
|
||||
Reference in New Issue
Block a user