[Vm-dev] #numTemps/tempCountOf: is not working correctly

Levente Uzonyi leves at caesar.elte.hu
Sat Oct 20 23:40:01 UTC 2018



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-bytecodes/

Levente


More information about the Vm-dev mailing list