Design and Implementation of a Partial Evaluation-Based Compiler for an Asynchronous Realtime Programming Language

Design and Implementation of a Partial Evaluation-Based Compiler for an Asynchronous Realtime Programming Language

Design and Implementation of a Partial EvaluationBased Compiler for an Asynchronous Realtime Programming Language Markus Freericks May Abstract This thesis describ es a compiler for the asynchronous realtime programming language ALDiSP Though the language has a complex semantics not suited for easy compilation the compiler has to generate co de for target platforms that have stringent space limitations and for target applications that have to satisfy hard realtime requirements To accomplish this feat the compiler is based up on an abstract interpreter that simulates all p ossible evaluation paths of the program In a reconstruction phase the program is then totally recreated from the information gained during this simulation The abstract interpreter is an extension of the formal semantics of ALDiSP Diese Dissertation b eschreibt einen Compiler fur die asynchrone EchtzeitProgrammiersprache ALDiSP Ob wohl diese Sprache eine komplexe Semantik hat die eine direkte Ub ersetzung ausschliet soll der Compiler Co de fur Zielarchitekturen erzeugen die starken Sp eicherplatzRestriktionen unterliegen und fur Applikatio nen die harte Echtzeitanforderungen erfullen mussen Um dieses Ziel zu erreichen enthalt der Compiler als zentrale Komp onente einen abstrakten Interpreterdersamtliche moglichen Ausfuhrungspfade eines Quell programms analysiert In einer Rekonstruktionsphase wird das Programm aus den vom Interpreter erzeugten Annotationen vollstandig neu aufbaut Der abstrakte Interpreter ist eine Erweiterung der formalen Semantik von ALDiSP Contents Intro duction RealTime Digital Signal Pro cessing Application Areas for ALDiSP Overview of Compiler and Thesis Goals and Results Related Work Languages Related Work Partial Evaluation Related Work Partial Evaluation for Numerics and DSP Stylistic Questions Thanks c ALDiSP A Primer Lexical Structure Overall Structure Evaluation Strategy Basic Typ es AutoMapping Susp ensions Blo cking Access Sequences Multiple Return Values Conditionals Lo cal Denitions Chec king and Casting Typ es Exceptions Lists Streams Pip es Declarations Mo dules Functions CONTENTS The Parser Overview Lexical Analysis Prepro cessing The Parser Blind Alleys Representation of Literals Implementing The Preprocessor Error Hand ling Line Numbers and File Names CPS Intermediate Form CPS Transformation The Morale The Lambda Form Semantic Domains Conventions and Notation Data Domains Results Evaluation Functions an Overview eval expr apply eval decl eval program State Auxiliary Semantic Functions eval exprs deref ob js block strict strict exprs eval norm thunk result Evaluating Expressions Lambda ClosureCreation LvarVariable LookUp Lit Literal Values LappFunction Application Lcheck Asserting Types Lcast Casting Types Lcond TwoWay Conditional Lselect NWay Conditional LseqSequences of Expressions Lcatch Hand ling Exceptions LetLocal Denitions Evaluating Declarations Ldecl The Simple Declarations Lpard Paral lel Declarations LseqdSequential Declarations LfixdRecursive Declarations Application Rules apply closure apply overloaded apply primitive apply array apply typ e AutoMapping apply mappable TopLevel Evaluation eval program schedule Discussion of Selected Problems Macros AutoMapping Blocking Implementing Recursion CONTENTS Transformation of the AST into Lambda Form Transforming Programs T program Transforming Declarations T decl Asimpledecl Aparamdecl Amultidecl Amoduledecl Aimportdecl Aabstypedecl Parameters An Example Transformation The Rules Arecdecl Transforming Typ e Expressions T typ e Afunctype Aexprtype Transforming Expressions T expr Avar Aapp Acond Acheck Acast Adelay Asuspend Atuple Aseq Astring Aint Afloat Aconst Aguard Areturn Alocal Postpro cessing Passes Implementation of postprocessing steps Expanding Macros Declaration Simplication Removing unnecessary Checks and Casts Conversion Problems with Rearranging Expressions da Hoisting Lamb Transforming FreeVariables into Parameters Strictness Analysis Partial Evaluation Denitions and Known Results Denitions Partial Evaluation Residual Program SelfApplication and the Futamura Pro jections Internal Sp ecialization OnlineOline Partial Evaluation Static and Dynamic Binding Times Partially Static Values Sp ecialization Generalization FoldingUnfolding Fixed Points Applying the Techniques of Abstract Interpretation to ALDiSP CONTENTS Abstract Interpretation of LF Expressions Goals of Abstract Interpretation Abstract Values General Remarks Domains Basic Domain Constructions Basic Examples Union of Domains The Ideal Abstract Domain and its Subsets Size of Domains Sources of Abstract Values An Example Abstract Conditionals Loop Detection Finding Fixed Points Speed Generalizing the Argument Lists Conclusion of the Example Implementing the Lo op Detector Na ve Loop Detection Schemes Problems with the Nave Scheme Not Enough Generalization Too much Generalization Mutual Recursion Multivariant Specialization Restarting Approximations Generalizing Loop Detection Concrete Arguments EvaluationOrder Eects ALDiSPsp ecic Problems State and Side Eects Promises Recursive Denitions Exceptions Function Values Generalizing Numeric Types Raising and Catching Exceptions The Abstract Scheduler Susp ensions and other Schedulable Entities NonDeterminism Sequentializing the Schedule Garbage Collection Finding Lo ops Alternative States Blo cking CONTENTS Execution Trace Reconstruction The Co de Form Dierences between CF and LF Abstract Syntax of CF Notation Closures Tuples Combinators TopLevel Bindings Semantics of the Code Form Programs Atoms Primitives Conditionals Function Application Throwing and Catching Exceptions Evaluating Declarations Evaluating Code expressions Relation b etween Abstract Results and Co de Attributes The Tr eatment of State atomaCode Attribute for Obj s Example StraightLine Co de InterFunction Optimizations Inlining Grouping Tabulation and Caching Elimination of Parameters and Return Values Variable Splitting Basic Optimizations Variable Propagation DeadCode Removal ReferenceTracing Tuple Tracing Example Blo cking Co de Whats in a Block Alternatives to Blocks CPS Alternatives to Blo cks Syntax Transformations The Blocking Example Sp ecication of Co de Generation eval exprs deref ob js block strict and strict exprs eval and norm thunk result Lit Lexical Lvar s Dynamic Lvar s Lambda Lcheck Lcast Lcond Lselect Lseq apply apply typ e apply primitive apply closure Related Work CONTENTS The BackEnd Dierences b etween M and CF Disjoint Address Space Index Types and HardwareLoops Data Formats Special Instructions and the ALDiSP Library No Implicit State Semantic Entities of M Function Denitions Structure of M Transforming CF into M The C backend The Future Automatic BackEnd Generation Conclusions and Outlo ok DevelopmentHistory Design Alternatives Explicit State Passing ContinuationPassing Style Compilation by Graph Reduction Redesigning ALDiSP A Literature B Index Chapter Intro duction Whenever anyone says theoretically they really mean not really DaveParnas This work describ es the overall design and the internal structure of ac the rst compiler for the ALDiSP programming language ALDiSP was develop ed by the author and Alois Knoll in at TU Berlin within the context of the CADiSP pro ject The goal was to create an interactive visually oriented system for the development of digital signal pro cessing DSP algorithms based on a dataow paradigm In such a system the user describ es the algorithms by connecting parameterizable blackboxes These basic comp onents were to b e describ ed in ALDiSP which in turn should b e compiled into the imp erative language ImDiSP whichnow has a life and a compiler of its own It so.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    174 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us