Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Symbolic vs Named variable register allocation

12 views
Skip to first unread message

Pete Lomax

unread,
Dec 3, 2003, 7:58:53 AM12/3/03
to perl6-i...@perl.org
The following demonstrates that $I1 and .local int i map to the same
register in the output pasm code:

.sub _main
goto L1
test:
$I1 = 1
ret
L1:
.local int i
i = 2
call test
print i # prints 1, not 2
end
.end

parrot -o - t.imc shows:
_main:
branch L1
test:
set I16, 1
ret
L1:
set I16, 2
bsr test
print I16
end


Is this a bug, or am I missing something?

Pete
PS this happens on pow builds 0.0.11 (20/09/03), and 15/11/03
Pete
http://palacebuilders.pwp.blueyonder.co.uk/euphoria.html

Leopold Toetsch

unread,
Dec 3, 2003, 9:01:00 AM12/3/03
to Pete Lomax, perl6-i...@perl.org
Pete Lomax <pete...@blueyonder.co.uk> wrote:
> The following demonstrates that $I1 and .local int i map to the same
> register in the output pasm code:

Yep. The problem seems to be the backward branch. When you put the
"test" sub after the "end" op, its working fine.

leo

Melvin Smith

unread,
Dec 3, 2003, 9:35:26 AM12/3/03
to l...@toetsch.at, Pete Lomax, perl6-i...@perl.org

At quick glance I would guess IMCC assumes that the "call test" branches
to a basic block that doesn't overlap with the callee basic block.

Much (most) of the flow analysis code was done before we adopted
new calling conventions. I'll have a look to see if there a quick fix
that would allow the code snippet sample to be legal.

-Melvin


Pete Lomax

unread,
Dec 10, 2003, 10:54:00 AM12/10/03
to perl6-i...@perl.org
>At 03:01 PM 12/3/2003 +0100, Leopold Toetsch wrote:
>>Pete Lomax <pete...@blueyonder.co.uk> wrote:
>> > The following demonstrates that $I1 and .local int i map to the same
>> > register in the output pasm code:
>>
>>Yep. The problem seems to be the backward branch. When you put the
>>"test" sub after the "end" op, its working fine.
>
Just a quick comment inspired by reading the perl 6 summary:

As Leo said, it is backward branch. $I1 and $I2 can both get stored in
the same register, as can .local int i and .local int j. I'm just
pointing out that my subject line was a little misleading.

Pete

0 new messages