Michal Wallace wrote:

Gosh you're quick. Thanks!

Welcome



Want another one? :)

Always.



      def g():
          return 0
      def f():
          return g()
      print f()


This prints:


'No more I register frames to pop!'

The return continuation P1 in f() isnt preserved.



# f from line 3
.pcc_sub _sub1 non_prototyped

.local Continuation retcc retcc = P1


    .local object res1            # (visitReturn:528)
    find_lex $P2, 'g'             # (callingExpression:325)
    newsub $P3, .Continuation, ret0# (callingExpression:331)
    .pcc_begin non_prototyped     # (callingExpression:332)
    .pcc_call $P2, $P3            # (callingExpression:335)
ret0:
    .result res1                  # (callingExpression:338)
    .pcc_end                      # (callingExpression:339)

P1 = retcc



    .pcc_begin_return             # (visitReturn:530)
    .return res1                  # (visitReturn:531)
    .pcc_end_return               # (visitReturn:532)
.end

As calling conventions clearly state, that the caller has to save everything, its probably up to imcc/pcc.c to insert above statements, if another sub gets called from a sub. I'll fix that in a minute ;-)



Michal J Wallace

Thanks, leo





Reply via email to