Programming Languages and Compilers

 

Lecture 13

 

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

 

The slides for this lecture can be found here, here and here.

 

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

 

Languages for the Java VM

 

Microsoft .NET

 

.Net General

 

The SML.NET compiler

 

The CLR Compiler Writer's Overview

 

I can recommend reading the article: “Lcc.NET: Targeting the .NET Common Intermediate Language from Standard C”, by DAVID R. HANSON, see

http://research.microsoft.com/~drh/pubs/msr-tr-2002-112.pdf

Exercises

 

Exercises for lecture 13 will be done from 12.30 till 14.14 before Lecture 14 on Tuesday the 20th 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.