cvsuser     04/03/22 05:09:32

  Modified:    imcc     pcc.c
               imcc/t/syn pcc.t
  Log:
  cleanup; add 2 more tests, one
  Courtesy of Ilya Martynov <[EMAIL PROTECTED]>
  
  Revision  Changes    Path
  1.55      +4 -7      parrot/imcc/pcc.c
  
  Index: pcc.c
  ===================================================================
  RCS file: /cvs/public/parrot/imcc/pcc.c,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -w -r1.54 -r1.55
  --- pcc.c     22 Mar 2004 11:48:28 -0000      1.54
  +++ pcc.c     22 Mar 2004 13:09:30 -0000      1.55
  @@ -265,11 +265,8 @@
               }
               if (next[REGSET_P] == LAST_PARAM_REG) {
                   /* clear P3 */
  -                if (!p3)
  -                    p3 = get_pasm_reg("P3");
  -                regs[0] = p3;
  +                regs[0] = get_pasm_reg("P3");
                   ins = insINS(interpreter, unit, ins, "null", regs, 1);
  -                p3 = NULL;
               }
               if (next[set] > LAST_PARAM_REG) {
                   goto overflow;
  @@ -277,7 +274,7 @@
               /*
                * if register number already matches - fine
                */
  -            if (arg->color == next[set] && arg->type & VTREGISTER) {
  +            if (arg->color == next[set] && (arg->type & VTREGISTER)) {
                   next[set]++;
                   break;
               }
  @@ -288,7 +285,7 @@
                   arg_reg->want_regno = next[set];
               }
               sprintf(buf, "%c%d", arg_reg->set, next[set]++);
  -            reg = mk_pasm_reg(str_dup(buf));
  +            reg = get_pasm_reg(buf);
               regs[0] = reg;
               regs[1] = arg_reg;
               ins = insINS(interpreter, unit, ins, "set", regs, 2);
  @@ -335,7 +332,7 @@
   
       /* set items in PRegs: I3 */
       if (flatten) {
  -        regs[0] = mk_pasm_reg(str_dup("I3"));;
  +        regs[0] = get_pasm_reg("I3");;
           regs[1] = mk_const(str_dup("5"), 'I');
           ins = insINS(interpreter, unit, ins, "sub", regs, 2);
       }
  
  
  
  1.38      +46 -1     parrot/imcc/t/syn/pcc.t
  
  Index: pcc.t
  ===================================================================
  RCS file: /cvs/public/parrot/imcc/t/syn/pcc.t,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -w -r1.37 -r1.38
  --- pcc.t     20 Mar 2004 09:35:48 -0000      1.37
  +++ pcc.t     22 Mar 2004 13:09:32 -0000      1.38
  @@ -1,6 +1,6 @@
   #!perl
   use strict;
  -use TestCompiler tests => 32;
  +use TestCompiler tests => 34;
   
   ##############################
   # Parrot Calling Conventions
  @@ -1273,3 +1273,48 @@
   10
   20
   OUT
  +
  +output_is(<<'CODE', <<'OUT', "P3 is NULL - 11 args");
  +.sub _main
  +    P3 = new .PerlArray
  +    # call with 11 parameters
  +    _foo($P1, $P2, $P3, $P4, $P5, $P6, $P7, $P8, $P9, $P10, $P11)
  +    end
  +.end
  +
  +.sub _foo
  +    isnull P3, p3_is_null
  +    print "P3 is not NULL\n"
  +    goto return
  +p3_is_null:
  +    print "P3 is NULL\n"
  +return:
  +.end
  +CODE
  +P3 is NULL
  +OUT
  +
  +output_is(<<'CODE', <<'OUT', "P3 isnt NULL - 12 args");
  +.sub _main
  +    P3 = new .PerlArray
  +    # call with 11 parameters
  +    _foo($P1, $P2, $P3, $P4, $P5, $P6, $P7, $P8, $P9, $P10, $P11, $P12)
  +    end
  +.end
  +
  +.sub _foo
  +    isnull P3, p3_is_null
  +    print "P3 is not NULL\n"
  +    $I0 = P3
  +    print $I0
  +    print "\n"
  +    goto return
  +p3_is_null:
  +    print "P3 is NULL\n"
  +return:
  +.end
  +CODE
  +P3 is not NULL
  +1
  +OUT
  +
  
  
  

Reply via email to