--- gforth/engine/threaded.h 1999/02/06 22:28:25 1.3 +++ gforth/engine/threaded.h 2000/09/23 15:47:08 1.7 @@ -1,6 +1,6 @@ /* This file defines a number of threading schemes. - Copyright (C) 1995, 1996,1997 Free Software Foundation, Inc. + Copyright (C) 1995, 1996,1997,1999 Free Software Foundation, Inc. This file is part of Gforth. @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. This files defines macros for threading. Many sets of macros are @@ -91,12 +91,12 @@ */ -#ifndef GETCFA -# define CFA_NEXT -/* a more appropriate name would be CFA_LIVE, i.e., cfa is live after NEXT */ -#endif +/* CFA_NEXT: if NEXT uses cfa, you have to #define CFA_NEXT, to get + * cfa declared in engine. + */ #ifdef DOUBLY_INDIRECT +# define CFA_NEXT # define NEXT_P0 ({cfa=*ip;}) # define IP (ip) # define SET_IP(p) ({ip=(p); NEXT_P0;}) @@ -117,6 +117,7 @@ #if THREADING_SCHEME==1 #warning direct threading scheme 1: autoinc, long latency, cfa live +# define CFA_NEXT # define NEXT_P0 ({cfa=*ip++;}) # define IP (ip-1) # define SET_IP(p) ({ip=(p); NEXT_P0;}) @@ -130,6 +131,9 @@ #if THREADING_SCHEME==2 #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 IP (ip-1) # define SET_IP(p) ({ip=(p); NEXT_P0;}) @@ -144,6 +148,7 @@ #if THREADING_SCHEME==3 #warning direct threading scheme 3: autoinc, low latency, cfa live +# define CFA_NEXT # define NEXT_P0 # define IP (ip) # define SET_IP(p) ({ip=(p); NEXT_P0;}) @@ -157,6 +162,9 @@ #if THREADING_SCHEME==4 #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 IP (ip) # define SET_IP(p) ({ip=(p); NEXT_P0;}) @@ -170,6 +178,7 @@ #if THREADING_SCHEME==5 #warning direct threading scheme 5: long latency, cfa live +# define CFA_NEXT # define NEXT_P0 ({cfa=*ip;}) # define IP (ip) # define SET_IP(p) ({ip=(p); NEXT_P0;}) @@ -183,6 +192,9 @@ #if THREADING_SCHEME==6 #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 IP (ip) # define SET_IP(p) ({ip=(p); NEXT_P0;}) @@ -197,6 +209,7 @@ #if THREADING_SCHEME==7 #warning direct threading scheme 7: low latency, cfa live +# define CFA_NEXT # define NEXT_P0 # define IP (ip) # define SET_IP(p) ({ip=(p); NEXT_P0;}) @@ -210,6 +223,9 @@ #if THREADING_SCHEME==8 #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 IP (ip) # define SET_IP(p) ({ip=(p); NEXT_P0;}) @@ -226,6 +242,7 @@ /* 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 to do some prefetching in between */ +# define CFA_NEXT # define NEXT_P0 # define IP ip # define SET_IP(p) ({ip=(p); next_cfa=*ip; NEXT_P0;}) @@ -240,6 +257,7 @@ #if THREADING_SCHEME==10 #warning direct threading scheme 10: plain (no attempt at scheduling) +# define CFA_NEXT # define NEXT_P0 # define IP (ip) # define SET_IP(p) ({ip=(p); NEXT_P0;}) @@ -257,6 +275,7 @@ #if THREADING_SCHEME==1 #warning indirect threading scheme 1: autoinc, long latency, cisc +# define CFA_NEXT # define NEXT_P0 ({cfa=*ip++;}) # define IP (ip-1) # define SET_IP(p) ({ip=(p); NEXT_P0;}) @@ -270,6 +289,7 @@ #if THREADING_SCHEME==2 #warning indirect threading scheme 2: autoinc, long latency +# define CFA_NEXT # define NEXT_P0 ({cfa=*ip++;}) # define IP (ip-1) # define SET_IP(p) ({ip=(p); NEXT_P0;}) @@ -284,6 +304,7 @@ #if THREADING_SCHEME==3 #warning indirect threading scheme 3: autoinc, low latency, cisc +# define CFA_NEXT # define NEXT_P0 # define IP (ip) # define SET_IP(p) ({ip=(p); NEXT_P0;}) @@ -297,6 +318,7 @@ #if THREADING_SCHEME==4 #warning indirect threading scheme 4: autoinc, low latency +# define CFA_NEXT # define NEXT_P0 ({cfa=*ip++;}) # define IP (ip-1) # define SET_IP(p) ({ip=(p); NEXT_P0;}) @@ -311,6 +333,7 @@ #if THREADING_SCHEME==5 #warning indirect threading scheme 5: long latency, cisc +# define CFA_NEXT # define NEXT_P0 ({cfa=*ip;}) # define IP (ip) # define SET_IP(p) ({ip=(p); NEXT_P0;}) @@ -324,6 +347,7 @@ #if THREADING_SCHEME==6 #warning indirect threading scheme 6: long latency +# define CFA_NEXT # define NEXT_P0 ({cfa=*ip;}) # define IP (ip) # define SET_IP(p) ({ip=(p); NEXT_P0;}) @@ -337,6 +361,7 @@ #if THREADING_SCHEME==7 #warning indirect threading scheme 7: low latency +# define CFA_NEXT # define NEXT_P0 ({cfa=*ip;}) # define IP (ip) # define SET_IP(p) ({ip=(p); NEXT_P0;}) @@ -350,6 +375,7 @@ #if THREADING_SCHEME==8 #warning indirect threading scheme 8: low latency,cisc +# define CFA_NEXT # define NEXT_P0 # define IP (ip) # define SET_IP(p) ({ip=(p); NEXT_P0;})