[self-interest] Re: Self bytecodes

David Ungar David.Ungar at Eng.Sun.COM
Tue Jun 1 23:08:54 UTC 1999


Also an good idea! (forgive, me I am reading mail backwards today)
It does have the slight drawback that the count is a memory-reference away
instead of being in the interpreter's I-stream.

- Dave



> > It all seems fine, but I donĀ“t understand something seemingly
>> straightforward: knowing that in a send the receiver and arguments are
>> popped off stack and the result is pushed onto stack, how is the number
>> of arguments of a send determined, so that my interpreter could know how
>> many pops it should make? It seems that in the fast_compiler, when the
>> machine code for a send is generated, the information of number of
>> arguments is kept somewhere. Where?
>
>You can just count the number of ':' characters in the selector name,
>and that is the number of arguments. Except that if the selector name
>is composed of special characters, then we have a binary selector and
>there is one argument.
>
>Testing this at every message send is *very* inefficient - the
>Smalltalk bytecodes encode the number of arguments in the send
>bytecode itself. But since the Self bytecodes were meant to be
>compiled away, this wasn't considered a problem.
>
>For an interpreter, there isn't a good solution if you are going
>to use a standard Self world. If you don't mind creating your own,
>slightly different, world you could separate canonical strings
>representing selectors into different "types". One way to do this
>would be to add a constant slot indicating the number of arguments
>when you canonicalize a string. That way, 'last' would have a
>constant slot with the value 0, while for 'between:And:' that
>slot's value would be 2. This slot would always be in the same
>place in the string's map (if you don't make any other changes)
>so your interpreter can easily access it.
>
>-- Jecel
>
>
>------------------------------------------------------------------------
>FREE email Newsletters delivered right to your in-box.
>CNET, USAToday, RollingStone, and more

>Click Here Now!  http://clickhere.egroups.com/click/314
>
>
>eGroups.com home: http://www.egroups.com/group/self-interest
>http://www.egroups.com - Simplifying group communications



    David Ungar
    Sun Microsystems Laboratories
    (650) 336-2618

------------------------------------------------------------------------

eGroups.com home: http://www.egroups.com/group/self-interest
http://www.egroups.com - Simplifying group communications






More information about the Self-interest mailing list