diff --git a/App/lib/core/BuildPipeline.vp b/App/lib/core/BuildPipeline.vp index a1e0d1e..daa8cab 100644 --- a/App/lib/core/BuildPipeline.vp +++ b/App/lib/core/BuildPipeline.vp @@ -596,9 +596,11 @@ def run_llc_parallel(tasks: bytes, task_count: int, max_threads: int) -> int: return 0 if max_threads <= 0: max_threads = 1 - # Thread 对象指针数组(stdlib,保证线程对象存活到 join) - th_ptrs: bytes = stdlib.malloc(t.CSizeT(max_threads) * 8) - if th_ptrs is None: + # Thread 对象数组(list 保类型):c.Deref 对 i8* 无法推断加载类型时 + # 只读 1 字节 → 垃圾指针 → join/is_alive 立即失败(ClassArrayTest llc + # "5 秒误报失败"根因);list[Thread].get 返回类型明确,无推断问题。 + th_list: list[vthreading.Thread] | t.CPtr = list[vthreading.Thread](_mbuddy, max_threads) + if th_list is None: VLogger.error("run_llc_parallel: 线程数组分配失败", "PhaseB") return 1 slot_size: t.CSizeT = LlcTask.__sizeof__() @@ -615,14 +617,12 @@ def run_llc_parallel(tasks: bytes, task_count: int, max_threads: int) -> int: t.CUInt64T(tasks) + t.CSizeT(batch_start + j) * slot_size, t.CPtr)) th: vthreading.Thread | t.CPtr = vthreading.Thread(_llc_task_worker, t.CPtr(tsk)) th.start() - # u64 槽存 Thread*(转 u64 存储,读取时再转回指针) - c.DerefAs(t.CUInt64T(t.CUInt64T(th_ptrs) + t.CSizeT(j) * 8, t.CPtr), t.CUInt64T(th)) + th_list.set(j, th) j += 1 # 本批 join j = 0 while j < batch_n: - th_j: vthreading.Thread | t.CPtr = (vthreading.Thread | t.CPtr)(t.CPtr(c.Deref( - t.CUInt64T(t.CUInt64T(th_ptrs) + t.CSizeT(j) * 8, t.CPtr)))) + th_j: vthreading.Thread | t.CPtr = th_list.get(j) #region debug-point LLC7 stdio.printf("[LLC-DBG] join 前 %d\n", j) #endregion @@ -651,7 +651,6 @@ def run_llc_parallel(tasks: bytes, task_count: int, max_threads: int) -> int: ret = 1 j += 1 batch_start += batch_n - stdlib.free(th_ptrs) return ret