计算机应用 ›› 2016, Vol. 36 ›› Issue (9): 2481-2485.DOI: 10.11772/j.issn.1001-9081.2016.09.2481

• 计算机软件技术 • 上一篇    下一篇

高阶代码消除性能比较框架的设计与实现

赵迪1,2, 华保健1,2, 朱洪军1,2   

  1. 1. 中国科学技术大学 软件学院, 合肥 230027;
    2. 中国科学技术大学 苏州研究院, 江苏 苏州 215123
  • 收稿日期:2016-03-07 修回日期:2016-03-25 出版日期:2016-09-10 发布日期:2016-09-08
  • 通讯作者: 华保健
  • 作者简介:赵迪(1988-),女,黑龙江齐齐哈尔人,硕士研究生,主要研究方向:程序设计语言;华保健(1979-),男,河北保定人,讲师,博士,主要研究方向:程序设计语言、软件安全;朱洪军(1983-),男,安徽阜阳人,讲师,硕士,主要研究方向:软件测试、移动安全。
  • 基金资助:
    国家自然科学基金青年科学基金资助项目(61202052);苏州市科技计划应用基础研究项目(SYG201406)。

Design and implementation of performance comparing frame for higher-order code elimination

ZHAO Di1,2, HUA Baojian1,2, ZHU Hongjun1,2   

  1. 1. School of Software Engineering, University of Science and Technology of China, Hefei Anhui 230027, China;
    2. Suzhou Institute for Advanced Study, University of Science and Technology of China, Suzhou Jiangsu 215123, China
  • Received:2016-03-07 Revised:2016-03-25 Online:2016-09-10 Published:2016-09-08
  • Supported by:
    This work is partially supported by the Science Fund Program for the Youths of the National Natural Science Foundation of China (61202052), the Science and Technology Improving Program (Applied Basic Research) of Suzhou (SYG201406).

摘要: 函数式语言编译中,闭包变换和函数消除是广泛采用的高阶代码消除方法。为了提高函数式语言的运行效率,针对函数式语言编译阶段的高阶代码消除过程对目标代码效率的影响,设计并实现了一种函数式语言编译框架。该框架采用了菱形的架构,平行地使用了闭包变换与函数消除两种高阶代码消除方法。设计了一种具有代表性的函数式语言——FUN语言,并以FUN语言为基础,给出了比较框架的一个完整实现。通过该系统,对闭包变换与函数消除的效率影响进行对比实验,选取具有典型特征的测试例,分别从生成代码的规模和运行效率方面对闭包变换与函数消除两种方法的结果进行比较。实验结果表明,与闭包变换相比,使用函数消除方式所得的目标代码量更少,最多可减少33.76%的目标代码量;并且运行效率更高,最多可提高69.51%。

关键词: 编译框架, 函数式语言, 高阶代码, 闭包变换, 函数消除

Abstract: In functional programming language compilation, closure conversion and defunctionalization are two widely used higher-order code eliminating methods. To improve the operational efficiency of functional programming languages, focusing on the higher-order code eliminating phase, a compiler frame to compare the performance of code generated by closure conversion and defunctionalization was proposed. Both closure conversion and defunctionalization were used in parallel in the comparing frame with a diamond structure. A functional programming language named FUN and a compiling system for FUN based on the comparing frame was proposed. Comparison experiments of closure conversion and defunctionalization were conducted on the proposed system by using typical use cases, and the experimental results were compared in code quantity and operation efficiency. The result suggests that compared with closure conversion, defunctionalization can produce shorter and faster target code; the amount of code can be decreased by up to 33.76% and performance can be improved by up to 69.51%.

Key words: compiler frame, functional programming language, higher-order code, closure conversion, defunctionalization

中图分类号: