Compressed Abstract Syntax Trees as Mobile Code Christian H. Stork Vivek Haldar University of California, Irvine.

Slides:



Advertisements
Similar presentations
CSc 453 Compilers & Systems Software Saumya Debray The University of Arizona Tucson, AZ
Advertisements

SableCC SableCC is developed by professors and graduate students at McGill University and is open source (licensed under the Apache License, Version 2.0)‏
Lecture 01 - Introduction Eran Yahav 1. 2 Who? Eran Yahav Taub 734 Tel: Monday 13:30-14:30
Cpeg421-08S/final-review1 Course Review Tom St. John.
1 Semantic Processing. 2 Contents Introduction Introduction A Simple Compiler A Simple Compiler Scanning – Theory and Practice Scanning – Theory and Practice.
Java for High Performance Computing Jordi Garcia Almiñana 14 de Octubre de 1998 de la era post-internet.
Reference Book: Modern Compiler Design by Grune, Bal, Jacobs and Langendoen Wiley 2000.
Introduction & Overview CS4533 from Cooper & Torczon.
1.3 Executing Programs. How is Computer Code Transformed into an Executable? Interpreters Compilers Hybrid systems.
JSZap: Compressing JavaScript Code Martin Burtscher, UT Austin Ben Livshits & Ben Zorn, Microsoft Research Gaurav Sinha, IIT Kanpur.
Lecture 2 Phases of Compiler. Preprocessors, Compilers, Assemblers, and Linkers Preprocessor Compiler Assembler Linker Skeletal Source Program Source.
September 7, September 7, 2015September 7, 2015September 7, 2015 Azusa, CA Sheldon X. Liang Ph. D. Computer Science at Azusa Pacific University.
ICS611 Introduction to Compilers Set 1. What is a Compiler? A compiler is software (a program) that translates a high-level programming language to machine.
COP4020 Programming Languages
Chapter 1. Introduction.
New Approaches to Mobile Code: Reconciling Execution Efficiency with Provable Security Michael Franz University of California at Irvine UC Irvine – project.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
1 October 1, October 1, 2015October 1, 2015October 1, 2015 Azusa, CA Sheldon X. Liang Ph. D. Computer Science at Azusa Pacific University Azusa.
Chapter 10: Compilers and Language Translation Invitation to Computer Science, Java Version, Third Edition.
Introduction to Compiler Construction Robert van Engelen COP5621 Compiler Construction Copyright Robert.
Compiler course 1. Introduction. Outline Scope of the course Disciplines involved in it Abstract view for a compiler Front-end and back-end tasks Modules.
Concordia University Department of Computer Science and Software Engineering Click to edit Master title style COMPILER DESIGN Review Joey Paquet,
New Approaches to Mobile Code: Reconciling Execution Efficiency with Provable Security Michael Franz University of California, Irvine July 2001 UC Irvine.
1 COMP 3438 – Part II-Lecture 1: Overview of Compiler Design Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
CS266 Software Reverse Engineering (SRE) Reversing and Patching Java Bytecode Teodoro (Ted) Cipresso,
Joey Paquet, Lecture 12 Review. Joey Paquet, Course Review Compiler architecture –Lexical analysis, syntactic analysis, semantic.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
Chapter 2. Design of a Simple Compiler J. H. Wang Sep. 21, 2015.
1 Chapter 1 Introduction. 2 Outlines 1.1 Overview and History 1.2 What Do Compilers Do? 1.3 The Structure of a Compiler 1.4 The Syntax and Semantics of.
COP 4620 / 5625 Programming Language Translation / Compiler Writing Fall 2003 Lecture 1, 08/28/03 Prof. Roy Levow.
Compiler design Lecture 1: Compiler Overview Sulaimany University 2 Oct
Chapter 1 Introduction. Chapter 1 - Introduction 2 The Goal of Chapter 1 Introduce different forms of language translators Give a high level overview.
CSc 453 Compilers & Systems Software Saumya Debray The University of Arizona Tucson, AZ
1. 2 Preface In the time since the 1986 edition of this book, the world of compiler design has changed significantly 3.
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Optimizing Compilers CISC 673 Spring 2009 Overview of Compilers and JikesRVM John.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
1 Compiler Design (40-414)  Main Text Book: Compilers: Principles, Techniques & Tools, 2 nd ed., Aho, Lam, Sethi, and Ullman, 2007  Evaluation:  Midterm.
Chapter 1 Introduction Study Goals: Master: the phases of a compiler Understand: what is a compiler Know: interpreter,compiler structure.
Compiler Design Introduction 1. 2 Course Outline Introduction to Compiling Lexical Analysis Syntax Analysis –Context Free Grammars –Top-Down Parsing –Bottom-Up.
Compiler Introduction 1 Kavita Patel. Outlines 2  1.1 What Do Compilers Do?  1.2 The Structure of a Compiler  1.3 Compilation Process  1.4 Phases.
The Model of Compilation Natawut Nupairoj, Ph.D. Department of Computer Engineering Chulalongkorn University.
1 Compiler & its Phases Krishan Kumar Asstt. Prof. (CSE) BPRCE, Gohana.
SAFE KERNEL EXTENSIONS WITHOUT RUN-TIME CHECKING George C. Necula Peter Lee Carnegie Mellon U.
C H A P T E R T W O Linking Syntax And Semantics Programming Languages – Principles and Paradigms by Allen Tucker, Robert Noonan.
What is a compiler? –A program that reads a program written in one language (source language) and translates it into an equivalent program in another language.
Compiler Construction CPCS302 Dr. Manal Abdulaziz.
CSC 4181 Compiler Construction
LECTURE 3 Compiler Phases. COMPILER PHASES Compilation of a program proceeds through a fixed series of phases.  Each phase uses an (intermediate) form.
©SoftMoore ConsultingSlide 1 Structure of Compilers.
1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY.
ICS312 Introduction to Compilers Set 23. What is a Compiler? A compiler is software (a program) that translates a high-level programming language to machine.
Reading Exercise 0 Discussion. Imperative vs Declarative A.Prolog, SQL, Perl B.ML, Lisp, SQL C.C, Java,Smalltalk D.C#, Haskell, Spreadsheets E.C++, Eiffel,
COP4020 Programming Languages Introduction Prof. Robert van Engelen (modified by Prof. Em. Chris Lacher)
Presented by : A best website designer company. Chapter 1 Introduction Prof Chung. 1.
Prologue Sung-Dong Kim, Dept. of Computer Engineering, Hansung University.
Objective of the course Understanding the fundamentals of the compilation technique Assist you in writing you own compiler (or any part of compiler)
Chapter 1. Introduction.
PRINCIPLES OF COMPILER DESIGN
Chapter 1 Introduction.
Introduction to Compiler Construction
Compiler Construction (CS-636)
Chapter 1 Introduction.
课程名 编译原理 Compiling Techniques
Compiler Lecture 1 CS510.
CSc 453 Compilers & Systems Software 00. Background
CPSC 388 – Compiler Design and Construction
CSE401 Introduction to Compiler Construction
Compilers B V Sai Aravind (11CS10008).
COP4020 Programming Languages
Chapter 10: Compilers and Language Translation
Presentation transcript:

Compressed Abstract Syntax Trees as Mobile Code Christian H. Stork Vivek Haldar University of California, Irvine

Intermediate Representation Engineering, 2001University of California, Irvine Outline of the talk Part I: Making the case for using abstract syntax trees as a mobile code distribution format Part II: Toplevel overview of how we compress abstract syntax trees Part III: Future work, work in progress, wild proposals

Part I: Abstract Syntax Trees as Mobile Code

Intermediate Representation Engineering, 2001University of California, Irvine Mobile Code Mobile code is the platform Desirable properties: Platform independent Safe to execute Compact Short start up time Tamper proof encoding Amenable for optimization

Intermediate Representation Engineering, 2001University of California, Irvine Overview Source Parser AST Encoder PPM-Model & Arithmetic Encoder … Code Generator AST Decoder PPM-Model & Arithmetic Decoder “classic Frontend” “classic Backend” Compression / Decompression

Intermediate Representation Engineering, 2001University of California, Irvine Mobile Code Infrastructure Code producers and consumers Producers distribute mobile code as compressed abstract syntax trees Consumers decompress and compile them for specific target Compression allowed to be computation intensive - one time effort at producer’s end

Intermediate Representation Engineering, 2001University of California, Irvine Why Abstract Syntax Trees? High level portable representation Compresses well Easy to optimize for specific targets Easy to reason about language level properties (type safety etc.) Protection from low-level (bytecode) attacks

Intermediate Representation Engineering, 2001University of California, Irvine Safety of abstract syntax trees Goal: safety by construction Guarantees provided: Adherence to abstract grammar of language Lexical scoping enforced as part of encoding

Intermediate Representation Engineering, 2001University of California, Irvine Genericity AST framework parameterized by abstract grammar of language Works with new language simply by specifying its grammar Currently: Java and Oberon

Part II: Compressing Abstract Syntax Trees

Intermediate Representation Engineering, 2001University of California, Irvine Why compress? Compactness is increasingly an issue: Limited bandwidth networks (wireless) Storage requirements (e.g. embedded systems) Processors much faster than disks/network – so compression gives net gain in performance

Intermediate Representation Engineering, 2001University of California, Irvine Compression Overview Parsing: get AST from source Serialize: get stream of symbols from AST Modeling: use context and abstract grammar to build predictive statistical model Coding: use arithmetic coding with model

Intermediate Representation Engineering, 2001University of California, Irvine Status and Results Compressor/decompressor Prototype in Python Completely generic – can be used with any abstract grammar Have implemented the Java abstract grammar Works with single Java source files as well as entire packages. Main comparison with Pugh’s results for Java bytecode compression

Intermediate Representation Engineering, 2001University of California, Irvine Results : Classes NameClass file GzipBzip2PughCASTCAST/ Pugh ErrorMessage % CompilerMember % BatchParser % Main % SourceMember % SourceClass % Classes from Sun’s javac package. All sizes in bytes. Compared with Pugh’s Java bytecode compressor

Intermediate Representation Engineering, 2001University of California, Irvine Results: Archives PackageJar file GzipBzip2PughCASTCAST/ Pugh Javac % Jess % Compressed ASTs are 5-50% smaller than Pugh. 3-8 times smaller than uncompressed class and JAR files Compressed collections of classes. All sizes in bytes.

Part III: Future Work

Intermediate Representation Engineering, 2001University of California, Irvine Future Work Compression Explore other PPM models for getting probabilities Well formedness – safety by construction Statically encode semantic constraints Annotations with the AST hard to compute, but easy to verify Aid optimization at target site

Intermediate Representation Engineering, 2001University of California, Irvine Well-formedness Statically enforce semantic properties as part of encoding Illegal programs cannot be expressed Goal: reduce, and ultimately eliminate costly verification phase E.g. for now, we do lexical scoping In the future: type safety… Well formedness  better compression

Intermediate Representation Engineering, 2001University of California, Irvine Transporting Annotations Shift computing burden from consumer to producer Transport hard to compute, easy to verify annotations Results of escape analysis PCC proofs…

Intermediate Representation Engineering, 2001University of California, Irvine Conclusion Abstract syntax trees viable as a mobile code format Can be highly compressed Java archives by factor of % better than Java bytecode specific compression by Pugh Working on well-formedness and transporting annotations