To go straight to the eye candy, check out...
direct graphical mapping of the object memoryWhen I got the current Spoon snapshot down to about 450 kilobytes, I realized that I could render it as a reasonably-sized picture (within 800 by 600 pixels). I was interested in doing this mostly because I'd never seen a graphical representation of the Smalltalk object memory before. As I proceeded, I found it enabled some pretty useful things.
simulator moviesIn Squeak, I made an 8-bit-per-pixel bitmap, put the snapshot bytes into it linearly, and displayed it. It looked like a very peculiar sort of confetti... It wasn't hard to see a few vague patterns, though. I instrumented the Squeak virtual machine simulator so that it would stop every so often to render a picture. I also chose the color of each pixel based on the class of the object of the corresponding byte.
I ran the simulator through the first 3000 instructions a Spoon object memory goes through after resuming, stopping after every 50 instructions to render a picture. (The simulated Spoon system went through its startup routine of reconnecting over the network to a headful system, so that one may browse it via remote messaging.) I put the pictures together into a 30-frames-per-second movie, a new picture every four frames. So here's an example of extreme slow-motion; in the course of two seconds one sees roughly the first eight microseconds of execution time (as measured on my hardware). Here's the movie.
exploring the spaceBut why just look at the pictures? I changed the normal picture viewer event handler so that when you click on a pixel, a cached simulator tells you more about the object of which the corresponding byte is a part. Coupled with an on-screen magnifying glass, this has turned out to be a valuable tool for finding more objects to delete from the Spoon snapshot. Here's a screenshot.
Finally, I augmented the simulator to export graphs of all the reference relationships between all the objects in the system. Rummaging around them in 3D is a lot of fun (the original full-res version is also available).
Please feel free to explore the graph data yourself and let me know if you find anything interesting. :) There are 8,628 objects (labelled) and 28,449 connections. It's in a format for use with the Walrus graph visualizer (a lovely thing!).
I think this stuff gives new meaning to the old jargon phrase "smalltalk image". :)
14 March 2007
27 January 2011