View Full Document

A Language for Flexible Type Analysis



View the full content.
View Full Document
View Full Document

1 views

Unformatted text preview:

LX A Language for Flexible Type Analysis Stephanie Weirich Cornell University joint work with Karl Crary Typed Compilation A series of translations between typed languages propagating a set of invariants throughout the entire compilation process Types are used for a variety of optimizations and provide safety assurances about the output of compiler Terms Source IL Machine Types Polymorphic Subscript Because any array may be passed to a polymorphic function all arrays must look the same no matter the type of their elements A array int B array bool sub Fn a Type fn A array a i int wordsub A i Monomorphic subscript In languages such as C the type of an array is always known at compilation We can pack boolean values into integer arrays int A 4 bool B 4 A 2 B 2 intsub A 2 intsub B 0 1 2 0 Type Analysis iML A array int B array bool type packedarray a Type typecase a of int array int bool array int sub Fn a Type fn A packedarray a i int typecase a of int wordsub A i bool wordsub A i div 32 1 i mod 32 0 A Problem What if during typed compilation two source types map to the same target type Source false true Language term compilation Target Language 0 1 int bool type compilation int An initial attempt Target language contains both source language and target language types and has a built in type constructor interp to translate between them sub Fn a S fn A array interp a i int typecase a of int S wordsub A i bool S wordsub A i div 32 1 i mod 32 0 Issues in Compilation How do we preserve the meaning of typecase when the types themselves change type translation may not be injective in TALx86 int int may be compiled into a variety of types depending on the calling convention register allocation etc In closure conversion a b converted to c a c b c larger type takes longer to analyze typecase is no longer exhaustive Goal Need a facility to describe the types of another language and describe a translation of those types into the types of the current language Need a way to examine



Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view A Language for Flexible Type Analysis and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view A Language for Flexible Type Analysis and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?