论文标题

尸体修订器:通过合同验证声音和高效逐渐键入

Corpse Reviver: Sound and Efficient Gradual Typing via Contract Verification

论文作者

Moy, Cameron, Nguyen, Phúc C., Tobin-Hochstadt, Sam, Van Horn, David

论文摘要

逐渐使用的编程语言允许将静态类型的静态类型添加到未型的程序中。为了保持声音,语言在键入和未经类型的代码之间的边界上插入运行时间检查。不幸的是,绩效研究表明,这些检查的开销可能是灾难性的,质疑声音逐渐键入的可行性。在本文中,我们表明,通过在软合约验证上进行现有工作,我们可以减少或消除此开销。 我们的关键见解是,虽然无法通过渐进类型的系统来信任未经类似的代码,但在优化逐渐型的程序时,无需仅考虑最坏的情况即可。取而代之的是,我们静态地分析了逐渐型程序的未型部分,以证明几乎所有按渐进类型边界所隐含的动态检查不会失败,并且可以在编译时消除。我们的分析是模块化的,可以应用于程序的任何部分。 我们在以前显示的十几个现有的逐渐投入的程序中评估了这种方法,其性能高度超高 - $ 3.5 \ timple $ $,最高$ 73.6 \ times $ $在最坏的情况下 - 在大多数情况下,在最坏情况下仅遭受了$ 1.6 \ times $ $ 00。

Gradually-typed programming languages permit the incremental addition of static types to untyped programs. To remain sound, languages insert run-time checks at the boundaries between typed and untyped code. Unfortunately, performance studies have shown that the overhead of these checks can be disastrously high, calling into question the viability of sound gradual typing. In this paper, we show that by building on existing work on soft contract verification, we can reduce or eliminate this overhead. Our key insight is that while untyped code cannot be trusted by a gradual type system, there is no need to consider only the worst case when optimizing a gradually-typed program. Instead, we statically analyze the untyped portions of a gradually-typed program to prove that almost all of the dynamic checks implied by gradual type boundaries cannot fail, and can be eliminated at compile time. Our analysis is modular, and can be applied to any portion of a program. We evaluate this approach on a dozen existing gradually-typed programs previously shown to have prohibitive performance overhead---with a median overhead of $3.5\times$ and up to $73.6\times$ in the worst case---and eliminate all overhead in most cases, suffering only $1.6\times$ overhead in the worst case.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源