-----Original Message----- From: Leopold Toetsch [mailto:[EMAIL PROTECTED]
The patch is fine with two exceptions: 1) still breaks existing P6C tests WRT exceptions & rules
You didn't mention this point. It might be only a small change in P6C code, I didn't look at (4 tests are failing now due to invoke changes).
2) performance of CPS sucks
This is the reason for the new implementation of the invoke op which assumes
that the continuation has already been put in place.
Ok then we need a new opcode:
newsub Px, .Class, jump_or_ret_addr
This constructs a sub or continuation type subroutine PMC in Px of class .Class and the referenced label - in one instruction.
Also allowing the invokecc to take an argument specifying the type of continuation to save may be helpful:
No, don't think so. The type is specified by the PMC class. The invoke of this class takes the appropriate action.
2b) There is still too much context copying going on AFAIK. The register top and base pointers are copied too in {save,restore}context worth of 8 words, while just copying the 3 stacks (pad, control, user) should more then be enough. The coroutine code only swaps these - BTW and doesn't set them COW.
I am not sure I follow this. Are you suggesting that the register stacks do not need to be copied? Again different types of continuations would be good.
I honestly don't know, what has to be copied. I just know that all now do copy different things and if CPS is involved also restore different things. Please look at sub/continuation/coroutine and their context saving: all are different.
As suggested in a previous email coroutine.pmc could just go away. Since returning from an otherwise normal sub using:
invokecc P1
Not quite. It has the same functionality, but it does construct a new continuation PMC for the address to continue. And as outline the performance sucks.
will save the appropriate context for a subsequent 'coroutine' call.
Yes for sure, but swapping 3 pointers is a lot faster.
Still a lot (almost all) of my original concerns are not addressed yet.
leo