Interpreters

The course designers and instructors deeply appreciate researchers in the community for their inspiring works, which provide rich materials for developing the course and advancing the research in this direction.

Back to Homepage · Previous Page




Welcome to the course on Interpreters and Virtual Machines! This course delves into the fascinating world of how programs are executed in another way, focusing on interpreted execution rather than compiled execution (which should be studied in the course known as Compilers). An interpreter or virtual machine, like the Python interpreter and the Java virtual machine, creates a simulated environment in which programs can run, providing benefits like platform independence and enhanced security. This course will guide you through the architecture of interpreters and virtual machines, including popular examples like the tree-walk interpreter and Java Virtual Machine (JVM).By the end of this course, you’ll have a deep understanding of how interpreters and virtual machines function and how they are used to execute code efficiently and securely. This knowledge is essential for anyone interested in the inner workings of programming languages, software development, or computer architecture.

Prerequisites: Before registering for this course, a student must check if he has basic knowledge of compilers and the C/C++ and Java programming languages.

Lectures

The course slides are provided in the table below. If you have any questions or suggestions, please feel free to reach out to the instructor or teaching assistants. The course designers sincerely thank the instructors and researchers in the community whose inspiring work has contributed valuable material for these slides.

Weeks
Lectures Materials
1
Introduction to Interpreters and Virtual Machines
   - Basic concepts of programming languages, compilers, interpreters, and VM

Slides-1
Tree-Walk Interpreter
2
Generating the Syntax Tree
   - Introduction to the mini Java language
   - Review of the lexical and syntax analysis

Slides-2
Slides-3
3
Expressions and Statements
   - Evaluating expressions / Online type checking
   - Evaluating statements / Scoping and shadowing
   - Lab 1: The first tree-walk interpreter

Slides-4
Slides-5
Lab-1
4
Control Flows and Methods
   - Conditional execution / Loops
   - Method declaration / Method invocation / Method return

Slides-6
Slides-7
5
Object-Oriented Programming
   - Arrays
   - Lab 2: Procedure-oriented programming
   - Classes

Slides-8
Lab-2
Slides-9
6
Inheritance and Polymorphism
   - Inheritance / Polymorphism
   - Lab 3: Object-oriented programming
   - Validating interpreters

Slides-10
Lab-3
Slides-11
Java Virtual Machine
7
Introduction to Java Virtual Machine
   - Java class file and bytecode / Basic structure of OpenJDK
   - The First Attempt at Hacking JVM
Slides-12
8
Class Loader and Linker
   - Verification, preparation, and resolution
   - Linking methods / Constant pool cache
Slides-13
9
Template Interpreter – I
   - Architecture of the interpreter / Basics of x86
   - Runtime code generation / Parasitic call stack
Slides-14
10
Template Interpreter – II
   - Template table / Top-of-stack cache
   - Template code / Dispatching table
Slides-15
11
Exceptions and Threads
   - Exception mechanisms and their implementations
   - Threads in JVM
Slides-16
12
Safepoint and Memory Management
   - Safepoint / Garbage collection
   - G1 GC / Z GC / Shenandoah GC
Slides-17
13
Just-in-Time Compilation – I
   - Bytecode → High-level IR (HIR) → Low-level IR (LIR)
   - HIR and LIR optimizations
Slides-18
14
Just-in-Time Compilation – II
   - Sea-of-node IR and optimizations
   - GC support and deoptimizations
Slides-19
Conclusion
15
Concluding the Course
   - Review of the lectures and the labs

Slides-20

Grading Scheme

Attendance (30%)

Labs (70%) – Online OJ

Teaching Assistants

Jielun Wu (jielunwu@smail.nju.edu.cn)

Yifan Zhang (yifan.zhang@smail.nju.edu.cn)

Online Discussion

QQ Group: 1012202612

Office Hours

By appointment. Feel free to email TAs or the instructors to claim a time slot.