LATX, opt: classify AOT file types#292
Open
ganjue66da wants to merge 1 commit into
Open
Conversation
luzeng87
reviewed
May 12, 2026
Contributor
luzeng87
left a comment
There was a problem hiding this comment.
PR #292 审查 — AOT 文件类型分类
作者: ganjue66da | 1 提交, 12 文件
概述
将 bool is_pe 替换为 uint8_t aot_file_type 位掩码(ELF/PE/CACHE/HASH 四类)。按类型差异化 SMC 处理、IR1 校验、stat 检查。
审查项
| # | 问题 | 严重度 | 说明 |
|---|---|---|---|
| 1 | is_elf_file 的 perror 噪音 |
低 | segment_tree_insert 对每个段都调 is_elf_file。非 ELF/PE 文件(如 deepinwine cache 路径)文件不存在,perror("Error opening file") 会打 stderr 噪音。建议删掉 perror 或加 if (option_debug_aot) 守卫 |
| 2 | is_deepinwine_cache 的 malloc + assert |
低 | static buffer 用 malloc(PATH_MAX) + assert 守卫。失败直接 assert(0) 进程崩溃。改为栈变量 char path[PATH_MAX] 更安全 |
| 3 | HASH_PAGE_LOADED / HASH_PAGE_NOINFO |
低 | enum 定义但 diff 中未使用。dead code 还是预留?建议标注或移出此 PR |
| 4 | ONE_TB_IN_TU |
低 | seg_flag 定义但未使用。同上 |
| 5 | PE stat 检查行为变更 | 需确认 | do_generate_aot 中 PE 文件现在也做 stat 校验(ELF_AOT_FILE | PE_AOT_FILE)。之前 PE 是否跳过 stat?请确认预期行为 |
| 6 | HASH 文件类型注释掉 | 低 | get_file_type 中 HASH 判断被注释,回退到 CACHE_AOT_FILE。安全,建议标注 TODO |
正面变更
page_is_pe从page_info清理is_running→seg_flag & SEG_RUNNING位标记化- PE/CACHE 文件 SMC 后允许重新 load AOT(
load_aot中PAGE_SMC非 ELF 不拦截) page_set_flags中p_info全局变量消除
总结
分类思路正确。修复 perror 噪音 + dead code + PE stat 确认后合。
ELF_AOT_FILE: AOT files corresponding to ELF binaries PE_AOT_FILE: AOT files corresponding to PE binaries CACHE_AOT_FILE: AOT files from cache directories HASH_AOT_FILE: AOT files generated from hash Only track SMC pages for ELF files in page_set_flags. PE_AOT_FILE and CACHE_AOT_FILE need check ir1. CACHE_AOT_FILE do not check origin file change time. HASH_AOT_FILE in the draft.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELF_AOT_FILE: AOT files corresponding to ELF binaries
PE_AOT_FILE: AOT files corresponding to PE binaries
CACHE_AOT_FILE: AOT files from cache directories
HASH_AOT_FILE: AOT files generated from hash
Only track SMC pages for ELF files in page_set_flags. PE_AOT_FILE and CACHE_AOT_FILE need check ir1.
CACHE_AOT_FILE do not check origin file change time.