[squeak-dev] [BUG] LiteralVariableNode>>sizeCodeForStorePop:

Igor Stasenko siguctua at gmail.com
Thu May 20 23:07:38 UTC 2010


Thanks for fix, Eliot.

It was a foolish to try to compile an assignment to read-only var binding.
But sure thing, its not an excuse for compiler. :)

On 20 May 2010 19:32, Eliot Miranda <eliot.miranda at gmail.com> wrote:
> 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.
>>>>
>>>
>>
>
>
>
>
>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list