Using CCodeGenerator for something beyond Plugins

Anthony Hannan ajh18 at cornell.edu
Wed Mar 20 15:53:49 UTC 2002


PhiHo Hoang <phiho.hoang at rogers.com> wrote:
> 	Then with a little bit of more work, one can right click on the
> 'Compiler' class, then 'Translate to ...' would give a Squeak Compiler
> in Objective C (C++, C#, Java...).
> 	Then nothing (?) would prevent one to preJIT a whole Squeak
> application by translating all Squeak objects and compile to the native
> machine code.

Pre-compiling a whole Squeak image to native code would not be better
than just-in-time compiling primarily because native code takes up a lot
more space than bytecodes.  It is better to only compile bytecodes that
are needed.  Each bytecode requires an average of 3 native instructions,
yielding about 12 bytes per bytecode [1]. Compiling all bytecodes would
create a huge image that could cause performance problems on machines
with limited memory.  In fact in some cases when the cpu cache is
sufficiently small it is faster to never compile to native code and always
interpret bytecodes [1].

Cheers,
Anthony

[1]  James Doyle, Elliot Moss & Antony Hosking. "When are Bytecodes
Faster than Direct Execution?" (1997).
<ftp://ftp.cs.umass.edu/pub/osl/papers/oopsla97a.ps.gz>



More information about the Squeak-dev mailing list