用异常处理机制获取程序继续
Obtaining Program Continuation Using Exception Handling Mechanism
-
摘要: 为在当今主流程序设计语言(如C++/Java/C#)中实现继续,采用异常处理机制获取程序继续的方法,利用优化的CPS(continuation passing style)作为中间表示语言,在切片阶段自动确定切片单元和分析定义活性变元的生命期;并且,归纳了支持本方法语言的公共特征,设计出一个一般的、可重用的类层次系统,给出了系统基本架构和应用间的简单接口及实现.结果表明,在高级语言中实现继续机制是完全可行的,可有效地解决确定变元生命期的难题.Abstract: With the rapid increasing of continuation-based interactive Web development,implementing first-class continuations on mainstream languages those do not support stack inspection and manipulation can pose a challenge.This paper describes a method of obtaining program continuation through exception handling mechanism.The method is based on program transformation,and steps on transformation are firstly introduced.Then,common properties on languages that can make use of this method are summarized.We also show that our method defines a distinguished general and reusable class hierarchies and simple interfaces between the system infrastructure and custom applications.With our design,implementing techniques on different languages have been discussed.Another point is that we introduce the optimized CPS language as the intermediate represent for ANF transformation which shows its advantage on fragment and live variables analysis.