deliverable: peephole patterns

The implementation only uses 4 peephole patterns. The generated code is pretty bad when compared with javac. There are many more patterns that can help the optimizer reduce the size of the generated bytecode.

For this deliverable you must repeatedly examine the Jasmin assembly (.j) files produced by the A- and A+ joos compilers as well as dejava after disassembling .class files compiled by javac, identify as many peephole patterns as you can, and implement them following the templates in patterns.h. As you implement patterns and shrink the generated code, you will find even more patterns that you can exploit.

You should examine optimize.c to see the various primitives you can use in your patterns. In particular, a pattern may only use the given operations on the goto graph and the makeCODExxx constructors defined in tree.h. Extensions are of course possible, but they must be clearly documented.

See the instructions for running the benchmarks.

You should create a new branch of your A- compiler:

$ svn cp group-X/joos/stacklimits group-X/joos/peephole
$ svn ci -m "* Create new A- branch for peephole contest"

You should check in the following:

  • Modifications to your patterns.h file.

  • A file called compile.log showing the results of running the compile_and_run_opt script on the 2009 class set of benchmarks. The TAs will make them available shortly, and while you are waiting, you should just experiment using the benchmarks from previous years.

    Your log file must show that all benchmarks compile correctly, verify correctly, and run with the correct output. This means that there must be no differences between the expected output and what each optimized benchmark produces.

    Making sure the patterns operate correctly on your benchmarks is necessary, but not sufficient. In addition, we will be manually checking your patterns are sound in general, removing any unsound patterns, and rerunning all of the benchmarks if necessary.

  • A file called size containing the result of running the totalbytes command on the .j files produced by your final A- compiler with your peephole optimizations enabled. This size is determined by compiling your .j file into a .class file and then decompiling that .class file into a .sj file using dejava.

The deadline is 23:59:59 on the Monday of the week in which the deliverable is due. It is worth 10% of your grade.

Since this deliverable is also the basis for the peephole contest, the deadline is firm, and we will simply take the latest pre-deadline version out of the Subversion repository. Make sure it works!

Maintained by Chris Pickett. [HOME]