Squeak and native threads

John M McIntosh johnmci at smalltalkconsulting.com
Tue Jan 9 08:55:31 UTC 2007

On Jan 8, 2007, at 10:10 PM, J J wrote:
> Could you define "a bit of work"?  You think like 3 months work for  
> the average guy?  More/Less?
> I'm sure there was less interest before because the threading world  
> is harder to work in then the non-threading world.  But it is  
> getting more important every day, so I thought this deserved some  
> looking into.

Well the original intent was to enable the VM to use one code segment  
and multiple data structures. The hard part was convincing SLANG to  
extrude almost all the interpreter.c
global variables as variables in a structure.

At the time I did this many years ago some variables were not put  
into the structure because the address of the variables were needed,  
however this usage has I see been
deleted for these two variables.

sqInt extraVMMemory;
usqInt memory;

The follow three elements are initialized, but a startup routine  
could do that work if passed the data structure before the  
interpreter is started.

void *primitiveTable
char* obsoleteIndexedPrimitiveTable[][3] =
const char* obsoleteNamedPrimitiveTable[][3] = {

mmm this is a const now, so not needed in the structure
const char *interpreterVersion = "Squeak3.8 of '5 May 2005' [latest  
update: #6665]";

exupery uses this one, but again I'll guess it could go into the  
sqInt (*compilerHooks[26])();

LIkely these two could go into the structure.
void* showSurfaceFn;
struct VirtualMachine* interpreterProxy;

So that is a couple of hours/day or so of work.
Now of course you would need to look at the different platform files  
that you need and make them global variable safe too.

However in doing all this it really just let you run multiple VM's in  
the same address space, which is different from  having smalltalk  
threads somehow mapped to
processor threads.

John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com

More information about the Squeak-dev mailing list