feat(llvm): Major refactor - BuilderCursor全域化 & Resolver API導入
Added: - Resolver API (resolve_i64) for unified value resolution with per-block cache - llvmlite harness (Python) for rapid PHI/SSA verification - Comprehensive LLVM documentation suite: - LLVM_LAYER_OVERVIEW.md: Overall architecture and invariants - RESOLVER_API.md: Value resolution strategy - LLVM_HARNESS.md: Python verification harness Updated: - BuilderCursor applied to ALL lowering paths (externcall/newbox/arrays/maps/call) - localize_to_i64 for dominance safety in strings/compare/flow - NYASH_LLVM_DUMP_ON_FAIL=1 for debug IR output Key insight: LoopForm didn't cause problems, it just exposed existing design flaws: - Scattered value resolution (now unified via Resolver) - Inconsistent type conversion placement - Ambiguous PHI wiring responsibilities Next: Wire Resolver throughout, achieve sealed=ON green for dep_tree_min_string
This commit is contained in:
@ -16,6 +16,7 @@ use super::builder_cursor::BuilderCursor;
|
||||
pub(in super::super) fn lower_boxcall<'ctx, 'b>(
|
||||
codegen: &CodegenContext<'ctx>,
|
||||
cursor: &mut BuilderCursor<'ctx, 'b>,
|
||||
resolver: &mut super::Resolver<'ctx>,
|
||||
cur_bid: BasicBlockId,
|
||||
func: &MirFunction,
|
||||
vmap: &mut HashMap<ValueId, inkwell::values::BasicValueEnum<'ctx>>,
|
||||
@ -59,7 +60,7 @@ pub(in super::super) fn lower_boxcall<'ctx, 'b>(
|
||||
|
||||
// Delegate String methods
|
||||
if super::strings::try_handle_string_method(
|
||||
codegen, cursor, cur_bid, func, vmap, dst, box_val, method, args, recv_v,
|
||||
codegen, cursor, resolver, cur_bid, func, vmap, dst, box_val, method, args, recv_v,
|
||||
bb_map, preds, block_end_values,
|
||||
)? {
|
||||
return Ok(());
|
||||
@ -77,7 +78,21 @@ pub(in super::super) fn lower_boxcall<'ctx, 'b>(
|
||||
|
||||
// Console convenience: treat println as env.console.log
|
||||
if method == "println" {
|
||||
return super::externcall::lower_externcall(codegen, cursor, cur_bid, func, vmap, dst, &"env.console".to_string(), &"log".to_string(), args);
|
||||
return super::externcall::lower_externcall(
|
||||
codegen,
|
||||
cursor,
|
||||
resolver,
|
||||
cur_bid,
|
||||
func,
|
||||
vmap,
|
||||
dst,
|
||||
&"env.console".to_string(),
|
||||
&"log".to_string(),
|
||||
args,
|
||||
bb_map,
|
||||
preds,
|
||||
block_end_values,
|
||||
);
|
||||
}
|
||||
|
||||
// getField/setField
|
||||
|
||||
Reference in New Issue
Block a user