1 / 12

CS 142 (b) – Compiler Construction Project

CS 142 (b) – Compiler Construction Project. Harry Xu Assistant Professor of Computer Science. Compiler is becoming more and more important …. General Information. Heavyweight project class Drop the class immediately If you don’t like programming If you have more than one project classes

tilden
Download Presentation

CS 142 (b) – Compiler Construction Project

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 142 (b) – Compiler Construction Project Harry Xu Assistant Professor of Computer Science

  2. Compiler is becoming more and more important …

  3. General Information • Heavyweight project class • Drop the class immediately • If you don’t like programming • If you have more than one project classes • Require compiler background knowledge and C/C++ programming experience • TA • Gulfem Savrun Yeniceri • Email: gsavruny@uci.edu, office: CS 444

  4. Project—Implement a Mini-JVM • Implement the functionality of the “java” command for a subset of the Java language • How a Java program is executed by a JVM • Interpreter • Optimizing compiler • Feedback-directed optimization system • Implement a static compiler as apposed to a dynamic compiler as used in modern JVMs √ √ X

  5. Project Phases Phase 1: Parsing .class files Representations of fields, classes, and methods Interpreter Phase 2: Building an Interpreter Compiler Phase 3: Building SSA SSA representation Phase 4: Building dataflow optimizers Optimized code Phase 5: Generating executable code

  6. Schedule • Phase 1: Parsing the .class file • Week 1, 1 lecture • Phase 2: Building an interpreter • Week 2 and 3, 1 lecture • Phase 3: Building SSA • Week 4 and 5, 1 lecture • Phase 4: Developing optimizations • Week 6 and 7, 2 lectures • Phase 5: Generating executable code • Week 8 and 9, 1 lecture • Demos in Week 10 • Lab sessions TBD

  7. Expected Outcome • After this quarter, you will have hands-on experience with • What is inside a JVM • How to implement a real-world compiler • How interpreter works • Dataflow analysis and optimizations • X86 assembler

  8. Grading Policy • I will provide a public set of test cases • If your project does phase 1, 2, and 3, you will be guaranteed to have a ‘B’ • If your project does all the five phases and passes all my test cases, you will get an ‘A’ • If your project does an additional dataflow optimization, you will get an ‘A+’

  9. Overview of the .class File ClassFile {      u4 magic;      // (0xCAFEBABE) u2 minor_version;      u2 major_version;      u2 constant_pool_count;      cp_infoconstant_pool[constant_pool_count-1];      u2 access_flags;      u2 this_class;      u2 super_class;      u2 interfaces_count;      u2 interfaces[interfaces_count];      u2 fields_count;      field_info fields[fields_count];      u2 methods_count;      method_info methods[methods_count];      u2 attributes_count;      attribute_info attributes[attributes_count];     } http://docs.oracle.com/javase/specs/jvms/se5.0/html/ClassFile.doc.html

  10. Your Representation class Class{ Method[] methods; //instance and static Field[] fields; //instance and static Attribute[] attributes; Class[] superclasses; … } Class Method{ Qualifier[] qualifiers; Instruction[] instructions; } Instruction{ intopCode; Operand[] operands; }

  11. No Need to Consider • Inner classes • Exception handling • Garbage collection • Anything related to runtime system

  12. Last but the Least • Various tutorials and resources are available at the course website • You cannot rely solely on lectures; do your homework to learn whatever necessary for the project

More Related