I just had an idea for the design of a “virtual machine browser”, for browsing the internal state of a running virtual machine simulator and the objects of the memory it’s running. Something more sophisticated than printing the debug support messages to the Transcript.
Archive for virtual machine
toward a virtual machine browser
Posted in Naiad, Smalltalk, Spoon with tags browser, debugging, virtual machine on 27 November 2013 by Craig Lattaa detailed description of Context’s object memory visualization tools
Posted in Appsterdam, consulting, Context, Smalltalk, Spoon with tags context, development tools, minimalism, simulation, smalltalk, spoon, virtual machine, visualization on 22 October 2012 by Craig Lattadirect graphical mapping of the object memory
When I got the current Context 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 movies
In 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 Context object memory goes through after resuming, stopping after every 50 instructions to render a picture. (The simulated Context 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).
exploring the space
But 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 Context snapshot.
Finally, I augmented the simulator to export graphs of all the reference relationships between all the objects in the system. Rummaging around in them in 3D is a lot of fun.
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”. :)
I’m writing a C build environment in Smalltalk.
Posted in Appsterdam, consulting, Smalltalk, Spoon with tags build, c, smalltalk, virtual machine on 17 October 2012 by Craig LattaI can no longer tolerate makefiles, autoconf, and all the other bullshit that currently permeates building C projects like the Squeak virtual machine. We’ve had the ability to manipulate command-line utilities from Smalltalk for years. I’m writing a model of C build artifacts, dependencies, and utilities. I’m collecting transcripts of successful Squeak virtual machine builds from all platforms, from which I will reverse engineer. Please do send yours. Thanks!