feat(sidecar): 落盘 {sha1}.meta 函数定义清单,声明文件判定改读结构化 sidecar
- 新增 WriteModuleFuncMeta:翻译期从 Module.FuncHead + Function.IsDeclared 产出 FUNC <mangled> DEF|DECL(与 dump_ir 的 stub/text 判据同源) - 新增 _MetaHasDef / 重写 IsDeclOnlyModule:不再扫 text.ll 的 define 行,改读 meta - Phase1/Phase2 落盘点紧随 text.ll 写出 meta;Phase1 增量跳转额外要求 meta 存在 - Phase2 内联 is_decl_mi 与 PhaseC 判定统一走 IsDeclOnlyModule 去 IR 化步骤①(sidecar 最小闭环),全后端统一,默认行为不变。
This commit is contained in:
1 parent
0ebe2e0752
commit
94d2bf5047
3 files changed
+134
-75
No files matched your search
@@ -922,9 +922,20 @@ def RunPhase1(mb: memhub.MemBuddy*, includes_dir: str, temp_dir: str,
|
||||
tf: rawptr[fileio.File] = fileio.File(text_path, fileio.MODE.R)
|
||||
if not tf.closed:
|
||||
tf.close()
|
||||
stdlib.free(text_path)
|
||||
stdlib.free(stub_path)
|
||||
continue
|
||||
# sidecar({sha1}.meta)也必须存在:缺失则重新翻译以补写,
|
||||
# 否则 Phase B+/C 的「纯声明文件」判定拿不到结构化清单。
|
||||
meta_path_1b: str = StubMergerCollect._sliced_path(temp_dir, dir_len, sha1, "meta")
|
||||
meta_ok_1b: int = 0
|
||||
if meta_path_1b is not None:
|
||||
mf_chk: rawptr[fileio.File] = fileio.File(meta_path_1b, fileio.MODE.R)
|
||||
if not mf_chk.closed:
|
||||
mf_chk.close()
|
||||
meta_ok_1b = 1
|
||||
stdlib.free(meta_path_1b)
|
||||
if meta_ok_1b != 0:
|
||||
stdlib.free(text_path)
|
||||
stdlib.free(stub_path)
|
||||
continue
|
||||
stdlib.free(text_path)
|
||||
# text.ll 不存在,需要重新翻译
|
||||
rp: str = entry.RelPath
|
||||
@@ -1129,6 +1140,9 @@ def RunPhase1(mb: memhub.MemBuddy*, includes_dir: str, temp_dir: str,
|
||||
stdlib.free(text_path_p1)
|
||||
stdlib.free(text_buf)
|
||||
|
||||
# save {sha1}.meta(结构化 sidecar:函数定义清单,替代从 text.ll 反推 declare-vs-define)
|
||||
StubMergerIR.WriteModuleFuncMeta(tr.Module, temp_dir, dir_len_p1, sha1)
|
||||
|
||||
# 计时点 3:dump(stub+text)完成;输出单文件三段耗时
|
||||
t_f3: uint64 = w32.win32base.GetTickCount64()
|
||||
VLogger.info(f"[{i+1}/{loop_n_b}] 翻译: {file_path} (parse={t_f1-t_f0} ms, translate={t_f2-t_f1} ms, dump={t_f3-t_f2} ms, total={t_f3-t_f0} ms)", "Phase1")
|
||||
|
||||
Reference in new issue
Block a user