[self-interest] Re: Self bytecodes

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


When I was working on the interpreter, I also added a POP bytecode.
If I can release the lastest Self VM, folks out there could have it.
Would there be any interest?

- Dave


At 4:38 PM -0400 5/31/99, Stefan Matthias Aust wrote:
> >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?
>
>You can derive that from the selector symbol.  Unary selectors (that are
>selectors composed from letters - especially the first character must be a
>lowercase letter - without ':' in it) need no arguments at all.  Binary
>selectors (that are all selectors which neither start with a letter or with
>an '_') have exactly one argument.  For keyword selectors (which are
>composed of sequences of letters (and digits) that end with a colon ':')
>simply count the number of colons.
>
>A different problem is to know when to pop returned objects from the stack
>which aren't used.  I think, you cannot detect that and simply adjust the
>stack when you leave the method.  Here's an example:  3+4. nil
>
>This will generate something along:  push 3, push 4, send #+, push nil.
>
>The + method for integers will pop both 3 and 4 from the stack and push the
>result, 7.  However, this object isn't needed and will use one stack slot
>upton the method returns (with nil).
>
>There might be a way to notice that "7" isn't used anywhere in the method,
>but that's probably to much work for an interpreter.  A compiler that will
>create and analyse a complete parse tree for each method can do this.
>
>
>bye
>--
>Stefan Matthias Aust // Truth Until Paradox!
>
>------------------------------------------------------------------------
>eGroups Spotlight:
>"Military Spouse Unlimited" - Participate in this support group for
>military spouses of on-duty servicemen and women.
>http://clickhere.egroups.com/click/118
>
>
>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