[squeak-dev] [BUG] LiteralVariableNode>>sizeCodeForStorePop:
Eliot Miranda
eliot.miranda at gmail.com
Thu May 20 16:32:51 UTC 2010
in inbox as Compiler-eem.140
On Thu, May 20, 2010 at 9:15 AM, Eliot Miranda <eliot.miranda at gmail.com>wrote:
>
>
> On Thu, May 20, 2010 at 9:04 AM, Eliot Miranda <eliot.miranda at gmail.com>wrote:
>
>> Oops. Find fix attached:
>>
>> LiteralVariableNode methods for code generation (new scheme)
>> sizeCodeForStorePop: encoder
>> self reserve: encoder.
>> ^(key isVariableBinding and: [key isSpecialWriteBinding])
>> ifTrue: [(self sizeCodeForStore: encoder) + encoder sizePop]
>> ifFalse: [encoder sizeStorePopLiteralVar: index]
>>
>> Arguably the compiler should issue an error, but the error is raised at
>> run-time because the generated code sends value: (correct) rather than using
>> any of the store lit var bytecodes. If a compiler error is wanted (my
>> preference) then find attached:
>>
>>
> Except that this is wrong:
>
>
>> LiteralVariableNode methods for testing
>> assignmentCheck: encoder at: location
>> ^(key isVariableBinding and: [key isSpecialWriteBinding])
>> ifTrue: [location]
>> ifFalse: [-1]
>>
>
> It will cause an error when assigning to IslandVariables in Croquet. So it
> must be
>
> LiteralVariableNode methods for testing
> assignmentCheck: encoder at: location
> ^(key isVariableBinding and: [key canAssign not])
> ifTrue: [location]
> ifFalse: [-1]
>
> Find attached.
>
>
>>
>> On Thu, May 20, 2010 at 2:16 AM, Igor Stasenko <siguctua at gmail.com>wrote:
>>
>>> Open a browser, pick any class, and enter the code:
>>>
>>> foo
>>> WorldState := nil
>>>
>>> then accept it.
>>> The compiler goes into an infinite recursion in
>>> LiteralVariableNode>>sizeCodeForStorePop:.
>>>
>>> sizeCodeForStorePop: encoder
>>> self reserve: encoder.
>>> ^(key isVariableBinding and: [key isSpecialWriteBinding])
>>> ifTrue: [(self sizeCodeForStorePop: encoder) + encoder
>>> sizePop]
>>> ifFalse: [encoder sizeStorePopLiteralVar: index]
>>>
>>>
>>> (Pharo 1.1 having no such problem - it accepts a code without any
>>> warnings.. )
>>>
>>> AFAIK, it should either warn or throw an error that assignment is not
>>> possible into read-only variable binding.
>>>
>>> --
>>> Best regards,
>>> Igor Stasenko AKA sig.
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20100520/10f7af71/attachment.htm
More information about the Squeak-dev
mailing list
|