Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations

Presentation on theme: "CS 142 (b) – Compiler Construction Project Harry Xu Assistant Professor of Computer Science."— 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 dont like programming – If you have more than one project classes Require compiler background knowledge and C/C++ programming experience TA – Gulfem Savrun Yeniceri – office: CS 444

4 ProjectImplement 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 Phase 2: Building an Interpreter 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_info constant_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]; }

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{ int opCode; 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

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

Similar presentations

Ads by Google