fix(gen): freed_restore/freed_join/freed_capture 补 global 声明,修复野写崩溃
上一提交(eea8111)在 freed_restore 里重新赋值全局指针 _g_freed_slots 却未声明 global,被解析成未初始化的局部变量:is None 判假 → 跳过分配 → 对垃圾地址(0x11)野写,ASan access-violation。为三个新函数统一声明 global _g_freed_slots, _g_freed_count(与 _FreedMark 同口径)。
This commit is contained in:
1 parent
eea8111e61
commit
034293df59
1 file changed
+3
-2
@@ -374,6 +374,7 @@ novirtual class VarGenMixin:
|
||||
# 路径都失效,才算失效"(求交),与 life_* 的 Meet 同点位、同生命周期(pool 快照)。
|
||||
def freed_capture(self, trans: HT.Translator*) -> sizet*:
|
||||
"""快照当前失效槽表:buf[0]=count,其后每项一个失效槽指针;失败返回 None"""
|
||||
global _g_freed_slots, _g_freed_count
|
||||
if trans is None or trans.Pool is None: return None
|
||||
pool: memhub.MemBuddy* = trans.Pool
|
||||
n: sizet = sizet(_g_freed_count)
|
||||
@@ -388,7 +389,7 @@ novirtual class VarGenMixin:
|
||||
|
||||
def freed_restore(self, buf: sizet*) -> int:
|
||||
"""把失效槽表复位到快照(分支出口 / 单侧到达合流时用);0=完成 / 1=无快照"""
|
||||
global _g_freed_count
|
||||
global _g_freed_slots, _g_freed_count
|
||||
if buf is None: return 1
|
||||
n: sizet = buf[0]
|
||||
if n > 0:
|
||||
@@ -404,7 +405,7 @@ novirtual class VarGenMixin:
|
||||
|
||||
def freed_join(self, buf: sizet*) -> int:
|
||||
"""合流:当前失效槽表与快照**求交**(只有两路都失效才算失效);0=完成 / 1=无快照"""
|
||||
global _g_freed_count
|
||||
global _g_freed_slots, _g_freed_count
|
||||
if buf is None: return 1
|
||||
n: sizet = buf[0]
|
||||
out: int = 0
|
||||
|
||||
Reference in new issue
Block a user