feat: 多轮运行 + GCOV 合并 + JSON 出力 + DesignDataGenerator

This commit is contained in:
hangshuo652
2026-07-12 21:04:58 +08:00
parent af37e33b98
commit f3be17e5eb
40 changed files with 4397 additions and 198 deletions
+47 -2
View File
@@ -16,7 +16,7 @@ _ABEND_PROGRAMS = {'ABENDPGM'}
def extend_abend_programs(names: list[str]):
_ABEND_PROGRAMS.update(n.upper() for n in names)
_MAX_PATHS = 10000
_MAX_PATHS = 50000
def _is_sentinel(c):
@@ -56,9 +56,44 @@ def get_term_type(cons):
return remaining, term
def _has_t_branch(cons):
for c in cons:
if len(c) >= 4 and c[0] == "__DP" and c[2] == "T":
return True
if c[3]:
return True
return False
def _has_f_branch(cons):
for c in cons:
if len(c) >= 4 and c[0] == "__DP" and c[2] == "F":
return True
if not c[3]:
return True
return False
def _cap_paths(paths):
if len(paths) > _MAX_PATHS:
return paths[:_MAX_PATHS]
special = [(i, p) for i, p in enumerate(paths) if any(_is_sentinel(c) for c in p)]
std = [(i, p) for i, p in enumerate(paths) if not any(_is_sentinel(c) for c in p)]
t_paths = [(i, p) for i, p in std if _has_t_branch(p)]
f_paths = [(i, p) for i, p in std if _has_f_branch(p)]
quota = _MAX_PATHS - len(special)
if quota <= 0:
return [p for _, p in special[:_MAX_PATHS]]
half = quota // 2
selected = [p for _, p in special[:len(special)]]
t_take = t_paths[:min(half, len(t_paths))]
f_take = f_paths[:min(quota - len(t_take), len(f_paths))]
ti, fi = 0, 0
while len(selected) < _MAX_PATHS and (ti < len(t_take) or fi < len(f_take)):
if ti < len(t_take):
selected.append(t_take[ti][1])
ti += 1
if fi < len(f_take) and len(selected) < _MAX_PATHS:
selected.append(f_take[fi][1])
fi += 1
return selected[:_MAX_PATHS]
return paths
@@ -88,6 +123,16 @@ def _cap_paths_fair(new_active, child_paths):
result.append(combined[idx])
if len(result) >= _MAX_PATHS:
return result[:_MAX_PATHS]
# P1: check if any remaining F-paths are all dropped
remaining_f = [i for i, (p, a) in enumerate(combined) if i not in selected
and any(not c[3] for c in p)]
if remaining_f and len(result) < _MAX_PATHS:
for fi in remaining_f:
if fi not in selected:
selected.add(fi)
result.append(combined[fi])
if len(result) >= _MAX_PATHS:
break
# Phase 2: 用剩余配额填充其余组合
remaining = _MAX_PATHS - len(result)
for idx in range(len(combined)):