ISSN 1000-1239 CN 11-1777/TP

计算机研究与发展 ›› 2014, Vol. 51 ›› Issue (10): 2336-2347.doi: 10.7544/issn1000-1239.2014.20130018

• 软件技术 • 上一篇    下一篇

二进制翻译中标志位的模式化翻译方法

王文文1,2,武成岗1,白童心1,王振江1,远翔1,2,崔慧敏1   

  1. 1(计算机体系结构国家重点实验室(中国科学院计算技术研究所) 北京 100190);2(中国科学院大学 北京 100049) (wangwenwen@ict.ac.cn)
  • 出版日期: 2014-10-01
  • 基金资助: 
    国家“九七三”重点基础研究发展计划基金项目(2010CB328104);国家自然科学基金项目(61202449,61272054,61370207,61320106007);国家“八六三”高技术研究发展计划基金项目(2013AA013503);国家科技支撑计划基金项目(2010BAI88B03,2011BAK21B02);高等学校博士学科点专项科研基金项目(20110092130002);江苏省产学研前瞻性联合研究项目(BY2012202);江苏省科技成果转化专项资金项目(BA2012036);江苏省网络与信息安全重点实验室资助项目(BM2003201);计算机网络和信息集成教育部重点实验室资助项目(93K-9)

A Pattern Translation Method for Flags in Binary Translation

Wang Wenwen1,2, Wu Chenggang1, Bai Tongxin1, Wang Zhenjiang1, Yuan Xiang1,2, Cui Huimin1   

  1. 1(State Key Laboratory of Computer Architecture, Institute of Computing Technology, Chinese Academy of Sciences, Beijing 100190); 2(University of Chinese Academy of Sciences, Beijing 100049)
  • Online: 2014-10-01

摘要: 二进制翻译是在不同硬件平台之间实现软件迁移的重要手段.在二进制翻译系统中,如何在没有标志位寄存器的目标平台上模拟实现源平台上标志位寄存器的功能,是影响系统性能的关键.现有的标志位分析技术通过对标志位的定值引用进行数据流分析,尽可能多地消除冗余的标志位定值.但是,对于那些会被引用的标志位定值,现有的技术仍然需要进行翻译.这不仅会导致翻译生成代码的膨胀,还会影响二进制翻译系统的性能.提出了一种二进制翻译中基于模式化的标志位翻译方法.该方法在标志位分析技术基础上,通过将源平台上标志位定值指令和引用指令组合成固定的标志位模式,然后根据模式的具体语义选择目标平台上具有相同语义功能的指令组合进行翻译.这种模式化的翻译方法,不仅可以降低因翻译标志位而引入的代码膨胀,还可以提升二进制翻译系统的性能.实验结果表明,对于SPEC CINT2006中的程序,该方法不仅可以使翻译生成的代码量平均减少7.5%,还可以将程序的性能平均提升10%.

关键词: 二进制翻译, 标志位寄存器, 标志位翻译, 标志位模式, 代码优化

Abstract: Binary translation is an important way for software migration between different hardware platforms. For binary translation systems, how to simulate the flag register on target platform that does not have the function of the flag register, is a key factor affecting system performance. Previous flag analysis techniques delete the unnecessary flag computing via the flow analysis of flag definition and usage during the process of flag translation. However, for the necessary flag computing, these techniques still have to translate for simulation, which can lead to the expanse of generated native code and the loss of system performance. A pattern translation method is presented for necessary flag computing in binary translation system. Based on previous flag analysis techniques, this method makes flag definition instruction and flag usage instruction a flag pattern, and chooses appropriate instruction groups on target platform to translate flag computing based on the semantics of the flag pattern. This method for flag translation can reduce the expanse of generated native code and improve the performance of binary translation system. The experiment results demonstrate that, for the programs in SPEC CINT2006, this method can reduce the amount of generated native code by 7.5% and improve the system performance by 10% on average.

Key words: binarytranslation, flag register, flag translation, flag pattern, code optimization

中图分类号: