Hi Folks,
[hidden email] wrote: > Nicolas Cellier uploaded a new version of Compiler to project The Trunk: > http://source.squeak.org/trunk/Compiler-nice.189.mcz > > ==================== Summary ==================== > > Name: Compiler-nice.189 > Author: nice > Time: 13 February 2011, 7:44:38.363 pm > UUID: 3f6f02cd-1acf-48de-a388-b5ac55e27055 > Ancestors: Compiler-nice.188 > > Enable cascading of special messages by deoptimizing, thanks Eliot. > This is mostly useless, but it removes an arbitrary limitation of the language. > > =============== Diff against Compiler-nice.188 =============== > true ifTrue: [ Transcript cr; show: 'was true' ]; yourself I found that this works ok with the interpreter but does nothing in Cog. A bug, right? Cheers, Juan Vuletich |
On Wed, Mar 2, 2011 at 11:46 AM, Juan Vuletich <[hidden email]> wrote: Hi Folks, Yes. But it is in the bytecode compiler, which has generated two blocks, not one: true ifTrue: [ Transcript cr; show: 'was true' ]; yourself. thisContext method symbolic 45 <71> pushConstant: true 46 <88> dup 47 <8F 00 00 07> closureNumCopied: 0 numArgs: 0 bytes 51 to 57
51 <41> pushLit: Transcript 52 <88> dup 53 <D2> send: cr
54 <87> pop 55 <24> pushConstant: 'was true' 56 <E3> send: show:
57 <7D> blockReturn 58 <8F 00 00 02> closureNumCopied: 0 numArgs: 0 bytes 62 to 63 62 <73> pushConstant: nil
63 <7D> blockReturn 64 <F0> send: ifTrue: 65 <87> pop 66 <D5> send: yourself 67 <87> pop
68 <89> pushThisContext: 69 <D7> send: method 70 <D6> send: symbolic 71 <7C> returnTop
|
In reply to this post by Juan Vuletich-4
Hi Juan,
here's a fix (inline and attached), but I haven't tested it on to:by:do:, which has a more complex transformation. ensureCanCascade: encoder special > 0 ifTrue: [special := 0. selector := encoder encodeSelector: selector key.
"Undo transformation of e.g. ifTrue: to ifTrue:ifFalse:" arguments size > selector key numArgs ifTrue:
[arguments := arguments copyFrom: 1 to: selector key numArgs]. "deoptimize any block args"
arguments do: [:each| each isBlockNode ifTrue:
[each deoptimize]]] On Wed, Mar 2, 2011 at 11:46 AM, Juan Vuletich <[hidden email]> wrote: Hi Folks, MessageNode-ensureCanCascade.st (766 bytes) Download Attachment |
In reply to this post by Juan Vuletich-4
Hi Juan,
I think the deoptimize-after-the-fact approach has no hope of working given the transformations for ifFalse:ifTrue: (swap arguments and transform to ifTrue:ifFalse:), ifNil:ifNotNil: et al. Better is to avoid transforming at all if in a cascade. So the attached is a start. It needs cleaning up, the older hack (ensureCanCascade:) removing and either all uses of receiver:selector:arguments:precedence:from:sourceRange: should use receiver:selector:arguments:precedence:from:sourceRange:canTransform:, or implement receiver:selector:arguments:precedence:from:sourceRange in terms of receiver:selector:arguments:precedence:from:sourceRange:canTransform. Anyway, test this and see how you get on.
cheers, Eliot
On Wed, Mar 2, 2011 at 11:46 AM, Juan Vuletich <[hidden email]> wrote: Hi Folks, no-macro-cascades.st (5K) Download Attachment |
Hi Eliot,
Thanks for caring! The attached code fixed the case I reported first, but not this: true ifTrue: [ 'was true' print ]; ifFalse: [ 'not true' print ] Thanks, Juan Vuletich Eliot Miranda wrote: > Hi Juan, > > I think the deoptimize-after-the-fact approach has no hope of > working given the transformations for ifFalse:ifTrue: (swap arguments > and transform to ifTrue:ifFalse:), ifNil:ifNotNil: et al. Better is > to avoid transforming at all if in a cascade. So the attached is a > start. It needs cleaning up, the older hack (ensureCanCascade:) > removing and either all uses of > receiver:selector:arguments:precedence:from:sourceRange: should use > receiver:selector:arguments:precedence:from:sourceRange:canTransform:, > or implement receiver:selector:arguments:precedence:from:sourceRange > in terms > of receiver:selector:arguments:precedence:from:sourceRange:canTransform. > Anyway, test this and see how you get on. > > cheers, > Eliot > > On Wed, Mar 2, 2011 at 11:46 AM, Juan Vuletich <[hidden email] > <mailto:[hidden email]>> wrote: > > Hi Folks, > > [hidden email] <mailto:[hidden email]> wrote: > > Nicolas Cellier uploaded a new version of Compiler to project > The Trunk: > http://source.squeak.org/trunk/Compiler-nice.189.mcz > > ==================== Summary ==================== > > Name: Compiler-nice.189 > Author: nice > Time: 13 February 2011, 7:44:38.363 pm > UUID: 3f6f02cd-1acf-48de-a388-b5ac55e27055 > Ancestors: Compiler-nice.188 > > Enable cascading of special messages by deoptimizing, thanks > Eliot. > This is mostly useless, but it removes an arbitrary limitation > of the language. > > =============== Diff against Compiler-nice.188 =============== > > > I integrated this nice code in Cuis, and tried: > > true ifTrue: [ Transcript cr; show: 'was true' ]; yourself > > I found that this works ok with the interpreter but does nothing > in Cog. A bug, right? > > Cheers, > Juan Vuletich > > > ------------------------------------------------------------------------ > > > > > ------------------------------------------------------------------------ > > No virus found in this message. > Checked by AVG - www.avg.com <http://www.avg.com> > Version: 10.0.1204 / Virus Database: 1435/3477 - Release Date: 03/02/11 > |
On Wed, Mar 2, 2011 at 1:52 PM, Juan Vuletich <[hidden email]> wrote: Hi Eliot, Does the second one have to be unoptimized? I guess that in this both are deoptimized right? true ifTrue: [ 'was true' print ]; ifFalse: [ 'not true' print ]; yourself
|
One dumb way would be to retain a copy of
originalSelector & originalArguments in MethodNode ivar at creation, then let #ensureCanCascade: restore the originals. Nicolas 2011/3/2 Eliot Miranda <[hidden email]>: > > > On Wed, Mar 2, 2011 at 1:52 PM, Juan Vuletich <[hidden email]> wrote: >> >> Hi Eliot, >> >> Thanks for caring! >> >> The attached code fixed the case I reported first, but not this: >> >> true ifTrue: [ 'was true' print ]; ifFalse: [ 'not true' print ] > > Does the second one have to be unoptimized? I guess that in this both are > deoptimized right? > > true ifTrue: [ 'was true' print ]; ifFalse: [ 'not true' print ]; yourself >> >> Thanks, >> Juan Vuletich >> >> Eliot Miranda wrote: >>> >>> Hi Juan, >>> >>> I think the deoptimize-after-the-fact approach has no hope of working >>> given the transformations for ifFalse:ifTrue: (swap arguments and transform >>> to ifTrue:ifFalse:), ifNil:ifNotNil: et al. Better is to avoid transforming >>> at all if in a cascade. So the attached is a start. It needs cleaning up, >>> the older hack (ensureCanCascade:) removing and either all uses of >>> receiver:selector:arguments:precedence:from:sourceRange: should use >>> receiver:selector:arguments:precedence:from:sourceRange:canTransform:, or >>> implement receiver:selector:arguments:precedence:from:sourceRange in terms >>> of receiver:selector:arguments:precedence:from:sourceRange:canTransform. >>> Anyway, test this and see how you get on. >>> >>> cheers, >>> Eliot >>> >>> On Wed, Mar 2, 2011 at 11:46 AM, Juan Vuletich <[hidden email] >>> <mailto:[hidden email]>> wrote: >>> >>> Hi Folks, >>> >>> [hidden email] <mailto:[hidden email]> wrote: >>> >>> Nicolas Cellier uploaded a new version of Compiler to project >>> The Trunk: >>> http://source.squeak.org/trunk/Compiler-nice.189.mcz >>> >>> ==================== Summary ==================== >>> >>> Name: Compiler-nice.189 >>> Author: nice >>> Time: 13 February 2011, 7:44:38.363 pm >>> UUID: 3f6f02cd-1acf-48de-a388-b5ac55e27055 >>> Ancestors: Compiler-nice.188 >>> >>> Enable cascading of special messages by deoptimizing, thanks >>> Eliot. >>> This is mostly useless, but it removes an arbitrary limitation >>> of the language. >>> >>> =============== Diff against Compiler-nice.188 =============== >>> >>> I integrated this nice code in Cuis, and tried: >>> >>> true ifTrue: [ Transcript cr; show: 'was true' ]; yourself >>> >>> I found that this works ok with the interpreter but does nothing >>> in Cog. A bug, right? >>> >>> Cheers, >>> Juan Vuletich >>> >>> >>> ------------------------------------------------------------------------ >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> No virus found in this message. >>> Checked by AVG - www.avg.com <http://www.avg.com> >>> Version: 10.0.1204 / Virus Database: 1435/3477 - Release Date: 03/02/11 >>> >> >> > > > > > |
On Wed, Mar 2, 2011 at 3:02 PM, Nicolas Cellier <[hidden email]> wrote: One dumb way would be to retain a copy of I like this. Not at all dumb.
|
Then attached proof of concept may work.
Nicolas 2011/3/3 Eliot Miranda <[hidden email]>: > > > On Wed, Mar 2, 2011 at 3:02 PM, Nicolas Cellier > <[hidden email]> wrote: >> >> One dumb way would be to retain a copy of >> originalSelector & originalArguments in MethodNode ivar at creation, >> then let #ensureCanCascade: restore the originals. > > I like this. Not at all dumb. > >> >> Nicolas >> >> 2011/3/2 Eliot Miranda <[hidden email]>: >> > >> > >> > On Wed, Mar 2, 2011 at 1:52 PM, Juan Vuletich <[hidden email]> >> > wrote: >> >> >> >> Hi Eliot, >> >> >> >> Thanks for caring! >> >> >> >> The attached code fixed the case I reported first, but not this: >> >> >> >> true ifTrue: [ 'was true' print ]; ifFalse: [ 'not true' print ] >> > >> > Does the second one have to be unoptimized? I guess that in this both >> > are >> > deoptimized right? >> > >> > true ifTrue: [ 'was true' print ]; ifFalse: [ 'not true' print ]; >> > yourself >> >> >> >> Thanks, >> >> Juan Vuletich >> >> >> >> Eliot Miranda wrote: >> >>> >> >>> Hi Juan, >> >>> >> >>> I think the deoptimize-after-the-fact approach has no hope of >> >>> working >> >>> given the transformations for ifFalse:ifTrue: (swap arguments and >> >>> transform >> >>> to ifTrue:ifFalse:), ifNil:ifNotNil: et al. Better is to avoid >> >>> transforming >> >>> at all if in a cascade. So the attached is a start. It needs >> >>> cleaning up, >> >>> the older hack (ensureCanCascade:) removing and either all uses of >> >>> receiver:selector:arguments:precedence:from:sourceRange: should use >> >>> receiver:selector:arguments:precedence:from:sourceRange:canTransform:, >> >>> or >> >>> implement receiver:selector:arguments:precedence:from:sourceRange in >> >>> terms >> >>> of >> >>> receiver:selector:arguments:precedence:from:sourceRange:canTransform. >> >>> Anyway, test this and see how you get on. >> >>> >> >>> cheers, >> >>> Eliot >> >>> >> >>> On Wed, Mar 2, 2011 at 11:46 AM, Juan Vuletich <[hidden email] >> >>> <mailto:[hidden email]>> wrote: >> >>> >> >>> Hi Folks, >> >>> >> >>> [hidden email] <mailto:[hidden email]> wrote: >> >>> >> >>> Nicolas Cellier uploaded a new version of Compiler to project >> >>> The Trunk: >> >>> http://source.squeak.org/trunk/Compiler-nice.189.mcz >> >>> >> >>> ==================== Summary ==================== >> >>> >> >>> Name: Compiler-nice.189 >> >>> Author: nice >> >>> Time: 13 February 2011, 7:44:38.363 pm >> >>> UUID: 3f6f02cd-1acf-48de-a388-b5ac55e27055 >> >>> Ancestors: Compiler-nice.188 >> >>> >> >>> Enable cascading of special messages by deoptimizing, thanks >> >>> Eliot. >> >>> This is mostly useless, but it removes an arbitrary limitation >> >>> of the language. >> >>> >> >>> =============== Diff against Compiler-nice.188 =============== >> >>> >> >>> I integrated this nice code in Cuis, and tried: >> >>> >> >>> true ifTrue: [ Transcript cr; show: 'was true' ]; yourself >> >>> >> >>> I found that this works ok with the interpreter but does nothing >> >>> in Cog. A bug, right? >> >>> >> >>> Cheers, >> >>> Juan Vuletich >> >>> >> >>> >> >>> >> >>> ------------------------------------------------------------------------ >> >>> >> >>> >> >>> >> >>> >> >>> ------------------------------------------------------------------------ >> >>> >> >>> No virus found in this message. >> >>> Checked by AVG - www.avg.com <http://www.avg.com> >> >>> Version: 10.0.1204 / Virus Database: 1435/3477 - Release Date: >> >>> 03/02/11 >> >>> >> >> >> >> >> > >> > >> > >> > >> > >> > > > > > CompileSepcialCascade.st (130 bytes) Download Attachment |
Oops, I always forget to select changes before filing out...
Nicolas 2011/3/3 Nicolas Cellier <[hidden email]>: > Then attached proof of concept may work. > > Nicolas > > 2011/3/3 Eliot Miranda <[hidden email]>: >> >> >> On Wed, Mar 2, 2011 at 3:02 PM, Nicolas Cellier >> <[hidden email]> wrote: >>> >>> One dumb way would be to retain a copy of >>> originalSelector & originalArguments in MethodNode ivar at creation, >>> then let #ensureCanCascade: restore the originals. >> >> I like this. Not at all dumb. >> >>> >>> Nicolas >>> >>> 2011/3/2 Eliot Miranda <[hidden email]>: >>> > >>> > >>> > On Wed, Mar 2, 2011 at 1:52 PM, Juan Vuletich <[hidden email]> >>> > wrote: >>> >> >>> >> Hi Eliot, >>> >> >>> >> Thanks for caring! >>> >> >>> >> The attached code fixed the case I reported first, but not this: >>> >> >>> >> true ifTrue: [ 'was true' print ]; ifFalse: [ 'not true' print ] >>> > >>> > Does the second one have to be unoptimized? I guess that in this both >>> > are >>> > deoptimized right? >>> > >>> > true ifTrue: [ 'was true' print ]; ifFalse: [ 'not true' print ]; >>> > yourself >>> >> >>> >> Thanks, >>> >> Juan Vuletich >>> >> >>> >> Eliot Miranda wrote: >>> >>> >>> >>> Hi Juan, >>> >>> >>> >>> I think the deoptimize-after-the-fact approach has no hope of >>> >>> working >>> >>> given the transformations for ifFalse:ifTrue: (swap arguments and >>> >>> transform >>> >>> to ifTrue:ifFalse:), ifNil:ifNotNil: et al. Better is to avoid >>> >>> transforming >>> >>> at all if in a cascade. So the attached is a start. It needs >>> >>> cleaning up, >>> >>> the older hack (ensureCanCascade:) removing and either all uses of >>> >>> receiver:selector:arguments:precedence:from:sourceRange: should use >>> >>> receiver:selector:arguments:precedence:from:sourceRange:canTransform:, >>> >>> or >>> >>> implement receiver:selector:arguments:precedence:from:sourceRange in >>> >>> terms >>> >>> of >>> >>> receiver:selector:arguments:precedence:from:sourceRange:canTransform. >>> >>> Anyway, test this and see how you get on. >>> >>> >>> >>> cheers, >>> >>> Eliot >>> >>> >>> >>> On Wed, Mar 2, 2011 at 11:46 AM, Juan Vuletich <[hidden email] >>> >>> <mailto:[hidden email]>> wrote: >>> >>> >>> >>> Hi Folks, >>> >>> >>> >>> [hidden email] <mailto:[hidden email]> wrote: >>> >>> >>> >>> Nicolas Cellier uploaded a new version of Compiler to project >>> >>> The Trunk: >>> >>> http://source.squeak.org/trunk/Compiler-nice.189.mcz >>> >>> >>> >>> ==================== Summary ==================== >>> >>> >>> >>> Name: Compiler-nice.189 >>> >>> Author: nice >>> >>> Time: 13 February 2011, 7:44:38.363 pm >>> >>> UUID: 3f6f02cd-1acf-48de-a388-b5ac55e27055 >>> >>> Ancestors: Compiler-nice.188 >>> >>> >>> >>> Enable cascading of special messages by deoptimizing, thanks >>> >>> Eliot. >>> >>> This is mostly useless, but it removes an arbitrary limitation >>> >>> of the language. >>> >>> >>> >>> =============== Diff against Compiler-nice.188 =============== >>> >>> >>> >>> I integrated this nice code in Cuis, and tried: >>> >>> >>> >>> true ifTrue: [ Transcript cr; show: 'was true' ]; yourself >>> >>> >>> >>> I found that this works ok with the interpreter but does nothing >>> >>> in Cog. A bug, right? >>> >>> >>> >>> Cheers, >>> >>> Juan Vuletich >>> >>> >>> >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> >>> >>> No virus found in this message. >>> >>> Checked by AVG - www.avg.com <http://www.avg.com> >>> >>> Version: 10.0.1204 / Virus Database: 1435/3477 - Release Date: >>> >>> 03/02/11 >>> >>> >>> >> >>> >> >>> > >>> > >>> > >>> > >>> > >>> >> >> >> >> >> > CompileSpecialCascade.st (3K) Download Attachment |
Looks good to me. Thanks, Nicolas!
On Wed, Mar 2, 2011 at 3:12 PM, Nicolas Cellier <[hidden email]> wrote: Oops, I always forget to select changes before filing out... |
Hi Folks,
This works great with the examples provided earlier. But a bit more of testing show new issues (this new issues happen both with Cog and the interpreter): true ifTrue: [ Transcript cr; show: 'was true' ]; ifFalse: [ Transcript cr; show: 'was false' ]; ifTrue: [ Transcript cr; show: 'was true2' ] ifFalse: [ Transcript cr; show: 'was false2' ]; ifFalse: [ Transcript cr; show: 'was false3' ] ifTrue: [ Transcript cr; show: 'was true3' ] prints: was true was true2 was false3 and this code: 7 ifNil: [Transcript cr; show: 'nil' ]; ifNotNil: [ Transcript cr; show: 'not nil' ]; ifNil: [Transcript cr; show: 'nil2' ] ifNotNil: [ Transcript cr; show: 'not nil2' ]; ifNotNil: [ Transcript cr; show: 'not nil3' ] ifNil: [Transcript cr; show: 'nil3' ] prints: not nil not nil2 nil3 Besides, if these expressions are put in a method, and I decompile it, and I get a dnu when decompiling the #ifTrue:ifFalse: call (UndefinedObject dnu #isMessage:receiver:arguments:). I remove that call, and I get swapped the blocks in the #ifNotNil:ifNil: and the #:ifFalse:ifTrue: calls. Thanks, Juan Vuletich Eliot Miranda wrote: > Looks good to me. Thanks, Nicolas! > > On Wed, Mar 2, 2011 at 3:12 PM, Nicolas Cellier > <[hidden email] > <mailto:[hidden email]>> wrote: > > Oops, I always forget to select changes before filing out... > > Nicolas > > 2011/3/3 Nicolas Cellier <[hidden email] > <mailto:[hidden email]>>: > > Then attached proof of concept may work. > > > > Nicolas > > > > 2011/3/3 Eliot Miranda <[hidden email] > <mailto:[hidden email]>>: > >> > >> > >> On Wed, Mar 2, 2011 at 3:02 PM, Nicolas Cellier > >> <[hidden email] > <mailto:[hidden email]>> wrote: > >>> > >>> One dumb way would be to retain a copy of > >>> originalSelector & originalArguments in MethodNode ivar at > creation, > >>> then let #ensureCanCascade: restore the originals. > >> > >> I like this. Not at all dumb. > >> > >>> > >>> Nicolas > >>> > >>> 2011/3/2 Eliot Miranda <[hidden email] > <mailto:[hidden email]>>: > >>> > > >>> > > >>> > On Wed, Mar 2, 2011 at 1:52 PM, Juan Vuletich > <[hidden email] <mailto:[hidden email]>> > >>> > wrote: > >>> >> > >>> >> Hi Eliot, > >>> >> > >>> >> Thanks for caring! > >>> >> > >>> >> The attached code fixed the case I reported first, but not > this: > >>> >> > >>> >> true ifTrue: [ 'was true' print ]; ifFalse: [ 'not true' > print ] > >>> > > >>> > Does the second one have to be unoptimized? I guess that in > this both > >>> > are > >>> > deoptimized right? > >>> > > >>> > true ifTrue: [ 'was true' print ]; ifFalse: [ 'not true' > print ]; > >>> > yourself > >>> >> > >>> >> Thanks, > >>> >> Juan Vuletich > >>> >> > >>> >> Eliot Miranda wrote: > >>> >>> > >>> >>> Hi Juan, > >>> >>> > >>> >>> I think the deoptimize-after-the-fact approach has no > hope of > >>> >>> working > >>> >>> given the transformations for ifFalse:ifTrue: (swap > arguments and > >>> >>> transform > >>> >>> to ifTrue:ifFalse:), ifNil:ifNotNil: et al. Better is to > avoid > >>> >>> transforming > >>> >>> at all if in a cascade. So the attached is a start. It needs > >>> >>> cleaning up, > >>> >>> the older hack (ensureCanCascade:) removing and either all > uses of > >>> >>> receiver:selector:arguments:precedence:from:sourceRange: > should use > >>> >>> > receiver:selector:arguments:precedence:from:sourceRange:canTransform:, > >>> >>> or > >>> >>> implement > receiver:selector:arguments:precedence:from:sourceRange in > >>> >>> terms > >>> >>> of > >>> >>> > receiver:selector:arguments:precedence:from:sourceRange:canTransform. > >>> >>> Anyway, test this and see how you get on. > >>> >>> > >>> >>> cheers, > >>> >>> Eliot > >>> >>> > >>> >>> On Wed, Mar 2, 2011 at 11:46 AM, Juan Vuletich > <[hidden email] <mailto:[hidden email]> > >>> >>> <mailto:[hidden email] <mailto:[hidden email]>>> > wrote: > >>> >>> > >>> >>> Hi Folks, > >>> >>> > >>> >>> [hidden email] > <mailto:[hidden email]> > <mailto:[hidden email] > <mailto:[hidden email]>> wrote: > >>> >>> > >>> >>> Nicolas Cellier uploaded a new version of Compiler > to project > >>> >>> The Trunk: > >>> >>> http://source.squeak.org/trunk/Compiler-nice.189.mcz > >>> >>> > >>> >>> ==================== Summary ==================== > >>> >>> > >>> >>> Name: Compiler-nice.189 > >>> >>> Author: nice > >>> >>> Time: 13 February 2011, 7:44:38.363 pm > >>> >>> UUID: 3f6f02cd-1acf-48de-a388-b5ac55e27055 > >>> >>> Ancestors: Compiler-nice.188 > >>> >>> > >>> >>> Enable cascading of special messages by > deoptimizing, thanks > >>> >>> Eliot. > >>> >>> This is mostly useless, but it removes an arbitrary > limitation > >>> >>> of the language. > >>> >>> > >>> >>> =============== Diff against Compiler-nice.188 > =============== > >>> >>> > >>> >>> I integrated this nice code in Cuis, and tried: > >>> >>> > >>> >>> true ifTrue: [ Transcript cr; show: 'was true' ]; yourself > >>> >>> > >>> >>> I found that this works ok with the interpreter but > does nothing > >>> >>> in Cog. A bug, right? > >>> >>> > >>> >>> Cheers, > >>> >>> Juan Vuletich > >>> >>> > >>> >>> > >>> >>> > >>> >>> > ------------------------------------------------------------------------ > >>> >>> > >>> >>> > >>> >>> > >>> >>> > >>> >>> > ------------------------------------------------------------------------ > >>> >>> > >>> >>> No virus found in this message. > >>> >>> Checked by AVG - www.avg.com <http://www.avg.com> > <http://www.avg.com> > >>> >>> Version: 10.0.1204 / Virus Database: 1435/3477 - Release Date: > >>> >>> 03/02/11 > >>> >>> > >>> >> > >>> >> > >>> > > >>> > > >>> > > >>> > > >>> > > >>> > >> > >> > >> > >> > >> > > > > > > > ------------------------------------------------------------------------ > > > > > ------------------------------------------------------------------------ > > No virus found in this message. > Checked by AVG - www.avg.com <http://www.avg.com> > Version: 10.0.1204 / Virus Database: 1435/3477 - Release Date: 03/02/11 > |
2011/3/3 Juan Vuletich <[hidden email]>:
> Hi Folks, > > This works great with the examples provided earlier. But a bit more of > testing show new issues (this new issues happen both with Cog and the > interpreter): > > true > ifTrue: [ Transcript cr; show: 'was true' ]; > ifFalse: [ Transcript cr; show: 'was false' ]; > ifTrue: [ Transcript cr; show: 'was true2' ] ifFalse: [ Transcript cr; > show: 'was false2' ]; > ifFalse: [ Transcript cr; show: 'was false3' ] ifTrue: [ Transcript cr; > show: 'was true3' ] > Thanks for testing. I have not an image under my eyes, but I think that inlining probably swap arguments in place. Thus it also modifies the originalArguments. Thus we must make a copy somewhere. Nicolas > prints: > was true > was true2 > was false3 > > and this code: > 7 > ifNil: [Transcript cr; show: 'nil' ]; > ifNotNil: [ Transcript cr; show: 'not nil' ]; > ifNil: [Transcript cr; show: 'nil2' ] ifNotNil: [ Transcript cr; show: > 'not nil2' ]; > ifNotNil: [ Transcript cr; show: 'not nil3' ] ifNil: [Transcript cr; > show: 'nil3' ] > > prints: > not nil > not nil2 > nil3 > > Besides, if these expressions are put in a method, and I decompile it, and I > get a dnu when decompiling the #ifTrue:ifFalse: call (UndefinedObject dnu > #isMessage:receiver:arguments:). I remove that call, and I get swapped the > blocks in the #ifNotNil:ifNil: and the #:ifFalse:ifTrue: calls. > > Thanks, > Juan Vuletich > > Eliot Miranda wrote: >> >> Looks good to me. Thanks, Nicolas! >> >> On Wed, Mar 2, 2011 at 3:12 PM, Nicolas Cellier >> <[hidden email] >> <mailto:[hidden email]>> wrote: >> >> Oops, I always forget to select changes before filing out... >> >> Nicolas >> >> 2011/3/3 Nicolas Cellier <[hidden email] >> <mailto:[hidden email]>>: >> > Then attached proof of concept may work. >> > >> > Nicolas >> > >> > 2011/3/3 Eliot Miranda <[hidden email] >> <mailto:[hidden email]>>: >> >> >> >> >> >> On Wed, Mar 2, 2011 at 3:02 PM, Nicolas Cellier >> >> <[hidden email] >> <mailto:[hidden email]>> wrote: >> >>> >> >>> One dumb way would be to retain a copy of >> >>> originalSelector & originalArguments in MethodNode ivar at >> creation, >> >>> then let #ensureCanCascade: restore the originals. >> >> >> >> I like this. Not at all dumb. >> >> >> >>> >> >>> Nicolas >> >>> >> >>> 2011/3/2 Eliot Miranda <[hidden email] >> <mailto:[hidden email]>>: >> >>> > >> >>> > >> >>> > On Wed, Mar 2, 2011 at 1:52 PM, Juan Vuletich >> <[hidden email] <mailto:[hidden email]>> >> >>> > wrote: >> >>> >> >> >>> >> Hi Eliot, >> >>> >> >> >>> >> Thanks for caring! >> >>> >> >> >>> >> The attached code fixed the case I reported first, but not >> this: >> >>> >> >> >>> >> true ifTrue: [ 'was true' print ]; ifFalse: [ 'not true' >> print ] >> >>> > >> >>> > Does the second one have to be unoptimized? I guess that in >> this both >> >>> > are >> >>> > deoptimized right? >> >>> > >> >>> > true ifTrue: [ 'was true' print ]; ifFalse: [ 'not true' >> print ]; >> >>> > yourself >> >>> >> >> >>> >> Thanks, >> >>> >> Juan Vuletich >> >>> >> >> >>> >> Eliot Miranda wrote: >> >>> >>> >> >>> >>> Hi Juan, >> >>> >>> >> >>> >>> I think the deoptimize-after-the-fact approach has no >> hope of >> >>> >>> working >> >>> >>> given the transformations for ifFalse:ifTrue: (swap >> arguments and >> >>> >>> transform >> >>> >>> to ifTrue:ifFalse:), ifNil:ifNotNil: et al. Better is to >> avoid >> >>> >>> transforming >> >>> >>> at all if in a cascade. So the attached is a start. It needs >> >>> >>> cleaning up, >> >>> >>> the older hack (ensureCanCascade:) removing and either all >> uses of >> >>> >>> receiver:selector:arguments:precedence:from:sourceRange: >> should use >> >>> >>> >> receiver:selector:arguments:precedence:from:sourceRange:canTransform:, >> >>> >>> or >> >>> >>> implement >> receiver:selector:arguments:precedence:from:sourceRange in >> >>> >>> terms >> >>> >>> of >> >>> >>> >> receiver:selector:arguments:precedence:from:sourceRange:canTransform. >> >>> >>> Anyway, test this and see how you get on. >> >>> >>> >> >>> >>> cheers, >> >>> >>> Eliot >> >>> >>> >> >>> >>> On Wed, Mar 2, 2011 at 11:46 AM, Juan Vuletich >> <[hidden email] <mailto:[hidden email]> >> >>> >>> <mailto:[hidden email] <mailto:[hidden email]>>> >> wrote: >> >>> >>> >> >>> >>> Hi Folks, >> >>> >>> >> >>> >>> [hidden email] >> <mailto:[hidden email]> >> <mailto:[hidden email] >> <mailto:[hidden email]>> wrote: >> >>> >>> >> >>> >>> Nicolas Cellier uploaded a new version of Compiler >> to project >> >>> >>> The Trunk: >> >>> >>> http://source.squeak.org/trunk/Compiler-nice.189.mcz >> >>> >>> >> >>> >>> ==================== Summary ==================== >> >>> >>> >> >>> >>> Name: Compiler-nice.189 >> >>> >>> Author: nice >> >>> >>> Time: 13 February 2011, 7:44:38.363 pm >> >>> >>> UUID: 3f6f02cd-1acf-48de-a388-b5ac55e27055 >> >>> >>> Ancestors: Compiler-nice.188 >> >>> >>> >> >>> >>> Enable cascading of special messages by >> deoptimizing, thanks >> >>> >>> Eliot. >> >>> >>> This is mostly useless, but it removes an arbitrary >> limitation >> >>> >>> of the language. >> >>> >>> >> >>> >>> =============== Diff against Compiler-nice.188 >> =============== >> >>> >>> >> >>> >>> I integrated this nice code in Cuis, and tried: >> >>> >>> >> >>> >>> true ifTrue: [ Transcript cr; show: 'was true' ]; yourself >> >>> >>> >> >>> >>> I found that this works ok with the interpreter but >> does nothing >> >>> >>> in Cog. A bug, right? >> >>> >>> >> >>> >>> Cheers, >> >>> >>> Juan Vuletich >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> >> >> ------------------------------------------------------------------------ >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> >> >> ------------------------------------------------------------------------ >> >>> >>> >> >>> >>> No virus found in this message. >> >>> >>> Checked by AVG - www.avg.com <http://www.avg.com> >> <http://www.avg.com> >> >>> >>> Version: 10.0.1204 / Virus Database: 1435/3477 - Release Date: >> >>> >>> 03/02/11 >> >>> >>> >> >>> >> >> >>> >> >> >>> > >> >>> > >> >>> > >> >>> > >> >>> > >> >>> >> >> >> >> >> >> >> >> >> >> >> > >> >> >> >> >> ------------------------------------------------------------------------ >> >> >> >> ------------------------------------------------------------------------ >> >> No virus found in this message. >> Checked by AVG - www.avg.com <http://www.avg.com> >> Version: 10.0.1204 / Virus Database: 1435/3477 - Release Date: 03/02/11 >> > > > |
Hi Folks,
Nicolas Cellier wrote: > 2011/3/3 Juan Vuletich <[hidden email]>: > >> Hi Folks, >> >> This works great with the examples provided earlier. But a bit more of >> testing show new issues (this new issues happen both with Cog and the >> interpreter): >> >> true >> ifTrue: [ Transcript cr; show: 'was true' ]; >> ifFalse: [ Transcript cr; show: 'was false' ]; >> ifTrue: [ Transcript cr; show: 'was true2' ] ifFalse: [ Transcript cr; >> show: 'was false2' ]; >> ifFalse: [ Transcript cr; show: 'was false3' ] ifTrue: [ Transcript cr; >> show: 'was true3' ] >> >> > > Thanks for testing. > I have not an image under my eyes, but I think that inlining probably > swap arguments in place. > Thus it also modifies the originalArguments. > Thus we must make a copy somewhere. > > Nicolas > field of expertise. The attach includes your suggestion. It seems to work ok. I also included a fix for the decompiler walkback described below. Please review. Cheers, Juan Vuletich >> prints: >> was true >> was true2 >> was false3 >> >> and this code: >> 7 >> ifNil: [Transcript cr; show: 'nil' ]; >> ifNotNil: [ Transcript cr; show: 'not nil' ]; >> ifNil: [Transcript cr; show: 'nil2' ] ifNotNil: [ Transcript cr; show: >> 'not nil2' ]; >> ifNotNil: [ Transcript cr; show: 'not nil3' ] ifNil: [Transcript cr; >> show: 'nil3' ] >> >> prints: >> not nil >> not nil2 >> nil3 >> >> Besides, if these expressions are put in a method, and I decompile it, and I >> get a dnu when decompiling the #ifTrue:ifFalse: call (UndefinedObject dnu >> #isMessage:receiver:arguments:). I remove that call, and I get swapped the >> blocks in the #ifNotNil:ifNil: and the #:ifFalse:ifTrue: calls. >> >> 'From Cuis 3.0 of 18 January 2011 [latest update: #768] on 3 March 2011 at 9:18:03 am'! !DecompilerConstructor methodsFor: 'constructor' stamp: 'jmv 3/3/2011 09:17'! decodeIfNilWithReceiver: receiver selector: selector arguments: arguments receiver ifNil: [ ^nil ]. "For instance, when cascading" selector == #ifTrue:ifFalse: ifFalse: [^ nil]. (receiver isMessage: #== receiver: nil arguments: [:argNode | argNode == NodeNil]) ifFalse: [^ nil]. ^ (MessageNode new receiver: receiver selector: (SelectorNode new key: #ifTrue:ifFalse: code: #macro) arguments: arguments precedence: 3) noteSpecialSelector: #ifNil:ifNotNil:! ! !MessageNode methodsFor: 'private' stamp: 'jmv 3/3/2011 08:53'! receiver: rcvr arguments: args precedence: p receiver := rcvr. arguments := args. originalArguments := arguments copy. sizes := Array new: arguments size. precedence := p! ! |
Free forum by Nabble | Edit this page |