Diff for /gforth/engine/threaded.h between versions 1.13 and 1.15

version 1.13, 2002/01/14 08:40:24 version 1.15, 2002/01/20 19:04:11
Line 91 Line 91
   
 */  */
   
 /* CFA_NEXT: if NEXT uses cfa, you have to #define CFA_NEXT, to get  
  * cfa declared in engine.  
  */  
   
 #ifdef DOUBLY_INDIRECT  #ifdef DOUBLY_INDIRECT
 #  define CFA_NEXT  
 #  define NEXT_P0       ({cfa=*ip;})  #  define NEXT_P0       ({cfa=*ip;})
 #  define IP            (ip)  #  define IP            (ip)
 #  define SET_IP(p)     ({ip=(p); NEXT_P0;})  #  define SET_IP(p)     ({ip=(p); NEXT_P0;})
Line 104 Line 99
 #  define INC_IP(const_inc)     ({cfa=IP[const_inc]; ip+=(const_inc);})  #  define INC_IP(const_inc)     ({cfa=IP[const_inc]; ip+=(const_inc);})
 #  define DEF_CA        Label ca;  #  define DEF_CA        Label ca;
 #  define NEXT_P1       ({\  #  define NEXT_P1       ({\
   if (cfa<=vm_prims+DOESJUMP || cfa>=vm_prims+sizeof(routines)) \    if (cfa<=vm_prims+DOESJUMP || cfa>=vm_prims+npriminfos) \
     fprintf(stderr,"NEXT encountered prim %p at ip=%p\n", cfa, ip); \      fprintf(stderr,"NEXT encountered prim %p at ip=%p\n", cfa, ip); \
   ip++; ca=**cfa;})    ip++; ca=**cfa;})
 #  define NEXT_P2       ({goto *ca;})  #  define NEXT_P2       ({goto *ca;})
 #  define EXEC(XT)      ({DEF_CA cfa=(XT);\  #  define EXEC(XT)      ({DEF_CA cfa=(XT);\
   if (cfa>vm_prims+DOESJUMP && cfa<vm_prims+sizeof(routines)) \    if (cfa>vm_prims+DOESJUMP && cfa<vm_prims+npriminfos) \
     fprintf(stderr,"EXEC encountered xt %p at ip=%p\n", cfa, ip); \      fprintf(stderr,"EXEC encountered xt %p at ip=%p, vm_prims=%p, xts=%p\n", cfa, ip, vm_prims, xts); \
  ca=**cfa; goto *ca;})   ca=**cfa; goto *ca;})
   
 #else /* !defined(DOUBLY_INDIRECT) */  #else /* !defined(DOUBLY_INDIRECT) */
   
 #if defined(DIRECT_THREADED)  #if defined(DIRECT_THREADED)
   
 /* note that the "cfa dead" versions only work if GETCFA exists and works */  
   
 #if THREADING_SCHEME==1  #if THREADING_SCHEME==1
 #warning direct threading scheme 1: autoinc, long latency, cfa live  #warning direct threading scheme 1: autoinc, long latency, cfa live
 #  define CFA_NEXT  
 #  define NEXT_P0       ({cfa=*ip++;})  #  define NEXT_P0       ({cfa=*ip++;})
 #  define IP            (ip-1)  #  define IP            (ip-1)
 #  define SET_IP(p)     ({ip=(p); NEXT_P0;})  #  define SET_IP(p)     ({ip=(p); NEXT_P0;})
Line 130 Line 122
 #  define DEF_CA  #  define DEF_CA
 #  define NEXT_P1  #  define NEXT_P1
 #  define NEXT_P2       ({goto *cfa;})  #  define NEXT_P2       ({goto *cfa;})
 #  define EXEC(XT)      ({cfa=(XT); goto *cfa;})  #  define EXEC(XT)      ({cfa=(XT); goto **cfa;})
 #endif  #endif
   
 #if THREADING_SCHEME==2  #if THREADING_SCHEME==2
 #warning direct threading scheme 2: autoinc, long latency, cfa dead  #warning direct threading scheme 2: autoinc, long latency, cfa dead
 #ifndef GETCFA  
 #error GETCFA must be defined for cfa dead threading  
 #endif  
 #  define NEXT_P0       (ip++)  #  define NEXT_P0       (ip++)
 #  define IP            (ip-1)  #  define IP            (ip-1)
 #  define SET_IP(p)     ({ip=(p); NEXT_P0;})  #  define SET_IP(p)     ({ip=(p); NEXT_P0;})
Line 146 Line 135
 #  define DEF_CA  #  define DEF_CA
 #  define NEXT_P1  #  define NEXT_P1
 #  define NEXT_P2       ({goto **(ip-1);})  #  define NEXT_P2       ({goto **(ip-1);})
 #  define EXEC(XT)      ({goto *(XT);})  #  define EXEC(XT)      ({cfa=(XT); goto **cfa;})
 #endif  #endif
   
   
 #if THREADING_SCHEME==3  #if THREADING_SCHEME==3
 #warning direct threading scheme 3: autoinc, low latency, cfa live  #warning direct threading scheme 3: autoinc, low latency, cfa live
 #  define CFA_NEXT  
 #  define NEXT_P0  #  define NEXT_P0
 #  define IP            (ip)  #  define IP            (ip)
 #  define SET_IP(p)     ({ip=(p); NEXT_P0;})  #  define SET_IP(p)     ({ip=(p); NEXT_P0;})
Line 161 Line 149
 #  define DEF_CA  #  define DEF_CA
 #  define NEXT_P1       ({cfa=*ip++;})  #  define NEXT_P1       ({cfa=*ip++;})
 #  define NEXT_P2       ({goto *cfa;})  #  define NEXT_P2       ({goto *cfa;})
 #  define EXEC(XT)      ({cfa=(XT); goto *cfa;})  #  define EXEC(XT)      ({cfa=(XT); goto **cfa;})
 #endif  #endif
   
 #if THREADING_SCHEME==4  #if THREADING_SCHEME==4
 #warning direct threading scheme 4: autoinc, low latency, cfa dead  #warning direct threading scheme 4: autoinc, low latency, cfa dead
 #ifndef GETCFA  
 #error GETCFA must be defined for cfa dead threading  
 #endif  
 #  define NEXT_P0  #  define NEXT_P0
 #  define IP            (ip)  #  define IP            (ip)
 #  define SET_IP(p)     ({ip=(p); NEXT_P0;})  #  define SET_IP(p)     ({ip=(p); NEXT_P0;})
Line 177 Line 162
 #  define DEF_CA  #  define DEF_CA
 #  define NEXT_P1  #  define NEXT_P1
 #  define NEXT_P2       ({goto **(ip++);})  #  define NEXT_P2       ({goto **(ip++);})
 #  define EXEC(XT)      ({goto *(XT);})  #  define EXEC(XT)      ({cfa=(XT); goto **cfa;})
 #endif  #endif
   
 #if THREADING_SCHEME==5  #if THREADING_SCHEME==5
 #warning direct threading scheme 5: long latency, cfa live  #warning direct threading scheme 5: long latency, cfa live
 #  define CFA_NEXT  
 #  define NEXT_P0       ({cfa=*ip;})  #  define NEXT_P0       ({cfa=*ip;})
 #  define IP            (ip)  #  define IP            (ip)
 #  define SET_IP(p)     ({ip=(p); NEXT_P0;})  #  define SET_IP(p)     ({ip=(p); NEXT_P0;})
Line 191 Line 175
 #  define DEF_CA  #  define DEF_CA
 #  define NEXT_P1       (ip++)  #  define NEXT_P1       (ip++)
 #  define NEXT_P2       ({goto *cfa;})  #  define NEXT_P2       ({goto *cfa;})
 #  define EXEC(XT)      ({cfa=(XT); goto *cfa;})  #  define EXEC(XT)      ({cfa=(XT); goto **cfa;})
 #endif  #endif
   
 #if THREADING_SCHEME==6  #if THREADING_SCHEME==6
 #warning direct threading scheme 6: long latency, cfa dead  #warning direct threading scheme 6: long latency, cfa dead
 #ifndef GETCFA  
 #error GETCFA must be defined for cfa dead threading  
 #endif  
 #  define NEXT_P0  #  define NEXT_P0
 #  define IP            (ip)  #  define IP            (ip)
 #  define SET_IP(p)     ({ip=(p); NEXT_P0;})  #  define SET_IP(p)     ({ip=(p); NEXT_P0;})
Line 207 Line 188
 #  define DEF_CA  #  define DEF_CA
 #  define NEXT_P1       (ip++)  #  define NEXT_P1       (ip++)
 #  define NEXT_P2       ({goto **(ip-1);})  #  define NEXT_P2       ({goto **(ip-1);})
 #  define EXEC(XT)      ({goto *(XT);})  #  define EXEC(XT)      ({cfa=(XT); goto **cfa;})
 #endif  #endif
   
   
 #if THREADING_SCHEME==7  #if THREADING_SCHEME==7
 #warning direct threading scheme 7: low latency, cfa live  #warning direct threading scheme 7: low latency, cfa live
 #  define CFA_NEXT  
 #  define NEXT_P0  #  define NEXT_P0
 #  define IP            (ip)  #  define IP            (ip)
 #  define SET_IP(p)     ({ip=(p); NEXT_P0;})  #  define SET_IP(p)     ({ip=(p); NEXT_P0;})
Line 222 Line 202
 #  define DEF_CA  #  define DEF_CA
 #  define NEXT_P1       ({cfa=*ip++;})  #  define NEXT_P1       ({cfa=*ip++;})
 #  define NEXT_P2       ({goto *cfa;})  #  define NEXT_P2       ({goto *cfa;})
 #  define EXEC(XT)      ({cfa=(XT); goto *cfa;})  #  define EXEC(XT)      ({cfa=(XT); goto **cfa;})
 #endif  #endif
   
 #if THREADING_SCHEME==8  #if THREADING_SCHEME==8
 #warning direct threading scheme 8: cfa dead, i386 hack  #warning direct threading scheme 8: cfa dead, i386 hack
 #ifndef GETCFA  
 #error GETCFA must be defined for cfa dead threading  
 #endif  
 #  define NEXT_P0  #  define NEXT_P0
 #  define IP            (ip)  #  define IP            (ip)
 #  define SET_IP(p)     ({ip=(p); NEXT_P0;})  #  define SET_IP(p)     ({ip=(p); NEXT_P0;})
Line 238 Line 215
 #  define DEF_CA  #  define DEF_CA
 #  define NEXT_P1       (ip++)  #  define NEXT_P1       (ip++)
 #  define NEXT_P2       ({goto **(ip-1);})  #  define NEXT_P2       ({goto **(ip-1);})
 #  define EXEC(XT)      ({goto *(XT);})  #  define EXEC(XT)      ({cfa=(XT); goto **cfa;})
 #endif  #endif
   
 #if THREADING_SCHEME==9  #if THREADING_SCHEME==9
Line 246 Line 223
 /* Power uses a prepare-to-branch instruction, and the latency between  /* Power uses a prepare-to-branch instruction, and the latency between
    this inst and the branch is 5 cycles on a PPC604; so we utilize this     this inst and the branch is 5 cycles on a PPC604; so we utilize this
    to do some prefetching in between */     to do some prefetching in between */
 #  define CFA_NEXT  
 #  define NEXT_P0  #  define NEXT_P0
 #  define IP            ip  #  define IP            ip
 #  define SET_IP(p)     ({ip=(p); next_cfa=*ip; NEXT_P0;})  #  define SET_IP(p)     ({ip=(p); next_cfa=*ip; NEXT_P0;})
Line 255 Line 231
 #  define DEF_CA          #  define DEF_CA        
 #  define NEXT_P1       ({cfa=next_cfa; ip++; next_cfa=*ip;})  #  define NEXT_P1       ({cfa=next_cfa; ip++; next_cfa=*ip;})
 #  define NEXT_P2       ({goto *cfa;})  #  define NEXT_P2       ({goto *cfa;})
 #  define EXEC(XT)      ({cfa=(XT); goto *cfa;})  #  define EXEC(XT)      ({cfa=(XT); goto **cfa;})
 #  define MORE_VARS     Xt next_cfa;  #  define MORE_VARS     Xt next_cfa;
 #endif  #endif
   
 #if THREADING_SCHEME==10  #if THREADING_SCHEME==10
 #warning direct threading scheme 10: plain (no attempt at scheduling)  #warning direct threading scheme 10: plain (no attempt at scheduling)
 #  define CFA_NEXT  
 #  define NEXT_P0  #  define NEXT_P0
 #  define IP            (ip)  #  define IP            (ip)
 #  define SET_IP(p)     ({ip=(p); NEXT_P0;})  #  define SET_IP(p)     ({ip=(p); NEXT_P0;})
Line 270 Line 245
 #  define DEF_CA  #  define DEF_CA
 #  define NEXT_P1  #  define NEXT_P1
 #  define NEXT_P2       ({cfa=*ip++; goto *cfa;})  #  define NEXT_P2       ({cfa=*ip++; goto *cfa;})
 #  define EXEC(XT)      ({cfa=(XT); goto *cfa;})  #  define EXEC(XT)      ({cfa=(XT); goto **cfa;})
 #endif  #endif
   
 /* direct threaded */  /* direct threaded */
Line 279 Line 254
   
 #if THREADING_SCHEME==1  #if THREADING_SCHEME==1
 #warning indirect threading scheme 1: autoinc, long latency, cisc  #warning indirect threading scheme 1: autoinc, long latency, cisc
 #  define CFA_NEXT  
 #  define NEXT_P0       ({cfa=*ip++;})  #  define NEXT_P0       ({cfa=*ip++;})
 #  define IP            (ip-1)  #  define IP            (ip-1)
 #  define SET_IP(p)     ({ip=(p); NEXT_P0;})  #  define SET_IP(p)     ({ip=(p); NEXT_P0;})
Line 293 Line 267
   
 #if THREADING_SCHEME==2  #if THREADING_SCHEME==2
 #warning indirect threading scheme 2: autoinc, long latency  #warning indirect threading scheme 2: autoinc, long latency
 #  define CFA_NEXT  
 #  define NEXT_P0       ({cfa=*ip++;})  #  define NEXT_P0       ({cfa=*ip++;})
 #  define IP            (ip-1)  #  define IP            (ip-1)
 #  define SET_IP(p)     ({ip=(p); NEXT_P0;})  #  define SET_IP(p)     ({ip=(p); NEXT_P0;})
Line 308 Line 281
   
 #if THREADING_SCHEME==3  #if THREADING_SCHEME==3
 #warning indirect threading scheme 3: autoinc, low latency, cisc  #warning indirect threading scheme 3: autoinc, low latency, cisc
 #  define CFA_NEXT  
 #  define NEXT_P0  #  define NEXT_P0
 #  define IP            (ip)  #  define IP            (ip)
 #  define SET_IP(p)     ({ip=(p); NEXT_P0;})  #  define SET_IP(p)     ({ip=(p); NEXT_P0;})
Line 322 Line 294
   
 #if THREADING_SCHEME==4  #if THREADING_SCHEME==4
 #warning indirect threading scheme 4: autoinc, low latency  #warning indirect threading scheme 4: autoinc, low latency
 #  define CFA_NEXT  
 #  define NEXT_P0       ({cfa=*ip++;})  #  define NEXT_P0       ({cfa=*ip++;})
 #  define IP            (ip-1)  #  define IP            (ip-1)
 #  define SET_IP(p)     ({ip=(p); NEXT_P0;})  #  define SET_IP(p)     ({ip=(p); NEXT_P0;})
Line 337 Line 308
   
 #if THREADING_SCHEME==5  #if THREADING_SCHEME==5
 #warning indirect threading scheme 5: long latency, cisc  #warning indirect threading scheme 5: long latency, cisc
 #  define CFA_NEXT  
 #  define NEXT_P0       ({cfa=*ip;})  #  define NEXT_P0       ({cfa=*ip;})
 #  define IP            (ip)  #  define IP            (ip)
 #  define SET_IP(p)     ({ip=(p); NEXT_P0;})  #  define SET_IP(p)     ({ip=(p); NEXT_P0;})
Line 351 Line 321
   
 #if THREADING_SCHEME==6  #if THREADING_SCHEME==6
 #warning indirect threading scheme 6: long latency  #warning indirect threading scheme 6: long latency
 #  define CFA_NEXT  
 #  define NEXT_P0       ({cfa=*ip;})  #  define NEXT_P0       ({cfa=*ip;})
 #  define IP            (ip)  #  define IP            (ip)
 #  define SET_IP(p)     ({ip=(p); NEXT_P0;})  #  define SET_IP(p)     ({ip=(p); NEXT_P0;})
Line 365 Line 334
   
 #if THREADING_SCHEME==7  #if THREADING_SCHEME==7
 #warning indirect threading scheme 7: low latency  #warning indirect threading scheme 7: low latency
 #  define CFA_NEXT  
 #  define NEXT_P0       ({cfa=*ip;})  #  define NEXT_P0       ({cfa=*ip;})
 #  define IP            (ip)  #  define IP            (ip)
 #  define SET_IP(p)     ({ip=(p); NEXT_P0;})  #  define SET_IP(p)     ({ip=(p); NEXT_P0;})
Line 379 Line 347
   
 #if THREADING_SCHEME==8  #if THREADING_SCHEME==8
 #warning indirect threading scheme 8: low latency,cisc  #warning indirect threading scheme 8: low latency,cisc
 #  define CFA_NEXT  
 #  define NEXT_P0  #  define NEXT_P0
 #  define IP            (ip)  #  define IP            (ip)
 #  define SET_IP(p)     ({ip=(p); NEXT_P0;})  #  define SET_IP(p)     ({ip=(p); NEXT_P0;})

Removed from v.1.13  
changed lines
  Added in v.1.15


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