feat(gen): 函数生命期摘要表 + 逃逸 walker(M2.3 v1b 步骤1-3)
- StructGenMixin:EscTable/EscCount(追加在类末尾,避免偏移漂移);register_file_funcs 每文件重置并逐函数算摘要。 - 逃逸 walker:return p / global 赋值 / obj.f 赋值,递归 if/while/for;不进嵌套 def/class;形参访问逐级显式重转(AST 退化)。 - 表内只存 u64 名哈希(djb2-64),不解引用字符串指针,消除槽内坏指针导致的 strcmp 崩溃。 - 表从 PermPool 分配并 memset。 - GenApi:get_param_escapes/get_ret_borrow 查询入口。调用点检查(步骤4)待接。
This commit is contained in:
1 parent
a6e1957768
commit
4ce577d8fb
2 files changed
+202
-3
No files matched your search
@@ -285,6 +285,19 @@ def is_file_func(name: str) -> int:
|
||||
return 0
|
||||
|
||||
|
||||
# ---------------- 生命期摘要查询(M2.3 v1b, delegates to StructGenMixin) ----------------
|
||||
def get_param_escapes(name: str) -> int:
|
||||
"""形参逃逸掩码(第 k 位=第 k 个形参逃逸);无记录返回 0"""
|
||||
if _g_gen is not None: return _g_gen.StructGen.get_param_escapes(name)
|
||||
return 0
|
||||
|
||||
|
||||
def get_ret_borrow(name: str) -> int:
|
||||
"""返回借用标记(1=该函数直接返回某形参);无记录返回 0"""
|
||||
if _g_gen is not None: return _g_gen.StructGen.get_ret_borrow(name)
|
||||
return 0
|
||||
|
||||
|
||||
# ---------------- find_struct_by_type (delegates to StructGenMixin.find_struct_by_type) ----------------
|
||||
def find_struct_by_type(struct_ty: mlirlite.LLVMType*) -> GenTypes.StructEntry*:
|
||||
"""Delegate to gen.find_struct_by_type"""
|
||||
|
||||
Reference in new issue
Block a user