COMP 621 Optimizing Compilers (Winter 2008)

A general note on resourcefulness

Index of Information on this Page


In this course you will need to run Soot, both from the command line and using the Eclipse plugin.

Soot is installed in ~cs621/Winter2008/ on the lab machines. I have set up a script that will help you run Soot. It is located at:

You can run this by typing out the full path above, or by putting this directory into your path. The script sets up the classpath for you, and calls soot with whatever arguments you give it.

Please note that you will usually need to include your java runtime classes as an argument to the soot classpath. These are in a jar located in your java JRE/lib directory called rt.jar. On the lab6 machines, this is:


If you want to setup your own shell to include the proper classpaths and such, minimally you need:
export JAVADIR=/opt/sun-jdk-
export PATH=$JAVADIR/bin:$PATH
export CLASSPATH=.:~cs621/Winter2008/jasmin-2.2.4/classes:~cs621/Winter2008/polyglot-1.3.4/classes:~cs621/Winter2008/polyglot-1.3.4/cup-classes:~cs621/Winter2008/soot-2.2.4/classes
in your .bash_profile or .bashrc for bash.

Note also that your .bash_profile gets executed for login shells, and your .bashrc gets executed for non-login shells. If you'd like to simplify things by putting all of your definitions in one file that will always get executed, put them in .bashrc, and put
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
. ~/.bashrc
into your .bash_profile if it's not already there.


setenv JAVADIR /opt/sun-jdk-
setenv PATH $JAVADIR/bin:$PATH
setenv CLASSPATH .:~cs621/Winter2008/jasmin-2.2.4/classes:~cs621/Winter2008/polyglot-1.3.4/classes:~cs621/Winter2008/polyglot-1.3.4/cup-classes:~cs621/Winter2008/soot-2.2.4/classes
in your .cshrc for tcsh.

$ java soot.Main
should then work. The above location of Java is for the lab6-x machines at McGill, other machines may have different configurations.

Eclipse Soot Plugin

You will need to install the Eclipse plugin yourself. The plugin was designed for Eclipse 3.1 and later. It seems to work well with both 3.1 and 3.2. On the lab6 machines, you can type eclipse-3.1 or eclipse-3.2 to start Eclipse. You should install the plugin by following the directions here: Eclipse Soot Plugin Installation

Please Note that you will have to specify an install directory somewhere within your own home folder, since you won't have write permissions to /usr/lib/. Just create a folder somewhere that will be out of the way, and make sure to specify it when installing the plugin. I have tried this out and it works fine.

To load your own analysis with Eclipse plug-in, you should put .class files of your analysis into plugins/ca.mcgill.sable.soot_2.2.2/myclasses/ (create one if myclasses does not exist), and restart Eclipse if you update your .class. You may create a symbol link instead of copying your .class files.

Soot Links

Once this is working, there are in-depth tutorials available from the Soot homepage.

Soot Home
How-To Set up a Soot Project in Eclipse
Soot API
Eclipse Plugin for Soot
Eclipse Downloads

JVM and Profiling

As stated earlier, the Sun 1.5.0_12 JDK is installed in /opt/sun-jdk- Additional JDKs/VMs are also available:

You can run java with the -help option to see available options. Note the all-important -X option, which prints help on many "hidden" options.

For profiling, we gather data using the built-in hprof program, invoked with the -Xrunhprof option.  Start with java -Xrunhprof:help to see the different ways of collecting data.  You can use the heap, cpu, and monitor flags to do time, space, and contention profling, and you can write the data to a text file. For help, check here: Using hprof

Also, feel free to investigate other Java profilers. Many exist, the following is a short sampling:


Version 1.1.0 of the AspectBench Compiler for AspectJ, abc, is installed on the lab6 machines. You can run it by typing


Version 1.2.1 of abc is installed in ~cs621/Winter2008/abc-1.2.1/ and within this directory there is a /bin directory with a script 'abc' to run it. This script sets the proper classpath for abc to run. To run it, type


Version 1.2 of the IBM AspectJ compiler, ajc (now associated with the Eclipse Foundation), is installed on the lab6 machines. You can run it by typing


Version 1.5.4 of ajc is installed in ~cs621/Winter2008/ajc-1.5.4/ and within this directory there is a /bin directory with a script 'ajc' to run it. This script sets the proper classpath for abc to run. To run it, type


The following notes appeared at the end of the ajc-1.5.4 installation process:

The automatic installation process is complete. We recommend you complete the installation as follows:
1. Add /home/course/cs621/Winter2008/ajc-1.5.4/lib/aspectjrt.jar to your CLASSPATH. This small .jar file contains classes required by any program compiled with the ajc compiler.

The versions of these compilers in ~cs621/Winter2008/ are latest. You may want use them, but abc only accepts Java 1.4 and AspectJ 1.2 syntax.

More information on how to use these compilers is available from their home pages.
AspectBench Compiler Home
AspectJ Home


2007 class benchmarks (28mb .tar.gz)
2006 class benchmarks (16.61mb .tar.gz)
2005 class benchmarks (3.1mb .tar.gz)
2003 class benchmarks (2.3mb .jar)
2002 class benchmarks (2.5mb .jar)

Existing AspectJ benchmarks

Useful Information

Logging in to the lab machines remotely

You can most certainly access lab computers remotely using ssh. I'll give you some information here, but you can also check out the SOCS docs for SSH here:
SOCS actually has a fairly good set of documentation for the services and facilities in the labs. The index is here:
SOCS Help Index
Anyhow, to login to a lab machine simply use:
where 'user' is your cs login name, and X is the lab you would like to login to and 'Y' is one of the available computers (usually from 1 to 20 is available, if not more, for each lab). I generally use lab 6 or 7, but you may use whatever machines you'd like. Here is a concrete example for me (using my login 'mbatch'):
ssh -XC
If you would like to use graphical programs remotely, this is also possible if you have an X-server on your remote machine. The '-XC' option specifies that ssh should do port-forwarding for X windows (so you can run graphical displays remotely) and to compress the network traffic. If you have a linux machine you will of course have an X-server already. It is also very easy to get an X-Server running on a Mac OSX machine, if that is what you have. If you have OSX 10.4.x (Tiger), you can install X11 from the installation DVD. This will most likely be the case for OSX 10.5.x (Leopard) as well. If you have OSX 10.3.x or earlier, see the website here:
X11 for Mac OS X
You can get a Microsoft Windows X-server running using Cygwin/X at:
If you want to run a graphical program and maintain use of your shell prompt, call the programs in the background like this:
(prompt): eclipse &
The trailing '&' symbol will run the program "in the background" (but since it is graphical, you will see the windows).

If you're unsure of what a particular program is called use a bash shell and use tab-completion. If you type a single tab, bash (or another shell) will fill in the rest of the entry for you (if there's only one option). If you type tab again, the shell will list all possible options. For example, on lab7-12, if I type "eclipse", then tab, then bash fills it in as "eclipse-3". If I type another tab, it lists:
eclipse-3 eclipse-3.1 eclipse-3.2

A very useful trick when working with ssh (especially with auto-logout) is a program called screen. If you log in to a lab machine, then type screen, it will open a new shell running on the lab machine but accessible through your ssh connection. You can then disconnect from the screen session (with the shell in it) by typing C-a C-d. You can log out of ssh now, and your screen session and any programs active in it will continue running on the lab machine. To reconnect to your screen session, log into the lab machine via ssh, then type screen -R. This is a very useful tool for letting long-running benchmark programs run unattended. Screen is a truly wonderful program with many other uses: read the screen man page for more info.

Edited from winter 2007 notes created by Richard L. Halpert