=== Top of the Swiki === Attachments ===

DynamicPrimitives

With the current Squeak system, you can write primitives in Smalltalk, but must translate them into C to compile and link them to the virtual machine. This is a very slow, cumbersome process, and has hindered my work on 3D primitives so much that I started working on a way to compile primitives into machine language directly.

The current state of affairs is that I can translate CompiledMethods into an intermediate form, that is very close to real machine language. During the translation, I do a limited form of type inferencing, and based on the information gathered, message sends are either inlined or translated into appropriate machine-level operations.

I now target the PowerPC processor since that's what I have at home. But, adding other code generators should not be too difficult. As soon as PPC works, I will start adding a 68K generator, because that's what the PPC Mac can emulate directly, and after that works, a generator for the Intel family. As soon as these are done, it should be possible to add new code generators in a matter of a few days to weeks.

--Hans-Martin Mosner

Update Nov 18, 1998:
Compiling and executing the PluckedSound and SampledSound primitives is now possible.
I've also done some primitives working on Bitmaps, for example one that dithers a 32-bit Form into an 8-bit Form using an ordered dither.

Open Issues:



Code is available at http://www.heeg.de/~hmm/squeak/Translator-981121/