ISSN 1000-1239 CN 11-1777/TP

计算机研究与发展

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

以虚拟机为核心支持动态层绑定的方法

朱常鹏 赵银亮 韩 博 曾庆花 刘淞佳   

  1. (西安交通大学计算机科学与技术系 西安 710049) (is99zcp@hotmail.com)
  • 出版日期: 2014-02-15

A VM-centric Approach for Dynamic Layer Binding

Zhu Changpeng, Zhao Yinliang, Han Bo, Zeng Qinghua, and Liu Songjia   

  1. (Department of Computer Science and Technology, Xi’an Jiaotong University, Xi’an 710049)
  • Online: 2014-02-15

摘要: 一些面向上下文的编程语言已经实现,但在这些语言中所有的层被编译为程序可执行代码的一部分,这限制了程序的应用范围.为了解决该问题,提出一种以虚拟机为核心的方法支持动态层绑定,它融入对象组合与代理到虚拟机实现层激活,利用虚拟机服务支持动态层绑定.为了精确描述该方法并有效分析该方法对程序类型安全的影响,定义一个以Featherweight Java演算为核心的演算.基于该演算,形式化分析它对程序类型安全的影响,定义相应的约束,并证明在满足该约束下动态层绑定能保持程序的类型安全.为证明方法可行,以演算为指导,通过扩展Java的编译器与虚拟机实现并评估该方法.该演算和方法的实现可用于指导类似Java的语言的扩展,以支持程序动态地绑定层,同时保证扩展后语言的类型安全.

关键词: 虚拟机, 面向上下文的编程, 对象组合, 代理, 类型系统

Abstract: Some context-oriented programming languages are implemented, but all layers in these languages are compiled into executable codes of programs, which increases the size of executable codes and restricts application ranges of programs. In this paper, a VM-centric approach is proposed to address these issues. It incorporates object composition and delegation into VM to implement layer activation, and extends existing VM services to support dynamic layer binding. To assure that the approach preserves type safety properties of the program, a calculus built on Featherweight Java is developed to describe it. Based on the calculus, the influences that the approach imposes on the type safety of the program are formally analyzed, the constraints on it are also proposed, and a formally proof is presented which ensures that the approach preserves the type safety of the program when these constraints are satisfied. Under guidance of the calculus, an implementation of the approach is presented and evaluated. The calculus and the implementation illustrate how to extend Java-like languages to support dynamic layer binding in a type safe way.

Key words: virtual machine, context-oriented programming, object composition, delegation, typed system