Deoptimized calls fail in Cog (was Re: [squeak-dev] The Trunk:
juan at jvuletich.org
Thu Mar 3 12:33:05 UTC 2011
Nicolas Cellier wrote:
> 2011/3/3 Juan Vuletich <juan at 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
>> 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.
Of course! I should have realized of that... The compiler is not my
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.
>> was true
>> was true2
>> was false3
>> and this code:
>> 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' ]
>> not nil
>> not nil2
>> 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.
-------------- next part --------------
'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: #==
arguments: [:argNode | argNode == NodeNil])
ifFalse: [^ nil].
^ (MessageNode new
selector: (SelectorNode new key: #ifTrue:ifFalse: code: #macro)
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! !
More information about the Squeak-dev