UW Cecil/Vortex/Diesel/Whirlwind project
Internal : Lore

WARNING: seriously out of date, and woefully incomplete :(

Hi all. I set up this page as a guide to curiosities of the internals of our compiler projects. Unlike the manuals, this is more for getting people up to speed on internal hacking and sharing information once we all start publishing.

Ideally, this will function better than manually searching the e-mail archive as a condensed FAQ-type document for project members. It may also free us to discuss more substantive and in-depth matters at code reviews.

Please add new lore as you learn more about the compiler framework. If you're too lazy to HTML-ize it, toss it between a pair of <xmp> tags, e.g.:

Q: question here A: answer here

-Keunwoo


Q: How should I print warning or error messages in Vortex/Whirlwind?

Short answer: use app.warning_msg or app.error_print.

Long answer: in case you're wondering what the app object is, it's part of the standard library (see app.cecil). The code for the Vortex/Whirlwind methods that add printing is in these files:

$VORTEX_SRC/compiler/infrastructure/environment/error-handling.cecil $VORTEX_SRC/compiler/infrastructure/environment/compiler-def.cecil

There is also a helper method warning_msg for printing a collection of messages in

$VORTEX_SRC/compiler/infrastructure/environment/compiler-def.cecil

See the sources for usage.


Q: How do I dump an object's state to standard output?

basic_print is defined on all objects and prints a low-level snapshot of the receiver. basic_print_string does the same thing, except it returns a string instead of printing it to standard output.

print_string is the idiomatic method for more high-level status messages (more like Java's toString() method).

These methods are all found in general.cecil of the standard library.


Debugging in Vortex

To set a breakpoint on a line, the easiest thing to do is insert a call to the standard library procedure breakpoint(). You can also hit Control-C during program execution (handy for breaking out of the Vortex command loop to do some debugging).

Once you've entered the debugger, you can evaluate any Cecil expression for the current scope by simply entering it at the debugger command line (i.e., the interactive debugger is also a read-eval-print loop). This includes expressions with side effects (e.g. calling basic_print_string()) and declarations that (re)define objects and methods.

When debugging, I often copy-and-paste many versions of a troublesome method from my Emacs buffer into the Cecil debugger until I get it right. Then I do a real rebuild from the source files.

Vortex does not currently provide a "step over" instruction. The best way to simulate that would be to add a breakpoint after every line and use "cont(inue)", but of course that's not convenient.


Cecil mode for Emacs

Get Cecil mode for Emacs in vortex/Cecil/bin/shell/cecil-mode.el.


Commenting/uncommenting regions of text

If you have cecil-mode.el on your Emacs autoload list, C-c C-C is bound to "cecil-comment-region" by default. C-c C-u is bound to "cecil-uncomment-region".


Template for bit of lore (copy and paste me)

Text here. Code here.

preformatted text here
Cecil/Vortex Project, cecil@cs.washington.edu
Last modified: Sat Nov 23 18:44:31 PST 2002