ISSN 1000-1239 CN 11-1777/TP

计算机研究与发展 ›› 2019, Vol. 56 ›› Issue (4): 742-754.doi: 10.7544/issn1000-1239.2019.20170412

• 系统结构 • 上一篇    下一篇

一种高效解决间接转移的反馈式静态二进制翻译方法

王军,庞建民,傅立国,岳峰,张家豪   

  1. (数学工程与先进计算国家重点实验室(战略支援部队信息工程大学) 郑州 450002) (wj_xd@foxmail.com)
  • 出版日期: 2019-04-01
  • 基金资助: 
    国家自然科学基金项目(61520106005,61761136014);国家重点研发计划项目(2017YFB1010000)

An Efficient Feedback Static Binary Translator for Solving Indirect Branch

Wang Jun, Pang Jianmin, Fu Liguo, Yue Feng, Zhang Jiahao   

  1. (State Key Laboratory of Mathematical Engineering and Advanced Computing (Strategic Support Force Information Engineering University), Zhengzhou 450002)
  • Online: 2019-04-01

摘要: 为了在追求程序执行效率的同时解决静态二进制翻译中的间接转移问题,针对现有间接转移问题处理方法中线性遍历翻译方式代码优化较少、冗余代码较多的缺陷,提出了基于基本块翻译的反馈式静态二进制翻译方法,并结合二级地址映射表实现了间接转移目标地址的快速映射.首先,在目标可执行程序运行过程中添加监控反馈机制解决代码发现问题,对未确定的间接转移地址进行反馈,以便对源程序重新划分基本块并重新翻译执行;然后构造二级地址映射表,借助二级地址映射快速解决代码定位问题.在开源二进制翻译平台QEMU(quick emulator)上实现了反馈式静态二进制翻译框架FD-SQEMU(feedback static QEMU),并基于SPEC2006和NBENCH测试集进行测试,与QEMU相比,FD-SQEMU平均加速比分别达到3.97倍和6.94倍;与课题组之前提出的保存源程序指令全地址的静态SQEMU翻译器相比,FD-SQEMU的平均加速比达到1.18倍,最高加速比达到了1.36倍,验证了提出的框架和方法的有效性.

关键词: 二进制翻译, 静态二进制翻译, 间接转移, 翻译器QEMU, 反馈式翻译框架FD-SQEMU

Abstract: In order to solve the problem of indirect branch efficiently in static binary translation, a feedback static binary translation method is proposed, with two-level address mapping table to realize the fast mapping of indirect branch target address. This method can solve the problem of less code optimization and more redundant code in existing linear traversal translation. Firstly, the two-level address mapping table is used to address the code location quickly, using array address to store the target platform code block address in the order of the source platform base block start address and using array index to save the index position of the basic block start address in array address. Then, the monitoring feedback mechanism is added to the target executable program to carry on the code discovery, and the uncertain indirect branch target address would be returned so that the source code can be divided to new basic blocks and re-translated. The feedback static binary translation framework FD-QEMU is implemented based on QEMU(quick emulator), an open source binary translator. As the experimental results on SPEC2006 and NBENCH show, compared with QEMU, the speedup ratio of FD-SQEMU (feedback static QEMU) is 3.97 and 6.94 times on average; compared with SQEMU, a static translator with all instructions’ address mapping originally proposed by our group, the average acceleration ratio of FD-SQEMU is 1.18 times, and the maximum speedup ratio is 1.36 times, which verifies the effectiveness of the framework and method proposed in this paper.

Key words: binary translation, static binary translation, indirect branch, translator QEMU, feedback translation framework FD-SQEMU

中图分类号: