perf(prof,gen): 编译热点优化 + 内存池 OOM 诊断接线 + REnum 指针载荷修正

CallGenBase: 模块返回类型文本表改单趟登记+查找,find_func_in_module 合并为单趟链表遍历(PROF 热点)

BuildPipeline: ensure_dir 增加快速路径(已存在目录直接返回)

AssignGenMixin/Translator: alloc 失败打印 Pool/PermPool 统计与阶段上下文(SetAllocCtx)

CallGenCtor: REnum 指针载荷补显式 build_ptrtoint 再 coerce/store;新增 DebugInfoGen.vp

其余为历史累积改动一并入库
This commit is contained in:
TermiNexus committed 2026-09-26 19:27:23 +08:00
1 parent 676c19c362
commit 373a20c3e5
20 files changed
+1984 -165

No files matched your search

+13
View File
@@ -27,6 +27,7 @@ import lib.Phase.Phase1.Phase1Topo as Phase1Topo
import lib.Phase.Phase1 as Phase1
import lib.core.Gen.GenApi as GenApi
import lib.core.Gen.DebugInfoGen as DebugInfoGen
# ============================================================
@@ -1027,6 +1028,11 @@ def RunPhase1(mb: memhub.MemBuddy*, includes_dir: str, temp_dir: str,
tr.ModuleSha1 = sha1
tr.CurrentPackage = GenApi.compute_package_from_relpath(mb, entry.RelPath)
GenApi.set_current_file_type(file_path)
# --traceback: mirror the DWARF switch into the Gen-layer emitter (the
# same BuildPipeline._traceback_mode that gates -frame-pointer=all /
# dbghelp / the Install() ctor). include/*.vp modules are compiled here,
# so this is what gives their frames DWARF line info.
DebugInfoGen.SetEnabled(BuildPipeline._traceback_mode)
GenApi.set_current_file_imports(file_path)
GenApi.set_current_module_sha1(sha1)
GenApi.clear_cdefine_constants()
@@ -1058,6 +1064,13 @@ def RunPhase1(mb: memhub.MemBuddy*, includes_dir: str, temp_dir: str,
failed += 1
continue
# --traceback: inject the startup Install() ctor when translating traceback.vp
# (its stub/text.ll below are what Phase2 reuses to build the .obj). The
# injector lives in the Gen layer (already depends on llvmlite), so this
# module gains no cross-module llvmlite symbol dependency.
if BuildPipeline._traceback_mode != 0 and BuildPipeline._tb_basename_is_traceback(file_path) != 0:
HandlesTranslator.InjectTracebackInstallCtor(tr)
# 诊断:pre_rc 哨兵在 translate 前、覆盖不到 translate 期间的 AST/IR 写穿,故 dump 前立即检查存活块 header/canary
# (rc=6 块尾 canary 损坏 = 越界写穿数据区),把「dump 时链表成环卡死」变成「定位到 translate 期间写穿发生的文件」。
post_rc: int = mb.check_alive_blocks(mark1)