On Jan 7, 2004, at 8:15 PM, Melvin Smith wrote:
Leopold Toetsch writes:
> Jeff Clites <[EMAIL PROTECTED]> wrote:
> > On Jan 7, 2004, at 1:46 AM, Leopold Toetsch wrote:
> Exactly the latter:
> That was AFAIK a design decision, when Dan did introduce CPS. At this
> time register backing stacks went out of the continuation or whatelse
> context - IIRC did Dan commit that to CVS himself.

I tend to agree, but maybe Dan can explain. I looked back at the CVS history and when I put continuations in, I did originally have register stacks in the Parrot_Context (although they weren't yet garbage collected). Dan since reverted that and put them back to the top level interpreter object.

I think I'm just being dense, but looking at include/parrot/interpreter.h it appears that they are in the context:


typedef struct Parrot_Context {
struct IRegChunk *int_reg_top; /* Current top chunk of int reg stack */
struct NRegChunk *num_reg_top; /* Current top chunk of the float reg
* stack */
struct SRegChunk *string_reg_top; /* Current top chunk of the string
* stack */
struct PRegChunk *pmc_reg_top; /* Current top chunk of the PMC stack */


struct Stack_Chunk *pad_stack; /* Base of the lex pad stack */
struct Stack_Chunk *user_stack; /* Base of the scratch stack */
struct Stack_Chunk *control_stack; /* Base of the flow control stack */
IntStack intstack; /* Base of the regex stack */
Buffer * warns; /* Keeps track of what warnings
* have been activated */
} parrot_context_t;



and


typedef struct Parrot_Interp {
struct IReg int_reg;
struct NReg num_reg;
struct SReg string_reg;
struct PReg pmc_reg;
struct Parrot_Context ctx; /* All the registers and stacks that
matter when context switching */
...


and in src/register.c we have:

void
Parrot_push_i(struct Parrot_Interp *interpreter, void *where)
{
    /* Do we have any space in the current savestack? If so, memcpy
     * down */
    if (interpreter->ctx.int_reg_top->used < FRAMES_PER_CHUNK) {
        memcpy(&interpreter->ctx.int_reg_top->
               IRegFrame[interpreter->ctx.int_reg_top->used],
               where, sizeof(struct IRegFrame));
        interpreter->ctx.int_reg_top->used++;
    }
...

The continuation code only saves interpreter->ctx, and not the stuff that hangs off of it, but it seems pretty clear that the register save stacks are attached to the interpreter context in the current sources.

So what am I missing?

JEff



Reply via email to