[racket-dev] Demodularizer

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Fri Oct 29 21:53:43 EDT 2010

Here is a message from Blake Johnson about something I just pushed for him:


Jay recently committed my changes implementing raco demod, which will
flatten a modular program into a single compiled module.

How to use it:

Run "raco demod <filename>". This will produce a demodularized zo file
called <filename>_merged.zo which can then be run by passing it to
racket. This process can take quite a while, so if you want to see
what is going on, you can set PLTSTDERR=debug or info. Once the zo
file is created, it can be moved and run from anywhere because it has
no dependencies.

What it doesn't do (yet):

- Dead code elimination

This is partially implemented but doesn't handle every case properly,
so it is turned off for now.

- Optimize the program

This is the next big thing I'm working on, which involves decompiling
the zo slightly and converting it into c structs so that the existing
optimizer can run on it.

- Work with programs that dynamically manipulate modules

This means things like DrRacket won't be able to be demodularized. We
have some ideas on how to handle this, but it probably won't happen
any time soon.

Other improvements:

zo-parse and zo-marshal should be able to handle any .zo you throw at them.

Help needed:

Any programs that don't work after demodularization would be helpful.


Blake Johnson


At the moment, we have not measured any performance improvements, etc
after using the demodularizer. At the moment, we do not anticipate
that there will be any because we are not doing DCE or the
re-optimization. We'll let everyone know when we measure that. For the
moment, this may be of particular interest to any out there that are
doing program analysis and would like "whole programs".


Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the dev mailing list.