Diff for /gforth/engine/main.c between versions 1.228 and 1.229

version 1.228, 2010/02/14 18:13:31 version 1.229, 2010/04/05 22:17:56
Line 313  static Cell min(Cell a, Cell b) Line 313  static Cell min(Cell a, Cell b)
  * If the word =CF(DODOES), it's a DOES> CFA   * If the word =CF(DODOES), it's a DOES> CFA
  * If the word =CF(DOESJUMP), it's a DOES JUMP (2 Cells after DOES>,   * If the word =CF(DOESJUMP), it's a DOES JUMP (2 Cells after DOES>,
  *                                      possibly containing a jump to dodoes)   *                                      possibly containing a jump to dodoes)
  * If the word is <CF(DOESJUMP) and bit 14 is set, it's the xt of a primitive   * If the word is <CF(DOER_MAX) and bit 14 is set, it's the xt of a primitive
  * If the word is <CF(DOESJUMP) and bit 14 is clear,    * If the word is <CF(DOER_MAX) and bit 14 is clear, 
  *                                        it's the threaded code of a primitive   *                                        it's the threaded code of a primitive
  * bits 13..9 of a primitive token state which group the primitive belongs to,   * bits 13..9 of a primitive token state which group the primitive belongs to,
  * bits 8..0 of a primitive token index into the group   * bits 8..0 of a primitive token index into the group
Line 410  void gforth_relocate(Cell *image, const Line 410  void gforth_relocate(Cell *image, const
             case CF(DOVAL)   :              case CF(DOVAL)   :
             case CF(DOUSER)  :               case CF(DOUSER)  : 
             case CF(DODEFER) :               case CF(DODEFER) : 
             case CF(DOFIELD) : MAKE_CF(image+i,symbols[CF(token)]); break;              case CF(DOFIELD) : 
               case CF(DOABICODE) : MAKE_CF(image+i,symbols[CF(token)]); break;
             case CF(DOESJUMP): image[i]=0; break;              case CF(DOESJUMP): image[i]=0; break;
 #endif /* !defined(DOUBLY_INDIRECT) */  #endif /* !defined(DOUBLY_INDIRECT) */
             case CF(DODOES)  :              case CF(DODOES)  :
Line 469  static UCell checksum(Label symbols[]) Line 470  static UCell checksum(Label symbols[])
   UCell r=PRIM_VERSION;    UCell r=PRIM_VERSION;
   Cell i;    Cell i;
   
   for (i=DOCOL; i<=DOESJUMP; i++) {    for (i=DOCOL; i<=DOER_MAX; i++) {
     r ^= (UCell)(symbols[i]);      r ^= (UCell)(symbols[i]);
     r = (r << 5) | (r >> (8*sizeof(Cell)-5));      r = (r << 5) | (r >> (8*sizeof(Cell)-5));
   }    }
Line 1074  static void check_prims(Label symbols1[] Line 1075  static void check_prims(Label symbols1[]
           ia->rel=0;            ia->rel=0;
           debugp(stderr,"\n   absolute immarg: offset %3d",j);            debugp(stderr,"\n   absolute immarg: offset %3d",j);
         } else if ((&(s1[j]))+(*(Cell *)&(s1[j]))+4 ==          } else if ((&(s1[j]))+(*(Cell *)&(s1[j]))+4 ==
                    symbols1[DOESJUMP+1]) {                     symbols1[DOER_MAX+1]) {
           ia->rel=1;            ia->rel=1;
           debugp(stderr,"\n   relative immarg: offset %3d",j);            debugp(stderr,"\n   relative immarg: offset %3d",j);
         } else {          } else {
Line 1093  static void check_prims(Label symbols1[] Line 1094  static void check_prims(Label symbols1[]
     debugp(stderr,"\n");      debugp(stderr,"\n");
   }    }
   decomp_prims = calloc(i,sizeof(PrimInfo *));    decomp_prims = calloc(i,sizeof(PrimInfo *));
   for (i=DOESJUMP+1; i<npriminfos; i++)    for (i=DOER_MAX+1; i<npriminfos; i++)
     decomp_prims[i] = &(priminfos[i]);      decomp_prims[i] = &(priminfos[i]);
   qsort(decomp_prims+DOESJUMP+1, npriminfos-DOESJUMP-1, sizeof(PrimInfo *),    qsort(decomp_prims+DOER_MAX+1, npriminfos-DOER_MAX-1, sizeof(PrimInfo *),
         compare_priminfo_length);          compare_priminfo_length);
 #endif  #endif
 }  }
Line 1264  Label decompile_code(Label _code) Line 1265  Label decompile_code(Label _code)
       break;        break;
   }    }
   /* reverse order because NOOP might match other prims */    /* reverse order because NOOP might match other prims */
   for (i=npriminfos-1; i>DOESJUMP; i--) {    for (i=npriminfos-1; i>DOER_MAX; i--) {
     PrimInfo *pi=decomp_prims[i];      PrimInfo *pi=decomp_prims[i];
     if (pi->start==code || (pi->start && memcmp(code,pi->start,pi->length)==0))      if (pi->start==code || (pi->start && memcmp(code,pi->start,pi->length)==0))
       return vm_prims[super2[super_costs[pi-priminfos].offset]];        return vm_prims[super2[super_costs[pi-priminfos].offset]];
Line 1820  void compile_prim1(Cell *start) Line 1821  void compile_prim1(Cell *start)
   if (start==NULL)    if (start==NULL)
     return;      return;
   prim = (Label)*start;    prim = (Label)*start;
   if (prim<((Label)(xts+DOESJUMP)) || prim>((Label)(xts+npriminfos))) {    if (prim<((Label)(xts+DOER_MAX)) || prim>((Label)(xts+npriminfos))) {
     fprintf(stderr,"compile_prim encountered xt %p\n", prim);      fprintf(stderr,"compile_prim encountered xt %p\n", prim);
     *start=(Cell)prim;      *start=(Cell)prim;
     return;      return;

Removed from v.1.228  
changed lines
  Added in v.1.229


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>