[squeak-dev] The Inbox: System-cwp.662.mcz

Colin Putney colin at wiresong.com
Sun Jan 12 15:50:03 UTC 2014


That diff is a bit hard to read, so here's the implementation:


allObjectsDo: aBlock
"Evaluate the argument, aBlock, for each object in the system
excluding SmallIntegers. New objects created by aBlock will
be included in the enumeration, and it is up to the caller to avoid
creating new objects faster than they are enumerated. It's
important that the next object is fetched before the block is
evaluated, because the block may use #become: to change the
identity of object."

| object nextObject |
object := self someObject.
[nextObject := object nextObject.
aBlock value: object.
object := nextObject.
0 == nextObject]
whileFalse.


This version has the following properties:

- objects created inside the block will be enumerated
- callers may use become inside the block
- callers must avoid infinite loop

I think these are the most desirable semantics for #allObjectsDo:. However,
the risk with this implementation is that it will execute an infinite loop
on VMs that create a new context object for each block activation. Cog and
the StackVM don't, but John's Mac VM 5.7.4.1 does, according to a quick
test I just did. I don't know what the behaviour of older Window and Linux
VMs are.

So  the question is, what VMs are we planning to support for in 4.5, and do
they recycle activation contexts?

Colin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140112/f0dcff76/attachment.htm


More information about the Squeak-dev mailing list