(Issues with) how Slate VM primitives work

Brian Rice water at tunes.org
Sat Mar 18 11:38:21 PST 2006


(re-created email from memory after a client editing app crashed:)

Okay, so after further thought, some mostly-countering thoughts have  
occurred:

Given an idea like taking these PrimitiveMethods and not installing  
them directly as named-methods on objects linked in the specialOops  
array, there are a couple of options:

- Just storing them at numbered offsets in specialOops.
   - Disadvantage: very brittle, no easy way to synchronize this.
- Storing them in slots on #_primitives.
   - Disadvantage: wastes a slot name symbol (recoup-able by using  
the likely selector as slot name, ignoring accessor/mutators).

Both options would require pre-bootstrap.slate code to fiddle with  
installation of the basics manually, requiring at least  
#atSlotNamed:, #at:, #asMethod:on: in order to take the other methods  
and install them for further use, so this is not something worth  
doing for at least a while without more arguments for it, simply  
because it would make the setup more complex and brittle.

#primitiveError still seems like a good idea, even with compiler- 
based primitiveMode code (Slate code compiled in low-level context  
without a static VM boundary).

#isSmallInt checking is also still a good idea, probably based on the  
usage of SmallIntegerProto and SmallIntegerTraits in `pidginPrimitive  
method role annotations. Probably #primitiveError would be sufficient  
to make this work effectively rather than a separate #integerExpected  
signal message. Right now, for example, the VM has a crashing bug for  
the use of the SmallInteger "prototype" (no cloning, so it's not  
really a prototype at all) or traits object in any math primitives.  
So, this is high priority, at least to get basic checks in.

Overriding the ASSERT() macro (which pidgin #assert: translates to)  
to call #primitiveError might be worthwhile. Either that or making a  
different selector #failIf: or something.

Theses are all still dis-organized, so I'll turn them into outline  
form and publish soon.

On Mar 12, 2006, at 8:30 PM, Brian Rice wrote:

> This is just a general list of recent thoughts.
>
> So, I see some problems with VM primitives as-is:
> - `pidginPrimitive does not allow for quick checking of isSmallInt  
> based on the definition which means the method body has to do it.  
> This could be changed to read/manipulate the dispatch in the  
> signature, haven't done it yet. Type-dispatch in the signature is  
> not allowed in Slate grammar yet, but would be the more appropriate  
> means; either that or I force usage of the method header.
> - Errors must be signaled with selectors that the image responds  
> to, which means an entry in the linkage table. Generic  
> "primitiveError"s are not that much better, but for very simple  
> things it's more appropriate to not have the VM try to be smart. In  
> any case, that may be the solution.
> - Primitives are written as whole methods which:
>   - Require a selector to be added to the linkage table as well as  
> the method object itself.
>   - Make it a little more awkward to re-use primitives or to write  
> fall-back Slate code in case the primitive fails or is not  
> available in the given VM.
>   - Require that the dispatched objects /also/ be in the linkage  
> table. To combat growth in the table, extra primitives are often  
> attached to the lobby. One possible solution is to just push them  
> all into a _primitives namespace as blocks in immutable slots.
>
> I'm not expecting feedback, but if you have ideas or comments,  
> please contribute. I'm reading a lot of fundamental Smalltalk books  
> lately (e.g. the blue book, Ungar's SOAR book) and these are what  
> are informing me.
>
> In any case, changing this level of the VM design would not seem to  
> affect further plans to be "VM-less". We shall see.

--
-Brian
http://tunes.org/~water/brice.vcf

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : /archives/slate/attachments/20060318/0d164fa0/PGP.pgp


More information about the Slate mailing list