Anyway, next will be to hide the return continuation in the interpreter context. So we need to have some opcodes to access the return continuation, e.g.:
get_cc(OUT Px) # 1) get current continuation, i.e. the return cont. return_cc() # 2) return via current continuation
1) is only needed for special porposes, like passing the continuation on to a different place. The normal way to return from a sub will be 2)
If that's in, access to C<P1> as a return continuation will be deprecated.
The PIR sequence:
.pcc_begin_return .return foo .pcc_end_return
will do the right thing accordingly.
Accompanied with that change, we could need another new opcode:
get_sub(OUT Px) # get current Sub PMC
Having the current Sub in the C<P0> register isn't really safe, as user code always can reuse that register. But we want to have error trackbacks finally, which will need to climb up the call chain in a safe way. Currently C<P0> as well as C<P1> might be saved away by C<pushp> or similar and live somewhere in the register backing stack only.
Any thoughts? leo