chore(dbg): 临时阶段日志定位 Phase A 崩溃点(定位后移除)

四个探针:PhaseA translating <path> / vpi.gen <rel_path> / TR.enter sha1 / TR.prelude.done。用于把崩溃点夹在 解析→vpi生成→模块前言→函数体翻译 四段之间。
This commit is contained in:
TermiNexus committed 2026-10-09 10:08:43 +08:00
1 parent 8b63ae4ca2
commit be2521fe46
3 files changed
+8

No files matched your search

+2
View File
@@ -840,6 +840,8 @@ def RunMultiFileProject(mb: memhub.MemBuddy*, source_dir: str, temp_dir: str, ou
done_flags[i] = 1
completed_this_pass += 1
continue
# [TEMP dbg] 阶段日志:定位 Phase A 崩溃点(定位后移除)
VLogger.info(f"PhaseA translating: {ent.Path}", "PhaseA")
# Compute the package name (the directory part relative to source_dir)
src_dir_len_pa: sizet = string.strlen(source_dir)
pkg_pa: str = None
+2
View File
@@ -661,6 +661,8 @@ def _PyiClass(buf: bytes, buf_size: sizet, pos: sizet, cls: ast.ClassDef*, inden
# Returns bytes written (0 on failure); rel_path should be absolute for error attribution.
def _GeneratePyiFromAst(mb: memhub.MemBuddy*, tree: ast.AST*, rel_path: str, buf: bytes, buf_size: sizet) -> sizet:
"""Generate .vpi stub content from an AST into buf"""
# [TEMP dbg] 阶段日志:进入 vpi 生成(定位崩溃点,定位后移除)
VLogger.info(f"vpi.gen: {rel_path}", "StubGen")
if tree is None or buf is None or buf_size == 0: return 0
# Error attribution: point "current file" at the file being stubbed. Callers must pass
+4
View File
@@ -381,6 +381,8 @@ novirtual class Translator:
"""Translate the AST into LLVM IR."""
if tree is None: return 1
if _mbuddy is None: return 1
# [TEMP dbg] 阶段日志:定位崩溃点(定位后移除)
VLogger.info(f"TR.enter sha1={self.ModuleSha1}", "TR")
pool: memhub.MemBuddy* = _mbuddy
@@ -453,6 +455,8 @@ novirtual class Translator:
# (现场:Test/NewLifetimeTest 未 import stdlib,拿不到 stdlib vpi 的 declare)。
free_func: mlirlite.Function* = mlirlite.create_declare(decl_pool, mod, "free", void_ty_decl)
if free_func is not None: mlirlite.add_param(decl_pool, free_func, i8_ptr_ty, "p")
# [TEMP dbg] 阶段日志:模块前言完成(定位崩溃点,定位后移除)
VLogger.info("TR.prelude.done", "TR")
# Check whether the user defined a main function
has_user_main: int = 0