cvsuser     04/10/25 09:10:20

  Modified:    classes  continuation.pmc sub.pmc
               imcc     pcc.c
               include/parrot interpreter.h sub.h
               src      inter_create.c inter_run.c register.c sub.c
               t/op     gc.t
               t/pmc    coroutine.t sub.t
  Log:
  indirect register frame 8 - first implementation bits
  * create a register stack
  * simplify coroutine context swapping
  * adjust some tests to use pdd03 conventions
  
  * INDIRECT_REGS is still off
  * does not handle overloaded methods yet: no return value handling
  * fails with some bogus looking coroutine tests, which assume
    share registers
  
  Revision  Changes    Path
  1.30      +9 -1      parrot/classes/continuation.pmc
  
  Index: continuation.pmc
  ===================================================================
  RCS file: /cvs/public/parrot/classes/continuation.pmc,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- continuation.pmc  22 Sep 2004 09:21:43 -0000      1.29
  +++ continuation.pmc  25 Oct 2004 16:10:13 -0000      1.30
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: continuation.pmc,v 1.29 2004/09/22 09:21:43 leo Exp $
  +$Id: continuation.pmc,v 1.30 2004/10/25 16:10:13 leo Exp $
   
   =head1 NAME
   
  @@ -163,7 +163,15 @@
   
       void* invoke (void* next) {
           struct Parrot_cont * cc = PMC_cont(SELF);
  +#if INDIRECT_REGS
  +        struct parrot_regs_t *caller_regs;
  +
  +        caller_regs = interpreter->ctx.bp;
  +#endif
           restore_context(interpreter, &cc->ctx);
  +#if INDIRECT_REGS
  +        copy_regs(interpreter, caller_regs);
  +#endif
           if (interpreter->code->cur_cs != cc->seg) {
               Parrot_switch_to_cs(interpreter, cc->seg, 1);
           }
  
  
  
  1.56      +18 -1     parrot/classes/sub.pmc
  
  Index: sub.pmc
  ===================================================================
  RCS file: /cvs/public/parrot/classes/sub.pmc,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- sub.pmc   24 Sep 2004 16:20:55 -0000      1.55
  +++ sub.pmc   25 Oct 2004 16:10:13 -0000      1.56
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: sub.pmc,v 1.55 2004/09/24 16:20:55 leo Exp $
  +$Id: sub.pmc,v 1.56 2004/10/25 16:10:13 leo Exp $
   
   =head1 NAME
   
  @@ -217,6 +217,10 @@
   
       void* invoke (void* next) {
           struct Parrot_sub * sub = PMC_sub(SELF);
  +#if INDIRECT_REGS
  +        struct parrot_regs_t *caller_regs;
  +#endif
  +
           if (++interpreter->ctx.recursion_depth >
                   interpreter->recursion_limit) {
               real_exception(interpreter, next, E_RuntimeError,
  @@ -239,6 +243,19 @@
           interpreter->ctx.current_sub = REG_PMC(0);
           interpreter->ctx.current_cont = REG_PMC(1);
           interpreter->ctx.current_object = REG_PMC(2);
  +#if INDIRECT_REGS
  +        caller_regs = interpreter->ctx.bp;
  +        interpreter->ctx.bp = stack_prepare_push(interpreter,
  +                &interpreter->ctx.reg_stack);
  +        copy_regs(interpreter, caller_regs);
  +        /*
  +         * for now copy P0..P2, S0
  +         */
  +        REG_PMC(0) = caller_regs->pmc_reg.registers[0];
  +        REG_PMC(1) = caller_regs->pmc_reg.registers[1];
  +        REG_PMC(2) = caller_regs->pmc_reg.registers[2];
  +        REG_STR(0) = caller_regs->string_reg.registers[0];
  +#endif
           return sub->address;
       }
   
  
  
  
  1.71      +10 -0     parrot/imcc/pcc.c
  
  Index: pcc.c
  ===================================================================
  RCS file: /cvs/public/parrot/imcc/pcc.c,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- pcc.c     3 Sep 2004 09:27:21 -0000       1.70
  +++ pcc.c     25 Oct 2004 16:10:14 -0000      1.71
  @@ -518,7 +518,9 @@
           regs[0] = get_pasm_reg("P0");
           regs[1] = unit->instructions->r[1]->pcc_sub->p0_sym;
           ins = insINS(interpreter, unit, ins, "set", regs, 2);
  +#if !INDIRECT_REGS
           ins = insINS(interpreter, unit, ins, "savetop", regs, 0);
  +#endif
       }
       /*
        * insert return invoke
  @@ -542,10 +544,12 @@
        * mark the invoke instruction's PCC sub type
        */
       ins->type |= arg_count == 0 ? ITPCCYIELD : (ITPCCRET|ITPCCSUB);
  +#if !INDIRECT_REGS
       if (arg_count == 0) {
           /* optimize this later */
           ins = insINS(interpreter, unit, ins, "restoretop", regs, 0);
       }
  +#endif
   }
   
   #ifdef CREATE_TAIL_CALLS
  @@ -972,8 +976,10 @@
           /*
            * emit a savetop for now
            */
  +#if !INDIRECT_REGS
           if (!sub->pcc_sub->nci)
               ins = insINS(interp, unit, ins, "savetop", regs, 0);
  +#endif
           /*
            * if we reuse the continuation, update it
            */
  @@ -1006,8 +1012,10 @@
           if (sub->pcc_sub->label && ins->next->type == ITLABEL) {
               ins = ins->next;
           }
  +#if !INDIRECT_REGS
           if (!sub->pcc_sub->nci)
               ins = insINS(interp, unit, ins, "restoretop", regs, 0);
  +#endif
           if (p1) {
               regs[0] = get_pasm_reg("P1");
               regs[1] = p1;
  @@ -1231,6 +1239,7 @@
                   ostat.deleted_ins++;
               }
           }
  +#if !INDIRECT_REGS
           else if (ins->type & (ITPCCSUB | ITPCCYIELD) ) {
               tmp = ins;
               tmp = tmp->prev;
  @@ -1242,6 +1251,7 @@
                       optc_savetop(interpreter, unit, tmp);
               }
           }
  +#endif
       }
   }
   
  
  
  
  1.155     +3 -1      parrot/include/parrot/interpreter.h
  
  Index: interpreter.h
  ===================================================================
  RCS file: /cvs/public/parrot/include/parrot/interpreter.h,v
  retrieving revision 1.154
  retrieving revision 1.155
  diff -u -r1.154 -r1.155
  --- interpreter.h     22 Oct 2004 13:29:34 -0000      1.154
  +++ interpreter.h     25 Oct 2004 16:10:15 -0000      1.155
  @@ -1,7 +1,7 @@
   /* interpreter.h
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *     $Id: interpreter.h,v 1.154 2004/10/22 13:29:34 leo Exp $
  + *     $Id: interpreter.h,v 1.155 2004/10/25 16:10:15 leo Exp $
    *  Overview:
    *     The interpreter api handles running the operations
    *  Data Structure and Algorithms:
  @@ -149,6 +149,8 @@
       struct Stack_Chunk *string_reg_stack;
       struct Stack_Chunk *pmc_reg_stack;
   
  +    struct Stack_Chunk *reg_stack;      /* all in one register 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 */
  
  
  
  1.36      +6 -1      parrot/include/parrot/sub.h
  
  Index: sub.h
  ===================================================================
  RCS file: /cvs/public/parrot/include/parrot/sub.h,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- sub.h     18 Oct 2004 01:35:25 -0000      1.35
  +++ sub.h     25 Oct 2004 16:10:15 -0000      1.36
  @@ -1,7 +1,7 @@
   /* sub.h
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *     $Id: sub.h,v 1.35 2004/10/18 01:35:25 brentdax Exp $
  + *     $Id: sub.h,v 1.36 2004/10/25 16:10:15 leo Exp $
    *  Overview:
    *  Data Structure and Algorithms:
    *     Subroutine, coroutine, closure and continuation structures
  @@ -76,6 +76,11 @@
   void mark_context(Interp *, struct Parrot_Context *);
   
   
  +#if INDIRECT_REGS
  +void copy_regs(Interp *, struct parrot_regs_t *caller_regs);
  +void mark_reg_stack(Interp *, Stack_Chunk_t *);
  +#endif
  +
   #endif /* PARROT_SUB_H_GUARD */
   
   /*
  
  
  
  1.23      +1 -10     parrot/src/inter_create.c
  
  Index: inter_create.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/inter_create.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- inter_create.c    22 Oct 2004 14:15:51 -0000      1.22
  +++ inter_create.c    25 Oct 2004 16:10:18 -0000      1.23
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: inter_create.c,v 1.22 2004/10/22 14:15:51 leo Exp $
  +$Id: inter_create.c,v 1.23 2004/10/25 16:10:18 leo Exp $
   
   =head1 NAME
   
  @@ -169,15 +169,6 @@
       init_object_cache(interpreter);
       /* allocate stack chunk cache */
       stack_system_init(interpreter);
  -#if INDIRECT_REGS
  -    /*
  -     * XXX create mem for regs - intermediate step
  -     *     to check indirect accressing
  -     */
  -    interpreter->ctx.bp =
  -        mem_sys_allocate_zeroed(sizeof(struct parrot_regs_t));
  -#endif
  -
       /* Set up the initial register chunks */
       setup_register_stacks(interpreter, &interpreter->ctx);
   
  
  
  
  1.11      +9 -26     parrot/src/inter_run.c
  
  Index: inter_run.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/inter_run.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- inter_run.c       22 Oct 2004 14:15:51 -0000      1.10
  +++ inter_run.c       25 Oct 2004 16:10:18 -0000      1.11
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: inter_run.c,v 1.10 2004/10/22 14:15:51 leo Exp $
  +$Id: inter_run.c,v 1.11 2004/10/25 16:10:18 leo Exp $
   
   =head1 NAME
   
  @@ -100,37 +100,17 @@
   
   */
   
  -#define DO_DOD_REGISTER 0
   void
   Parrot_runops_fromc(Parrot_Interp interpreter, PMC *sub)
   {
       PMC *ret_c, *old_c;
       opcode_t offset, *dest;
   
  -    /*
  -     * the caller doesn't know, that a subroutine is called
  -     * so P1 isn't copied up to the upper half of the register
  -     * frames and isn't stored with savetop - it's totally unachored
  -     *
  -     * we have to dod_register the caller's return continuation
  -     * to prevent it from sudden death
  -     */
  -    old_c = REG_PMC(1);
  -#if DO_DOD_REGISTER
  -    /* XXX it should be visible on the stack here */
  -    dod_register_pmc(interpreter, old_c);
  -#endif
       /* we need one return continuation with a NULL offset */
       REG_PMC(1) = ret_c = new_ret_continuation_pmc(interpreter, NULL);
   #if GC_VERBOSE
       PObj_report_SET(ret_c);     /* s. also dod.c */
   #endif
  -    /*
  -     * also be sure that this continuation isn't destroyed
  -     */
  -#if DO_DOD_REGISTER
  -    dod_register_pmc(interpreter, ret_c);
  -#endif
       /* invoke the sub, which places the context of the sub in the
        * interpreter, and switches code segments if needed
        */
  @@ -139,11 +119,6 @@
           offset = dest - interpreter->code->byte_code;
           runops(interpreter, offset);
       }
  -    REG_PMC(1) = old_c;
  -#if DO_DOD_REGISTER
  -    dod_unregister_pmc(interpreter, ret_c);
  -    dod_unregister_pmc(interpreter, old_c);
  -#endif
   }
   
   /*
  @@ -172,6 +147,9 @@
   PARROT_INLINE static regsave *
   save_regs(Parrot_Interp interpreter, PMC *sub)
   {
  +#if INDIRECT_REGS
  +    return NULL;
  +#else
       regsave *save;
       size_t size = used_size(interpreter, sub);
       Regs_cache * rc = &interpreter->caches->regs_cache;
  @@ -189,6 +167,7 @@
       save->size = size;
       Parrot_memcpy_aligned(&save->regs, interpreter, size);
       return save;
  +#endif
   }
   
   void *
  @@ -201,6 +180,9 @@
   restore_regs(Parrot_Interp interpreter, regsave *data)
   {
   
  +#if INDIRECT_REGS
  +    return;
  +#else
       Regs_cache * rc = &interpreter->caches->regs_cache;
   
       Parrot_memcpy_aligned(interpreter, &data->regs, data->size);
  @@ -208,6 +190,7 @@
       rc->reg_save_top = data;
       assert(rc->reg_save_mark == data);
       rc->reg_save_mark = data->next;
  +#endif
   }
   
   void
  
  
  
  1.51      +35 -1     parrot/src/register.c
  
  Index: register.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/register.c,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- register.c        30 Sep 2004 14:34:14 -0000      1.50
  +++ register.c        25 Oct 2004 16:10:18 -0000      1.51
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: register.c,v 1.50 2004/09/30 14:34:14 leo Exp $
  +$Id: register.c,v 1.51 2004/10/25 16:10:18 leo Exp $
   
   =head1 NAME
   
  @@ -57,6 +57,14 @@
   
       ctx->pmc_reg_stack = register_new_stack(interpreter,
               "PMCReg_", sizeof(struct PRegFrame));
  +
  +#if INDIRECT_REGS
  +    ctx->reg_stack = register_new_stack(interpreter,
  +            "Register_", sizeof(struct parrot_regs_t));
  +
  +    ctx->bp = (struct parrot_regs_t *)STACK_DATAP(ctx->reg_stack);
  +#endif
  +
   }
   
   
  @@ -105,6 +113,32 @@
       }
   }
   
  +#if INDIRECT_REGS
  +void
  +mark_reg_stack(Parrot_Interp interpreter, Stack_Chunk_t* chunk)
  +{
  +    UINTVAL j;
  +    PObj *obj;
  +
  +    for ( ; ; chunk = chunk->prev) {
  +        struct parrot_regs_t *regs = (struct parrot_regs_t *)STACK_DATAP(chunk);
  +
  +        pobject_lives(interpreter, (PObj*)chunk);
  +        if (chunk == chunk->prev)
  +            break;
  +        for (j = 0; j < NUM_REGISTERS; j++) {
  +            obj = (PObj*) regs->pmc_reg.registers[j];
  +            if (obj)
  +                pobject_lives(interpreter, obj);
  +            obj = (PObj*) regs->string_reg.registers[j];
  +            if (obj)
  +                pobject_lives(interpreter, obj);
  +        }
  +    }
  +}
  +
  +#endif
  +
   /*
   
   =item C<void
  
  
  
  1.72      +69 -69    parrot/src/sub.c
  
  Index: sub.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/sub.c,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- sub.c     24 Sep 2004 11:13:41 -0000      1.71
  +++ sub.c     25 Oct 2004 16:10:18 -0000      1.72
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: sub.c,v 1.71 2004/09/24 11:13:41 leo Exp $
  +$Id: sub.c,v 1.72 2004/10/25 16:10:18 leo Exp $
   
   =head1 NAME
   
  @@ -76,6 +76,9 @@
       mark_register_stack(interpreter, ctx->num_reg_stack);
       mark_string_register_stack(interpreter, ctx->string_reg_stack);
       mark_pmc_register_stack(interpreter, ctx->pmc_reg_stack);
  +#if INDIRECT_REGS
  +    mark_reg_stack(interpreter, ctx->reg_stack);
  +#endif
   }
   
   /*
  @@ -86,8 +89,8 @@
                   struct Stack_Chunk *saved_stack,
                   struct Stack_Chunk *saved_base)>
   
  -The final C<ctx_stack> = C<interp_stack> + C<saved_stack>, which
  -gets swapped with the C<interp_stack> during the prepend.
  +The final C<ctx_stack> = C<interp_stack> + C<saved_stack>.
  +C<interp_stack> and C<ctx_stack> are already swapped here.
   
   =cut
   
  @@ -100,14 +103,10 @@
                   struct Stack_Chunk *saved_base)
   {
       /*
  -     * the coroutines context gets the interpreter stack
  -     */
  -    *ctx_stack = *interp_stack;
  -    /*
        * new interpreter stack is the saved coroutine stack top
        * with the base pointing to the old top
        */
  -    saved_base->prev = *interp_stack;
  +    saved_base->prev = *ctx_stack;
   
       *interp_stack = saved_stack;
   }
  @@ -120,9 +119,8 @@
                   struct Stack_Chunk **saved_stack,
                   struct Stack_Chunk *saved_base)>
   
  -Swap C<**interp_stack> and C<**ctx_stack> and save the coroutine only
  -parts of the stack in C<**saved_stack>, so effectively undoing
  -C<prepend_stack()>.
  +Undo C<prepend_stack()>.
  +C<interp_stack> and C<ctx_stack> are already swapped here.
   
   =cut
   
  @@ -134,25 +132,13 @@
                   struct Stack_Chunk **saved_stack,
                   struct Stack_Chunk *saved_base)
   {
  -    /*
  -     * swap stacks back
  -     */
  -    *saved_stack = *interp_stack;
  -    *interp_stack = *ctx_stack;
  +    *saved_stack = *ctx_stack;
       /*
        * the coroutine stack ends here
        */
       saved_base->prev = saved_base;
   }
   
  -static void
  -swap_pmcs(PMC *a, PMC *b)
  -{
  -    PMC *t = a;
  -    a = b;
  -    b = t;
  -}
  -
   /*
   
   =item C<void
  @@ -167,41 +153,19 @@
   void
   swap_context(Interp *interpreter, struct PMC *sub)
   {
  -    struct Stack_Chunk * tmp_stack = NULL;
  -    UINTVAL warns;
       struct Parrot_coro* co = PMC_coro(sub);
       struct Parrot_Context *ctx = &co->ctx;
  -    Stack_Chunk_t *reg_top;
  +    struct Parrot_Context temp;
  +#if INDIRECT_REGS
  +    struct parrot_regs_t *reg_p;
  +#endif
   
       /*
  -     * Swap user stacks and warnings
  +     * Swap context structures
        */
  -
  -    tmp_stack = interpreter->ctx.user_stack;
  -    interpreter->ctx.user_stack = ctx->user_stack;
  -    ctx->user_stack = tmp_stack;
  -
  -    warns = interpreter->ctx.warns;
  -    interpreter->ctx.warns = ctx->warns;
  -    ctx->warns = warns;
  -
  -    warns = interpreter->ctx.errors;
  -    interpreter->ctx.errors = ctx->errors;
  -    ctx->errors = warns;
  -
  -    /* swap register frame tops */
  -    reg_top = interpreter->ctx.int_reg_stack;
  -    interpreter->ctx.int_reg_stack = ctx->int_reg_stack;
  -    ctx->int_reg_stack = reg_top;
  -    reg_top = interpreter->ctx.num_reg_stack;
  -    interpreter->ctx.num_reg_stack = ctx->num_reg_stack;
  -    ctx->num_reg_stack = reg_top;
  -    reg_top = interpreter->ctx.string_reg_stack;
  -    interpreter->ctx.string_reg_stack = ctx->string_reg_stack;
  -    ctx->string_reg_stack = reg_top;
  -    reg_top = interpreter->ctx.pmc_reg_stack;
  -    interpreter->ctx.pmc_reg_stack = ctx->pmc_reg_stack;
  -    ctx->pmc_reg_stack = reg_top;
  +    memcpy(&temp, &interpreter->ctx, sizeof(temp));
  +    memcpy(&interpreter->ctx, ctx,   sizeof(temp));
  +    memcpy(ctx, &temp,               sizeof(temp));
   
       /* if calling the coroutine */
       if (!(PObj_get_FLAGS(sub) & PObj_private0_FLAG)) {
  @@ -209,14 +173,15 @@
            * first time set current sub, cont, object
            */
           if (!interpreter->ctx.current_sub) {
  +#if INDIRECT_REGS
  +            copy_regs(interpreter, ctx->bp);
  +            ctx->current_sub = interpreter->ctx.current_sub = sub;
  +            interpreter->ctx.current_cont = ctx->bp->pmc_reg.registers[1];
  +#else
               interpreter->ctx.current_sub = REG_PMC(0);
               interpreter->ctx.current_cont = REG_PMC(1);
               interpreter->ctx.current_object = REG_PMC(2);
  -        }
  -        else {
  -            swap_pmcs(interpreter->ctx.current_sub, ctx->current_sub);
  -            swap_pmcs(interpreter->ctx.current_cont, ctx->current_cont);
  -            swap_pmcs(interpreter->ctx.current_object, ctx->current_object);
  +#endif
           }
           /*
            * construct stacks that have the interpreterreter stack
  @@ -230,17 +195,13 @@
           PObj_get_FLAGS(sub) &= ~PObj_private0_FLAG;
           restore_stack(&interpreter->ctx.control_stack, &ctx->control_stack,
                   &co->co_control_stack, co->co_control_base);
  -        swap_pmcs(interpreter->ctx.current_sub, ctx->current_sub);
  -        swap_pmcs(interpreter->ctx.current_cont, ctx->current_cont);
  -        swap_pmcs(interpreter->ctx.current_object, ctx->current_object);
  +#if INDIRECT_REGS
  +        copy_regs(interpreter, ctx->bp);
  +#endif
       }
  -    /*
  -     * TODO FIXME swap the pad_stack or act like the control_stack
  -     */
  -#if 1
  -    tmp_stack = interpreter->ctx.pad_stack;
  -    interpreter->ctx.pad_stack = ctx->pad_stack;
  -    ctx->pad_stack = tmp_stack;
  +#if INDIRECT_REGS
  +    REG_PMC(0) = interpreter->ctx.current_sub;
  +    REG_PMC(1) = interpreter->ctx.current_cont;
   #endif
   }
   
  @@ -354,6 +315,7 @@
       co->seg = interp->code->cur_cs;
       ctx = &co->ctx;
       save_context(interp, ctx);
  +    ctx->current_sub = NULL;
   
       /* we have separate register stacks
        * - or not, with our single item stack
  @@ -401,6 +363,44 @@
   }
   
   
  +#if INDIRECT_REGS
  +/*
  +
  +=item C<void copy_regs(Interp *, struct parrot_regs_t *caller_regs)>
  +
  +Copy function arguments or return values from C<caller_regs> to interpreter.
  +
  +=cut
  +
  +*/
  +
  +void
  +copy_regs(Interp *interpreter, struct parrot_regs_t *caller_regs)
  +{
  +    int i, n, proto;
  +
  +    proto = caller_regs->int_reg.registers[0];
  +    if (proto) {
  +        for (i = 0; i < 5 + caller_regs->int_reg.registers[1]; ++i)
  +            REG_INT(i) = caller_regs->int_reg.registers[i];
  +        for (i = 0; i < caller_regs->int_reg.registers[2]; ++i)
  +            REG_STR(i + 5) = caller_regs->string_reg.registers[i + 5];
  +        for (i = 0; i < caller_regs->int_reg.registers[3]; ++i)
  +            REG_PMC(i + 5) = caller_regs->pmc_reg.registers[i + 5];
  +        for (i = 0; i < caller_regs->int_reg.registers[4]; ++i)
  +            REG_NUM(i + 5) = caller_regs->num_reg.registers[i + 5];
  +    }
  +    else {
  +        REG_INT(0) = 0;
  +        REG_INT(3) = n = caller_regs->int_reg.registers[3];
  +        for (i = 0; i < n; ++i)
  +            REG_PMC(i + 5) = caller_regs->pmc_reg.registers[i + 5];
  +    }
  +    REG_PMC(3) = caller_regs->pmc_reg.registers[3];
  +}
  +
  +#endif
  +
   /*
   
   =back
  
  
  
  1.19      +11 -1     parrot/t/op/gc.t
  
  Index: gc.t
  ===================================================================
  RCS file: /cvs/public/parrot/t/op/gc.t,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- gc.t      1 Oct 2004 21:16:49 -0000       1.18
  +++ gc.t      25 Oct 2004 16:10:19 -0000      1.19
  @@ -1,6 +1,6 @@
   #! perl -w
   # Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -# $Id: gc.t,v 1.18 2004/10/01 21:16:49 jrieks Exp $
  +# $Id: gc.t,v 1.19 2004/10/25 16:10:19 leo Exp $
   
   =head1 NAME
   
  @@ -241,6 +241,11 @@
       setprop P12, "buf", P14
       setprop P2, "buffer", P12
   buffer_ok:
  +    set I0, 1
  +    null I1
  +    set I2, 1
  +    null I3
  +    null I4
       set S5, P12
       invoke P1
   
  @@ -250,6 +255,11 @@
       getprop P12, "buf", P2
       set S16, P12
       set S5, S16
  +    set I0, 1
  +    null I1
  +    set I2, 1
  +    null I3
  +    null I4
       invoke P1
   CODE
   hello
  
  
  
  1.11      +22 -13    parrot/t/pmc/coroutine.t
  
  Index: coroutine.t
  ===================================================================
  RCS file: /cvs/public/parrot/t/pmc/coroutine.t,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- coroutine.t       1 Oct 2004 21:16:52 -0000       1.10
  +++ coroutine.t       25 Oct 2004 16:10:20 -0000      1.11
  @@ -1,6 +1,6 @@
   #! perl -w
   # Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -# $Id: coroutine.t,v 1.10 2004/10/01 21:16:52 jrieks Exp $
  +# $Id: coroutine.t,v 1.11 2004/10/25 16:10:20 leo Exp $
   
   =head1 NAME
   
  @@ -45,20 +45,24 @@
   OUTPUT
   
   output_is(<<'CODE', <<'OUTPUT', "Coroutines");
  +    null I0
  +    null I3
       new P0, .Coroutine
       set_addr P0, co2
   co1:
  -    set I1, 4
  +    set I10, 4
       print "start 1\n"
   co1_loop:
       invoke
       print "back  1\n"
  -    dec I1
  -    ne I1, 0, co1_loop
  +    dec I10
  +    ne I10, 0, co1_loop
       print "done\n"
       end
   
   co2:
  +    null I0
  +    null I3
       print "start 2\n"
       new P5, .Coroutine
       set_addr P5, co3
  @@ -73,6 +77,8 @@
       branch co2_loop
   
   co3:
  +    null I0
  +    null I3
       print "start 3\n"
       new P7, .Coroutine
       set_addr P7, co2_loop
  @@ -152,13 +158,16 @@
       store_lex -1, "a", P20
       store_lex -2, "b", P21
   
  -    new P1, .Coroutine
  -    set_addr P1, co1
   
  -    new P2, .Coroutine
  -    set_addr P2, co2
  +    new P5, .Coroutine
  +    set_addr P5, co1
   
  -    set P0, P1
  +    new P6, .Coroutine
  +    set_addr P6, co2
  +
  +    null I0
  +    set I3, 2
  +    set P0, P5
       invoke
   
       find_lex P10, "b"
  @@ -194,11 +203,11 @@
       store_lex "a", P22      # replaces
   
       # invoke c02
  -    set P0, P2
  +    set P0, P6
       invoke
   
       # return
  -    set P0, P1
  +    set P0, P5
       invoke
   
       find_lex P10, "b"
  @@ -210,7 +219,7 @@
       print "\n"
   
       # return again
  -    set P0, P1
  +    set P0, P5
       invoke
   
       find_lex P10, "b"
  @@ -222,7 +231,7 @@
       print "\n"
   
       # return again
  -    set P0, P1
  +    set P0, P5
       invoke
   
   co2:
  
  
  
  1.45      +11 -1     parrot/t/pmc/sub.t
  
  Index: sub.t
  ===================================================================
  RCS file: /cvs/public/parrot/t/pmc/sub.t,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- sub.t     1 Oct 2004 21:16:52 -0000       1.44
  +++ sub.t     25 Oct 2004 16:10:20 -0000      1.45
  @@ -1,6 +1,6 @@
   #! perl -w
   # Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -# $Id: sub.t,v 1.44 2004/10/01 21:16:52 jrieks Exp $
  +# $Id: sub.t,v 1.45 2004/10/25 16:10:20 leo Exp $
   
   =head1 NAME
   
  @@ -57,6 +57,11 @@
       set_addr P0, func
   
       set I5, 3
  +    set I0, 1
  +    set I1, 1
  +    null I2
  +    null I3
  +    null I4
       save I5
   
       invokecc
  @@ -92,6 +97,11 @@
       set_addr P0, func
   
       set I5, 3
  +    set I0, 1
  +    set I1, 1
  +    null I2
  +    null I3
  +    null I4
       save I5
   
       invokecc P0
  
  
  

Reply via email to