Self ported to Linux

Jecel Assumpcao Jr jecel at merlintec.com
Tue Jan 29 21:13:42 UTC 2002


On Monday 28 January 2002 02:48, alban read wrote:
> Despite all the hype about the self compiler it actually runs like
> a total dog (Self 4.1 on the Mac anyway).
> It has to be ten times slower than Squeak and is too slow to be
> useful. (Which is a shame)

There is a lot of confusion about this. Since this is getting off topic 
for Squeak, I am sending a copy to the Self list so any discussion can 
continue over there. On the other hand, the subject might be of 
interest to jittery Squeakers ;-)

The famous Self compiler that ran numerical benchmarks at 50% the speed 
of optimized C was introduced in Self 2.0 and was created by Craig 
Chambers. The result is simply amazing when you consider that C does no 
index or overflow checking and had a far better code generator. Craig's 
compiler was a huge leap forward in type analysis and he has continued 
this work in his Vortex Compiler project (for the Modula 3 and Cecil 
languages). The problem was that compilation was slow and so 
interactive use of Self 2 wasn't very nice. The compiler didn't do such 
a great job in highly polymorphic (very OO styled) benchmarks.

In Self 3 and 4 an entirely different direction was taken by Urs 
Hölzle. Two simple compilers replaced the complex one used previously, 
and type analysis was replaced with type feedback. The first compiler 
(NIC, the Non Inlining Compiler) did a quick and dirty job that allowed 
code to start running. Data structures called PICs (Polymorphic Inline 
Caches) improved the performance of message sending and, as a side 
effect, collected information about the types of objects actually used 
in the various call sites in the code. When a given method was 
identified as being critical to system performance (a "hot spot", hence 
the name of the technology given at Animorphics and included in Java 2) 
the second compiler (SIC, the Simple Inlining Compiler) was called to 
generate much better code. Though the type information available in the 
PICs was just a subset of what could be obtained with type analysis, it 
was good enough for the SIC to do a good job very quickly.

This new system did a better job on real applications and is far better 
for interactive use, but it doesn't get the fantastic benchmark results 
that Self 2 did.

When porting Self to a new system, you can get it running by just 
implementing the NIC. Performance will be terrible since no inlining or 
type feedback will be used and these two are the key technologies in 
Self. For example, a simple "[...] whileTrue: [...]" will involve many 
message sends and block context creations *per loop*. Contrast that 
with Squeak where the compiler will generate optimized jump bytecodes 
instead.

Unfortunately, neither the Power Mac nor the Linux PC ports implement 
the SIC, yet. David Ungar says performance is good enough on his 
PowerBook and a previous version (4.1.2) seemed almost reasonable on a 
233 MHz iMac. The current version (4.1.4) is supposed to improve 
performance, but it seemed very slow on the 600 MHz iBook I tried it on 
(it wouldn't run on the iMac's OS 8.6).

So I am afraid you haven't had a chance to see Self either as it was 
(Self 2) or how it is meant to be (NIC+SIC). At least for now, I am 
keeping my UltraSparc :-)

-- Jecel



More information about the Squeak-dev mailing list