This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: The Coolaid Reference Manual Bor-Yuh Evan Chang George Necula November 10, 2004 1 Introduction Coolaid is a tool to statically verify some basic correctness properties of the MIPS assembly code produced from Cool source. Coolaid will check that the assembly code is well-typed with respect to the Cool typing rules * , just like the Java bytecode verifier checks that the bytecode output by a Java compiler is type safe. Aside from checking the safety of the output code, this tool can greatly benefit the development process of a Cool compiler, specifically the code generation phase. Since the compiler front-end ensures that the source program is well-typed and that the type system guarantees certain safety properties, we expect that those properties should also hold on the resulting assembly code. If Coolaid is not able to verify some particular safety property, then a likely cause is a bug in the compiler itself. Traditionally, one debugs the code generation phase of a compiler by either 1. compiling test programs, executing them on sample inputs, and then looking for the expected behavior of the test program; or 2. inspecting the assembly produced by the compiler on test programs. The first method suffers from the problem that not only must a suite of test programs be designed to cover the functionality of the compiler, but also sample inputs must be created to cover all the paths of the test programs. It is also very difficult to create test programs and their sample inputs to cover all possible mistakes in a compiler. Finally, a bad instruction in code generated by a compiler often manifests itself long after the instruction has executed, making it very hard to diagnose the bug. The second method is extremely tedious, if done manually. Coolaid can be viewed as a tool to automate this step. Given a compiler test case, Coolaid will check the output of the Cool compiler without requiring that we run this generated code. Coolaid will point precisely at the offending instruction, but you still have to find out why your compiler is emitting this instruction. At the time of this writing, Coolaid is checking for 175 different correctness conditions. We tested Coolaid on 3500 programs generated by student compilers from the Spring 2003 Last modified on Wed Nov 10 04:34:45 PST 2004 * Actually, the analysis performed by Coolaid is somewhat stronger in that there are programs Coolaid can verify as safe that would not pass the Cool type-checker. 1 offering of CS164 at UC Berkeley. The standard testing procedure used for grading found errors in 1000 of those. Often the error messages were in the form of garbled output or output that did not match the expected output....
View Full Document
This note was uploaded on 01/12/2010 for the course MATH 42 at Stanford.