Programming Languages and Compilers

 

Lecture 9

 

In this lecture we will look at interpretation and implementation of virtual machines.

 

The slides for this lecture can be found here in

ppt and pdf

ppt and pdf

ppt and pdf

Literature

 

Watt & Brown, chapter 8, the article The lean, mean, virtual machine, by Bill Venners about the JVM, the Jasmin User Guide and the article “Technical Overview of the Common Language

Runtime (or why the JVM is not my favorite execution environment), by Erik Meijer and Jim Miller, see http://docs.msdnaa.net/ark/Webfiles/WhitePapers/CLR.pdf

 

Further background material can be found following the below links:

 

Java Virtual Machine - Online Instruction Reference Manual

 

The Java Virtual Machine Specification

 

Jasmin Home Page

 

Languages for the Java VM

 

.NET compliant languages

 

Hacker's introduction to the Microsoft Intermediate Langauge (MSIL)

 

Exercises

 

Exercises for lecture 9 will be done from 8.15 till 10.00 before Lecture 10 on the 7th of April.

 

The following exercises are best done as group discussions:

 

  1. Do Watt and Brown exercise 8.5 page 332
  2. Do Watt and Brown exercise 8.6 page 332
  3. Do Watt and Brown exercise 8.10 page 333
  4. Discuss the advantages and disadvantages of types in the JVM instruction set.
  5. MS IL has similar properties to JVM instruction, but they are not all typed. Discuss why that is the case and what are the consequences.
  6. Today most JVM implementations are JIT, the CLR is JIT, what may be the reasons for this?
  7. DSP (digital Signal Processors) have traditionally been programmed in assembler or C. Recent studies show that Java implementations of DSP algorithms on some JVM implementations are faster than their C implementations. Can you think of reasons why?

 

 

You should limit the discussion to about 5 minutes per question.

 

The following exercises you may prefer to do on your own or in pairs and discuss the outcome with your group:

 

 

 

  1. Do Watt and Brown exercise 8.1 page 331
  2. Do Watt and Brown exercise 8.2 page 331
  3. Do Watt and Brown exercise 8.3 page 331
  4. Do Watt and Brown exercise 8.8 page 332
  5. Take a look at the Java source for the Triangle Abstract Machine starting with the file Interpreter.java.