7
Flex Compiler Compiler Case Study By Mee Ka Chang

Flex Compiler Compiler Case Study By Mee Ka Chang

Embed Size (px)

Citation preview

Page 1: Flex Compiler Compiler Case Study By Mee Ka Chang

Flex Compiler

Compiler Case Study

By Mee Ka Chang

Page 2: Flex Compiler Compiler Case Study By Mee Ka Chang

Flex Compiler

FLEX is a product of the Program Analysis and Compilation Group at MIT.

Current Team Martin Rinard C. Scott Ananian Chandrasekhar Boyapati Brian Demsky Viktor Kuncak Patrick Lam Darko Marinov Alex Salcianu Karen Zee Wes Beebee

FLEX is a compiler infrastructure written in Java for Java. Applications include a program analysis and transformation framework for distributed and embedded systems.

Native backends exist for the StrongARM and MIPS processors.

Generate portable C code that can run on any platform with gcc.

Page 3: Flex Compiler Compiler Case Study By Mee Ka Chang

Architecture

The compiler front-end translates Java bytecode files into a class-oriented intermediate representation which is intended to be easier to analyze and manipulate than bytecode assembly language. The intermediate representation is control-flow-graph structured, with all control flow explicit, and use static single-assignment(SSA).

Page 4: Flex Compiler Compiler Case Study By Mee Ka Chang

Research

SSA form, static single-assignment form is used, instead of a def-use chain, where the compiler keep a list of pointers to all the use sites of variables defined there, and a list of pointers to all definition sites of the variables used.

SSA form is an intermediate representation in which each variable has only one definition in the program text. The one (static) definition-site may be in a loop that is executed many dynamic times.

The Flex compiler system was used as a platform for pointer and escape analysis research.

SSA form where each variable is statically define with useful information, and can help reduce analysis cost.

A benefit of the SSA form is that unrelated uses of the same variable in the source become different variables in SSA form, eliminating false dependencies.

But it becomes more difficult with branching.

Exception handling in the Java language complicates control-flow, from operations implicitly throwing exceptions

To facilitate analysis, exception handling and its associated control-flow is made explicit in the intermediate representation. (Null pointer and array bounds checks are inserted before object and array references)

Page 5: Flex Compiler Compiler Case Study By Mee Ka Chang
Page 6: Flex Compiler Compiler Case Study By Mee Ka Chang

Development

Support Boehm-Demers-Weiser conservative garbage collection and their own precise garbage collector.

Support region-based allocation via their implementation of the Real-Time Specification for Java.

Supports several implementations of the standard Java threads package and lightweight user-level implementation.

Provides a range of standard compiler analyses and optimizations, as well as unique optimizations for embedded targets, including space optimization. “

Currently the site does not specifically state any planned future enhancements.

Page 7: Flex Compiler Compiler Case Study By Mee Ka Chang

Sources

http://flex-compiler.csail.mit.edu/Harpoon/quads/quads.pdf

http://www.cag.csail.mit.edu/~rinard/flex http://flex-compiler.csail.mit.edu