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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

Eliot Miranda-2
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:

LiteralVariableNode methods for testing
assignmentCheck: encoder at: location
^(key isVariableBinding and: [key isSpecialWriteBinding])
ifTrue: [location]
ifFalse: [-1]

On Thu, May 20, 2010 at 2:16 AM, Igor Stasenko <[hidden email]> 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.



_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

LiteralVariableNode-sizeCodeForStorePop.st (566 bytes) Download Attachment
LiteralVariableNode-assignmentCheckat.st (410 bytes) Download Attachment