COMP-621 Optimizing Compilers Winter 2006 Notes

COMP-621 Home

A general note on resourcefulness


Index of Information on this Page


News News News

16-02-2006 - Benchmarks - The benchmarks for this year are now available in a tar.gz package here (16.6mb). One or two of them are tied to SABS but otherwise it's mostly just java/aj files that can be compiled normally. Each benchmark has a 'benchmark.txt' with comments about the program and a README (or readme.txt, or README.txt) which gives compiling/running instructions.

13-02-2006 - Screenshots - if you are looking for a good way to capture screenshots try the Gimp (Gnu Image Manipulation Program). It's a pretty useful open-source image processor. It is already installed on the lab machines (or Sable machines) and can be executed with the command gimp. To acquire a screenshot, follow the File - Acquire - Screen Shot menu structure. This is a good way to handle your screenshots because the Gimp can save in practically any file type you might want (e.g. eps files for latex).

If you are using Windows, the PrtScrn key and MS Paint should work well, though there is a Gimp version available for Windows.

09-02-2006 - If anyone has problems getting Eclipse and the Soot plugin set up, please let me know and I will help sort things out. It should be fairly simple. I tested both Eclipse 3.0.1 and Eclipse 3.1.1 with no problems following the directions given in the Soot Plugin Intall instructions and Jennifer's how-to on using your own Soot main class in the plugin. If you would like to test your setup with an example main class, put this file in your myclasses directory and try to run it. It is a simple driver which tags all assignment statements with the color blue: AssignStmtDriver.java compiled: AssignStmtDriver.class. You might be interested in looking at the code for that class in order to get the general idea of how to add tags.

09-02-2006 - More Info for Assignment #2 - Jennifer of the Soot Eclipse plugin fame has written up a short Wiki on how to get your own soot Main class working with the plugin (so that you can run your analysis/tagger directly from Eclipse). You can find it here on the sable svn here. You will need to make sure that you have the Soot plugin installed, of course. If you are using the lab machines I suggest installing it in your own directory (something like ~/eclipsePlugins/). You can then follow Jennifer's instructions on how to point the plugin to your own soot extensions. You can then run any Soot main class by right-clicking on a java file in your eclipse package view and following the Soot - Process [Source/Class] Files menu structure. There are default options to generate Jimple or Grimp but if you want to specify your own main class you will need to select Manage Configurations and create a new configuration. Enter your fully-qualified main class in the last preference panel in the soot plugin configuration (called Soot Main Class). You can now run soot using this menu structure. The resulting output files will show up in your project under the directory "sootOutput" as you are familiar with. If those files (jimple, java, etc) have been tagged then these tags should show up if you open the files in Eclipse.

07-02-2006 - Information for Assignment #2 - This assignment may require a bit of work getting software downloaded, installed, and working. Don't wait till the last minute or you may find yourself in a bind. Specifically, here are things you will need:
07-02-2006 - I have looked over everyone's assignment #1. As a general note on graduate school and personal pride in one's work I have the following suggestions when submitting things - even if it's only a homework assignment:
31-01-2006 - I have updated the ~cs621/Winter2006 directory and scripts. There were some problems initially with permissions and classpaths but they should all be fixed now. The ~cs621/abc-1.1.0/bin/abc script should now work without any problems as well as ~cs621/soot-2.2.2/soot. These scripts do assume that 'java' resolves to a proper java JVM so make sure this works. Sorry for the problems.

Helpful Questions And Answers

Throughout the course, if I get asked a good question I will respond to all students in the class. I will try to also remember to post the responses on this page as well.

Jan. 23rd Question #1: Logging into lab machines remotely.


Soot

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

Soot is installed in ~cs621/Winter2006/ on the lab machines.  To run it, you need a suitable Java runtime, and Soot's classes need to be on your classpath.

I have setup a script that will help you run Soot. It is located at:
~cs621/Winter2006/soot-2.2.2/soot
You can put this directory in your path, and run soot by simply calling that script 'soot' without having to include the full path - this script sets up the classpath for you. Please note that you will probably want to specify 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. If you want to setup your own shell to include the proper classpaths and such, Minimally you need:

export JAVADIR=/opt/sun-jdk-1.4.2.10
export PATH=$JAVADIR/bin:$PATH
export CLASSPATH=.:~cs621/Winter2006/jasmin-2.2.2/classes:~cs621/Winter2006/polyglot-1.3.2/classes:~cs621/Winter2006/polyglot-1.3.2/cup-classes:~cs621/Winter2006/soot-2.2.2/classes

in your .profile for bash, or the setenv equivalents for csh. If you're having trouble and want to take a look at my .bashrc file, it's here.

$ java soot.Main

should then work (Make sure you're getting version 2.2.2).  The above location of Java is for the lab7-x machines at McGill, other machines will have different configurations.

Eclipse Soot Plugin

You will need to install the Eclipse plugin yourself. Make sure to use eclipse-3.1 as this is the version that the plugin was designed for. The SOCS staff has installed the plugin but it is still not working properly. I will try and get them to fix this. For now, you can install the plugin yourself 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.

Don't rely on SOCS to get the plugin working in time. If you want to modify either the Eclipse plugin or Soot, or to run them locally whilst not at a lab machine, you will obviously need to get the sources yourself. Instructions and files can be found in the links below. Note that writing analyses and transformations that use the Soot framework doesn't necessarily require modification of code in the Soot distribution.

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 3.0.1 Downloads

Profiling

As stated earlier, the Sun 1.4.2_10 JDK is installed in /opt/sun-jdk-1.4.2.10. 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:

AspectJ

Version 1.1.0 of the AspectBench Compiler for AspectJ, abc, is installed in ~cs621/Winter2006/abc-1.1.0/ 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.

The IBM AspectJ compiler, ajc (now associated with the Eclipse Foundation), is installed in ~cs621/Winter2006/ajc-1.2.1

More information on how to use these compilers is available from their home pages.

AspectBench Compiler Home
ABC download page

AspectJ Home

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

The automatic installation process is complete. We recommend you complete the installation as follows:

1) Add /home/course/cs621/Winter2006/ajc-1.2.1/lib/aspectjrt.jar to your CLASSPATH. This small .jar file contains classes required by any program compiled with the ajc compiler.

2) Modify your PATH to include /home/course/cs621/Winter2006/ajc-1.2.1/bin. This will make it easier to run ajc and ajbrowser.

These steps are described in more detail in /home/course/cs621/Winter2006/ajc-1.2.1/README-AspectJ.html.

Benchmarks

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)

Benchmark description form

Existing AspectJ benchmarks


Useful Information

Question #1: Logging in to the lab machines remotely

is it currently possible to access the lab for the comp621 course remotely, via ssh? It would be most useful for the assignments! Could you indicate me some documentation for this or a similar access?
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 SSH page
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:
ssh user@labX-Y.cs.mcgill.ca
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 mbatch@lab6-2.cs.mcgill.ca
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. See the website here:
X11 for Mac OS X
You can get a Microsoft Windows X-server running using Cygwin/X at:
Cygwin/X
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. For example, typing "ec " in my shell lists the available options quite nicely:
echo echo-client-2 eclipse eclipse-2.1 eclipse3.0.1