[squeak-dev] The Trunk: System-cwp.660.mcz

Florin Mateoc florin.mateoc at gmail.com
Sat Jan 11 17:11:23 UTC 2014


On 1/11/2014 3:13 AM, Levente Uzonyi wrote:
> On Sat, 11 Jan 2014, Levente Uzonyi wrote:
>
>> On Fri, 10 Jan 2014, Colin Putney wrote:
>>
>>>
>>>
>>>
>>> On Fri, Jan 10, 2014 at 5:32 PM, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>>>  
>>>       1) Why isn't the sentinel object enumerated in a shrunken image?
>>>
>>> send me an image poised at the right point and I'll take a look...
>>>
>>>
>>> While working on creating this image, I noticed that Bert was right. There is a #becomeForward: happening inside the
>>> block that's passed into #allObjectsDo:. It's because #allObjectsDo: is called from
>>> #obsoleteBehaviors, which sends #isBehavior to all the objects. If the image happens to contain an instance of
>>> MCInfoProxy, the DNU causes it to download the full ancestry and become it. 
>>>
>>> However, I don't see why that would cause the sentinel object not to be enumerated. 
>>
>> Because #nextObject will be sent to an object which was created after the sentinel.
>
> Now I see why it wasn't clear. For performance reasons #become* methods
> don't move the objects around, they just rewrite the pointers pointing to them. Here's an example:
>
> a := { $a }.
> b := { $b }.
> c := { $c }.
> self assert: a nextObject == b.
> self assert: b nextObject == c.
> b become: c.
> self assert: a nextObject = #($b).
> self assert: b = #($c).
> self assert: c = #($b).
> self assert: a nextObject == c.
> self assert: c nextObject == b.
>
> I think it might help in this case, to ask for the next object before evaluating the block in the loop of #allObjectsDo:
>
>     [lastObject == object]
>         whileFalse: [
>             | nextObject |
>             nextObject := object nextObject.
>             aBlock value: object.
>             object := nextObject]
>
>
> Levente
>


I would think that materializing proxies or otherwise creating new objects within an allObjectsDo: loop is a bug, just
as it usually is whenever one grows a collection while iterating over it. It is the responsibility of the caller to
ensure that this does not happen.
Here the bug would be in #obsoleteBehaviors, which should install a copy of #isBehavior in ProtoObject before the loop
and remove it afterwards (or ProtoObject should just implement it)

Florin





More information about the Squeak-dev mailing list