[GOODIE] named primitives without dynamic loading

Tim Rowledge rowledge at interval.com
Fri Dec 10 17:12:24 UTC 1999


On Thu 09 Dec, John.Maloney at disney.com wrote:
> Tim:
> 
> I *think* that what you suggest is what Ohshima is proposing. It's
> a good idea.
It looks like Oshima was intending to rely on the perfect hash - which
I suspect is cleverer and more complicated than realy needed; something
he pointed out himself.

> A slight refinement might be to sort the primitive names
> and then do a binary search in the lookup. While it's true that for
> named primitives that are *found* you only have to do the lookup
> once. But I believe that primitive that is not found (and thus fails)
> will get looked up every time. If the primitive is "optional" and
> there is actually Smalltalk code that runs when the primitive fails,
> it might be better not to penalize that Smalltalk code any more
> than necessary.
Ooh, good point, didn't think of it that way...

> An alternative would be to have the VM cache the fact that it
> failed to find the primitive. On machines that actually don't
> have dynamic libraries like the Zaurus (all named primitives
> must be built into the VM), that would make sense. On other
> platforms, you probably need to look for the library every time
> because the user may have installed it since the last (failed)
> attempt to run the primitive.
As long as there is a good way to mark that something has been not-found
this would be easy to do in the platform dependent part of the code. At
the moment the platcode returns 0 as the not-found code and the interp.c
code will then keep retrying each time the external prim is called.
Maybe if we return -1 and change the vm to recognise that as 'mark this
unretryable' ?

tim

-- 
Useful random insult:- Useful as a kickstand on a horse.
Tim Rowledge:  rowledge at interval.com (w)  +1 (650) 842-6110 (w)
 tim at sumeru.stanford.edu (h)  <http://sumeru.stanford.edu/tim>





More information about the Squeak-dev mailing list