On Tue, Jan 14, 2014 at 02:27:11PM +0100, Bert Freudenberg wrote:
On 14.01.2014, at 01:36, David T. Lewis lewis@mail.msen.com wrote:
On Mon, Jan 13, 2014 at 12:28:33PM +0100, Bert Freudenberg wrote:
I'd fill the remaining slots with 0 instead of nil. Even better: allocate the array as object count + 1 and *always* put a 0 last. That way the image code cannot ever "forget" to check for 0.
Attached is an implementation of Bert's proposal. There is at least one integer zero at the end of the result array, or more if the primitive caused a GC.
I sort of like this idea now that I understand the rational for using integer zero as the fill.
But Eliot is right, it would be better to answer only the objects that still exist after any possible GC.
Dave
<InterpreterPrimitives-primitiveAllObjects-dtl.2.cs>
Nice. Now we just need the same for allInstances :)
- Bert -
One more update for primitiveAllObjects to fix a buglet. If garbage collection occurs during allocation of the result array, then the result array itself was being included in the result. We want to have self includes: self ==> false for the result array. This fixes it.
Truncating the array per Eliot's suggestion remains on the to-do list.
Dave