Generic Go to Go: Dictionary-Passing, Monomorphisation, and Hybrid
Stephen Ellis, Shuofei Zhu, Nobuko Yoshida, Linhai Song

TL;DR
This paper introduces a new call-site based dictionary-passing translation for Go generics, aiming to reduce code bloat and improve compilation speed compared to existing approaches like monomorphisation and hybrid.
Contribution
It formalizes a novel non-specialising call-site based translation for Go generics and proves its correctness using bisimulation techniques.
Findings
The new translation reduces code size and compilation time.
Benchmark results compare five different generics translation approaches.
Insights suggest improvements for Go 1.18's generics implementation.
Abstract
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 on 15th March 2022 includes bounded parametric polymorphism via generic types. Go 1.18 implements generic types using 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 it 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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Advanced Malware Detection Techniques
