From 1cf17cc2fe8c0886b32f919a066d7c8fe1cd29ec Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Fri, 16 Apr 2010 12:11:52 +0100 Subject: [PATCH 1/2] improve type in token --- H/yapio.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/H/yapio.h b/H/yapio.h index f1081626f..31d3657cd 100644 --- a/H/yapio.h +++ b/H/yapio.h @@ -165,7 +165,7 @@ extern YP_FILE yp_iob[YP_MAX_FILES]; typedef YP_FILE *YP_File; -enum TokenKinds { +typedef enum TokenKinds { Name_tok, Number_tok, Var_tok, @@ -174,16 +174,16 @@ enum TokenKinds { Ponctuation_tok, Error_tok, eot_tok -}; +} tkinds; typedef struct TOKEN { - unsigned char Tok; + enum TokenKinds Tok; Term TokInfo; int TokPos; struct TOKEN *TokNext; } TokEntry; -#define Ord(X) ((int) (X)) +#define Ord(X) ((enum TokenKinds) (X)) #define NextToken GNextToken() From d68c7854bda96b18aa16b860bacd6d4213410395 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Fri, 16 Apr 2010 12:12:23 +0100 Subject: [PATCH 2/2] make things run in sparc-64 --- H/Regs.h | 67 ++++--------------------------------------------------- H/absmi.h | 20 ++++++++--------- 2 files changed, 14 insertions(+), 73 deletions(-) diff --git a/H/Regs.h b/H/Regs.h index d51a155b0..adf6ff594 100644 --- a/H/Regs.h +++ b/H/Regs.h @@ -31,12 +31,12 @@ #undef PUSH_X #endif -#ifdef __x86_64__ -#undef PUSH_REGS +#ifdef sparc +#define PUSH_REGS 1 #undef PUSH_X #endif -#if defined(sparc) || defined(__sparc) +#ifdef __x86_64__ #undef PUSH_REGS #undef PUSH_X #endif @@ -202,66 +202,7 @@ extern int Yap_stack_overflows; #define YENV_ADDRESS (&(YENV)) #define MEM2YENV -#if defined(__GNUC__) && defined(sparc) && !defined(__NetBSD__) && !defined(THREADS) - -#define P Yap_REGS.P_ /* prolog machine program counter */ -#define YENV Yap_REGS.YENV_ /* current environment (may differ from ENV)*/ -#define S Yap_REGS.S_ /* structure pointer */ - -register CELL *H asm ("g5"); -#define TR Yap_REGS.TR_ /* latest choice point */ -#define B Yap_REGS.B_ /* latest choice point */ -#define CP Yap_REGS.CP_ /* continuation program counter */ -#define HB Yap_REGS.HB_ /* heap (global) stack top at time of latest c.p. */ -#define CreepFlag Yap_REGS.CreepFlag_ - -EXTERN inline void save_machine_regs(void) { - Yap_REGS.H_ = H; -} - -EXTERN inline void restore_machine_regs(void) { - H = Yap_REGS.H_; -} - -#define BACKUP_MACHINE_REGS() \ - CELL *BK_H = H; \ - restore_machine_regs() - -#define RECOVER_MACHINE_REGS() \ - save_machine_regs(); \ - H = BK_H - -EXTERN inline void save_H(void) { - Yap_REGS.H_ = H; -} - -EXTERN inline void restore_H(void) { - H = Yap_REGS.H_; -} - -#define BACKUP_H() CELL *BK_H = H; restore_H() - -#define RECOVER_H() save_H(); H = BK_H - -EXTERN inline void save_B(void) { -} - -EXTERN inline void restore_B(void) { -} - -#if defined(__svr4__) -#define BACKUP_B() - -#define RECOVER_B() -#else -#define BACKUP_B() - -#define RECOVER_B() -#endif - -#define restore_TR() - -#elif defined(__GNUC__) && defined(__alpha) +#if defined(__GNUC__) && defined(__alpha) #define P Yap_REGS.P_ /* prolog machine program counter */ #define YENV Yap_REGS.YENV_ /* current environment (may differ from ENV) */ diff --git a/H/absmi.h b/H/absmi.h index 5aee6e98f..ce9423edb 100644 --- a/H/absmi.h +++ b/H/absmi.h @@ -36,16 +36,6 @@ static char SccsId[] = "%W% %G%"; */ #ifdef __GNUC__ -#if defined(sparc) || defined(__sparc) -#define SHADOW_P 1 -#define SHADOW_Y 1 -#define SHADOW_S 1 -#define SHADOW_REGS 1 -#define SHADOW_CP 1 -#define SHADOW_HB 1 -#define USE_PREFETCH 1 -#endif - #ifdef hppa #define SHADOW_P 1 #define SHADOW_Y 1 @@ -91,6 +81,16 @@ register struct yami* P1REG asm ("bp"); /* can't use yamop before Yap.h */ #endif /* BP_FREE */ #endif /* i386 */ +#ifdef sparc +#define SHADOW_P 1 +#ifdef BP_FREE +#undef BP_FREE +#endif +#define S_IN_MEM 1 +#define Y_IN_MEM 1 +#define TR_IN_MEM 1 +#endif /* sparc_ */ + #ifdef __x86_64__ #define SHADOW_P 1 #ifdef BP_FREE