The Trunk: Collections-fbs.482.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-fbs.482.mcz

commits-2
Frank Shearar uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-fbs.482.mcz

==================== Summary ====================

Name: Collections-fbs.482
Author: fbs
Time: 3 August 2012, 9:26:33.402 pm
UUID: f236f58a-ba49-4c8c-8314-731f82206158
Ancestors: Collections-ael.481

Merge Collections-ael.481

remove spurious sharing of associations between a dictionary and another created from it

=============== Diff against Collections-cwp.480 ===============

Item was changed:
  ----- Method: Dictionary class>>newFrom: (in category 'instance creation') -----
  newFrom: aDict
  "Answer an instance of me containing the same associations as aDict.
  Error if any key appears twice."
  | newDictionary |
  newDictionary := self new: aDict size.
  aDict associationsDo:
  [:x |
  (newDictionary includesKey: x key)
  ifTrue: [self error: 'Duplicate key: ', x key printString]
+ ifFalse: [newDictionary add: x copy]].
- ifFalse: [newDictionary add: x]].
  ^ newDictionary
 
  " NewDictionary newFrom: {1->#a. 2->#b. 3->#c}
  {1->#a. 2->#b. 3->#c} as: NewDictionary
  NewDictionary newFrom: {1->#a. 2->#b. 1->#c}
  {1->#a. 2->#b. 1->#c} as: NewDictionary
  "!

Item was added:
+ ----- Method: WeakRegistry class>>migrateOldRegistries (in category 'migrating registry') -----
+ migrateOldRegistries
+ Smalltalk at: #WeakFinalizationRegistry ifAbsent: [ ^ self "already done" ].
+
+ Smalltalk recreateSpecialObjectsArray.
+ WeakArray restartFinalizationProcess.
+
+ Smalltalk garbageCollect; garbageCollect.
+
+ "leave no chance to interrupt migration"
+ Compiler evaluate: '
+ [ | old new oldClass newClass |
+ old := OrderedCollection new.
+ new := OrderedCollection new.
+ WeakRegistry allInstancesDo: [:registry | | newr |
+ old add: registry.
+ newr := WeakFinalizationRegistry basicNew initialize.
+ registry migrateTo: newr.
+ new add: newr ].
+ old asArray elementsForwardIdentityTo: new asArray.
+
+ oldClass := WeakRegistry.
+ newClass := WeakFinalizationRegistry.
+
+ Smalltalk forgetClass: newClass logged: false.
+ newClass superclass removeSubclass: newClass.
+ newClass setName: #WeakRegistry.
+ oldClass becomeForward: newClass.
+ ] forkAt: Processor highestPriority.
+ '.
+ !


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Collections-fbs.482.mcz

Frank Shearar-3
On 3 August 2012 21:27,  <[hidden email]> wrote:

> Frank Shearar uploaded a new version of Collections to project The Trunk:
> http://source.squeak.org/trunk/Collections-fbs.482.mcz
>
> ==================== Summary ====================
>
> Name: Collections-fbs.482
> Author: fbs
> Time: 3 August 2012, 9:26:33.402 pm
> UUID: f236f58a-ba49-4c8c-8314-731f82206158
> Ancestors: Collections-ael.481
>
> Merge Collections-ael.481
>
> remove spurious sharing of associations between a dictionary and another created from it
>
> =============== Diff against Collections-cwp.480 ===============
>
> Item was changed:
>   ----- Method: Dictionary class>>newFrom: (in category 'instance creation') -----
>   newFrom: aDict
>         "Answer an instance of me containing the same associations as aDict.
>          Error if any key appears twice."
>         | newDictionary |
>         newDictionary := self new: aDict size.
>         aDict associationsDo:
>                 [:x |
>                 (newDictionary includesKey: x key)
>                         ifTrue: [self error: 'Duplicate key: ', x key printString]
> +                       ifFalse: [newDictionary add: x copy]].
> -                       ifFalse: [newDictionary add: x]].
>         ^ newDictionary
>
>   "     NewDictionary newFrom: {1->#a. 2->#b. 3->#c}
>         {1->#a. 2->#b. 3->#c} as: NewDictionary
>         NewDictionary newFrom: {1->#a. 2->#b. 1->#c}
>         {1->#a. 2->#b. 1->#c} as: NewDictionary
>   "!
>
> Item was added:
> + ----- Method: WeakRegistry class>>migrateOldRegistries (in category 'migrating registry') -----
> + migrateOldRegistries

Grr. Ael's commit didn't change this method, and I merged it in, so I
don't know why it got added. Seperate commit re-removes it.

frank

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Collections-fbs.482.mcz

Aran Lunzer-2
In reply to this post by commits-2
Frank Shearar wrote:
> Re-remove WeakRegistry class>>migrateOldRegistries. Accidental commit during a merge.

...

> Grr. Ael's commit didn't change this method, and I merged it in, so I
> don't know why it got added. Seperate commit re-removes it.

I did see this method when saving my change, and explicitly reverted
it in my image to persuade Monticello not to regard it as part of the
update.  Sorry if that wasn't the right form of persuasion to use in
this case.

Aran

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Collections-fbs.482.mcz

Levente Uzonyi-2
In reply to this post by Frank Shearar-3
On Fri, 3 Aug 2012, Frank Shearar wrote:

> On 3 August 2012 21:27,  <[hidden email]> wrote:
>> Frank Shearar uploaded a new version of Collections to project The Trunk:
>> http://source.squeak.org/trunk/Collections-fbs.482.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Collections-fbs.482
>> Author: fbs
>> Time: 3 August 2012, 9:26:33.402 pm
>> UUID: f236f58a-ba49-4c8c-8314-731f82206158
>> Ancestors: Collections-ael.481
>>
>> Merge Collections-ael.481
>>
>> remove spurious sharing of associations between a dictionary and another created from it
>>
>> =============== Diff against Collections-cwp.480 ===============
>>
>> Item was changed:
>>   ----- Method: Dictionary class>>newFrom: (in category 'instance creation') -----
>>   newFrom: aDict
>>         "Answer an instance of me containing the same associations as aDict.
>>          Error if any key appears twice."
>>         | newDictionary |
>>         newDictionary := self new: aDict size.
>>         aDict associationsDo:
>>                 [:x |
>>                 (newDictionary includesKey: x key)
>>                         ifTrue: [self error: 'Duplicate key: ', x key printString]
>> +                       ifFalse: [newDictionary add: x copy]].
>> -                       ifFalse: [newDictionary add: x]].
>>         ^ newDictionary
>>
>>   "     NewDictionary newFrom: {1->#a. 2->#b. 3->#c}
>>         {1->#a. 2->#b. 3->#c} as: NewDictionary
>>         NewDictionary newFrom: {1->#a. 2->#b. 1->#c}
>>         {1->#a. 2->#b. 1->#c} as: NewDictionary
>>   "!
>>
>> Item was added:
>> + ----- Method: WeakRegistry class>>migrateOldRegistries (in category 'migrating registry') -----
>> + migrateOldRegistries
>
> Grr. Ael's commit didn't change this method, and I merged it in, so I
> don't know why it got added. Seperate commit re-removes it.

It keeps sneaking back every once in a while. We should find the reason
why it's happening.


Levente

>
> frank
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Collections-fbs.482.mcz

Levente Uzonyi-2
In reply to this post by commits-2
On Fri, 3 Aug 2012, [hidden email] wrote:

> Frank Shearar uploaded a new version of Collections to project The Trunk:
> http://source.squeak.org/trunk/Collections-fbs.482.mcz
>
> ==================== Summary ====================
>
> Name: Collections-fbs.482
> Author: fbs
> Time: 3 August 2012, 9:26:33.402 pm
> UUID: f236f58a-ba49-4c8c-8314-731f82206158
> Ancestors: Collections-ael.481
>
> Merge Collections-ael.481
>
> remove spurious sharing of associations between a dictionary and another created from it

I vaguely recall that the sharing is/was necessary for the compiler to
work properly. I'm not sure if it's still true (or if it was ever true).
Let's hope the tests will cover this case.


Levente

>
> =============== Diff against Collections-cwp.480 ===============
>
> Item was changed:
>  ----- Method: Dictionary class>>newFrom: (in category 'instance creation') -----
>  newFrom: aDict
>   "Answer an instance of me containing the same associations as aDict.
>   Error if any key appears twice."
>   | newDictionary |
>   newDictionary := self new: aDict size.
>   aDict associationsDo:
>   [:x |
>   (newDictionary includesKey: x key)
>   ifTrue: [self error: 'Duplicate key: ', x key printString]
> + ifFalse: [newDictionary add: x copy]].
> - ifFalse: [newDictionary add: x]].
>   ^ newDictionary
>
>  " NewDictionary newFrom: {1->#a. 2->#b. 3->#c}
>   {1->#a. 2->#b. 3->#c} as: NewDictionary
>   NewDictionary newFrom: {1->#a. 2->#b. 1->#c}
>   {1->#a. 2->#b. 1->#c} as: NewDictionary
>  "!
>
> Item was added:
> + ----- Method: WeakRegistry class>>migrateOldRegistries (in category 'migrating registry') -----
> + migrateOldRegistries
> + Smalltalk at: #WeakFinalizationRegistry ifAbsent: [ ^ self "already done" ].
> +
> + Smalltalk recreateSpecialObjectsArray.
> + WeakArray restartFinalizationProcess.
> +
> + Smalltalk garbageCollect; garbageCollect.
> +
> + "leave no chance to interrupt migration"
> + Compiler evaluate: '
> + [ | old new oldClass newClass |
> + old := OrderedCollection new.
> + new := OrderedCollection new.
> + WeakRegistry allInstancesDo: [:registry | | newr |
> + old add: registry.
> + newr := WeakFinalizationRegistry basicNew initialize.
> + registry migrateTo: newr.
> + new add: newr ].
> + old asArray elementsForwardIdentityTo: new asArray.
> +
> + oldClass := WeakRegistry.
> + newClass := WeakFinalizationRegistry.
> +
> + Smalltalk forgetClass: newClass logged: false.
> + newClass superclass removeSubclass: newClass.
> + newClass setName: #WeakRegistry.
> + oldClass becomeForward: newClass.
> + ] forkAt: Processor highestPriority.
> + '.
> + !
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Collections-fbs.482.mcz

Frank Shearar-3
On 4 August 2012 05:21, Levente Uzonyi <[hidden email]> wrote:

> On Fri, 3 Aug 2012, [hidden email] wrote:
>
>> Frank Shearar uploaded a new version of Collections to project The Trunk:
>> http://source.squeak.org/trunk/Collections-fbs.482.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Collections-fbs.482
>> Author: fbs
>> Time: 3 August 2012, 9:26:33.402 pm
>> UUID: f236f58a-ba49-4c8c-8314-731f82206158
>> Ancestors: Collections-ael.481
>>
>> Merge Collections-ael.481
>>
>> remove spurious sharing of associations between a dictionary and another
>> created from it
>
>
> I vaguely recall that the sharing is/was necessary for the compiler to work
> properly. I'm not sure if it's still true (or if it was ever true). Let's
> hope the tests will cover this case.

Compiler tests show green, for what it's worth.

frank

> Levente
>
>>
>> =============== Diff against Collections-cwp.480 ===============
>>
>> Item was changed:
>>  ----- Method: Dictionary class>>newFrom: (in category 'instance
>> creation') -----
>>  newFrom: aDict
>>         "Answer an instance of me containing the same associations as
>> aDict.
>>          Error if any key appears twice."
>>         | newDictionary |
>>         newDictionary := self new: aDict size.
>>         aDict associationsDo:
>>                 [:x |
>>                 (newDictionary includesKey: x key)
>>                         ifTrue: [self error: 'Duplicate key: ', x key
>> printString]
>> +                       ifFalse: [newDictionary add: x copy]].
>> -                       ifFalse: [newDictionary add: x]].
>>         ^ newDictionary
>>
>>  "      NewDictionary newFrom: {1->#a. 2->#b. 3->#c}
>>         {1->#a. 2->#b. 3->#c} as: NewDictionary
>>         NewDictionary newFrom: {1->#a. 2->#b. 1->#c}
>>         {1->#a. 2->#b. 1->#c} as: NewDictionary
>>  "!
>>
>> Item was added:
>> + ----- Method: WeakRegistry class>>migrateOldRegistries (in category
>> 'migrating registry') -----
>> + migrateOldRegistries
>> +       Smalltalk at: #WeakFinalizationRegistry ifAbsent: [ ^ self
>> "already done" ].
>> +
>> +       Smalltalk recreateSpecialObjectsArray.
>> +       WeakArray restartFinalizationProcess.
>> +
>> +       Smalltalk garbageCollect; garbageCollect.
>> +
>> +       "leave no chance to interrupt migration"
>> +       Compiler evaluate: '
>> +       [ | old new oldClass newClass |
>> +               old := OrderedCollection new.
>> +               new := OrderedCollection new.
>> +               WeakRegistry allInstancesDo: [:registry | | newr |
>> +                       old add: registry.
>> +                       newr := WeakFinalizationRegistry basicNew
>> initialize.
>> +                       registry migrateTo: newr.
>> +                       new add: newr ].
>> +               old asArray elementsForwardIdentityTo: new asArray.
>> +
>> +               oldClass := WeakRegistry.
>> +               newClass := WeakFinalizationRegistry.
>> +
>> +               Smalltalk forgetClass: newClass logged: false.
>> +               newClass superclass removeSubclass: newClass.
>> +               newClass setName: #WeakRegistry.
>> +               oldClass becomeForward: newClass.
>> +       ] forkAt: Processor highestPriority.
>> +       '.
>> + !
>>
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Collections-fbs.482.mcz

Bert Freudenberg
In reply to this post by Levente Uzonyi-2

On 03.08.2012, at 21:19, Levente Uzonyi wrote:

> On Fri, 3 Aug 2012, Frank Shearar wrote:
>
>> On 3 August 2012 21:27,  <[hidden email]> wrote:
>>>
>>> + ----- Method: WeakRegistry class>>migrateOldRegistries (in category 'migrating registry') -----
>>> + migrateOldRegistries
>>
>> Grr. Ael's commit didn't change this method, and I merged it in, so I
>> don't know why it got added. Seperate commit re-removes it.
>
> It keeps sneaking back every once in a while. We should find the reason why it's happening.
>
> Levente


Yep. Very curious.

- Bert -