Diff for /gforth/Attic/engine.c between versions 1.14 and 1.16

version 1.14, 1994/09/08 17:20:05 version 1.16, 1994/09/26 20:31:10
Line 123  static char* fileattr[6]={"r","rb","r+", Line 123  static char* fileattr[6]={"r","rb","r+",
   
 static Address up0=NULL;  static Address up0=NULL;
   
 #if defined(i386) && defined(FORCE_REG)  /* if machine.h has not defined explicit registers, define them as implicit */
 #  define REG(reg) __asm__(reg)  #ifndef IPREG
   #define IPREG
 Label *engine(Xt *ip0, Cell *sp0, Cell *rp, Float *fp, Address lp)  #endif
 {  #ifndef SPREG
    register Xt *ip REG("%esi")=ip0;  #define SPREG
    register Cell *sp REG("%edi")=sp0;  #endif
   #ifndef RPREG
 #else  #define RPREG
 #  define REG(reg)  #endif
   #ifndef FPREG
 Label *engine(Xt *ip, Cell *sp, Cell *rp, Float *fp, Address lp)  #define FPREG
 {  #endif
   #ifndef LPREG
   #define LPREG
   #endif
   #ifndef CFAREG
   #define CFAREG
   #endif
   #ifndef UPREG
   #define UPREG
   #endif
   #ifndef TOSREG
   #define TOSREG
 #endif  #endif
   #ifndef FTOSREG
   #define FTOSREG
   #endif
   
   Label *engine(Xt *ip0, Cell *sp0, Cell *rp0, Float *fp0, Address lp0)
 /* executes code at ip, if ip!=NULL  /* executes code at ip, if ip!=NULL
    returns array of machine code labels (for use in a loader), if ip==NULL     returns array of machine code labels (for use in a loader), if ip==NULL
 */  */
   register Xt cfa  {
 #ifdef i386    register Xt *ip IPREG = ip0;
 #  ifdef USE_TOS    register Cell *sp SPREG = sp0;
    REG("%ecx")    register Cell *rp RPREG = rp0;
 #  else    register Float *fp FPREG = fp0;
    REG("%edx")    register Address lp LPREG = lp0;
 #  endif    register Xt cfa CFAREG;
 #endif    register Address up UPREG = up0;
    ;    IF_TOS(register Cell TOS TOSREG;)
   Address up=up0;    IF_FTOS(register Float FTOS FTOSREG;)
   static Label symbols[]= {    static Label symbols[]= {
     &&docol,      &&docol,
     &&docon,      &&docon,
Line 160  Label *engine(Xt *ip, Cell *sp, Cell *rp Line 176  Label *engine(Xt *ip, Cell *sp, Cell *rp
     &&dodoes,  /* dummy for does handler address */      &&dodoes,  /* dummy for does handler address */
 #include "prim_labels.i"  #include "prim_labels.i"
   };    };
   IF_TOS(register Cell TOS;)  
   IF_FTOS(Float FTOS;)  
 #ifdef CPU_DEP  #ifdef CPU_DEP
   CPU_DEP;    CPU_DEP;
 #endif  #endif
   
   #ifdef DEBUG
     fprintf(stderr,"ip=%x, sp=%x, rp=%x, fp=%x, lp=%x, up=%x\n",
             ip,sp,rp,fp,lp,up);
   #endif
   
   if (ip == NULL)    if (ip == NULL)
     return symbols;      return symbols;
   
Line 176  Label *engine(Xt *ip, Cell *sp, Cell *rp Line 195  Label *engine(Xt *ip, Cell *sp, Cell *rp
       
  docol:   docol:
 #ifdef DEBUG  #ifdef DEBUG
   printf("%08x: col: %08x\n",(Cell)ip,(Cell)PFA1(cfa));    fprintf(stderr,"%08x: col: %08x\n",(Cell)ip,(Cell)PFA1(cfa));
 #endif  #endif
 #ifdef i386  #ifdef CISC_NEXT
   /* this is the simple version */    /* this is the simple version */
   *--rp = (Cell)ip;    *--rp = (Cell)ip;
   ip = (Xt *)PFA1(cfa);    ip = (Xt *)PFA1(cfa);
   NEXT;    NEXT;
 #endif  #else
   /* this one is important, so we help the compiler optimizing    /* this one is important, so we help the compiler optimizing
      The following version may be better (for scheduling), but probably has       The following version may be better (for scheduling), but probably has
      problems with code fields employing calls and delay slots       problems with code fields employing calls and delay slots
Line 197  Label *engine(Xt *ip, Cell *sp, Cell *rp Line 216  Label *engine(Xt *ip, Cell *sp, Cell *rp
     ip = current_ip+1;      ip = current_ip+1;
     NEXT1_P2;      NEXT1_P2;
   }    }
   #endif
       
  docon:   docon:
 #ifdef DEBUG  #ifdef DEBUG
   printf("%08x: con: %08x\n",(Cell)ip,*(Cell*)PFA1(cfa));    fprintf(stderr,"%08x: con: %08x\n",(Cell)ip,*(Cell*)PFA1(cfa));
 #endif  #endif
 #ifdef USE_TOS  #ifdef USE_TOS
   *sp-- = TOS;    *sp-- = TOS;
Line 212  Label *engine(Xt *ip, Cell *sp, Cell *rp Line 232  Label *engine(Xt *ip, Cell *sp, Cell *rp
       
  dovar:   dovar:
 #ifdef DEBUG  #ifdef DEBUG
   printf("%08x: var: %08x\n",(Cell)ip,(Cell)PFA1(cfa));    fprintf(stderr,"%08x: var: %08x\n",(Cell)ip,(Cell)PFA1(cfa));
 #endif  #endif
 #ifdef USE_TOS  #ifdef USE_TOS
   *sp-- = TOS;    *sp-- = TOS;
Line 226  Label *engine(Xt *ip, Cell *sp, Cell *rp Line 246  Label *engine(Xt *ip, Cell *sp, Cell *rp
       
  douser:   douser:
 #ifdef DEBUG  #ifdef DEBUG
   printf("%08x: user: %08x\n",(Cell)ip,(Cell)PFA1(cfa));    fprintf(stderr,"%08x: user: %08x\n",(Cell)ip,(Cell)PFA1(cfa));
 #endif  #endif
 #ifdef USE_TOS  #ifdef USE_TOS
   *sp-- = TOS;    *sp-- = TOS;
Line 238  Label *engine(Xt *ip, Cell *sp, Cell *rp Line 258  Label *engine(Xt *ip, Cell *sp, Cell *rp
       
  dodefer:   dodefer:
 #ifdef DEBUG  #ifdef DEBUG
   printf("%08x: defer: %08x\n",(Cell)ip,(Cell)PFA1(cfa));    fprintf(stderr,"%08x: defer: %08x\n",(Cell)ip,(Cell)PFA1(cfa));
 #endif  #endif
   cfa = *(Xt *)PFA1(cfa);    cfa = *(Xt *)PFA1(cfa);
   NEXT1;    NEXT1;
Line 262  Label *engine(Xt *ip, Cell *sp, Cell *rp Line 282  Label *engine(Xt *ip, Cell *sp, Cell *rp
             
      */       */
 #ifdef DEBUG  #ifdef DEBUG
   printf("%08x/%08x: does: %08x\n",(Cell)ip,(Cell)cfa,*(Cell)PFA(cfa));    fprintf(stderr,"%08x/%08x: does: %08x\n",(Cell)ip,(Cell)cfa,DOES_CODE1(cfa));
   fflush(stdout);    fflush(stderr);
 #endif  #endif
   *--rp = (Cell)ip;    *--rp = (Cell)ip;
   /* PFA1 might collide with DOES_CODE1 here, so we use PFA */    /* PFA1 might collide with DOES_CODE1 here, so we use PFA */
Line 275  Label *engine(Xt *ip, Cell *sp, Cell *rp Line 295  Label *engine(Xt *ip, Cell *sp, Cell *rp
   *--sp = (Cell)PFA(cfa);    *--sp = (Cell)PFA(cfa);
 #endif  #endif
   NEXT;    NEXT;
     
 #include "primitives.i"  #include "primitives.i"
 }  }

Removed from v.1.14  
changed lines
  Added in v.1.16


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