The Trunk: Traits-nice.299.mcz

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

The Trunk: Traits-nice.299.mcz

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

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

Name: Traits-nice.299
Author: nice
Time: 20 September 2013, 9:45:04.474 pm
UUID: d6c18da8-7e93-4bcc-b94e-7f67426a2965
Ancestors: Traits-nice.298

Don't pass a category to a Compiler, classifying is not its job.

=============== Diff against Traits-nice.298 ===============

Item was changed:
  ----- Method: ClassDescription>>traitAddSelector:withMethod: (in category '*Traits-NanoKernel') -----
  traitAddSelector: selector withMethod: traitMethod
  "Add a method inherited from a trait.
  Recompiles to avoid sharing and implement aliasing."
  | oldMethod source methodNode newMethod originalSelector |
  oldMethod := self compiledMethodAt: selector ifAbsent:[nil].
  oldMethod ifNotNil:[
  "The following is an important optimization as it prevents exponential
  growth in recompilation. If T1 is used by T2 and T2 by T3 then (without
  this optimization) any change in T1 would cause all methods in T2 to be
  recompiled and each recompilation of a method in T2 would cause T3
  to be fully recompiled. The test eliminates all such situations."
  (oldMethod sameTraitCodeAs: traitMethod) ifTrue:[^oldMethod].
  ].
  originalSelector := traitMethod selector.
  source := traitMethod methodClass sourceCodeAt: originalSelector.
  originalSelector == selector ifFalse:[
  "Replace source selectors for aliases"
  source := self replaceSelector: originalSelector withAlias: selector in: source.
  ].
  methodNode := self newCompiler
+ compile: source in: self notifying: nil ifFail:[^nil].
- compile: source in: self classified: nil notifying: nil ifFail:[^nil].
  newMethod := methodNode generate: self defaultMethodTrailer.
  newMethod putSource: source fromParseNode: methodNode inFile: 2
  withPreamble: [:f | f cr; nextPut: $!!; nextChunkPut: 'Trait method'; cr].
  newMethod originalTraitMethod: traitMethod.
  ^super addSelectorSilently: selector withMethod: newMethod.!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Traits-nice.299.mcz

Chris Muller-3
I would expect these changes to break a lot of code..

On Fri, Sep 20, 2013 at 2:45 PM,  <[hidden email]> wrote:

> Nicolas Cellier uploaded a new version of Traits to project The Trunk:
> http://source.squeak.org/trunk/Traits-nice.299.mcz
>
> ==================== Summary ====================
>
> Name: Traits-nice.299
> Author: nice
> Time: 20 September 2013, 9:45:04.474 pm
> UUID: d6c18da8-7e93-4bcc-b94e-7f67426a2965
> Ancestors: Traits-nice.298
>
> Don't pass a category to a Compiler, classifying is not its job.
>
> =============== Diff against Traits-nice.298 ===============
>
> Item was changed:
>   ----- Method: ClassDescription>>traitAddSelector:withMethod: (in category '*Traits-NanoKernel') -----
>   traitAddSelector: selector withMethod: traitMethod
>         "Add a method inherited from a trait.
>         Recompiles to avoid sharing and implement aliasing."
>         | oldMethod source methodNode newMethod originalSelector |
>         oldMethod := self compiledMethodAt: selector ifAbsent:[nil].
>         oldMethod ifNotNil:[
>                 "The following is an important optimization as it prevents exponential
>                 growth in recompilation. If T1 is used by T2 and T2 by T3 then (without
>                 this optimization) any change in T1 would cause all methods in T2 to be
>                 recompiled and each recompilation of a method in T2 would cause T3
>                 to be fully recompiled. The test eliminates all such situations."
>                 (oldMethod sameTraitCodeAs: traitMethod) ifTrue:[^oldMethod].
>         ].
>         originalSelector := traitMethod selector.
>         source := traitMethod methodClass sourceCodeAt: originalSelector.
>         originalSelector == selector ifFalse:[
>                 "Replace source selectors for aliases"
>                 source := self replaceSelector: originalSelector withAlias: selector in: source.
>         ].
>         methodNode := self newCompiler
> +               compile: source in: self notifying: nil ifFail:[^nil].
> -               compile: source in: self classified: nil notifying: nil ifFail:[^nil].
>         newMethod := methodNode generate: self defaultMethodTrailer.
>         newMethod putSource: source fromParseNode: methodNode inFile: 2
>                 withPreamble: [:f | f cr; nextPut: $!!; nextChunkPut: 'Trait method'; cr].
>         newMethod originalTraitMethod: traitMethod.
>         ^super addSelectorSilently: selector withMethod: newMethod.!
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Traits-nice.299.mcz

Frank Shearar-3
For instance: http://build.squeak.org/job/SqueakTrunk/536/console

Look for

Exception MessageNotUnderstood raised:
Behavior class>>compile:notifying:trailer:ifFail:

I don't know where it's coming from yet - that's the entire stack trace.

frank


On 21 September 2013 18:17, Chris Muller <[hidden email]> wrote:

> I would expect these changes to break a lot of code..
>
> On Fri, Sep 20, 2013 at 2:45 PM,  <[hidden email]> wrote:
>> Nicolas Cellier uploaded a new version of Traits to project The Trunk:
>> http://source.squeak.org/trunk/Traits-nice.299.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Traits-nice.299
>> Author: nice
>> Time: 20 September 2013, 9:45:04.474 pm
>> UUID: d6c18da8-7e93-4bcc-b94e-7f67426a2965
>> Ancestors: Traits-nice.298
>>
>> Don't pass a category to a Compiler, classifying is not its job.
>>
>> =============== Diff against Traits-nice.298 ===============
>>
>> Item was changed:
>>   ----- Method: ClassDescription>>traitAddSelector:withMethod: (in category '*Traits-NanoKernel') -----
>>   traitAddSelector: selector withMethod: traitMethod
>>         "Add a method inherited from a trait.
>>         Recompiles to avoid sharing and implement aliasing."
>>         | oldMethod source methodNode newMethod originalSelector |
>>         oldMethod := self compiledMethodAt: selector ifAbsent:[nil].
>>         oldMethod ifNotNil:[
>>                 "The following is an important optimization as it prevents exponential
>>                 growth in recompilation. If T1 is used by T2 and T2 by T3 then (without
>>                 this optimization) any change in T1 would cause all methods in T2 to be
>>                 recompiled and each recompilation of a method in T2 would cause T3
>>                 to be fully recompiled. The test eliminates all such situations."
>>                 (oldMethod sameTraitCodeAs: traitMethod) ifTrue:[^oldMethod].
>>         ].
>>         originalSelector := traitMethod selector.
>>         source := traitMethod methodClass sourceCodeAt: originalSelector.
>>         originalSelector == selector ifFalse:[
>>                 "Replace source selectors for aliases"
>>                 source := self replaceSelector: originalSelector withAlias: selector in: source.
>>         ].
>>         methodNode := self newCompiler
>> +               compile: source in: self notifying: nil ifFail:[^nil].
>> -               compile: source in: self classified: nil notifying: nil ifFail:[^nil].
>>         newMethod := methodNode generate: self defaultMethodTrailer.
>>         newMethod putSource: source fromParseNode: methodNode inFile: 2
>>                 withPreamble: [:f | f cr; nextPut: $!!; nextChunkPut: 'Trait method'; cr].
>>         newMethod originalTraitMethod: traitMethod.
>>         ^super addSelectorSilently: selector withMethod: newMethod.!
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Traits-nice.299.mcz

Nicolas Cellier
Please send reports, I'm all ear.
Though I'm not aware of any raised: no sender no implementor in my image.
Or is it raised ? It's a Morph thing...


2013/9/21 Frank Shearar <[hidden email]>
For instance: http://build.squeak.org/job/SqueakTrunk/536/console

Look for

Exception MessageNotUnderstood raised:
Behavior class>>compile:notifying:trailer:ifFail:

I don't know where it's coming from yet - that's the entire stack trace.

frank


On 21 September 2013 18:17, Chris Muller <[hidden email]> wrote:
> I would expect these changes to break a lot of code..
>
> On Fri, Sep 20, 2013 at 2:45 PM,  <[hidden email]> wrote:
>> Nicolas Cellier uploaded a new version of Traits to project The Trunk:
>> http://source.squeak.org/trunk/Traits-nice.299.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Traits-nice.299
>> Author: nice
>> Time: 20 September 2013, 9:45:04.474 pm
>> UUID: d6c18da8-7e93-4bcc-b94e-7f67426a2965
>> Ancestors: Traits-nice.298
>>
>> Don't pass a category to a Compiler, classifying is not its job.
>>
>> =============== Diff against Traits-nice.298 ===============
>>
>> Item was changed:
>>   ----- Method: ClassDescription>>traitAddSelector:withMethod: (in category '*Traits-NanoKernel') -----
>>   traitAddSelector: selector withMethod: traitMethod
>>         "Add a method inherited from a trait.
>>         Recompiles to avoid sharing and implement aliasing."
>>         | oldMethod source methodNode newMethod originalSelector |
>>         oldMethod := self compiledMethodAt: selector ifAbsent:[nil].
>>         oldMethod ifNotNil:[
>>                 "The following is an important optimization as it prevents exponential
>>                 growth in recompilation. If T1 is used by T2 and T2 by T3 then (without
>>                 this optimization) any change in T1 would cause all methods in T2 to be
>>                 recompiled and each recompilation of a method in T2 would cause T3
>>                 to be fully recompiled. The test eliminates all such situations."
>>                 (oldMethod sameTraitCodeAs: traitMethod) ifTrue:[^oldMethod].
>>         ].
>>         originalSelector := traitMethod selector.
>>         source := traitMethod methodClass sourceCodeAt: originalSelector.
>>         originalSelector == selector ifFalse:[
>>                 "Replace source selectors for aliases"
>>                 source := self replaceSelector: originalSelector withAlias: selector in: source.
>>         ].
>>         methodNode := self newCompiler
>> +               compile: source in: self notifying: nil ifFail:[^nil].
>> -               compile: source in: self classified: nil notifying: nil ifFail:[^nil].
>>         newMethod := methodNode generate: self defaultMethodTrailer.
>>         newMethod putSource: source fromParseNode: methodNode inFile: 2
>>                 withPreamble: [:f | f cr; nextPut: $!!; nextChunkPut: 'Trait method'; cr].
>>         newMethod originalTraitMethod: traitMethod.
>>         ^super addSelectorSilently: selector withMethod: newMethod.!
>>
>>
>




Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Traits-nice.299.mcz

Chris Muller-3
I was too afraid to update my image because I need stability at the
moment so I haven't tested or reviewed it closely yet.

What's got me confused is that we've just changed some age-old API's
because, suddenly, after all these years, someone decided it wasn't
the Compiler's responsibility to classify..?  To compile something we
have to specify the Class to compile it in, and all classes have
categories / protocols, so isn't it convenient to do that during
compilation?  What is responsible for classifying now and what is the
new API for code-generators to classify the methods they generate?

On Sat, Sep 21, 2013 at 2:52 PM, Nicolas Cellier
<[hidden email]> wrote:

> Please send reports, I'm all ear.
> Though I'm not aware of any raised: no sender no implementor in my image.
> Or is it raised ? It's a Morph thing...
>
>
> 2013/9/21 Frank Shearar <[hidden email]>
>>
>> For instance: http://build.squeak.org/job/SqueakTrunk/536/console
>>
>> Look for
>>
>> Exception MessageNotUnderstood raised:
>> Behavior class>>compile:notifying:trailer:ifFail:
>>
>> I don't know where it's coming from yet - that's the entire stack trace.
>>
>> frank
>>
>>
>> On 21 September 2013 18:17, Chris Muller <[hidden email]> wrote:
>> > I would expect these changes to break a lot of code..
>> >
>> > On Fri, Sep 20, 2013 at 2:45 PM,  <[hidden email]> wrote:
>> >> Nicolas Cellier uploaded a new version of Traits to project The Trunk:
>> >> http://source.squeak.org/trunk/Traits-nice.299.mcz
>> >>
>> >> ==================== Summary ====================
>> >>
>> >> Name: Traits-nice.299
>> >> Author: nice
>> >> Time: 20 September 2013, 9:45:04.474 pm
>> >> UUID: d6c18da8-7e93-4bcc-b94e-7f67426a2965
>> >> Ancestors: Traits-nice.298
>> >>
>> >> Don't pass a category to a Compiler, classifying is not its job.
>> >>
>> >> =============== Diff against Traits-nice.298 ===============
>> >>
>> >> Item was changed:
>> >>   ----- Method: ClassDescription>>traitAddSelector:withMethod: (in
>> >> category '*Traits-NanoKernel') -----
>> >>   traitAddSelector: selector withMethod: traitMethod
>> >>         "Add a method inherited from a trait.
>> >>         Recompiles to avoid sharing and implement aliasing."
>> >>         | oldMethod source methodNode newMethod originalSelector |
>> >>         oldMethod := self compiledMethodAt: selector ifAbsent:[nil].
>> >>         oldMethod ifNotNil:[
>> >>                 "The following is an important optimization as it
>> >> prevents exponential
>> >>                 growth in recompilation. If T1 is used by T2 and T2 by
>> >> T3 then (without
>> >>                 this optimization) any change in T1 would cause all
>> >> methods in T2 to be
>> >>                 recompiled and each recompilation of a method in T2
>> >> would cause T3
>> >>                 to be fully recompiled. The test eliminates all such
>> >> situations."
>> >>                 (oldMethod sameTraitCodeAs: traitMethod)
>> >> ifTrue:[^oldMethod].
>> >>         ].
>> >>         originalSelector := traitMethod selector.
>> >>         source := traitMethod methodClass sourceCodeAt:
>> >> originalSelector.
>> >>         originalSelector == selector ifFalse:[
>> >>                 "Replace source selectors for aliases"
>> >>                 source := self replaceSelector: originalSelector
>> >> withAlias: selector in: source.
>> >>         ].
>> >>         methodNode := self newCompiler
>> >> +               compile: source in: self notifying: nil ifFail:[^nil].
>> >> -               compile: source in: self classified: nil notifying: nil
>> >> ifFail:[^nil].
>> >>         newMethod := methodNode generate: self defaultMethodTrailer.
>> >>         newMethod putSource: source fromParseNode: methodNode inFile: 2
>> >>                 withPreamble: [:f | f cr; nextPut: $!!; nextChunkPut:
>> >> 'Trait method'; cr].
>> >>         newMethod originalTraitMethod: traitMethod.
>> >>         ^super addSelectorSilently: selector withMethod: newMethod.!
>> >>
>> >>
>> >
>>
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Traits-nice.299.mcz

Nicolas Cellier
No, the Compiler did not classify for ages...
The Compiler does not install the generated CompiledMethod, it either answer it, or execute it.
So I did not change much, I just avoided to pass an information that the Compiler does not need.
In fact, the category was used only in one place: to pass it to a SyntaxErrorNotification, then to a SyntaxError, just to display the category in the pop up window (the single message in message list...).
For backward compatibility it's possible to add the messages in *deprecated protocol, but since there are many messages, I'd like to ear which one exactly...


2013/9/21 Chris Muller <[hidden email]>
I was too afraid to update my image because I need stability at the
moment so I haven't tested or reviewed it closely yet.

What's got me confused is that we've just changed some age-old API's
because, suddenly, after all these years, someone decided it wasn't
the Compiler's responsibility to classify..?  To compile something we
have to specify the Class to compile it in, and all classes have
categories / protocols, so isn't it convenient to do that during
compilation?  What is responsible for classifying now and what is the
new API for code-generators to classify the methods they generate?

On Sat, Sep 21, 2013 at 2:52 PM, Nicolas Cellier
<[hidden email]> wrote:
> Please send reports, I'm all ear.
> Though I'm not aware of any raised: no sender no implementor in my image.
> Or is it raised ? It's a Morph thing...
>
>
> 2013/9/21 Frank Shearar <[hidden email]>
>>
>> For instance: http://build.squeak.org/job/SqueakTrunk/536/console
>>
>> Look for
>>
>> Exception MessageNotUnderstood raised:
>> Behavior class>>compile:notifying:trailer:ifFail:
>>
>> I don't know where it's coming from yet - that's the entire stack trace.
>>
>> frank
>>
>>
>> On 21 September 2013 18:17, Chris Muller <[hidden email]> wrote:
>> > I would expect these changes to break a lot of code..
>> >
>> > On Fri, Sep 20, 2013 at 2:45 PM,  <[hidden email]> wrote:
>> >> Nicolas Cellier uploaded a new version of Traits to project The Trunk:
>> >> http://source.squeak.org/trunk/Traits-nice.299.mcz
>> >>
>> >> ==================== Summary ====================
>> >>
>> >> Name: Traits-nice.299
>> >> Author: nice
>> >> Time: 20 September 2013, 9:45:04.474 pm
>> >> UUID: d6c18da8-7e93-4bcc-b94e-7f67426a2965
>> >> Ancestors: Traits-nice.298
>> >>
>> >> Don't pass a category to a Compiler, classifying is not its job.
>> >>
>> >> =============== Diff against Traits-nice.298 ===============
>> >>
>> >> Item was changed:
>> >>   ----- Method: ClassDescription>>traitAddSelector:withMethod: (in
>> >> category '*Traits-NanoKernel') -----
>> >>   traitAddSelector: selector withMethod: traitMethod
>> >>         "Add a method inherited from a trait.
>> >>         Recompiles to avoid sharing and implement aliasing."
>> >>         | oldMethod source methodNode newMethod originalSelector |
>> >>         oldMethod := self compiledMethodAt: selector ifAbsent:[nil].
>> >>         oldMethod ifNotNil:[
>> >>                 "The following is an important optimization as it
>> >> prevents exponential
>> >>                 growth in recompilation. If T1 is used by T2 and T2 by
>> >> T3 then (without
>> >>                 this optimization) any change in T1 would cause all
>> >> methods in T2 to be
>> >>                 recompiled and each recompilation of a method in T2
>> >> would cause T3
>> >>                 to be fully recompiled. The test eliminates all such
>> >> situations."
>> >>                 (oldMethod sameTraitCodeAs: traitMethod)
>> >> ifTrue:[^oldMethod].
>> >>         ].
>> >>         originalSelector := traitMethod selector.
>> >>         source := traitMethod methodClass sourceCodeAt:
>> >> originalSelector.
>> >>         originalSelector == selector ifFalse:[
>> >>                 "Replace source selectors for aliases"
>> >>                 source := self replaceSelector: originalSelector
>> >> withAlias: selector in: source.
>> >>         ].
>> >>         methodNode := self newCompiler
>> >> +               compile: source in: self notifying: nil ifFail:[^nil].
>> >> -               compile: source in: self classified: nil notifying: nil
>> >> ifFail:[^nil].
>> >>         newMethod := methodNode generate: self defaultMethodTrailer.
>> >>         newMethod putSource: source fromParseNode: methodNode inFile: 2
>> >>                 withPreamble: [:f | f cr; nextPut: $!!; nextChunkPut:
>> >> 'Trait method'; cr].
>> >>         newMethod originalTraitMethod: traitMethod.
>> >>         ^super addSelectorSilently: selector withMethod: newMethod.!
>> >>
>> >>
>> >
>>
>
>
>
>




Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Traits-nice.299.mcz

Bob Arning-2
In reply to this post by Nicolas Cellier
I think the line

Exception MessageNotUnderstood raised:

means that MNU occurred (raised as in the java fanboy corruption of signal)

Probably like this (from debug log posted moments ago):

ClassDescription class(Object)>>doesNotUnderstand: #compile:notifying:trailer:ifFail:
    Receiver: ClassDescription
    Arguments and temporary variables:
        aMessage:     compile: 'compile: text classified: category withStamp: changeStamp n...etc...
        exception:     MessageNotUnderstood: ClassDescription class>>compile:notifying:trai...etc...
        resumeValue:     nil
    Receiver's instance variables:
        superclass:     Behavior
        methodDict:     a MethodDictionary(size 167)
        format:     140
        instanceVariables:     #('instanceVariables' 'organization')
        organization:     ('initialize-release' forgetDoIts obsolete superclass:methodDicti...etc...
        subclasses:     {TraitBehavior . Class . Metaclass}
        name:     #ClassDescription
        classPool:     a Dictionary(#TraitImpl->Trait )
        sharedPools:     nil
        environment:     Smalltalk
        category:     #'Kernel-Classes'

[] in MethodAddition>>createCompiledMethod
    Receiver: a MethodAddition
    Arguments and temporary variables:
<<error during printing>

Cheers,
Bob

On 9/21/13 3:52 PM, Nicolas Cellier wrote:
Please send reports, I'm all ear.
Though I'm not aware of any raised: no sender no implementor in my image.
Or is it raised ? It's a Morph thing...


2013/9/21 Frank Shearar <[hidden email]>
For instance: http://build.squeak.org/job/SqueakTrunk/536/console

Look for

Exception MessageNotUnderstood raised:
Behavior class>>compile:notifying:trailer:ifFail:

I don't know where it's coming from yet - that's the entire stack trace.

frank


On 21 September 2013 18:17, Chris Muller <[hidden email]> wrote:
> I would expect these changes to break a lot of code..
>
> On Fri, Sep 20, 2013 at 2:45 PM,  <[hidden email]> wrote:
>> Nicolas Cellier uploaded a new version of Traits to project The Trunk:
>> http://source.squeak.org/trunk/Traits-nice.299.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Traits-nice.299
>> Author: nice
>> Time: 20 September 2013, 9:45:04.474 pm
>> UUID: d6c18da8-7e93-4bcc-b94e-7f67426a2965
>> Ancestors: Traits-nice.298
>>
>> Don't pass a category to a Compiler, classifying is not its job.
>>
>> =============== Diff against Traits-nice.298 ===============
>>
>> Item was changed:
>>   ----- Method: ClassDescription>>traitAddSelector:withMethod: (in category '*Traits-NanoKernel') -----
>>   traitAddSelector: selector withMethod: traitMethod
>>         "Add a method inherited from a trait.
>>         Recompiles to avoid sharing and implement aliasing."
>>         | oldMethod source methodNode newMethod originalSelector |
>>         oldMethod := self compiledMethodAt: selector ifAbsent:[nil].
>>         oldMethod ifNotNil:[
>>                 "The following is an important optimization as it prevents exponential
>>                 growth in recompilation. If T1 is used by T2 and T2 by T3 then (without
>>                 this optimization) any change in T1 would cause all methods in T2 to be
>>                 recompiled and each recompilation of a method in T2 would cause T3
>>                 to be fully recompiled. The test eliminates all such situations."
>>                 (oldMethod sameTraitCodeAs: traitMethod) ifTrue:[^oldMethod].
>>         ].
>>         originalSelector := traitMethod selector.
>>         source := traitMethod methodClass sourceCodeAt: originalSelector.
>>         originalSelector == selector ifFalse:[
>>                 "Replace source selectors for aliases"
>>                 source := self replaceSelector: originalSelector withAlias: selector in: source.
>>         ].
>>         methodNode := self newCompiler
>> +               compile: source in: self notifying: nil ifFail:[^nil].
>> -               compile: source in: self classified: nil notifying: nil ifFail:[^nil].
>>         newMethod := methodNode generate: self defaultMethodTrailer.
>>         newMethod putSource: source fromParseNode: methodNode inFile: 2
>>                 withPreamble: [:f | f cr; nextPut: $!!; nextChunkPut: 'Trait method'; cr].
>>         newMethod originalTraitMethod: traitMethod.
>>         ^super addSelectorSilently: selector withMethod: newMethod.!
>>
>>
>





    



Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Traits-nice.299.mcz

Nicolas Cellier
Ah now I understand better thanks!
funny miss-interpretation...


2013/9/21 Bob Arning <[hidden email]>
I think the line

Exception MessageNotUnderstood raised:

means that MNU occurred (raised as in the java fanboy corruption of signal)

Probably like this (from debug log posted moments ago):

ClassDescription class(Object)>>doesNotUnderstand: #compile:notifying:trailer:ifFail:
    Receiver: ClassDescription
    Arguments and temporary variables:
        aMessage:     compile: 'compile: text classified: category withStamp: changeStamp n...etc...
        exception:     MessageNotUnderstood: ClassDescription class>>compile:notifying:trai...etc...
        resumeValue:     nil
    Receiver's instance variables:
        superclass:     Behavior
        methodDict:     a MethodDictionary(size 167)
        format:     140
        instanceVariables:     #('instanceVariables' 'organization')
        organization:     ('initialize-release' forgetDoIts obsolete superclass:methodDicti...etc...
        subclasses:     {TraitBehavior . Class . Metaclass}
        name:     #ClassDescription
        classPool:     a Dictionary(#TraitImpl->Trait )
        sharedPools:     nil
        environment:     Smalltalk
        category:     #'Kernel-Classes'

[] in MethodAddition>>createCompiledMethod
    Receiver: a MethodAddition
    Arguments and temporary variables:
<<error during printing>

Cheers,
Bob

On 9/21/13 3:52 PM, Nicolas Cellier wrote:
Please send reports, I'm all ear.
Though I'm not aware of any raised: no sender no implementor in my image.
Or is it raised ? It's a Morph thing...


2013/9/21 Frank Shearar <[hidden email]>
For instance: http://build.squeak.org/job/SqueakTrunk/536/console

Look for

Exception MessageNotUnderstood raised:
Behavior class>>compile:notifying:trailer:ifFail:

I don't know where it's coming from yet - that's the entire stack trace.

frank


On 21 September 2013 18:17, Chris Muller <[hidden email]> wrote:
> I would expect these changes to break a lot of code..
>
> On Fri, Sep 20, 2013 at 2:45 PM,  <[hidden email]> wrote:
>> Nicolas Cellier uploaded a new version of Traits to project The Trunk:
>> http://source.squeak.org/trunk/Traits-nice.299.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Traits-nice.299
>> Author: nice
>> Time: 20 September 2013, 9:45:04.474 pm
>> UUID: d6c18da8-7e93-4bcc-b94e-7f67426a2965
>> Ancestors: Traits-nice.298
>>
>> Don't pass a category to a Compiler, classifying is not its job.
>>
>> =============== Diff against Traits-nice.298 ===============
>>
>> Item was changed:
>>   ----- Method: ClassDescription>>traitAddSelector:withMethod: (in category '*Traits-NanoKernel') -----
>>   traitAddSelector: selector withMethod: traitMethod
>>         "Add a method inherited from a trait.
>>         Recompiles to avoid sharing and implement aliasing."
>>         | oldMethod source methodNode newMethod originalSelector |
>>         oldMethod := self compiledMethodAt: selector ifAbsent:[nil].
>>         oldMethod ifNotNil:[
>>                 "The following is an important optimization as it prevents exponential
>>                 growth in recompilation. If T1 is used by T2 and T2 by T3 then (without
>>                 this optimization) any change in T1 would cause all methods in T2 to be
>>                 recompiled and each recompilation of a method in T2 would cause T3
>>                 to be fully recompiled. The test eliminates all such situations."
>>                 (oldMethod sameTraitCodeAs: traitMethod) ifTrue:[^oldMethod].
>>         ].
>>         originalSelector := traitMethod selector.
>>         source := traitMethod methodClass sourceCodeAt: originalSelector.
>>         originalSelector == selector ifFalse:[
>>                 "Replace source selectors for aliases"
>>                 source := self replaceSelector: originalSelector withAlias: selector in: source.
>>         ].
>>         methodNode := self newCompiler
>> +               compile: source in: self notifying: nil ifFail:[^nil].
>> -               compile: source in: self classified: nil notifying: nil ifFail:[^nil].
>>         newMethod := methodNode generate: self defaultMethodTrailer.
>>         newMethod putSource: source fromParseNode: methodNode inFile: 2
>>                 withPreamble: [:f | f cr; nextPut: $!!; nextChunkPut: 'Trait method'; cr].
>>         newMethod originalTraitMethod: traitMethod.
>>         ^super addSelectorSilently: selector withMethod: newMethod.!
>>
>>
>





    







Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Traits-nice.299.mcz

Chris Muller-4
In reply to this post by Nicolas Cellier
On Sat, Sep 21, 2013 at 4:06 PM, Nicolas Cellier
<[hidden email]> wrote:

> No, the Compiler did not classify for ages...
> The Compiler does not install the generated CompiledMethod, it either answer
> it, or execute it.
> So I did not change much, I just avoided to pass an information that the
> Compiler does not need.
> In fact, the category was used only in one place: to pass it to a
> SyntaxErrorNotification, then to a SyntaxError, just to display the category
> in the pop up window (the single message in message list...).
> For backward compatibility it's possible to add the messages in *deprecated
> protocol, but since there are many messages, I'd like to ear which one
> exactly...

Ah, ok.  That's good to know, thanks.  It must be the *Class* (or
Behavior) that assumes responsibility for classifying, since he's the
one who has them.

> 2013/9/21 Chris Muller <[hidden email]>
>>
>> I was too afraid to update my image because I need stability at the
>> moment so I haven't tested or reviewed it closely yet.
>>
>> What's got me confused is that we've just changed some age-old API's
>> because, suddenly, after all these years, someone decided it wasn't
>> the Compiler's responsibility to classify..?  To compile something we
>> have to specify the Class to compile it in, and all classes have
>> categories / protocols, so isn't it convenient to do that during
>> compilation?  What is responsible for classifying now and what is the
>> new API for code-generators to classify the methods they generate?
>>
>> On Sat, Sep 21, 2013 at 2:52 PM, Nicolas Cellier
>> <[hidden email]> wrote:
>> > Please send reports, I'm all ear.
>> > Though I'm not aware of any raised: no sender no implementor in my
>> > image.
>> > Or is it raised ? It's a Morph thing...
>>
>> >
>> >
>> > 2013/9/21 Frank Shearar <[hidden email]>
>> >>
>> >> For instance: http://build.squeak.org/job/SqueakTrunk/536/console
>> >>
>> >> Look for
>> >>
>> >> Exception MessageNotUnderstood raised:
>> >> Behavior class>>compile:notifying:trailer:ifFail:
>> >>
>> >> I don't know where it's coming from yet - that's the entire stack
>> >> trace.
>> >>
>> >> frank
>> >>
>> >>
>> >> On 21 September 2013 18:17, Chris Muller <[hidden email]> wrote:
>> >> > I would expect these changes to break a lot of code..
>> >> >
>> >> > On Fri, Sep 20, 2013 at 2:45 PM,  <[hidden email]> wrote:
>> >> >> Nicolas Cellier uploaded a new version of Traits to project The
>> >> >> Trunk:
>> >> >> http://source.squeak.org/trunk/Traits-nice.299.mcz
>> >> >>
>> >> >> ==================== Summary ====================
>> >> >>
>> >> >> Name: Traits-nice.299
>> >> >> Author: nice
>> >> >> Time: 20 September 2013, 9:45:04.474 pm
>> >> >> UUID: d6c18da8-7e93-4bcc-b94e-7f67426a2965
>> >> >> Ancestors: Traits-nice.298
>> >> >>
>> >> >> Don't pass a category to a Compiler, classifying is not its job.
>> >> >>
>> >> >> =============== Diff against Traits-nice.298 ===============
>> >> >>
>> >> >> Item was changed:
>> >> >>   ----- Method: ClassDescription>>traitAddSelector:withMethod: (in
>> >> >> category '*Traits-NanoKernel') -----
>> >> >>   traitAddSelector: selector withMethod: traitMethod
>> >> >>         "Add a method inherited from a trait.
>> >> >>         Recompiles to avoid sharing and implement aliasing."
>> >> >>         | oldMethod source methodNode newMethod originalSelector |
>> >> >>         oldMethod := self compiledMethodAt: selector ifAbsent:[nil].
>> >> >>         oldMethod ifNotNil:[
>> >> >>                 "The following is an important optimization as it
>> >> >> prevents exponential
>> >> >>                 growth in recompilation. If T1 is used by T2 and T2
>> >> >> by
>> >> >> T3 then (without
>> >> >>                 this optimization) any change in T1 would cause all
>> >> >> methods in T2 to be
>> >> >>                 recompiled and each recompilation of a method in T2
>> >> >> would cause T3
>> >> >>                 to be fully recompiled. The test eliminates all such
>> >> >> situations."
>> >> >>                 (oldMethod sameTraitCodeAs: traitMethod)
>> >> >> ifTrue:[^oldMethod].
>> >> >>         ].
>> >> >>         originalSelector := traitMethod selector.
>> >> >>         source := traitMethod methodClass sourceCodeAt:
>> >> >> originalSelector.
>> >> >>         originalSelector == selector ifFalse:[
>> >> >>                 "Replace source selectors for aliases"
>> >> >>                 source := self replaceSelector: originalSelector
>> >> >> withAlias: selector in: source.
>> >> >>         ].
>> >> >>         methodNode := self newCompiler
>> >> >> +               compile: source in: self notifying: nil
>> >> >> ifFail:[^nil].
>> >> >> -               compile: source in: self classified: nil notifying:
>> >> >> nil
>> >> >> ifFail:[^nil].
>> >> >>         newMethod := methodNode generate: self defaultMethodTrailer.
>> >> >>         newMethod putSource: source fromParseNode: methodNode
>> >> >> inFile: 2
>> >> >>                 withPreamble: [:f | f cr; nextPut: $!!;
>> >> >> nextChunkPut:
>> >> >> 'Trait method'; cr].
>> >> >>         newMethod originalTraitMethod: traitMethod.
>> >> >>         ^super addSelectorSilently: selector withMethod: newMethod.!
>> >> >>
>> >> >>
>> >> >
>> >>
>> >
>> >
>> >
>> >
>>
>