Simulating the Interpreter
Last updated at 5:11 pm UTC on 16 January 2006
April 2002
It seems that the last system where this worked is 2.7 (January 2000). [Update January 2005... Dan Ingalls made some fixes to the simulator since I last wrote here; it's worth a try in recent releases. –crl]
Here's a demo script:
- Download 2.7 (from http://wuarchive.wustl.edu/languages/smalltalk/Smalltalk/Squeak/2.7 ...it's much faster than the other drop points :).
- Fire it up, go to full-screen mode, open a small workspace.
- In the workspace, type (InterpreterSimulatorLSB new openOn: 'source.image') test. Don't evaluate it yet. If you're on a big-endian host (e.g., Macintosh, as opposed to, e.g., x86) use InterpreterSimulator instead of InterpreterSimulatorLSB.
- Move the workspace off to the left side of the screen.
- Make a snapshot under a groovy name like "stimulator".
- Change Squeak's desktop color to something which contrasts with the current color.
- Turn off full-screen mode, and resize the Squeak's host window so that it's about a quarter of the full-screen size.
- Make another snapshot under the name "source".
- Exit Squeak.
- Start the stimulator image, and evaluate the workspace expression.
- After about a minute (on a 500 MHz PIII), the source image will come up in simulation in the lower right corner of the display.
- Try to keep from fainting with delight. :)
In 2.8, I got flack from the LargeIntegerPlugin; apparently external calls don't work under simulation yet. My run died in InterpreterSimulatorLSB(Interpreter)>>classNameOf:Is:, when Interpreter>>arrayValueOf: answered self, instead of the class name we were trying to confirm. And to get that far I had to fix InterpreterSimulator>>ioLoadExternalFunction:OfLength:FromModule:OfLength: (the block that populates functionString was trying to write to pluginString again). I moved on/back to 2.7 at that point. I assume that debugging the simulator is even hairier in post-2.8 releases. :)
The last time I ran the simulator was in Summer 1999, when I was debugging a scanned-sound-synthesis plugin I wrote. It was very handy!
enjoy,
Craig Latta