From 5d660a5448bdca95c77a353b9a581f6f6afd4122 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Sat, 15 Aug 2026 06:42:30 +0800 Subject: [PATCH] =?UTF-8?q?docs(=5Fwithcontent):=20=5Finit=5Ftls=20?= =?UTF-8?q?=E5=AE=88=E5=8D=AB=E6=B3=A8=E9=87=8A=E6=9B=B4=E6=96=B0=E4=B8=BA?= =?UTF-8?q?=E5=8F=8C=E4=BF=9D=E9=99=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TPV 已正式实现 @t.TLS(FuncGenMixin.translate_function_def 与 ClassGenMixin._translate_method 生成 __tls_init_done 全局标志 + skip/cont 块,对齐 TPC HandlesFunctions.py L1763-1792);此判重 守卫保留以兼容未重建的旧 TPV.exe。 --- includes/_withcontent.vp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/includes/_withcontent.vp b/includes/_withcontent.vp index 6036313..4bd7bd7 100644 --- a/includes/_withcontent.vp +++ b/includes/_withcontent.vp @@ -26,10 +26,9 @@ _tls_index: ULONG = 0 def _init_tls(): """Initialize TLS index (executes once; subsequent calls are skipped).""" global _tls_index - # TPV 未实现 @t.TLS 的"首次执行"守卫(函数每次调用都执行体), - # 不加守卫会导致每次 _get_stack 都 TlsAlloc 新索引 → 每次拿到新 - # 空栈 → push/find 各用各的栈,provider 永远匹配失败。_tls_index - # 初始为 0(TlsAlloc 成功不会返回 0),以此判重即等价 TLS 语义。 + # 双保险:TPV 已正式实现 @t.TLS(函数级一次性守卫,首次执行后置 + # __tls_init_done 标志,后续调用直接返回),此判重守卫保留以兼容 + # 尚未重建的旧 TPV.exe。_tls_index 初始为 0(TlsAlloc 成功不会返回 0)。 if _tls_index == 0: _tls_index = TlsAlloc()