=== Top of the Swiki === Attachments ===
Virtual Machine Hacking
Among those things that make Squeak unique in the Smalltalk world: the ability to change everything about the system, including the Virtual Machine: VM.
{See also: defunct #3 and Maximum Squeak}
There is the beginnings of a guide to porting on Porting Squeak
- Primitives can be added easily using the CTranslator. You can write them in Smalltalk, test them, add a few type hints, and translate them to C for speed. The sound primitives are done this way. Since the VM plugin system ( Named Primitives was creatd, adding primitives to the main VM is strongly deprecated and you ought to build subclasses of InterpreterPlugin.
- Stephen Travis Pope tells you exactly how to add your own primitives in: "The Do-It-Yourself Guide to Squeak Primitives" at http://www.create.ucsb.edu/squeak/DIYSqPrims.html. He has been busy adding primitives for MIDI and sound I/O, and for fast sound processing and mixing. His Siren VM/VI has many other enhancements aside from the added primitives.
- The VM can be changed to 2 tag bits for more immediate object kinds: immediate characters, points,... Hans-Martin Mosner did some work on this, for version 1.18 http://www.heeg.de/~hmm/squeak/2tagbits/
- IanPiumarta built a somewhat faster VM using a ContextCache, and has now finished a VM with DynamicTranslation (Just In Time compiling) to ThreadedCode; see SqueakVersions. Should be 2x to 4x faster.
- Tim Rowledge modified the BitBltSimulation to support little-endian forms; speeds up display performance on little-endian systems. (As of Nov 18 '98, thisis withdrawn because nobody else was interested in using it. Not worth the effort to re-udate it for every release!)
- Hans-Martin Mosner added matrix operations and 3D rendering primitives: ThreeDimensionalGraphics
- AlejandroReimondo added an interface to support external API calls under Windows platforms http://www.sugarWeb.com/
- Boris Shingarov added another interface to support external API calls that works under OS/2 and will be ported to other platforms soon ftp://visualage.dialogue.msu.su/pub/smalltalk/squeak/ He also added support for OS/2 callbacks to do native widgets from PresentationManager.
- Hans-Martin Mosner has suspended work on the 3D stuff and now concentrates on DynamicPrimitives. When they work, he'll resume 3D, using the new tools.
- Andreas Raab recently added Named Primitives to the VM, a way of adding primitives without having to claim a primitive number. Currently works on Windows, ought to work on unix reasonably easily, Mac & Acorn, who knows?
- Tim Rowledge has a little goodie that is useful to anyone running the InterpreterSimulator on a little-endian machine - (http://sumeru.stanford.edu/tim/pooters/SqFiles/deltas/VMsimulator.6Nov.cs)
- He's at it again - Tim Rowledge has released VM/image changes to 'clean up' the CompiledMethod format and provide simpler extensions of source code accessing, plus error return values for primitives. See http://sumeru.stanford.edu/tim/pooters/squeak.html. This is now adopted as an official project New Compiled Method Format and 3.0 Image
- And there's more. Tim Rowledge has a starting version of general event input code, to help capture those events not related to the keyboard, mouse or network, such as 'Display resize'. It's in the usual place http://sumeru.stanford.edu/tim/pooters/SqFiles/deltas Better code will appear someday.
- Andrew C. Greenberg figured out how to use Apple's (FREE!) MPW compiler to create Mac VMs: http://www.mucow.com/SqueakMPW.html