refactor(llvm): Major progress on codegen modularization by ChatGPT
Major changes: - Removed 617 lines of duplicate/legacy code from mod.rs (lines 351-967) - All BoxCall handling now properly delegated to instructions::lower_boxcall - Updated CURRENT_TASK.md with new findings: - String concatenation issue (BinOp type mismatch) - Plugin return value smoke test added - Clear next steps for fixing return value display Key improvements: - Clean separation between dispatch (mod.rs) and implementation (instructions.rs) - Legacy code marked as unreachable and ready for removal - Better error visibility with modularized code structure - llvm_smoke.sh updated with new plugin return value tests Next steps: 1. Fix BinOp string concatenation type handling 2. Investigate MIR value_types for BoxCall returns 3. Further split lower_boxcall function (still 260+ lines)
This commit is contained in:
@ -1172,19 +1172,7 @@ pub(super) fn lower_boxcall<'ctx>(
|
||||
if args.len() >= 3 { a3 = get_i64(args[2])?; }
|
||||
if args.len() >= 4 { a4 = get_i64(args[3])?; }
|
||||
|
||||
// f64 fast-path for concat
|
||||
if method == "concat" && args.len() == 1 {
|
||||
let fnty = codegen.context.f64_type().fn_type(&[i64t.into(), i64t.into(), i64t.into()], false);
|
||||
let callee = codegen.module.get_function("nyash_plugin_invoke3_f64").unwrap_or_else(|| codegen.module.add_function("nyash_plugin_invoke3_f64", fnty, None));
|
||||
let tid = i64t.const_int(type_id as u64, true);
|
||||
let midv = i64t.const_int((*mid) as u64, false);
|
||||
let call = codegen.builder.build_call(callee, &[tid.into(), midv.into(), argc_val.into(), recv_h.into(), a1.into(), a2.into()], "pinvoke_f64").map_err(|e| e.to_string())?;
|
||||
if let Some(d) = dst {
|
||||
let rv = call.try_as_basic_value().left().ok_or("invoke3_f64 returned void".to_string())?;
|
||||
vmap.insert(*d, rv);
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
// Note: String.concat should return a handle (i64) and be processed by the tagged path below.
|
||||
// tagged fixed-arity <=4
|
||||
let mut tag1 = i64t.const_int(3, false);
|
||||
let mut tag2 = i64t.const_int(3, false);
|
||||
|
||||
Reference in New Issue
Block a user