Archive for squeak

A Spoonful of Raspberry Pi

Posted in consulting, Naiad, Smalltalk, Spoon with tags , , , , , , , , , on 3 January 2014 by Craig Latta


Spoon is up on the Raspberry Pi and exchanging remote messages with Spoon on my laptop. Morphic works, but it’s pretty slow, so I’ll be sticking with MVC for now (the Raspberry Pi is a 700MHz machine… I’m looking forward to Tim’s profiling work!). I’m writing a talk for FOSDEM in February called “A Spoonful of Raspberry Pi”. What should the Pi do? I’m eager to hear your suggestions!

Another VM debugging trick: halting

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

Just another little VM debugging trick I use… In one of my VM plugins I include a little C function called “breakHere”, which Smalltalk can call as a primitive. I put a breakpoint on it in the C debugger, and then have a convenient way to break in the C debugger from Smalltalk.

What services should the initial Context filesystem provide?

Posted in Context, Naiad, Smalltalk, Spoon with tags , , , , , , , , on 19 December 2013 by Craig Latta

The Context app is now mountable as a virtual (WebDAV) filesystem. What should it do? It has a file at the top level called “README.html”, which is obvious enough. What should the README describe? What would you want a newcomer to be able to do from their favorite text editor (or their favorite file-aware programming language)? Browse classes and methods? Resume and suspend object memories? Add and remove code modules? Please share your thoughts, keeping in mind that this is meant to be a minimal system (one can always add code modules to it later).


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!

%d bloggers like this: