fix(gen): 类归属不采信星号导入候选,收口 fatal_error 返回类型与默认值补全

TypeGenResolve._class_true_def_sha1 / CallGenBase._lookup_reexport_from_vpi 新增 allow_star 参数:类归属只采信具名 re-export。此前 `from X import *` 候选被当成类的真实定义模块,而几乎每个文件都 star-import stdint,导致 TypeGenErr 前向声明被建成 "stdint.TypeGenErr";该名字在 StructTable 里只剩一个错误 sha1 的条目,fatal_error 的跨模块返回类型解析全部落空并 fail-fast。

TypeGenErr.fatal_error/fatal_type_error 显式 -> int(留空会解析出退化类型 i0,命中 CallGenCall 的 i0 守卫);_fail_method_ret_ty 增加失败上下文转储并并入同一条 VLogger.error(批处理下 error 即 sys.exit,其后代码全是死代码)。

CallGenMixin 模块级调用:默认值已知但重建不出时 fail-fast,不再静默产出操作数不足的 llvm.call(只会被 MLIR 校验拦下);AssignGenMixin 两处 VLogger.error 补上 category 实参。

M2.3 v1b 收尾:逃逸摘要表与扫描临时区改为只分配一次、传递闭包扫到不动点、u64 改 sizet;VpiReader 不再 free 跨阶段引用的 src_sha1(heap-use-after-free)。
This commit is contained in:
TermiNexus committed 2026-10-08 16:38:35 +08:00
1 parent 1fb0f4a4ea
commit b03e55bb7e
9 files changed
+183 -49

No files matched your search

+5 -2
View File
@@ -1920,8 +1920,11 @@ def _ParseVpiIntoModuleImpl(pool: memhub.MemBuddy*, mod: mlirlite.LLVMModule*, v
# Import/ImportFrom -> skip (nothing to process)
# free the SHA1 buffer (allocated by _extract_sha1_from_path via stdlib.malloc)
if src_sha1 is not None: stdlib.free(src_sha1)
# 不要 free src_sha1:它会被后续阶段继续引用(模块/类型注册按 `<sha1>.Name` 命名,
# 之后 resolve_annotation_type 仍会对它 strcmp)——在此 free 会造成 heap-use-after-free
# (现场:alloc @ _extract_sha1_from_path → free @ 本函数 → 读 @ resolve_annotation_type:2065)。
# 跨阶段字符串按本仓惯例常驻;若将来确需回收,应改为在**存入注册表处**拷贝一份到 PermPool,
# 而不是在解析结束时释放。
# free vpi_buf only after all tree processing (see the parsing comment)
stdlib.free(vpi_buf)
return 1