Smalltalk on the JVM

I ran across a piece of software called St/JVM by Mission Software that allows you to run Smalltalk code on the JVM. This is inherently exciting because not only does it bring some assemblance to the CLI (specifically, the .NET VM) — I can’t think of any inherent reason that the JVM can’t support multiple languages in the same way that the .NET VM does (although other languages are ‘second class’). It makes me wonder how this is implemented though — as I recall there were certain issues with having to modify the .NET VM that Ralph Johnson’s group was working on to get Smalltalk to work on the .NET VM.

Is there some sort of intermediary layer between St/JVM that is written in Java itself, and not simply a compiler that compiles to JVM byte code? St/JVM also claims to support blocks, which leads me to believe that this must be the case — and that St/JVM could potentially be somewhat slow. This is mainly due to fact that activation records in Smalltalk sit in the heap, whereas activation records for most other languages sit on the stack. This is mainly due to the fact that you can create blocks with references to variables in the activation record — the lifetime of the block could live longer than the lifetime of the function, and the existing variables that are referenced in the block must still be valid as long as the block is still exists (this is probably the hardest thing to deal with in implementing blocks in Objective-C, I intend to write more about this in the future). It would seem like St/JVM probably implements activation record objects using a Java abstraction, allowing you to do all of the neat things that Smalltalk does, such as viewing activation records as objects when in the debugger. Unfortunately, there’s no downloadable demo at the moment on the page — it would be interesting to see what the performance is.

Leave a Reply