Skip to content

AOT TB link#288

Merged
luzeng87 merged 3 commits into
lat-opensource:masterfrom
ganjue66da:t2
May 12, 2026
Merged

AOT TB link#288
luzeng87 merged 3 commits into
lat-opensource:masterfrom
ganjue66da:t2

Conversation

@ganjue66da
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor

@luzeng87 luzeng87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

审查总结

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 目标偏移写入 AOT
  • link_aot_tb(): tb_htable_lookup 查找 aim1/aim2_pc -> tb_add_jump 直接链接
  • tb_add_jumptu.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_jumpinlinelink_aot_tb/load_page__inline

底线

TB link 机制正确,建议合此 PR 关闭 #287。pread PROT_EXEC 守卫必须先修。

@ganjue66da ganjue66da force-pushed the t2 branch 5 times, most recently from 1755c17 to c558d5e Compare May 12, 2026 07:20
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.
@luzeng87 luzeng87 merged commit 53950e4 into lat-opensource:master May 12, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants