The A- implementation
only uses 4 peephole patterns. The generated code is pretty bad when
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, identify as many peephole
patterns as you can, and implement them following the templates in
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
constructors defined in
Extensions are of course possible, but they must be clearly documented.
You will be graded on the 2009 JOOS benchmarks, however you can also try your optimizations
with the 2010 and 2011 benchmarks if that helps (all of them are in the GitHub repository).
We expect you to at least reach the A+ compiler. Anything better would be nice.
See the instructions for running the benchmarks.You should check in the following:
patterns.hfile, for each optimization you should add a comment explaining why it is sound.
compile.logshowing the results of running the
compile_and_run_optscript on the 2009 class set of benchmarks. 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.
sizecontaining the result of running the
totalbytescommand 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.