version 1.114, 2011/11/13 00:45:21
|
version 1.120, 2012/07/23 13:27:47
|
Line 1
|
Line 1
|
/* Gforth virtual machine (aka inner interpreter) |
/* Gforth virtual machine (aka inner interpreter) |
|
|
Copyright (C) 1995,1996,1997,1998,2000,2003,2004,2005,2006,2007,2008,2010 Free Software Foundation, Inc. |
Copyright (C) 1995,1996,1997,1998,2000,2003,2004,2005,2006,2007,2008,2010,2011 Free Software Foundation, Inc. |
|
|
This file is part of Gforth. |
This file is part of Gforth. |
|
|
Line 89
|
Line 89
|
|
|
#ifdef MEMCMP_AS_SUBROUTINE |
#ifdef MEMCMP_AS_SUBROUTINE |
extern int gforth_memcmp(const char * s1, const char * s2, size_t n); |
extern int gforth_memcmp(const char * s1, const char * s2, size_t n); |
|
extern Char *gforth_memmove(Char * dest, const Char* src, Cell n); |
|
extern Char *gforth_memset(Char * s, Cell c, UCell n); |
|
extern Char *gforth_memcpy(Char * dest, const Char* src, Cell n); |
#define memcmp(s1,s2,n) gforth_memcmp(s1,s2,n) |
#define memcmp(s1,s2,n) gforth_memcmp(s1,s2,n) |
|
#define memmove(a,b,c) gforth_memmove(a,b,c) |
|
#define memset(a,b,c) gforth_memset(a,b,c) |
|
#define memcpy(a,b,c) gforth_memcpy(a,b,c) |
#endif |
#endif |
|
|
#define NEWLINE '\n' |
#define NEWLINE '\n' |
Line 202 extern int gforth_memcmp(const char * s1
|
Line 208 extern int gforth_memcmp(const char * s1
|
#ifndef FTOSREG |
#ifndef FTOSREG |
#define FTOSREG |
#define FTOSREG |
#endif |
#endif |
|
#ifndef OPREG |
|
#define OPREG |
|
#endif |
|
|
#ifndef CPU_DEP1 |
#ifndef CPU_DEP1 |
# define CPU_DEP1 0 |
# define CPU_DEP1 0 |
Line 263 extern int gforth_memcmp(const char * s1
|
Line 272 extern int gforth_memcmp(const char * s1
|
#endif |
#endif |
|
|
#ifdef STANDALONE |
#ifdef STANDALONE |
jmp_buf throw_jmp_buf; |
jmp_buf * throw_jmp_handler; |
|
|
void throw(int code) |
void throw(int code) |
{ |
{ |
longjmp(throw_jmp_buf,code); /* !! or use siglongjmp ? */ |
longjmp(*throw_jmp_handler,code); /* !! or use siglongjmp ? */ |
} |
} |
#endif |
#endif |
|
|
Line 311 void throw(int code)
|
Line 320 void throw(int code)
|
/* the asm(""); is there to get a stop compiled on Itanium */ |
/* the asm(""); is there to get a stop compiled on Itanium */ |
#define LABEL2(name) K_##name: asm(""); |
#define LABEL2(name) K_##name: asm(""); |
|
|
Label *gforth_engine(Xt *ip0, Cell *sp0, Cell *rp0, Float *fp0, Address lp0 sr_proto) |
Label *gforth_engine(Xt *ip0 sr_proto) |
/* 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 |
*/ |
*/ |
Line 326 Label *gforth_engine(Xt *ip0, Cell *sp0,
|
Line 335 Label *gforth_engine(Xt *ip0, Cell *sp0,
|
#ifndef NO_IP |
#ifndef NO_IP |
register Xt *ip IPREG = ip0; |
register Xt *ip IPREG = ip0; |
#endif |
#endif |
register Cell *sp SPREG = sp0; |
register Cell *sp SPREG = gforth_SP; |
register Float *fp FPREG = fp0; |
register Float *fp FPREG = gforth_FP; |
register Address lp LPREG = lp0; |
register Address lp LPREG = gforth_LP; |
register Xt cfa CFAREG; |
register Xt cfa CFAREG; |
register Label real_ca CAREG; |
register Label real_ca CAREG; |
|
#ifdef HAS_OBJECTS |
|
register Char * op OPREG = NULL; |
|
#endif |
#ifdef MORE_VARS |
#ifdef MORE_VARS |
MORE_VARS |
MORE_VARS |
#endif |
#endif |
Line 390 Label *gforth_engine(Xt *ip0, Cell *sp0,
|
Line 402 Label *gforth_engine(Xt *ip0, Cell *sp0,
|
CPU_DEP2 |
CPU_DEP2 |
#endif |
#endif |
|
|
rp = rp0; |
rp = gforth_RP; |
#ifdef DEBUG |
#ifdef DEBUG |
fprintf(stderr,"ip=%x, sp=%x, rp=%x, fp=%x, lp=%x, up=%x\n", |
fprintf(stderr,"ip=%x, sp=%x, rp=%x, fp=%x, lp=%x, up=%x\n", |
(unsigned)ip0,(unsigned)sp,(unsigned)rp, |
(unsigned)ip0,(unsigned)sp,(unsigned)rp, |
Line 424 Label *gforth_engine(Xt *ip0, Cell *sp0,
|
Line 436 Label *gforth_engine(Xt *ip0, Cell *sp0,
|
#endif |
#endif |
} |
} |
|
|
#if !(defined(GFORTH_DEBUGGING) || defined(INDIRECT_THREADED) || defined(DOUBLY_INDIRECT) || defined(VM_PROFILING)) |
#ifdef USE_TOS |
sp += STACK_CACHE_DEFAULT-1; |
sp += STACK_CACHE_DEFAULT-1; |
/* some of those registers are dead, but its simpler to initialize them all */ spTOS = sp[0]; |
/* some of those registers are dead, but its simpler to initialize them all */ spTOS = sp[0]; |
spb = sp[-1]; |
spb = sp[-1]; |