[squeak-dev] [BUG] Compiler Bug: Code generation with cascade and #caseOf: fails
Thiede, Christoph
Christoph.Thiede at student.hpi.uni-potsdam.de
Sun Jan 19 11:56:50 UTC 2020
Wow, thanks for the fast fix and explanation! :-)
Best,
Christoph
<http://www.hpi.de/>
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Eliot Miranda <eliot.miranda at gmail.com>
Gesendet: Sonntag, 19. Januar 2020 02:41:23
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] [BUG] Compiler Bug: Code generation with cascade and #caseOf: fails
Hi Christoph,
On Sat, Jan 18, 2020 at 12:10 PM Thiede, Christoph <Christoph.Thiede at student.hpi.uni-potsdam.de<mailto:Christoph.Thiede at student.hpi.uni-potsdam.de>> wrote:
Steps to reproduce:
Do it:
Object compile: '
foo: anObject
^ self foo
flag: #bar;
caseOf: { [#corge] -> [self grault: anObject] }
'
Error:
In TempVariableNode >> #isReferencedWithinBlockExtent:: MessageNotUnderstood: UndefinedObject >> #rangleIncludes:.
anInterval is nil.
In #computeCopiedValues:, blockExtent of the BlockNode {[#corge]} is nil.
This may be related to the observation made in http://forum.world.st/BUG-Cannot-compile-cascade-sent-to-block-td5108942.html that blockExtent can be nil.
Maybe we should handle optimized BlockNodes differently in this method?
Not (yet?) further investigated.
I see a contradiction. The cascaded message "caseOf: { [#corge] -> [self grault: anObject]" has special = 0, which means it hasn't been optimized. But both of its blocks are marked as being optimized. We can't have that discrepancy. Ether a cascaded caseOf: is (to be) inlined (special > 0) and its blocks are optimized, or it is not to be inlined and its blocks are not to be optimized.
Ah, the bug I believe is this:
ensureCanCascade: encoder
special > 0 ifTrue:
[special := 0.
receiver := originalReceiver.
selector := encoder encodeSelector: originalSelector.
arguments := originalArguments.
receiver isBlockNode ifTrue: [receiver deoptimize].
arguments do:
[:each|
each isBlockNode ifTrue:
[each deoptimize]]]
This assumes that optimized blocks only appear as arguments, not also in BraceNode elements, as they do in case statements.
Fixed in Compiler-eem.416
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200119/675c2e45/attachment.html>
More information about the Squeak-dev
mailing list
|