Archive for squeak

VM debugging trick: browsing object memory snapshots made from the C debugger in the simulator

Posted in Smalltalk, Spoon with tags , , , , , , on 17 December 2013 by Craig Latta

Recently I made use of a virtual machine debugging trick that I don’t think I’ve written about here. The virtual machine simulator is a great way to browse around the state of object memory at the point of a VM crash, but it’s relatively slow (I measured it at about 3,000 instructions per second in my sonification work). The time it takes to get to that point might be prohibitively long.

Instead, you can run to that point in the C debugger (I use lldb on Mac OS), and make a snapshot by invoking primitiveSnapshot() manually. Then, open a simulator on that snapshot and browse the objects to your heart’s content. Depending on the error, you might even be able to modify the objects such that the active process may proceed, and you can snapshot a repaired object memory from the simulator.


virtual machine sonification

Posted in Smalltalk, Spoon with tags , , , , , , , on 9 December 2013 by Craig Latta

A while back I instrumented the Smalltalk virtual machine to generate visualizations of object memories. Now I’m designing instrumentations for sonification, so that the virtual machine will generate sound as it runs. This could be especially interesting for insights into the virtual machine’s operation, since I think it will run usefully in real time. It might be a useful profiling tool, for example. If you have any ideas for how to map messages and executed instructions to sound, please let me know!

the smallest object memory so far

Posted in Appsterdam, consulting, Smalltalk, Spoon with tags , , , , , on 21 October 2012 by Craig Latta

The smallest object memory snapshot I’ve made so far is 1,337 bytes long, on 19 January 2006. You can get the bits (also see my notes about the visualization tools). It adds 3 and 4, then quits.

I created it with a new version of the Squeak system tracer that I wrote. This tracer is implemented as a feature of the Squeak virtual machine simulator. It keeps track of all the objects that are touched during a particular duration of operation, then uses that information to guide a final garbage collection and snapshot.

When you run the snapshot, the virtual machine gets the object address (“oop”) for the special-objects array from the snapshot header. Note that the snapshot header doesn’t appear in this picture. The visualization is of the object memory bytes after they’ve been read from the snapshot file, not the snapshot file itself. The header is the only use of bytes in the snapshot file other than the object memory bytes.

Indirectly from the special-objects array (through the Processor and its active process) the virtual machine finds the active context and continues execution. The instructions executed come from a method used by the context. The instructions are: push (3), push (4), add, send (#quitPrimitive). The send invokes >>quitPrimitive, another method. That method terminates the virtual machine via a primitive. The virtual machine needs to look up >>quitPrimitive in the method dictionary of the class of Smalltalk, a literal association in the literal frame of the initial context.

In the above, we’ve touched the following objects from the snapshot file, in the following order:

  1. the special-objects array
  2. the global Processor association
  3. the Processor
  4. the active Process
  5. the active Process’s suspended context
  6. the now-active context’s method
  7. the symbol #quitPrimitive from the context’s literal frame
  8. the global Smalltalk association
  9. the system dictionary (Smalltalk)
  10. class SystemDictionary
  11. SystemDictionary’s method dictionary
  12. SystemDictionary’s method dictionary’s association array
  13. nil (touched during method lookup)
  14. that array’s association for key #quitPrimitive
  15. the value for key #quitPrimitive (the second method)

The method dictionary of the first method is in there also, as is true and false, making 18 objects. (The numbers 3 and 4 are immediates in the first method’s literal frame.) I could kill those last three, but I declared victory when I got the thing under 1,337 bytes. :)

Context 3 beta 2 (“Usable By Humans”) released

Posted in Appsterdam, consulting, Context, Naiad, Smalltalk, Spoon with tags , , , , , , on 19 October 2012 by Craig Latta

Context 3 beta 2 is released. This one includes the development environment memory from the 3 alpha 3 release, startable from the webpage that the app automatically opens. A remote system browser onto the history memory opens automatically. You can also shut down the development environment from the webpage. It should be fairly easy to get into trouble with this release…

Next, I’ll set up a third memory, a minimal environment which will become Squeak 5. I’ll write instructions for creating unit tests for each package in our community, and imprinting the code run by those tests into the minimal memory, thereby creating a module. We can work toward a release where all the packages anyone might want to load are served by some online history memory, with package metadata searchable with Google.

All I want for Christmas is a virtual machine running Snow Leopard.

Posted in Appsterdam, consulting, Smalltalk, Spoon with tags , , , , , , on 19 October 2012 by Craig Latta

Aha, so it’s not possible to build a Cog VM on Mac OS 10.7 or later, because John’s Mac support relies on QuickDraw system calls that were removed in 10.7, and Cog’s unixbuild won’t build on the Mac (not exactly sure why, Eliot just says so). Too bad… I’ve always appreciated having Ian’s Quartz-based Mac support to fall back on when John’s stuff misbehaved.

You can run 10.7 or later in a VMWare or Parallels virtual machine, but no earlier non-server releases (because of policy issues, nothing technical). So I guess I need to find and buy a copy of Snow Leopard Server.

I’m interviewed on the Smalltalk Inspect podcast

Posted in Appsterdam, consulting, Naiad, Smalltalk, Spoon with tags , , , , , on 1 October 2012 by Craig Latta

Oh! I forgot to mention: I had another fun podcast interview, this time with Joachim Tuchel for the Smalltalk Inspect podcast. Check it out!


Posted in Appsterdam, consulting, GLASS, Seaside, Smalltalk with tags , , , , , , , on 30 September 2012 by Craig Latta

I made a new EC2 machine running Ubuntu 12.04 and Gemstone, with GemTools displaying onto a virtual xpra display. It all seems to work. Cool!

Context 3 beta 1 released

Posted in Appsterdam, consulting, Context, Naiad, Smalltalk, Spoon with tags , , , , , , on 12 September 2012 by Craig Latta

I’ve released Context 3 beta 1. This is another “ignition check” release. On the Mac, the intended sequence of events is:

  • You double-click on the app.
  • The app is an AppleScript which starts an embedded Context virtual machine, which resumes a web server. The AppleScript also opens a web browser on the web server’s welcome page.
  • The welcome page tells you what to do next (but it currently refers to things which don’t exist).

I’m working on the equivalent magic for Microsoft Windows and GNU/Linux for the next release; suggestions welcome.

Please let me know if the startup sequence works for you, and any questions or comments you have. This is an exciting release, because it’s the first one that could be the basis for a self-supporting community.



Simulating Cuis

Posted in Spoon with tags , , , , on 3 March 2012 by Craig Latta

simulating Cuis

I fixed a few bugs with the virtual machine simulator in Squeak 4.3, and now I have it running Cuis. Next I’ll run Dissolve on it, to see how small I can get it.

%d bloggers like this: