Generic go to go: dictionary-passing, monomorphisation, and hybrid

Generic go to go: dictionary-passing, monomorphisation, and hybrid
复制标题

通用 go to go:字典传递、单态化和混合

DOI:
10.1145/3563331
复制
发表时间:
2022
影响因子:
--
通讯作者:
Ellis S
Ellis S
中科院分区:
--
文献类型:
--
作者:
Ellis S

文献摘要

参考文献

被引文献

相似文献

GO是一种流行的静态类型工业编程语言。为了帮助代码的类型安全重用,2022年初发布的最新GO版本(GO 1.18)通过泛型类型包括了有界参数多态。Go 1.18使用单形化和基于调用图的词典传递(称为混合)的组合来实现泛型类型。这种混合方法可以被视为单形化的优化形式,它基于可能的实例化静态地生成专门化的方法和类型。单片字典补充了单词化过程中丢失的信息,并根据程序的调用图进行构造。遗憾的是,这种混合方法仍然存在代码膨胀、编译速度慢和代码覆盖率有限的问题。本文提出并形式化了一种新的基于非特定调用点的词典传递翻译。我们的基于调用点的翻译为每个类型参数创建单独的字典,用字典构造代替实例化,克服了混合的限制。我们用一种新颖和通用的互模拟技术证明了它的正确性。为了更好地了解不同的泛型翻译方法在实践中是如何工作的,我们对五个翻译器GO 1.18、两个现有的单词化翻译器、我们的词典传递翻译器和一个擦除翻译器进行了基准测试。我们的发现揭示了对GO 1.18改进的几点建议--具体地说,如何克服通用GO的表达限制,并改善GO 1.18的编译时间和编译代码大小性能。
Go is a popular statically-typed industrial programming language. To aid the type safe reuse of code, the recent Go release (Go 1.18) published early 2022 includes bounded parametric polymorphism via generic types. Go 1.18 implements generic types using a combination of monomorphisation and call-graph based dictionary-passing called hybrid. This hybrid approach can be viewed as an optimised form of monomorphisation that statically generates specialised methods and types based on possible instantiations. A monolithic dictionary supplements information lost during monomorphisation, and is structured according to the program’s call graph. Unfortunately, the hybrid approach still suffers from code bloat, poor compilation speed, and limited code coverage.In this paper we propose and formalise a new non-specialising call-site based dictionary-passing translation. Our call-site based translation creates individual dictionaries for each type parameter, with dictionary construction occurring in place of instantiation, overcoming the limitations of hybrid. We prove it correct using a novel and general bisimulation up to technique. To better understand how different generics translation approaches work in practice, we benchmark five translators, Go 1.18, two existing monomorphisation translators, our dictionary-passing translator, and an erasure translator. Our findings reveal several suggestions for improvements for Go 1.18— specifically how to overcome the expressiveness limitations of generic Go and improve compile time and compiled code size performance of Go 1.18.
动态语言基于跟踪的即时类型专业化
DOI: 10.1145/1542476.1542528
发表时间: 2009
影响因子: 19
作者:
A. Gal;Brendan Eich;Mike Shaver;David Anderson;David Mandelin;M. Haghighat;Blake Kaplan;Graydon Hoare;B. Zbarsky;Jason Orendorff;J. Ruderman;Edwin W. Smith;Rick Reitmaier;Michael Bebenita;Mason Chang;M. Franz
通讯作者: M. Franz
DOI: 10.1145/378795.378797
发表时间: 2001-05
期刊: --
影响因子: --
作者:
A. Kennedy;Don Syme
通讯作者: A. Kennedy;Don Syme
Miniboxing:提高参数多态性翻译中代码大小权衡的速度
DOI: --
发表时间: 2013
期刊: Conference on Object-Oriented Programming Systems, Languages, and Applications
影响因子: --
作者:
Vlad Ureche;Cristian Talau;Martin Odersky
通讯作者: Martin Odersky
泛型 Java 中运行时类型的情况
DOI: --
发表时间: 2002
期刊: PPPJ/IRE
影响因子: --
作者:
Eric E. Allen;Robert Cartwright
通讯作者: Robert Cartwright
Pizza 到 Java :将理论转化为实践Martin
DOI: --
发表时间: 1997
期刊:
影响因子: --
作者:
Martin Odersky;P. Wadler
通讯作者: P. Wadler