2011/3/3 Juan Vuletich juan@jvuletich.org:
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 <nicolas.cellier.aka.nice@gmail.com mailto:nicolas.cellier.aka.nice@gmail.com> wrote:
Oops, I always forget to select changes before filing out...
Nicolas
2011/3/3 Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com mailto:nicolas.cellier.aka.nice@gmail.com>: > Then attached proof of concept may work. > > Nicolas > > 2011/3/3 Eliot Miranda <eliot.miranda@gmail.com mailto:eliot.miranda@gmail.com>: >> >> >> On Wed, Mar 2, 2011 at 3:02 PM, Nicolas Cellier >> <nicolas.cellier.aka.nice@gmail.com mailto:nicolas.cellier.aka.nice@gmail.com> 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 <eliot.miranda@gmail.com mailto:eliot.miranda@gmail.com>: >>> > >>> > >>> > On Wed, Mar 2, 2011 at 1:52 PM, Juan Vuletich <juan@jvuletich.org mailto:juan@jvuletich.org> >>> > 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 <juan@jvuletich.org mailto:juan@jvuletich.org >>> >>> <mailto:juan@jvuletich.org mailto:juan@jvuletich.org>> wrote: >>> >>> >>> >>> Hi Folks, >>> >>> >>> >>> commits@source.squeak.org mailto:commits@source.squeak.org <mailto:commits@source.squeak.org mailto:commits@source.squeak.org> 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