Efficiently supporting sound gradual typing in a language with structural types is challenging. To date, the Grift compiler is the only close-to-the-metal implementation of gradual typing in this setting, exploiting coercions for runtime checks, and further extended with monotonic references for efficient access to statically-typed data structures. On the language design and semantics side, the Abstracting Gradual Typing (AGT) methodology has proven fruitful to elucidate existing designs and to innovate by deriving gradualizations of a wide variety of typing disciplines and language features. Grounded in abstract interpretation, the Curry-Howard inspired runtime semantics of AGT is based on the notion of evidence for consistent judgments that evolve during reduction, monitoring the plausibility of well-typedness. While expressive and versatile, it is unclear whether such evidence-based semantics are a viable route to realize an efficient implementation of gradual typing. In this work, we explore this question by designing, implementing, and evaluating an evidence-based compiler, called GrEv. We explain how to bridge the gap between the formal semantics and the GrEv compiler implementation, and identify novel monotonic semantics. We empirically evaluate the performance of GrEv on the Grift benchmark suite. The results show that an evidence-based compiler can be competitive with, and even faster than, a coercion-based compiler, exhibiting more stability across configurations on the static-to-dynamic spectrum. In addition to enriching the space of gradual typing compilers, this work opens a direct door to exploring efficient implementations of the many advanced gradual typing disciplines formally derived with AGT in the literature.


翻译:在具有结构类型的语言中高效支持可靠的渐进类型具有挑战性。迄今为止,Grift编译器是该场景下唯一接近硬件的渐进类型实现,它利用强制转换进行运行时检查,并进一步扩展了单调引用以高效访问静态类型数据结构。在语言设计和语义方面,抽象渐进类型(AGT)方法论已被证明富有成效,既能阐明现有设计,又能通过推导多种类型系统和语言特性的渐进化版本进行创新。AGT奠基于抽象解释,其受Curry-Howard启发的运行时语义以一致性判断的证据概念为核心,这些证据在规约过程中演化,监控类型良好性的合理性。尽管表达力强且用途广泛,但此类基于证据的语义是否是实现渐进类型高效编译的可行路径尚不明确。本研究通过设计、实现和评估一个名为GrEv的基于证据的编译器来探讨该问题。我们阐述了如何弥合形式语义与GrEv编译器实现之间的差距,并提出了新颖的单调语义。我们在Grift基准测试套件上对GrEv的性能进行了实证评估。结果表明,基于证据的编译器能够与基于强制转换的编译器竞争,甚至在某些情况下更快,且在静态到动态谱系的配置中表现出更高的稳定性。除了丰富渐进类型编译器的设计空间,本工作还为探索文献中通过AGT形式化推导的多种高级渐进类型系统的高效实现开辟了直接通道。

0
下载
关闭预览

相关内容

编译器(Compiler),是一种计算机程序,它会将用某种编程语言写成的源代码(原始语言),转换成另一种编程语言(目标语言)。
EMNLP 2021 | 学习改写非自回归机器翻译的翻译结果
专知会员服务
16+阅读 · 2021年12月25日
Python图像处理,366页pdf,Image Operators Image Processing in Python
高效的文本生成方法 — LaserTagger 现已开源
TensorFlow
30+阅读 · 2020年2月27日
【NeurIPS2019】图变换网络:Graph Transformer Network
国家自然科学基金
17+阅读 · 2017年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
10+阅读 · 2014年12月31日
VIP会员
相关VIP内容
相关基金
国家自然科学基金
17+阅读 · 2017年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
10+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员