计算机与现代化 ›› 2016, Vol. 0 ›› Issue (6): 19-23,25.doi: doi: 10.3969/j.issn.1006-2475.2016.06.005

• 应用与开发 • 上一篇    下一篇

基于源码变更分析的程序中间代码生成技术

  

  1. 1.上海交通大学软件学院,上海200240;2.上海交通大学计算机科学与工程系,上海200240
  • 收稿日期:2015-11-17 出版日期:2016-06-16 发布日期:2016-06-17
  • 作者简介:黄海汇(1990-),男,江苏南通人,上海交通大学软件学院硕士研究生,研究方向:程序分析与测试,软件工程; 陈雨亭,上海交通大学计算机科学与工程系讲师。
  • 基金资助:
    国家自然科学基金资助项目(61572312)

An Intermediate Representation Generation Based on Code Change Analysis

  1. 1. School of Software, Shanghai Jiao Tong University, Shanghai 200240, China; 
    2. Department of Computer Science and Engineering, Shanghai Jiao Tong University, Shanghai 200240, China
  • Received:2015-11-17 Online:2016-06-16 Published:2016-06-17

摘要: 当前存在很多针对程序中间代码变更进行的程序增量分析、验证技术。为更有效地在实际中应用这些技术,如何获取程序中间代码的变更信息成为一个关键研究问题。本文主要研究通过提取源码的变更,将源码变更映射至中间代码变更的新的程序中间代码生成技术IRChange。IRChange基于Clang和LLVM中间代码,在源码中添加标记,在程序编译过程中传递变更标记;进一步地,将变更前中间代码与变更标记进行合成,以生成新的中间代码。实验结果表明,本文所获取的带增量信息的中间代码不仅具有较高正确性,且可以用于中间代码的差异分析,为增量程序分析、验证提供便利。

关键词: 源码变更, 中间代码生成, 标记

Abstract: Nowadays there exist many incremental program analysis and verification techniques, while working on intermediate representations. In order to make these techniques more practical, this paper proposes an approach to extract the program changes at the source code level, and then propagates these changes to the intermediate representations. We design a novel approach called IRChange, on the basis of LLVM and Clang, adding annotations indicating the changes to the source code, and then transferring the changes at the compiling time. Furthermore, new intermediate representations can be generated through synthesizing old intermediate representations and the annotations with change information. The experiment results show that new intermediate representations are correct. It also can be used for diff analysis at the intermediate representation level, so that the increments can be used for incremental program analysis and verification.

Key words:  source code change, generation of intermediate representations, annotation

中图分类号: