diff --git a/includes/_withcontent.vp b/includes/_withcontent.vp index 01c82e4..6036313 100644 --- a/includes/_withcontent.vp +++ b/includes/_withcontent.vp @@ -26,7 +26,12 @@ _tls_index: ULONG = 0 def _init_tls(): """Initialize TLS index (executes once; subsequent calls are skipped).""" global _tls_index - _tls_index = TlsAlloc() + # TPV 未实现 @t.TLS 的"首次执行"守卫(函数每次调用都执行体), + # 不加守卫会导致每次 _get_stack 都 TlsAlloc 新索引 → 每次拿到新 + # 空栈 → push/find 各用各的栈,provider 永远匹配失败。_tls_index + # 初始为 0(TlsAlloc 成功不会返回 0),以此判重即等价 TLS 语义。 + if _tls_index == 0: + _tls_index = TlsAlloc() def _get_stack() -> _ProviderStack | t.CPtr: