[Glass] recompiling sortBlocks - after upgrade to 3.3.0 from 3.2.4
Paul DeBruicker via Glass
glass at lists.gemtalksystems.com
Fri Feb 19 11:31:08 PST 2016
Thanks Dale & Paul.
There were 27 'bad blocks'. I ended up doing this:
sortBlockRepairScript
| badsByBlock index |
badsByBlock := IdentityDictionary new.
SortedCollection allInstances
do: [ :ea |
[ ea indexOf: 1 ]
on: Error
do: [ :ex |
ea sortBlock isBlock
ifTrue: [ (badsByBlock at: ea sortBlock ifAbsentPut: [ Array new
]) add: ea ] ] ].
index := 1.
badsByBlock
keysAndValuesDo: [ :badBlock :instancesWithBadBlock |
instancesWithBadBlock
do: [ :ea |
| sBlock val str |
sBlock := ea sortBlock.
str := sBlock _sourceString.
val := str evaluate.
ea _sortBlock: val.
index \\ 100 = 0
ifTrue: [
System commitTransaction.
GsFile gciLogServer: 'commit ' , index asString ].
index := index + 1 ].
GsFile gciLogServer: 'next block ' , index asString ].
GsFile gciLogServer: 'done ' , index asString.
System commitTransaction
Initially I would get a "VM temporary object memory is full , native code
space full" error in topaz so I added all the commits and it worked fine.
Thanks for your help.
Paul
GLASS mailing list wrote
> HI Paul,
>
> Migrating the SortedCollection instances won't help because it is a
> block instance that needs to be migrated. The migration to the new block
> is to simply recompile it from source so that the old instances are no
> longer referenced. Problem is, SortedCollection instances refer to
> instances of blocks that wouldn't be de-referenced simply by recompiling
> code. The fix is to gather the bad instances (likely only one canonical
> instance) and replace the sort block with the sort block that is now
> assigned to new instances.
>
> | badsByBlock newBlock |
> badsByBlock := IdentityDictionary new.
> SortedCollection allInstances do: [:dict :ea |
> [ ea indexOf: 1]
> on: Error
> do: [:ex |
> (badsByBlock at: ea sortBlock ifAbsentPut: [Array new])
> add: ea.
> ].
> ].
> badsByBlock size > 1 ifTrue: [self error: 'sorry, this can't handle
> the SC instances that have custom blocks'].
> newBlock := SortedCollection new sortBlock.
> badsByBlock do: [:bads |
> bads do: [:ea | ea sortBlock: newBlock ].
> ].
> ^badsByBlock
>
> The code above is similar to what you might do. You might have to
> compensate for missing accessors if #sortBlock or #sortBlock: don't
> exist. The code will warn that it can't fix the problem if custom sort
> blocks are discovered. If there are custom sort blocks then you can try
> to assign the recompiled form of the block source code.
>
> Regards,
>
> Paul Baumann
> On Career Break
>
>
>
> On 02/19/2016 11:24 AM, Paul DeBruicker via Glass wrote:If #sortBlock is
> not implemented then workaround with #instVarAt:. If #sortBlock: is not
> implemented then workaround with #instVarAt:put:.
>> Of the 43,786 instances of SortedCollection in the stone, 43,654 exhibit
>> the
>> error.
>>
>>
>> (SortedCollection allInstances select:[:ea |
>> |keep |
>> keep:=false.
>> [ ea indexOf: 1] on: Error do:[:ex | keep:=true].
>> keep]) size
>>
>>
>>
>>
>>
>> GLASS mailing list wrote
>>> Hi=
>>>
>>> I'm having trouble getting rid of the error:
>>>
>>>
>>> Cannot execute method, 'GsNMethod with oop 2909441 needs recompile'
>>>
>>>
>>>
>>>
>>> The method it is referring to is SortedCollection class>>#new
>>>
>>> But recompiling the SortedCollection class & committing doesn't fix
>>> things
>>> so its probably the sortBlock for that instance that needs recompiled
>>> and
>>> I'm unsure how to do that safely.
>>>
>>> I'm also seeing the error in another method that also defines a
>>> sortBlock
>>> so I'm guessing there is a step I missed in the upgrade but I can't find
>>> it in the docs.
>>>
>>>
>>> How should I go about recompiling the sortBlocks? Or is there something
>>> else I should do to fix this?
>>>
>>>
>>> Thanks in advance
>>>
>>>
>>> Paul
>>>
>>> _______________________________________________
>>> Glass mailing list
>>> Glass at .gemtalksystems
>>> http://lists.gemtalksystems.com/mailman/listinfo/glass
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://forum.world.st/recompiling-sortBlocks-after-upgrade-to-3-3-0-from-3-2-4-tp4879002p4879012.html
>> Sent from the GLASS mailing list archive at Nabble.com.
>> _______________________________________________
>> Glass mailing list
>>
> Glass at .gemtalksystems
>> http://lists.gemtalksystems.com/mailman/listinfo/glass
>
> _______________________________________________
> Glass mailing list
> Glass at .gemtalksystems
> http://lists.gemtalksystems.com/mailman/listinfo/glass
--
View this message in context: http://forum.world.st/recompiling-sortBlocks-after-upgrade-to-3-3-0-from-3-2-4-tp4879002p4879065.html
Sent from the GLASS mailing list archive at Nabble.com.
More information about the Glass
mailing list