The Trunk: Kernel-nice.746.mcz

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

The Trunk: Kernel-nice.746.mcz

commits-2
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.746.mcz

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

Name: Kernel-nice.746
Author: nice
Time: 10 March 2013, 7:52:48.738 pm
UUID: 0f9d411b-68a9-49eb-b37a-1bc4fb8fa36d
Ancestors: Kernel-bf.744

Fix ClassBuilder which previously failed to flush the cache of old CompiledMethod when the class changes of format.
This failure to invoke primitive 116 can lead to COG VM crash (a cogit jitted method is not unlinked).
This does not affect old interpreter which clear the caches thru primitive 119.
It is essential that the newClass points to identity-preserved CompiledMethods of oldClass methodDictionary before recompiling so that primitive 116 be correctly invoked, particularly we must not clear methodDictionary with a MethodDictionary new..

=============== Diff against Kernel-bf.744 ===============

Item was changed:
  ----- Method: ClassBuilder>>newSubclassOf:type:instanceVariables:from: (in category 'class definition') -----
  newSubclassOf: newSuper type: type instanceVariables: instVars from: oldClass
  "Create a new subclass of the given superclass with the given specification."
  | newFormat newClass |
  "Compute the format of the new class"
  newFormat :=
  self computeFormat: type
  instSize: instVars size
  forSuper: newSuper
  ccIndex: (oldClass ifNil:[0] ifNotNil:[oldClass indexIfCompact]).
 
  newFormat == nil ifTrue:[^nil].
 
  (oldClass == nil or:[oldClass isMeta not])
  ifTrue:[newClass := self privateNewSubclassOf: newSuper from: oldClass]
  ifFalse:[newClass := oldClass clone].
 
  newClass
  superclass: newSuper
+ methodDictionary: (oldClass ifNil: [MethodDictionary new] ifNotNil: [oldClass methodDict copy])
- methodDictionary: MethodDictionary new
  format: newFormat;
  setInstVarNames: instVars.
 
  oldClass ifNotNil:[
  newClass organization: oldClass organization.
  "Recompile the new class"
  oldClass hasMethods
  ifTrue:[newClass compileAllFrom: oldClass].
 
  oldClass hasTraitComposition ifTrue: [
  newClass setTraitComposition: oldClass traitComposition copyTraitExpression ].
  oldClass class hasTraitComposition ifTrue: [
  newClass class setTraitComposition: oldClass class traitComposition copyTraitExpression ].
 
  self recordClass: oldClass replacedBy: newClass.
  ].
 
  (oldClass == nil or:[oldClass isObsolete not])
  ifTrue:[newSuper addSubclass: newClass]
  ifFalse:[newSuper addObsoleteSubclass: newClass].
 
  ^newClass!

Item was changed:
  ----- Method: ClassBuilder>>privateNewSubclassOf:from: (in category 'private') -----
  privateNewSubclassOf: newSuper from: oldClass
  "Create a new meta and non-meta subclass of newSuper using oldClass as template"
  "WARNING: This method does not preserve the superclass/subclass invariant!!"
  | newSuperMeta oldMeta newMeta |
  oldClass ifNil:[^self privateNewSubclassOf: newSuper].
  newSuperMeta := newSuper ifNil:[Class] ifNotNil:[newSuper class].
  oldMeta := oldClass class.
  newMeta := oldMeta clone.
  newMeta
  superclass: newSuperMeta
+ methodDictionary: oldMeta methodDict copy
- methodDictionary: MethodDictionary new
  format: (self computeFormat: oldMeta typeOfClass
  instSize: oldMeta instVarNames size
  forSuper: newSuperMeta
  ccIndex: 0);
  setInstVarNames: oldMeta instVarNames;
  organization: oldMeta organization.
  "Recompile the meta class"
  oldMeta hasMethods
  ifTrue:[newMeta compileAllFrom: oldMeta].
  "Record the meta class change"
  self recordClass: oldMeta replacedBy: newMeta.
  "And create a new instance"
  ^newMeta adoptInstance: oldClass from: oldMeta!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-nice.746.mcz

David T. Lewis
On Sun, Mar 10, 2013 at 06:53:11PM +0000, [hidden email] wrote:

> Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
> http://source.squeak.org/trunk/Kernel-nice.746.mcz
>
> ==================== Summary ====================
>
> Name: Kernel-nice.746
> Author: nice
> Time: 10 March 2013, 7:52:48.738 pm
> UUID: 0f9d411b-68a9-49eb-b37a-1bc4fb8fa36d
> Ancestors: Kernel-bf.744
>
> Fix ClassBuilder which previously failed to flush the cache of old CompiledMethod when the class changes of format.
> This failure to invoke primitive 116 can lead to COG VM crash (a cogit jitted method is not unlinked).
> This does not affect old interpreter which clear the caches thru primitive 119.
> It is essential that the newClass points to identity-preserved CompiledMethods of oldClass methodDictionary before recompiling so that primitive 116 be correctly invoked, particularly we must not clear methodDictionary with a MethodDictionary new..
>

Really good job of debugging to find this problem and fix it :)

Dave


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-nice.746.mcz

Nicolas Cellier
2013/3/10 David T. Lewis <[hidden email]>:

> On Sun, Mar 10, 2013 at 06:53:11PM +0000, [hidden email] wrote:
>> Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
>> http://source.squeak.org/trunk/Kernel-nice.746.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Kernel-nice.746
>> Author: nice
>> Time: 10 March 2013, 7:52:48.738 pm
>> UUID: 0f9d411b-68a9-49eb-b37a-1bc4fb8fa36d
>> Ancestors: Kernel-bf.744
>>
>> Fix ClassBuilder which previously failed to flush the cache of old CompiledMethod when the class changes of format.
>> This failure to invoke primitive 116 can lead to COG VM crash (a cogit jitted method is not unlinked).
>> This does not affect old interpreter which clear the caches thru primitive 119.
>> It is essential that the newClass points to identity-preserved CompiledMethods of oldClass methodDictionary before recompiling so that primitive 116 be correctly invoked, particularly we must not clear methodDictionary with a MethodDictionary new..
>>
>
> Really good job of debugging to find this problem and fix it :)
>
> Dave
>

:(
Il ne faut pas vendre la peau de l'ours avant de l'avoir tué.
My last attempt to update a Squeak 4.4 image just failed while loading
Compiler-nice.256...

Nicolas

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-nice.746.mcz

David T. Lewis
On Sun, Mar 10, 2013 at 09:01:59PM +0100, Nicolas Cellier wrote:

> 2013/3/10 David T. Lewis <[hidden email]>:
> > On Sun, Mar 10, 2013 at 06:53:11PM +0000, [hidden email] wrote:
> >> Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
> >> http://source.squeak.org/trunk/Kernel-nice.746.mcz
> >>
> >> ==================== Summary ====================
> >>
> >> Name: Kernel-nice.746
> >> Author: nice
> >> Time: 10 March 2013, 7:52:48.738 pm
> >> UUID: 0f9d411b-68a9-49eb-b37a-1bc4fb8fa36d
> >> Ancestors: Kernel-bf.744
> >>
> >> Fix ClassBuilder which previously failed to flush the cache of old CompiledMethod when the class changes of format.
> >> This failure to invoke primitive 116 can lead to COG VM crash (a cogit jitted method is not unlinked).
> >> This does not affect old interpreter which clear the caches thru primitive 119.
> >> It is essential that the newClass points to identity-preserved CompiledMethods of oldClass methodDictionary before recompiling so that primitive 116 be correctly invoked, particularly we must not clear methodDictionary with a MethodDictionary new..
> >>
> >
> > Really good job of debugging to find this problem and fix it :)
> >
> > Dave
> >
>
> :(
> Il ne faut pas vendre la peau de l'ours avant de l'avoir tu?.
> My last attempt to update a Squeak 4.4 image just failed while loading
> Compiler-nice.256...
>
> Nicolas

Well, I see that the bear is putting up a good fight ;)

Dave


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-nice.746.mcz

Nicolas Cellier
2013/3/10 David T. Lewis <[hidden email]>:

> On Sun, Mar 10, 2013 at 09:01:59PM +0100, Nicolas Cellier wrote:
>> 2013/3/10 David T. Lewis <[hidden email]>:
>> > On Sun, Mar 10, 2013 at 06:53:11PM +0000, [hidden email] wrote:
>> >> Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
>> >> http://source.squeak.org/trunk/Kernel-nice.746.mcz
>> >>
>> >> ==================== Summary ====================
>> >>
>> >> Name: Kernel-nice.746
>> >> Author: nice
>> >> Time: 10 March 2013, 7:52:48.738 pm
>> >> UUID: 0f9d411b-68a9-49eb-b37a-1bc4fb8fa36d
>> >> Ancestors: Kernel-bf.744
>> >>
>> >> Fix ClassBuilder which previously failed to flush the cache of old CompiledMethod when the class changes of format.
>> >> This failure to invoke primitive 116 can lead to COG VM crash (a cogit jitted method is not unlinked).
>> >> This does not affect old interpreter which clear the caches thru primitive 119.
>> >> It is essential that the newClass points to identity-preserved CompiledMethods of oldClass methodDictionary before recompiling so that primitive 116 be correctly invoked, particularly we must not clear methodDictionary with a MethodDictionary new..
>> >>
>> >
>> > Really good job of debugging to find this problem and fix it :)
>> >
>> > Dave
>> >
>>
>> :(
>> Il ne faut pas vendre la peau de l'ours avant de l'avoir tu?.
>> My last attempt to update a Squeak 4.4 image just failed while loading
>> Compiler-nice.256...
>>
>> Nicolas
>
> Well, I see that the bear is putting up a good fight ;)
>
> Dave
>

Ah ah, it could be that the old methods are re-jitted before we end
the compilation of newClass.
I put a super hammer Object flushCache in ClassBuilder>>mutate:to: and
the update went well.
I don't know how many attempts are ncessary to prove the theory...

Nicolas