On Mon, 2 Feb 2004 20:51:21 -0500 (EST), Michal Wallace
<[EMAIL PROTECTED]> wrote:

>On Tue, 3 Feb 2004, Pete Lomax wrote:
>
>> .sub _main
>>      goto L1
>> test:
>>      $I1 = 1
>>      ret
>> L1:
>>      $I2 = 2
>>      call test
>>      print $I2               # prints 1, not 2
>>      end
>> .end

>Huh. That is pretty funky. The problem is that
>imcc doesn't realize the two variables ought to
>be distinct, right?
Yup.
>
>A workaround is to call pushtopi and poptopi
>around the "call" statement...
Um. Why topi? why not bottomi? why not saveall?
What if I want some side effects? What if I don't know exactly which
variables will/will not be affected? Or what happens if it is a
spilled register I _don't_ want updated?. More to the point how do I
work out which registers to restore to the ones I _did_ want updated?

Er.. sorry, you appear to have touched a raw nerve there...

>What's the benefit of doing it this way, rather
>than using separate subs?
Does this answer?:
.sub _main
        $I2 = 2
        call _m2
        print $I2               # prints 1, not 2
        end
.end
.sub _m2
        $I1 = 1
        ret
.end

I'm using a single sub because of a complete lack of file-level
variables. This I see as a serious, fundamental flaw.

Pete

Reply via email to