50 likes | 145 Views
Survey of Typed Assembly Language (TAL). Introduction and Motivation Conventional untyped compiler < Typed intermediate languages Typed intermediate language < Typed target language ( TAL) Resources
E N D
Survey of Typed Assembly Language (TAL) • Introduction and Motivation • Conventional untyped compiler < Typed intermediate languages • Typed intermediate language < Typed target language ( TAL) • Resources • From System F to Typed Assembly Language Greg Morrisett, David Walker, Karl Crary, and Neal Glew • From System F to Typed Assembly Language (Extended version). Technical Report TR97-1651 Greg Morrisett, David Walker, Karl Crary, and Neal Glew • Intensional Polymorphism in Type-Erasure Semantics. Stephanie Weirich , Karl Crary and Greg Morrisett • TALx86: A Realistic Typed Assembly Language Greg Morrisett, Karl Crary, Neal Glew, Dan Grossman, Richard Samuels, Frederick Smith, David Walker, Stephanie Weirich, and Steve Zdancewic • Structure • From system F to TAL: 4 translations and 5 typed calculi • Extension and practice: • TAL86x, a realistic typed assembly language
Compilation of System F to Typed Assembly Language * Product type • Step 1 : system F and Continuation Passing style (CPS) conversion • Objective: conversion to CPS • Syntax for λF(call-by-value variant of system F augmented with products and recursion ) • Syntax forλK (target calculus, typed intermediate language) • What’re completed and changed? • Names all intermediate computations and eliminates the need for a control stack • All unconditional control transfers are achieved via function call • λK is almost linear, except for if0 • Functions in λK invoke continuations using “ void” • Halt[τ]υ terminates the computation * Recursion * * Cited from “From system F to TAL”
Compilation of System F to Typed Assembly Language * • Step 2 : Simplified Polymorphic Closure Conversion • Objective: separate program code from data • Two steps: • Closure conversion proper • Approaches: Minamide et al / The Definition of Standard ML@ • Type-passing / Type-erasure interpretation of polymorphism (types are constructed and passed to polymorphic functions at run-time) (run-time type information is represented by ordinary terms) • Polymorphic instantiation cannot / can easily be handled via substitution • Requires / Don’t require both abstract kinds of translucent types • Cost of Polymorphic closure conversion • Hoisting – lift the closed function code to the top of program • Key point of implementation of the Type-erasure interpretation • Partial applications of functions to type arguments to be values Eg. : υ has type is treated as a value and has type * * Cited from “From system F to TAL”, Greg Morrisett, David Walker, Karl Crary, and Neal Glew @ Cited from “Intensional Polymorphism in Type-Erasure Semantics ”, Karl Crary, Stephanie Weirich, and Greg Morrisett
Compilation of System F to Typed Assembly Language * • Step 3 : Explicit Allocation • Objective: allocate spaces for tuples and fill them out field by field • Syntax forλA(similar to λC ): • Features: • Tuples no long have value form • Creation of an n-element tuple: an allocation step + n initialization steps Eg. Creation of the pair <υ0, υ1 > * * * Cited from “From system F to TAL”
Compilation of System F to Typed Assembly Language * • Step 4: Code generation • Objective: convertλA to TAL, mostly syntactic • TAL syntax * Key technical Difference TAL program * * Cited from “From system F to TAL”