Zero

Zero
Zero

04 diciembre 2007

Pool of primitive objects in Zero

So far, each primitive object employed (integer, real or string), was created and destroyed on the fly, just for each moment in which it was needed. For example:


x = x.sum( 1 );


That would be translated to:


INT 1
MSG x sum __acc
ASG x


Would make the VM, with INT 1, to create a new integer value (with its corredponding Zero object, and, after the MSG opcode, when the accumulator __acc changed, it would be destroyed.

With these new pools of objects, (integers, floats and strings) are created on the bootstrap of the VM, and (re)used (again and again) under requirement. For example, integers and floating point numbers are created on the beginning, from zero to 20. This technique gives better performance, in general, on any program.