[Glass] recompiling sortBlocks - after upgrade to 3.3.0 from 3.2.4

Paul Baumann via Glass glass at lists.gemtalksystems.com
Fri Feb 19 09:52:43 PST 2016

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 ].

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.


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 lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/glass

More information about the Glass mailing list