[squeak-dev] [BUG] Cannot compile cascade sent to block

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Sat Dec 28 15:41:40 UTC 2019


Hi Christoph,
it's possible that I've already fixed that a few years ago, but it was not
considered useful enough.
Is this really a problem?

Le sam. 28 déc. 2019 à 15:53, Thiede, Christoph <
Christoph.Thiede at student.hpi.uni-potsdam.de> a écrit :

> Hi all! :-)
>
>
> *Steps to reproduce:*
>
> Do it:
>
> [true]
> whileTrue;
> whileFalse
>
>
> *Expected behavior:*
> The script is compiled and executed (and an infinite loop occurs).
>
> *Actual behavior:*
>
>
> *Further investigations:*
> In #analyseTempsWithin:rootNode:assignmentPools:, the inner BlockNode
> [true] is not computed a blockExtent, because it is optimized.
> This leads to a nil key in the ByteCodeEncoder's blockExtentsToLocals.
> A fast solution would be to skip nil blockExtents in #noteBlockExtent:hasLocals:,
> but that's a dirty workaround.
>
> *Similar bug:*
> Try to do:
>
> Object newSubclass compile:  'iWontCompile: foo
> foo.
> [true]
> whileTrue;
> whileFalse'
>
> Fails with:
>
> Again, the problem is that blockExtent isNil.
>
> *Workaround:*
> Send #yourself to the block before sending the cascade. This prevents the
> receiver from being optimized.
>
> Please note that this problem does not only occur in case of special
> blocks. For example, [Sensor anyButtonPressed] whileTrue; whileFalse
> fails as well.
>
>
> How to fix this appropriately? I'm not sure whether I understand the whole
> idea of blockExtent so far. According to the documentation comment, it
> should be okay to be nil; however, the #blockExtent comment does not
> mention this fact.
> Please see the attached changeset for an approach to fix the issue. All
> tests from KernelTests-Methods and most tests from Test-Compiler pass it,
> except of the testAllNodePCs* which time out in my fresh image. It would be
> great to hear if this is the right way to solve the bug, or just extending
> a workaround :-)
>
> Best,
> Christoph
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20191228/b2ff5d91/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 43032 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20191228/b2ff5d91/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 38107 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20191228/b2ff5d91/attachment-0003.png>


More information about the Squeak-dev mailing list