Pragmatic Smalltalk
===================

Overview
--------

This is a smalltalk JIT and static compiler, producing native code running on
top of an Objective-C runtime for the object model.  The code is in three main
parts:

1) The parser and AST takes a string as input and constructs a Smalltalk
abstract syntax tree.

2) The code generator, hidden behind an abstract interface, produces native
code.  Currently, there is only one implementation of this.  It uses LLVM and
shares code with the Objective-C front end for LLVM; clang.

3) The support libraries, such as MsgSendSmallInt and BlockClosure implement
parts of Smalltalk that are not already present in Objective-C / OpenStep.

The first two of these are in the SmalltalkKit directory.  The last is in the
Support directory.

Building
--------

If you have LLVM, Lemon, and EtoileFoundation installed, GNUstep make should
build without problems.  If it doesn't, please send me a bug report.

Hacking
-------

At the time of writing, the code contains 39 'FIXME's and 12 'TODO's - patches
for any of these are welcome, please post them on [the code review site
](http://review.etoileos.com).  

Note that MsgSendSmallInt.bc is an LLVM bitcode file.  This is used as a
template for code generation of message sends to small integers, allowing them
to be inlined.  If you modify the corresponding .m file, please use clang to
regenerate this file.

The big project still to do is add a type inference engine.  If we can
guarantee that an object is or isn't a SmallInt, we can get some performance
improvements.  Since methods never return SmallInts (although they might return
unboxed integers, which are handled differently), we can use this information
to eliminate a number of branches.  Beyond this, if we can guess (even if we
are wrong some of the time) the class of an object then we can get another
performance boost from speculative inlining of methods.

There is currently no real garbage collection for Smalltalk.  This needs to be
done in a way that can interoperate with non-GC'd Objective-C, to allow ObjC to
be used for performance critical parts without GC overhead.  This should be
done by integrating the cycle detector in GCKit and marking Smalltalk objects
as black.

Summary of Missing Features
---------------------------

Still missing for 1.0:

- Full implementation of Smalltalk-80 SmallInt messages.

Still missing for 2.0:

- Support for floating point values.
- Type inference engine.
- More complete implementation of Smalltalk-80 objects (ideally as class-name
  mappings and categories on OpenStep objects where possible.)
- Working support for the new runtime.

Still missing for 3.0:

- Self-style prototype support.
- World domination.


Have fun!

- David Chisnall
