Home  |   Deutsch  |  Gordon  |  Radionetworkprocessor  |  Self Language  |  Engineering Consulting  
This page describes how I got to start a port of Self

Implementation Details


Self on Smalltalk

Due to the simplicity of Self, it should be no problem to implement it from scratch. At one hacking session, which took place around Munich in October 1995, I started an implementation of Self from scratch with Smalltalk/V. This code was later released (see the corresponding README file ) and extended by Stefan Matthias Aust to run on VisualWorks a.k.a. Cincom Smalltalk (see his homepage for more details). This implementation is kind of nice because it integrates Self objects seamlessly with Smalltalk objects.

On the downside, this implementation is purely interpreted, and therefore much slower than the compiled one. In addition, the vast amount of software included in the Self system released by Stanford University and Sun (e.g. the Morphic GUI, the Mango parser generator, the Smalltalk subsystem) heavily uses Unix library infrastructure, which is not available in Smalltalk in this form. However, Stefan Matthias Aust got the implementation to process core/systemStructure.self and core/coreObjects.self of the original Self system.

A Self Parser in Yacc/Lex

I also started a parser for Self using lex and yacc. However, I ran into trouble since the language definition has some delicate features. Firstly, a dot '.' can be used both as statement separator and resend designator. Secondly, parentheses '()' can mean constructors of objects, as well as operator precedence, depending on the context.

The End of the Green Project

When Sun dumped Self in favor of Java, it became a little quiet about the Self group. The Self homepage sometimes appeared and sometimes disappeared, and for very short periods of time the source code of the Self system was available on the Self homepage.

At one of these occasions, I downloaded this source code (Release 4.0), released under BSD license, and stored it on my hard-disc. This was around 1995, and it took quite a long while until I took the time to have a look at it.

This code is highly optimized to SPARC as target architecture, and fortunately, I did not know that the Self community considered it impossible to port the system to another architecture than SPARC. :-)

My Winter Vacation 1999

From winter holidays 1998 till the end of January 1999, I had a few weeks of vacation to spend. Since my former fiancée had to learn for her university tests, I took these 5 weeks to dig into the Self code. Somehow, I was not amused by the imagination of having to program in C++ only all my life.

It took me the first two weeks to figure out and fix a quite stupid memory leak in the Self build system (makeDepsAndIncs). After that, the whole system compiled under Linux quite nicely, except that is was still compiling and jumping to SPARC binary code.

Another challenge was the Unix signal stacks that Self uses to implement its multi-threading. The Linux kernel 2.0 which I was working with did not fully implement these signal stacks (see define 'SIGNAL_STACKS_AVAILABLE' in Self4Linux-0.1.0.tar.gz). Fortunately, I had the source code of the kernel and of C runtime library available, so I could plainly see what was going on.

The next step was the setup of an i386 assembler and to make all the various places in the Self compiler emit x86 code. After trying several alternatives, I stuck to the robust way of wrapping the machine specific part of gas into the Self kind of OO shell. This approach is somewhat slower than the Sparc one because if uses virtual functions for the operand classes. In addition, the gas code is GPL, so the whole system had to be release under GPL, too. It is still an open project to create a faster assembler from scratch.

Middle of January, I announced my work in the self-interest mailing list, and I got a lot of support by various people. Most notably, Mario Wolczko sent me a manual of the SPARC instruction set, which made it easier for me to figure out what the original Self system was supposed to do (I didn't have any way to run the original Self on SPARC by that time).

End of January 1999, I release the first version of Self. It was running on Linux and was able to perform simple message passing. Because of the stack problems, blocks did not work yet, the garbage collector could not walk the stack, and the multi-threading did not work.

The Final Steps

A MacOS version of Self running on PowerPC was brought out by David Ungar in October 31 of 1999 (see Self 4.1 ). This version contained a portable stack frame architecture.

Thorsten Dittmar and Maximilian Thiel wrote a GPL-free new implementation of the i386 assembler. We conducted a Self-Hacking-Session on January 8th 2000 in Witten, Germany. On this occasion, we ported my changes to Self 4.0 to the new release of 4.1.

Maximilian Thiel was working on it for a while, and in July/August he spent a few weeks in Munich with me in which we got pretty close to getting the GUI up and running. However, we didn't find all bugs in the new assembler. Since I had to go to Dresden to pursue my Ph.D., I could not work on it further.

Independently, Harald Gliebe merged the i386 code generation of me with the portable stack frame of David and made the GUI running December 2001 using my gas assembler framework. In addition, he also got to run it on Microsoft Windows using Cygwin, and made various other improvements.

© 1997-2012 Gordon Cichon - Contact