Re: New bytecodes not in blue book ... (Eliot Miranda)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: New bytecodes not in blue book ... (Eliot Miranda)

jamesl
Thanks Eliot.  Your linked article clears it up: http://www.mirandabanda.org/cogblog/2008/07/22/closures-part-ii-the-bytecodes/

       140         10001100 kkkkkkkk jjjjjjjj                  Push Temp At kkkkkkkk In Temp Vector At: jjjjjjjj This fetches the local at offset j..j on the stack and push the k..k’th element in it.
The next two store into the k..k’th element of the local at j..j, one version popping the result off the stack. This is a general convention in the Smalltalk-80 compiler. These are store and store-pop forms of almost every store opcode. The store form is used in the stores into vat and vax in things like
        var := vat := vax := expr
whereas the pop form gets used in the store into var.
        141         10001101 kkkkkkkk jjjjjjjj                  Store Temp At kkkkkkkk In Temp Vector At: jjjjjjjj
        142         10001110 kkkkkkkk jjjjjjjj                  Pop and Store Temp At kkkkkkkk In Temp Vector At: jjjjjjjj
The final bytecode is more interesting.

The wording is unclear to me: "This fetches the local at offset j..j on the stack and push the k..k’th element in it."

Does it mean, get local at index j..j and push onto the stack the k..k'th element in it?

So

109     <8C 00 01> pushTemp: 0 inVectorAt: 1
Get temp at 1 (j..j) and push element at 0 (k..k)    ??

97 <8E 00 01> popIntoTemp: 0 inVectorAt: 1
get vector at temp index 1 (j..j) and pop and store stack value into element 0 (k..k) ??

116 <8D 00 01> storeIntoTemp: 0 inVectorAt: 1

I dont understand this one, store what? into element 0 of vector at 1 ??

In the pop variation I can understand where the value is coming from, but not the above
form. Please can you clarify?

Rgs, James.






_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: New bytecodes not in blue book ... (Eliot Miranda)

Eliot Miranda-2
Hi James,

    perhaps you could use the implementations of ContextPart  pushRemoteTemp:inVectorAt: popIntoRemoteTemp:inVectorAt:  storeIntoRemoteTemp:inVectorAt: (& Interpreter pushRemoteTemp:inVectorAt: popIntoRemoteTemp:inVectorAt: if you have them to hand) as the spec and check the documentation.  The intent is that k..k is the index of the temp containing the remote vector and j..j is the index in the remote temp vector.

cheers
Eliot

2010/8/29 James Ladd <[hidden email]>
Thanks Eliot.  Your linked article clears it up: http://www.mirandabanda.org/cogblog/2008/07/22/closures-part-ii-the-bytecodes/

       140         10001100 kkkkkkkk jjjjjjjj                  Push Temp At kkkkkkkk In Temp Vector At: jjjjjjjj This fetches the local at offset j..j on the stack and push the k..k’th element in it.
The next two store into the k..k’th element of the local at j..j, one version popping the result off the stack. This is a general convention in the Smalltalk-80 compiler. These are store and store-pop forms of almost every store opcode. The store form is used in the stores into vat and vax in things like
        var := vat := vax := expr
whereas the pop form gets used in the store into var.
        141         10001101 kkkkkkkk jjjjjjjj                  Store Temp At kkkkkkkk In Temp Vector At: jjjjjjjj
        142         10001110 kkkkkkkk jjjjjjjj                  Pop and Store Temp At kkkkkkkk In Temp Vector At: jjjjjjjj
The final bytecode is more interesting.

The wording is unclear to me: "This fetches the local at offset j..j on the stack and push the k..k’th element in it."

Does it mean, get local at index j..j and push onto the stack the k..k'th element in it?

So

109     <8C 00 01> pushTemp: 0 inVectorAt: 1
Get temp at 1 (j..j) and push element at 0 (k..k)    ??

97 <8E 00 01> popIntoTemp: 0 inVectorAt: 1
get vector at temp index 1 (j..j) and pop and store stack value into element 0 (k..k) ??

116 <8D 00 01> storeIntoTemp: 0 inVectorAt: 1

I dont understand this one, store what? into element 0 of vector at 1 ??

In the pop variation I can understand where the value is coming from, but not the above
form. Please can you clarify?

Rgs, James.






_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project