Compiling polymorphism using intensional type analysis

Compiling polymorphism using intensional type analysis
复制标题

使用内涵类型分析编译多态性

DOI:
10.1145/199448.199475
复制
发表时间:
1995
期刊:
Proceedings of the 22nd annual ACM SIGPLAN conference on Object-oriented programming systems, languages and applications
影响因子:
--
通讯作者:
G. Morrisett
G. Morrisett
中科院分区:
--
文献类型:
--
作者:
R. Harper;G. Morrisett

文献摘要

被引文献

相似文献

实施多态性的传统技术通常对未知类型的对象进行通用表示,即使已知对象的类型,我们也可以使用通用表示。为了确定对象的表示,例程允许单态代码使用自然,有效的表示与多态性的多态性定义以及多态性的实现不同,自然表示可以用于诸如REF和阵列之类的可变物体。 我们对中间语言的打字属性特别感兴趣,该属性允许在语言中编码运行时类型分析,我们提供一种核心目标语言,可以在该语言中对类型分析运算符进行编码,并且可以准确跟踪此类操作员的类型。代码多种有用的功能,但是类型检查仍然可以决定,我们将类似于ML的语言转换为目标语言,以便原始操作员可以分析类型以产生有效的表示。操作员通过编码扁平的元组,编组,类型类以及语言中的一种类型动态形式。
Traditional techniques for implementing polymorphism use a universal representation for objects of unknown type. Often, this forces a compiler to use universal representations even if the types of objects are known. We examine an alternative approach for compiling polymorphism where types are passed as arguments to polymorphic routines in order to determine the representation of an object. This approach allows monomorphic code to use natural, efficient representations, supports separate compilation of polymorphic definitions and, unlike coercion-based implementations of polymorphism, natural representations can be used for mutable objects such as refs and arrays. We are particularly interested in the typing properties of an intermediate language that allows run-time type analysis to be coded within the language. This allows us to compile many representation transformations and many language features without adding new primitive operations to the language. In this paper, we provide a core target language where type-analysis operators can be coded within the language and the types of such operators can be accurately tracked. The target language is powerful enough to code a variety of useful features, yet type checking remains decidable. We show how to translate an ML-like language into the target language so that primitive operators can analyze types to produce efficient representations. We demonstrate the power of the “user-level” operators by coding flattened tuples, marshalling, type classes, and a form of type dynamic within the language.