From 6cd8adc54cc8209960577c0ec336c7dfa1064152 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Sun, 23 Aug 2026 14:03:27 +0800 Subject: [PATCH] =?UTF-8?q?refactor(tpv):=20=E7=AE=80=E5=8C=96=20BuildTopo?= =?UTF-8?q?SortedIndices=20=E9=98=9F=E5=88=97=E5=BE=AA=E7=8E=AF=E4=B8=BA?= =?UTF-8?q?=20for=20range=20-=20StubMergerTopo.vp=20=E4=B8=AD=20while=20q?= =?UTF-8?q?=5Fhead=20<=20q=5Ftail=20+=20=E6=89=8B=E5=8A=A8=20q=5Fhead=20+?= =?UTF-8?q?=3D=201=20=E6=94=B9=E4=B8=BA=20for=20q=5Fhead=20in=20range(q=5F?= =?UTF-8?q?tail)=EF=BC=8C=E9=80=BB=E8=BE=91=E7=AD=89=E4=BB=B7=E3=80=81?= =?UTF-8?q?=E6=B6=88=E9=99=A4=E5=86=97=E4=BD=99=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/lib/Stub/StubMerger/StubMergerTopo.vp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/App/lib/Stub/StubMerger/StubMergerTopo.vp b/App/lib/Stub/StubMerger/StubMergerTopo.vp index 175a874..10b297f 100644 --- a/App/lib/Stub/StubMerger/StubMergerTopo.vp +++ b/App/lib/Stub/StubMerger/StubMergerTopo.vp @@ -112,7 +112,6 @@ def BuildTopoSortedIndices(store_count: int, store_sha1_arr: bytes, if dsha1 is not None and StubMergerCollect._is_in_sha1_set(dsha1, reachable_set, reachable_count) != 0: indegree[si] = indegree[si] + 1 # Kahn:入度为 0(不依赖任何可达模块)者先出 → 最先编译 - q_head: int = 0 q_tail: int = 0 for i_r in range(rel_count): si2: int = rel_idx[i_r] @@ -120,9 +119,8 @@ def BuildTopoSortedIndices(store_count: int, store_sha1_arr: bytes, queue[q_tail] = si2 q_tail += 1 out_count: int = 0 - while q_head < q_tail: + for q_head in range(q_tail): m: int = queue[q_head] - q_head += 1 sorted_idx[out_count] = m out_count += 1 # 对依赖 m 的可达模块减入度