recompiling sortBlocks - after upgrade to 3.3.0 from 3.2.4

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

recompiling sortBlocks - after upgrade to 3.3.0 from 3.2.4

GLASS mailing list
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
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: recompiling sortBlocks - after upgrade to 3.3.0 from 3.2.4

Paul DeBruicker
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
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: recompiling sortBlocks - after upgrade to 3.3.0 from 3.2.4

GLASS mailing list
In reply to this post by GLASS mailing list
Paul,

Very good question.

We document a $GEMSTONE/bin/postconv script for use in recompiling the
sort blocks in the 2.4 to 3.3 section of the installation guide[1] and
after a quick read of the script, there doesn't appear to be any
2.4-specific operations in the script so it should work for a 3.2 to 3.3
upgrade as well.

The postconv script arranges to run multiple gems in parallel to do the
conversion with cache warmers and the whole nine yards, but basic
operations can be distilled to the following for each SortedCollection
instance:

   | sc sortBlock val cls str val |
   sc := "sortedcollection instance".
   sortBlock := sc sortBlock.
   str := sortBlock _sourceString.
   val := str evaluate.
   sc _sortBlock: val

Now this only works for simple blocks ... if the blocks are more
complicated then you will have to provide the proper evaluation context
for the `evaluate` call ... I can help with that if necessary.

The script hasn't been incorporated into GsDevKit_home, but I think it
would be a good idea[2].

Dale

[1]
https://downloads.gemtalksystems.com/docs/GemStone64/3.3.x/GS64-InstallGuide-Linux-3.3/3-Conversion.htm#pgfId-1053114
[2] https://github.com/GsDevKit/GsDevKit_home/issues/70

On 02/19/2016 08:13 AM, PAUL DEBRUICKER via Glass 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
> [hidden email]
> http://lists.gemtalksystems.com/mailman/listinfo/glass

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: recompiling sortBlocks - after upgrade to 3.3.0 from 3.2.4

GLASS mailing list
In reply to this post by Paul DeBruicker
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@.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
> [hidden email]
> http://lists.gemtalksystems.com/mailman/listinfo/glass

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: recompiling sortBlocks - after upgrade to 3.3.0 from 3.2.4

Paul DeBruicker
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@.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
> [hidden email]
> http://lists.gemtalksystems.com/mailman/listinfo/glass

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass