AOT TB link#288
Merged
Merged
Conversation
luzeng87
reviewed
May 12, 2026
Contributor
luzeng87
left a comment
There was a problem hiding this comment.
审查总结
AOT TB 直接链接 + PE 文件支持。此 PR 是 #287 的超集。
1. AOT TB link 机制 (aot_link_seg.c, aot_recover_tb.c, aot.c, cpu-exec.c)
核心改动:
aot_link_info简化为{curr, aim1_pc, aim2_pc},不再存 addr/flags/cflags/type 枚举create_aot_tb: 新增next_tb_pc_offset/target_tb_pc_offset,同类段内 branch/call/jmp 目标偏移写入 AOTlink_aot_tb():tb_htable_lookup查找 aim1/aim2_pc ->tb_add_jump直接链接tb_add_jump从tu.c移除重复定义,cpu-exec.c去 static 导出try_aot_link()统一:先 link_aot_tb(直接跳转),再 patch_jrra(返回地址)- 容量 1000 -> 100000
records -> replay 消除运行时 TB lookup。正确.
2. option_aot == 2 整段加载 (aot_recover_tb.c)
新增 load_aot(): 一次性加载整段 TB -> try_aot_link() 一次性链接。load_page 改为接受 seg_info *info。没问题。
3. PE 文件支持 (= #287)
IR1 缓存、pread 追踪、is_elf_file、aot_buffer 参数化、pe 跳过 protect、新 epilogue 重定位。同 #287 评价.
需关注
| 问题 | 说明 |
|---|---|
| 与 #287 重复 | 此 PR 是 #287 超集,合并后应关闭另一个 |
| pread 无 PROT_EXEC 守卫 | 同 #287,任何 PE 文件 pread 都触发 AOT 追踪 |
check_ir1 仍用全局 aot_buffer |
其他函数已参数化,此处不一致 |
__inline vs inline 混用 |
tb_add_jump 用 inline,link_aot_tb/load_page 用 __inline |
底线
TB link 机制正确,建议合此 PR 关闭 #287。pread PROT_EXEC 守卫必须先修。
1755c17 to
c558d5e
Compare
1. Added support for PE file reading via pread system call. 2. Implement guest code comparison before loading AOT TB for PE files to ensure security.
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.
No description provided.