fix(vpi): 逃逸摘要在所有 vpi 加载点都喂缓存,修 EscapeXmodTest 跨模块漏检

_ensure_vpi_ret_annot_loaded 开头有"本模块 ret 注解已缓存则直接 return 1"的短路:若某模块先经 _ParseVpiIntoModuleImpl(stub 注入)加载,而该处只喂了 ret/param 缓存、没喂逃逸缓存,后续跨模块逃逸查询就会永久查空。现场:EscapeXmodTest 漏检——box.vpi 里 `# esc=2 ret=0` 落盘正确,查询侧却命中不到。在该加载点补 _cache_vpi_escape_annots_text。
This commit is contained in:
TermiNexus committed 2026-10-08 17:58:07 +08:00
1 parent 64502471e1
commit 14920c0e1e
1 file changed
+5
+5
View File
@@ -1803,6 +1803,11 @@ def _ParseVpiIntoModuleImpl(pool: memhub.MemBuddy*, mod: mlirlite.LLVMModule*, v
# Likewise cache param annotations (tree param lists may be truncated;
# _inject_*_declare uses this cache to complete declare param counts).
_cache_vpi_param_annots_text(vpi_buf, src_sha1)
# v3 逃逸摘要必须**在所有 vpi 加载点**都喂一份:_ensure_vpi_ret_annot_loaded 开头有
# "本模块 ret 注解已缓存 → 直接 return 1" 的短路,若某模块先经本函数(stub 注入)
# 加载、而这里没喂逃逸缓存,后续跨模块逃逸查询就会永久命中不到(现场:EscapeXmodTest
# 漏检——box.vpi 里 `# esc=2` 明明写对了,查询侧却查空)。
_cache_vpi_escape_annots_text(vpi_buf, src_sha1)
# 3. walk top-level AST nodes
ch: list[ast.AST*]* = tree.children