We motivate the design of a statically typed assembly language (TAL) and present a type-preserving transb tion from System F to TAL. The TAL we present is based on a conventional RISC assembly language, but its static type system provides support for enforcing high-level language abstractions, such as closures, tuples, and objects, as well as user-defined abstract data types. The type system ensures that well-typed programs cannot violate these abstractions. In addition, the typing constructs place almost no restrictions on low-level optimizations such as register allocation, instruction selection, or instruction scheduling. Our translation to TAL is specified as a sequence of type-preserving transformations, including CPS aud closure conversion phases; typecorrect source programs are mapped to type-correct assembly language. A key contribution is an approach to polymorphic closure conversion that is considerably simpler than previous work. The compiler and typed assembly language provide a fully automatic way to produce proof carrying code, mitable for use in systems where untrusted and potentially malicious code must be checked for safety before execution. Permission lo mnkc digitalfhard copies of all or part of ihis material for personnl or classroom use is granted without fee provided that thecopies are not mxdc or distributed for proiit or commercial advantage, the copyright notice, ihc title ofthepublication and its date appear, and notice is given that copyright is by permission of the ACM, Inc. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires specific permission r&or fee POPL 98 San Diego CA USA Copyright 1998&M 0-89791-979-3/98/Ol..S3.50
Typed Assembly languages REF do serve as a compilation target, usually taking the form of a complex type system imposed on top of an existing assembly language.
From system F to typed assembly language