Here's again a summary of upcoming changes. I'll commit for now just the new "returncc" opcode. Other changes that start breaking things will follow in a few days.

Summary:

1) PIR code using PIRs HLL call syntax doesn't need changes.

   foo()         # call sub foo
   a = bar(x)    # call bar with argument, get return value
   (a,b,c) = baz(x,y)

   .return()     # return from a sub - maybe omitted if last
                 # statement before .end
   .return(foo, bar)     # return these values

   .yield(foo)   # yield value(s) from a coroutine

   self."method"(x, y)    # method call on object self
   $P0 = other_object     # and on another one
   (r, s) = $P0."other_meth"(a)


2) PASM code using pdd03 calling conventions

All explicit usage of P0, P1 related to subroutines as well as P2 in OO code is *not* safe and need changes.

2a) return from a sub

instead of "invoke P1"   use the new opcode "returncc"

2b) accessing the object "self" in methods:

    .include "interpinfo.pasm"
    interpinfo P2, .INTERPINFO_CURRENT_OBJECT
    # get object into given register

2c) access the current subroutine object

    .include "interpinfo.pasm"
    interpinfo P0, .INTERPINFO_CURRENT_SUB

2d) create a real continuation from the current continuation

    .include "interpinfo.pasm"
    interpinfo P1, .INTERPINFO_CURRENT_CONT

This continuation is already a full Continuation PMC usable for call/cc.

Reference:
docs/pdds/pdd03_calling_conventions.pod

I'll try to make these changes seamlessly, but I can't guarantee that there will be no intermittend failures in tests or other code, until the changes are done.

leo



Reply via email to