Hi, I came into a weird behavior that I think is an error. In pharo/squeak/cuis if you evaluate this:
(String>>#romanNumber) numTemps
It returns 1, but that method has 3 temps. The same happens with other methods like "(SmallInteger>>#printOn:base:length:padded:) numTemps", that return 9 but the method has 8 temps.
With an interpreter simulator I ran an image, look for String>>#romanNumber and send the #tempCountOf: to the simulator with the romanNumber method as parameter and I got 1, as in the image, instead of 3. So at least #tempCountOf: behavior is consistent with the #numTemps of the image.
My question is: is that the right behavior? or is it an error? It looks like an error to me but I may not know something about how #numTemps work.
Thanks Hernan.
On Sat, 20 Oct 2018, Hernan Wilkinson wrote:
It returns 1, but that method has 3 temps. The same happens with other methods like "(SmallInteger>>#printOn:base:length:padded:) numTemps", that return 9 but the method has 8 temps.
That method has one temporary variable which holds the indirection vector containing the slots for the three variables the closure closes over.
"Any closed-over variable which does change after being closed over is put in a heap-allocated "indirection vector" (a simple array, one element per closed-over variable) and the indirection vector is copied into the closure. All accesses to the variable are made through the indirection vector." - http://www.mirandabanda.org/cogblog/2008/07/22/closures-part-ii-the-bytecode...
Levente
Thank you! now I understand :-)
On Sat, Oct 20, 2018 at 8:40 PM Levente Uzonyi leves@caesar.elte.hu wrote:
On Sat, 20 Oct 2018, Hernan Wilkinson wrote:
It returns 1, but that method has 3 temps. The same happens with other
methods like "(SmallInteger>>#printOn:base:length:padded:) numTemps", that return 9 but the method has 8 temps.
That method has one temporary variable which holds the indirection vector containing the slots for the three variables the closure closes over.
"Any closed-over variable which does change after being closed over is put in a heap-allocated "indirection vector" (a simple array, one element per closed-over variable) and the indirection vector is copied into the closure. All accesses to the variable are made through the indirection vector." - http://www.mirandabanda.org/cogblog/2008/07/22/closures-part-ii-the-bytecode...
Levente
vm-dev@lists.squeakfoundation.org