2001-04-09 20:54:03 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* *
|
|
|
|
* YAP Prolog %W% %G% *
|
|
|
|
* Yap Prolog was developed at NCCUP - Universidade do Porto *
|
|
|
|
* *
|
|
|
|
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
|
|
|
|
* *
|
|
|
|
**************************************************************************
|
|
|
|
* *
|
|
|
|
* File: Regs.h *
|
|
|
|
* mods: *
|
|
|
|
* comments: YAP abstract machine registers *
|
2008-08-12 02:27:23 +01:00
|
|
|
* version: $Id: Regs.h,v 1.42 2008-08-12 01:27:22 vsc Exp $ *
|
2001-04-09 20:54:03 +01:00
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/********* abstract machine registers **********************************/
|
2011-11-10 12:26:23 +00:00
|
|
|
#ifdef YAP_H
|
2005-11-18 18:52:41 +00:00
|
|
|
#ifdef CUT_C
|
|
|
|
#include "cut_c.h"
|
|
|
|
#endif
|
|
|
|
|
2006-05-22 17:31:47 +01:00
|
|
|
#if defined MYDDAS_ODBC || defined MYDDAS_MYSQL
|
|
|
|
#include "myddas.h"
|
2006-01-17 22:54:02 +00:00
|
|
|
#endif
|
2011-11-10 12:26:23 +00:00
|
|
|
#endif
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
#define MaxTemps 512
|
2008-12-09 12:54:27 +00:00
|
|
|
#define MaxArithms 32
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
#ifdef i386
|
|
|
|
#define PUSH_REGS 1
|
|
|
|
#undef PUSH_X
|
|
|
|
#endif
|
|
|
|
|
2010-04-16 12:12:23 +01:00
|
|
|
#ifdef sparc
|
|
|
|
#define PUSH_REGS 1
|
2006-02-01 13:28:57 +00:00
|
|
|
#undef PUSH_X
|
|
|
|
#endif
|
|
|
|
|
2010-04-16 12:12:23 +01:00
|
|
|
#ifdef __x86_64__
|
2011-10-02 23:55:22 +01:00
|
|
|
#define PUSH_REGS 1
|
2001-04-09 20:54:03 +01:00
|
|
|
#undef PUSH_X
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __alpha
|
|
|
|
#undef PUSH_REGS
|
|
|
|
#undef PUSH_X
|
|
|
|
#endif
|
|
|
|
|
2005-12-23 00:20:14 +00:00
|
|
|
#if defined(_POWER) || defined(__POWERPC__)
|
2001-04-09 20:54:03 +01:00
|
|
|
#undef PUSH_REGS
|
|
|
|
#undef PUSH_X
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef hppa
|
|
|
|
#undef PUSH_REGS
|
|
|
|
#undef PUSH_X
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef mips
|
|
|
|
#undef PUSH_REGS
|
|
|
|
#undef PUSH_X
|
|
|
|
#endif
|
|
|
|
|
2004-01-23 02:23:51 +00:00
|
|
|
/* force a cache of WAM regs for multi-threaded architectures! */
|
|
|
|
#ifdef THREADS
|
|
|
|
#ifndef PUSH_REGS
|
|
|
|
#define PUSH_REGS 1
|
|
|
|
#endif
|
|
|
|
#ifndef PUSH_X
|
|
|
|
#define PUSH_X 1
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2012-06-29 22:44:08 +01:00
|
|
|
#include "inline-only.h"
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY inline EXTERN void restore_machine_regs(void);
|
|
|
|
INLINE_ONLY inline EXTERN void save_machine_regs(void);
|
|
|
|
INLINE_ONLY inline EXTERN void restore_H(void);
|
|
|
|
INLINE_ONLY inline EXTERN void save_H(void);
|
|
|
|
INLINE_ONLY inline EXTERN void restore_B(void);
|
|
|
|
INLINE_ONLY inline EXTERN void save_B(void);
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2011-03-07 16:02:55 +00:00
|
|
|
#define CACHE_REGS
|
2012-12-11 22:07:10 +00:00
|
|
|
#define REFRESH_CACHE_REGS
|
2011-03-07 16:02:55 +00:00
|
|
|
#define INIT_REGS
|
|
|
|
#define PASS_REGS1
|
|
|
|
#define PASS_REGS
|
|
|
|
#define USES_REGS1 void
|
|
|
|
#define USES_REGS
|
|
|
|
|
|
|
|
typedef struct regstore_t
|
2001-04-09 20:54:03 +01:00
|
|
|
{
|
2013-12-12 14:24:40 +00:00
|
|
|
CELL EventFlag_; /* 13 */
|
2001-04-09 20:54:03 +01:00
|
|
|
CELL CreepFlag_; /* 13 */
|
|
|
|
CELL *HB_; /* 4 heap (global) stack top at latest c.p. */
|
2011-03-30 15:32:59 +01:00
|
|
|
#if defined(YAPOR_SBA) || defined(TABLING)
|
2001-04-09 20:54:03 +01:00
|
|
|
choiceptr BB_; /* 4 local stack top at latest c.p. */
|
2011-03-30 15:32:59 +01:00
|
|
|
#endif /* YAPOR_SBA || TABLING */
|
2001-04-09 20:54:03 +01:00
|
|
|
CELL *H0_; /* 2 base of heap (global) stack */
|
|
|
|
tr_fr_ptr TR_; /* 24 top of trail */
|
|
|
|
CELL *H_; /* 25 top of heap (global) stack */
|
|
|
|
choiceptr B_; /* 26 latest choice point */
|
2011-10-03 01:01:14 +01:00
|
|
|
#ifdef DEPTH_LIMIT
|
|
|
|
CELL DEPTH_; /* 27 */
|
|
|
|
#endif /* DEPTH_LIMIT */
|
|
|
|
yamop *CP_; /* 28 continuation program counter */
|
|
|
|
CELL *ENV_; /* 1 current environment */
|
2005-11-18 18:52:41 +00:00
|
|
|
#ifdef CUT_C
|
2012-12-11 23:02:05 +00:00
|
|
|
struct cut_c_str *CUT_C_TOP;
|
2005-11-18 18:52:41 +00:00
|
|
|
#endif
|
2006-01-17 22:54:02 +00:00
|
|
|
#if defined CUT_C && (defined MYDDAS_ODBC || defined MYDDAS_MYSQL)
|
2012-12-14 23:29:07 +00:00
|
|
|
struct myddas_global *MYDDAS_GLOBAL_POINTER;
|
2006-01-17 22:54:02 +00:00
|
|
|
#endif
|
2001-04-09 20:54:03 +01:00
|
|
|
yamop *P_; /* 7 prolog machine program counter */
|
|
|
|
CELL *YENV_; /* 5 current environment (may differ from ENV)*/
|
|
|
|
CELL *S_; /* 6 structure pointer */
|
|
|
|
CELL *ASP_; /* 8 top of local stack */
|
|
|
|
CELL *LCL0_; /* 3 local stack base */
|
2011-10-02 20:18:09 +01:00
|
|
|
tr_fr_ptr CurrentTrailTop_; /* 10 Auxiliary stack top */
|
2009-05-23 00:35:24 +01:00
|
|
|
ADDR AuxBase_; /* 9 Auxiliary base pointer */
|
2001-04-09 20:54:03 +01:00
|
|
|
CELL *AuxSp_; /* 9 Auxiliary stack pointer */
|
|
|
|
ADDR AuxTop_; /* 10 Auxiliary stack top */
|
|
|
|
/* visualc*/
|
2010-07-21 12:49:06 +01:00
|
|
|
struct DB_TERM * EX_; /* 18 */
|
2004-02-12 12:37:12 +00:00
|
|
|
Term CurrentModule_;
|
2011-03-30 15:32:59 +01:00
|
|
|
#if defined(YAPOR_SBA) || defined(TABLING)
|
2001-04-09 20:54:03 +01:00
|
|
|
CELL *H_FZ_;
|
|
|
|
choiceptr B_FZ_;
|
|
|
|
tr_fr_ptr TR_FZ_;
|
2011-03-30 15:32:59 +01:00
|
|
|
#endif /* YAPOR_SBA || TABLING */
|
2004-02-05 16:57:02 +00:00
|
|
|
struct pred_entry *PP_;
|
2008-08-30 02:39:36 +01:00
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
2011-05-09 19:36:51 +01:00
|
|
|
unsigned int worker_id_;
|
|
|
|
struct worker_local *worker_local_;
|
2004-02-11 13:33:19 +00:00
|
|
|
/* recursive write-locks for PredEntry */
|
2004-02-05 16:57:02 +00:00
|
|
|
yamop **PREG_ADDR_;
|
2011-03-30 15:32:59 +01:00
|
|
|
#ifdef YAPOR_SBA
|
2001-04-09 20:54:03 +01:00
|
|
|
choiceptr BSEG_;
|
|
|
|
struct or_frame *frame_head_, *frame_tail_;
|
|
|
|
char *binding_array_;
|
|
|
|
int sba_offset_;
|
|
|
|
int sba_end_;
|
|
|
|
int sba_size_;
|
2011-03-30 15:32:59 +01:00
|
|
|
#endif /* YAPOR_SBA */
|
2010-02-10 13:16:08 +00:00
|
|
|
#endif /* YAPOR || THREADS */
|
2001-04-09 20:54:03 +01:00
|
|
|
#if PUSH_REGS
|
|
|
|
/* On a X86 machine, the best solution is to keep the
|
|
|
|
X registers on a global variable, whose address is known between
|
|
|
|
runs, and to push the remaining registers to the stack.
|
|
|
|
|
|
|
|
On a register based machine, one can have a dedicated register,
|
|
|
|
always pointing to the XREG global variable. This spends an
|
|
|
|
extra register, but makes it easier to access X[1].
|
|
|
|
*/
|
|
|
|
|
2008-03-25 22:03:14 +00:00
|
|
|
#ifdef PUSH_X
|
2001-04-09 20:54:03 +01:00
|
|
|
Term XTERMS[MaxTemps]; /* 29 */
|
|
|
|
#endif
|
2008-12-09 12:54:27 +00:00
|
|
|
yamop *ARITH_EXCEPTION_;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
REGSTORE;
|
|
|
|
|
2002-11-18 18:18:05 +00:00
|
|
|
extern REGSTORE *Yap_regp;
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2008-03-25 22:03:14 +00:00
|
|
|
#ifdef PUSH_X
|
2004-01-23 02:23:51 +00:00
|
|
|
|
2004-02-06 17:22:24 +00:00
|
|
|
#define XREGS (Yap_REGS.XTERMS)
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2004-01-23 02:23:51 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
/* keep X as a global variable */
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2008-08-12 02:27:23 +01:00
|
|
|
extern Term Yap_XREGS[MaxTemps]; /* 29 */
|
2002-11-11 17:38:10 +00:00
|
|
|
|
2002-11-18 18:18:05 +00:00
|
|
|
#define XREGS Yap_XREGS
|
2002-11-11 17:38:10 +00:00
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif
|
|
|
|
|
2004-01-23 02:23:51 +00:00
|
|
|
#ifdef THREADS
|
|
|
|
|
2004-02-06 17:22:24 +00:00
|
|
|
extern pthread_key_t Yap_yaamregs_key;
|
2004-01-23 02:23:51 +00:00
|
|
|
|
2011-03-07 16:02:55 +00:00
|
|
|
#undef CACHE_REGS
|
2012-12-11 22:07:10 +00:00
|
|
|
#undef REFRESH_CACHE_REGS
|
2011-03-07 16:02:55 +00:00
|
|
|
#undef INIT_REGS
|
|
|
|
#undef PASS_REGS
|
|
|
|
#undef PASS_REGS1
|
|
|
|
#undef USES_REGS
|
|
|
|
#undef USES_REGS1
|
|
|
|
#define CACHE_REGS REGSTORE *regcache = ((REGSTORE *)pthread_getspecific(Yap_yaamregs_key));
|
2012-12-11 22:07:10 +00:00
|
|
|
#define REFRESH_CACHE_REGS regcache = ((REGSTORE *)pthread_getspecific(Yap_yaamregs_key));
|
2011-03-07 16:02:55 +00:00
|
|
|
#define INIT_REGS , ((REGSTORE *)pthread_getspecific(Yap_yaamregs_key))
|
|
|
|
#define PASS_REGS1 regcache
|
|
|
|
#define PASS_REGS , regcache
|
|
|
|
#define USES_REGS1 struct regstore_t *regcache
|
|
|
|
#define USES_REGS , struct regstore_t *regcache
|
|
|
|
#define Yap_regp regcache
|
2004-01-23 02:23:51 +00:00
|
|
|
|
2011-03-03 11:41:21 +00:00
|
|
|
#endif
|
|
|
|
|
2002-11-18 18:18:05 +00:00
|
|
|
#define Yap_REGS (*Yap_regp)
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2004-01-23 02:23:51 +00:00
|
|
|
#else /* !PUSH_REGS */
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
Term X[MaxTemps]; /* 29 */
|
|
|
|
|
2002-11-18 18:18:05 +00:00
|
|
|
#define XREGS Yap_REGS.X
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
REGSTORE;
|
|
|
|
|
2002-11-18 18:18:05 +00:00
|
|
|
extern REGSTORE Yap_REGS;
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif /* PUSH_REGS */
|
|
|
|
|
|
|
|
#define MinTrailGap (sizeof(CELL)*1024)
|
|
|
|
#define MinHeapGap (sizeof(CELL)*4096)
|
|
|
|
#define MinStackGap (sizeof(CELL)*8*1024)
|
|
|
|
|
|
|
|
|
2002-11-18 18:18:05 +00:00
|
|
|
#define ENV Yap_REGS.ENV_ /* current environment */
|
|
|
|
#define ASP Yap_REGS.ASP_ /* top of local stack */
|
|
|
|
#define H0 Yap_REGS.H0_ /* base of heap (global) stack */
|
|
|
|
#define LCL0 Yap_REGS.LCL0_ /* local stack base */
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2006-01-17 14:10:42 +00:00
|
|
|
#define YENV2MEM
|
|
|
|
#define YENV_ADDRESS (&(YENV))
|
|
|
|
#define MEM2YENV
|
|
|
|
|
2010-04-16 12:12:23 +01:00
|
|
|
#if defined(__GNUC__) && defined(__alpha)
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2002-11-18 18:18:05 +00:00
|
|
|
#define P Yap_REGS.P_ /* prolog machine program counter */
|
|
|
|
#define YENV Yap_REGS.YENV_ /* current environment (may differ from ENV) */
|
2014-01-19 21:15:05 +00:00
|
|
|
register CELL *HR asm ("$9");
|
2001-04-09 20:54:03 +01:00
|
|
|
register CELL *HB asm ("$10");
|
|
|
|
register choiceptr B asm ("$11");
|
|
|
|
register yamop *CP asm ("$12");
|
|
|
|
register CELL *S asm ("$13");
|
2001-11-25 19:48:34 +00:00
|
|
|
register tr_fr_ptr TR asm ("$14");
|
|
|
|
/* gcc+debug chokes if $15 is in use on alphas */
|
|
|
|
#ifdef DEBUG
|
2002-11-18 18:18:05 +00:00
|
|
|
#define CreepFlag Yap_REGS.CreepFlag_
|
2001-11-25 19:48:34 +00:00
|
|
|
#else
|
|
|
|
register CELL CreepFlag asm ("$15");
|
|
|
|
#endif
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
/* Interface with foreign code, make sure the foreign code sees all the
|
|
|
|
registers the way they used to be */
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void save_machine_regs(void) {
|
2014-01-19 21:15:05 +00:00
|
|
|
Yap_REGS.H_ = HR;
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_REGS.HB_ = HB;
|
|
|
|
Yap_REGS.B_ = B;
|
|
|
|
Yap_REGS.CP_ = CP;
|
2002-01-14 22:26:53 +00:00
|
|
|
#ifndef DEBUG
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_REGS.CreepFlag_ = CreepFlag;
|
2002-01-14 22:26:53 +00:00
|
|
|
#endif
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_REGS.TR_ = TR;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
2014-01-19 21:15:05 +00:00
|
|
|
HR = Yap_REGS.H_;
|
2002-11-18 18:18:05 +00:00
|
|
|
HB = Yap_REGS.HB_;
|
|
|
|
B = Yap_REGS.B_;
|
|
|
|
CP = Yap_REGS.CP_;
|
2002-01-14 22:26:53 +00:00
|
|
|
#ifndef DEBUG
|
2002-11-18 18:18:05 +00:00
|
|
|
CreepFlag = Yap_REGS.CreepFlag_;
|
2002-01-14 22:26:53 +00:00
|
|
|
#endif
|
2002-11-18 18:18:05 +00:00
|
|
|
TR = Yap_REGS.TR_;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define BACKUP_MACHINE_REGS() \
|
|
|
|
CELL *BK_H = H; \
|
|
|
|
CELL *BK_HB = HB; \
|
|
|
|
choiceptr BK_B = B; \
|
|
|
|
CELL BK_CreepFlag = CreepFlag; \
|
|
|
|
yamop *BK_CP = CP; \
|
|
|
|
tr_fr_ptr BK_TR = TR; \
|
|
|
|
restore_machine_regs()
|
|
|
|
|
|
|
|
#define RECOVER_MACHINE_REGS() \
|
|
|
|
save_machine_regs(); \
|
|
|
|
H = BK_H; \
|
|
|
|
HB = BK_HB; \
|
|
|
|
B = BK_B; \
|
|
|
|
CreepFlag = BK_CreepFlag; \
|
|
|
|
CP = BK_CP; \
|
|
|
|
TR = BK_TR
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void save_H(void) {
|
2014-01-19 21:15:05 +00:00
|
|
|
Yap_REGS.H_ = HR;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void restore_H(void) {
|
2014-01-19 21:15:05 +00:00
|
|
|
HR = Yap_REGS.H_;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2014-01-19 21:15:05 +00:00
|
|
|
#define BACKUP_H() CELL *BK_H = HR; restore_H()
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2014-01-19 21:15:05 +00:00
|
|
|
#define RECOVER_H() save_H(); HR = BK_H
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void save_B(void) {
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_REGS.B_ = B;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void restore_B(void) {
|
2002-11-18 18:18:05 +00:00
|
|
|
B = Yap_REGS.B_;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define BACKUP_B() choiceptr BK_B = B; restore_B()
|
|
|
|
|
|
|
|
#define RECOVER_B() save_B(); B = BK_B
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN void restore_TR(void);
|
|
|
|
INLINE_ONLY EXTERN void save_TR(void);
|
2003-02-14 12:20:57 +00:00
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void save_TR(void) {
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_REGS.TR_ = TR;
|
2001-06-27 16:46:26 +01:00
|
|
|
}
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void restore_TR(void) {
|
2002-11-18 18:18:05 +00:00
|
|
|
TR = Yap_REGS.TR_;
|
2001-06-27 16:46:26 +01:00
|
|
|
}
|
|
|
|
|
2002-02-06 17:35:26 +00:00
|
|
|
#elif defined(__GNUC__) && defined(mips)
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2002-11-18 18:18:05 +00:00
|
|
|
#define P Yap_REGS.P_ /* prolog machine program counter */
|
|
|
|
#define YENV Yap_REGS.YENV_ /* current environment (may differ from ENV) */
|
2014-01-19 21:15:05 +00:00
|
|
|
register CELL *HR asm ("$16");
|
2001-04-09 20:54:03 +01:00
|
|
|
register CELL *HB asm ("$17");
|
|
|
|
register choiceptr B asm ("$18");
|
|
|
|
register yamop *CP asm ("$19");
|
|
|
|
register CELL *S asm ("$20");
|
|
|
|
register CELL CreepFlag asm ("$21");
|
|
|
|
register tr_fr_ptr TR asm ("$22");
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void save_machine_regs(void) {
|
2014-01-19 21:15:05 +00:00
|
|
|
Yap_REGS.H_ = HR;
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_REGS.HB_ = HB;
|
|
|
|
Yap_REGS.B_ = B;
|
|
|
|
Yap_REGS.CP_ = CP;
|
|
|
|
Yap_REGS.CreepFlag_ = CreepFlag;
|
|
|
|
Yap_REGS.TR_ = TR;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
2014-01-19 21:15:05 +00:00
|
|
|
HR = Yap_REGS.H_;
|
2002-11-18 18:18:05 +00:00
|
|
|
HB = Yap_REGS.HB_;
|
|
|
|
B = Yap_REGS.B_;
|
|
|
|
CP = Yap_REGS.CP_;
|
|
|
|
CreepFlag = Yap_REGS.CreepFlag_;
|
|
|
|
TR = Yap_REGS.TR_;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define BACKUP_MACHINE_REGS() \
|
2014-01-19 21:15:05 +00:00
|
|
|
CELL *BK_H = HR; \
|
2001-04-09 20:54:03 +01:00
|
|
|
CELL *BK_HB = HB; \
|
|
|
|
choiceptr BK_B = B; \
|
|
|
|
CELL BK_CreepFlag = CreepFlag; \
|
|
|
|
yamop *BK_CP = CP; \
|
|
|
|
tr_fr_ptr BK_TR = TR; \
|
|
|
|
restore_machine_regs()
|
|
|
|
|
|
|
|
#define RECOVER_MACHINE_REGS() \
|
|
|
|
save_machine_regs(); \
|
2014-01-19 21:15:05 +00:00
|
|
|
HR = BK_H; \
|
2001-04-09 20:54:03 +01:00
|
|
|
HB = BK_HB; \
|
|
|
|
B = BK_B; \
|
|
|
|
CreepFlag = BK_CreepFlag; \
|
|
|
|
CP = BK_CP; \
|
|
|
|
TR = BK_TR
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void save_H(void) {
|
2014-01-19 21:15:05 +00:00
|
|
|
Yap_REGS.H_ = HR;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void restore_H(void) {
|
2014-01-19 21:15:05 +00:00
|
|
|
HR = Yap_REGS.H_;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2014-01-19 21:15:05 +00:00
|
|
|
#define BACKUP_H() CELL *BK_H = HR; restore_H()
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2014-01-19 21:15:05 +00:00
|
|
|
#define RECOVER_H() save_H(); HR = BK_H
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void save_B(void) {
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_REGS.B_ = B;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void restore_B(void) {
|
2002-11-18 18:18:05 +00:00
|
|
|
B = Yap_REGS.B_;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define BACKUP_B() choiceptr BK_B = B; restore_B()
|
|
|
|
|
|
|
|
#define RECOVER_B() save_B(); B = BK_B
|
|
|
|
|
2006-02-13 16:58:55 +00:00
|
|
|
#define restore_TR()
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
#elif defined(__GNUC__) && defined(hppa)
|
|
|
|
|
2002-11-18 18:18:05 +00:00
|
|
|
#define P Yap_REGS.P_ /* prolog machine program counter */
|
|
|
|
#define YENV Yap_REGS.YENV_ /* current environment (may differ from ENV) */
|
2014-01-19 21:15:05 +00:00
|
|
|
register CELL *HR asm ("r12");
|
2001-04-09 20:54:03 +01:00
|
|
|
register CELL *HB asm ("r13");
|
|
|
|
register choiceptr B asm ("r14");
|
|
|
|
register yamop *CP asm ("r15");
|
|
|
|
register CELL *S asm ("r16");
|
|
|
|
register CELL CreepFlag asm ("r17");
|
|
|
|
register tr_fr_ptr TR asm ("r18");
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void save_machine_regs(void) {
|
2014-01-19 21:15:05 +00:00
|
|
|
Yap_REGS.H_ = HR;
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_REGS.HB_ = HB;
|
|
|
|
Yap_REGS.B_ = B;
|
|
|
|
Yap_REGS.CP_ = CP;
|
|
|
|
Yap_REGS.CreepFlag_ = CreepFlag;
|
|
|
|
Yap_REGS.TR_ = TR;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
2014-01-19 21:15:05 +00:00
|
|
|
HR = Yap_REGS.H_;
|
2002-11-18 18:18:05 +00:00
|
|
|
HB = Yap_REGS.HB_;
|
|
|
|
B = Yap_REGS.B_;
|
|
|
|
CP = Yap_REGS.CP_;
|
|
|
|
CreepFlag = Yap_REGS.CreepFlag_;
|
|
|
|
TR = Yap_REGS.TR_;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define BACKUP_MACHINE_REGS() \
|
2014-01-19 21:15:05 +00:00
|
|
|
CELL *BK_H = HR; \
|
2001-04-09 20:54:03 +01:00
|
|
|
CELL *BK_HB = HB; \
|
|
|
|
choiceptr BK_B = B; \
|
|
|
|
CELL BK_CreepFlag = CreepFlag; \
|
|
|
|
yamop *BK_CP = CP; \
|
|
|
|
tr_fr_ptr BK_TR = TR; \
|
|
|
|
restore_machine_regs()
|
|
|
|
|
|
|
|
#define RECOVER_MACHINE_REGS() \
|
|
|
|
save_machine_regs(); \
|
2014-01-19 21:15:05 +00:00
|
|
|
HR = BK_H; \
|
2001-04-09 20:54:03 +01:00
|
|
|
HB = BK_HB; \
|
|
|
|
B = BK_B; \
|
|
|
|
CreepFlag = BK_CreepFlag; \
|
|
|
|
CP = BK_CP; \
|
|
|
|
TR = BK_TR
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void save_H(void) {
|
2014-01-19 21:15:05 +00:00
|
|
|
Yap_REGS.H_ = HR;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void restore_H(void) {
|
2014-01-19 21:15:05 +00:00
|
|
|
HR = Yap_REGS.H_;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2014-01-19 21:15:05 +00:00
|
|
|
#define BACKUP_H() CELL *BK_H = HR; restore_H()
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2014-01-19 21:15:05 +00:00
|
|
|
#define RECOVER_H() save_H(); HR = BK_H
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void save_B(void) {
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_REGS.B_ = B;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void restore_B(void) {
|
2002-11-18 18:18:05 +00:00
|
|
|
B = Yap_REGS.B_;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define BACKUP_B() choiceptr BK_B = B; restore_B()
|
|
|
|
|
|
|
|
#define RECOVER_B() save_B(); B = BK_B
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN void restore_TR(void);
|
|
|
|
INLINE_ONLY EXTERN void save_TR(void);
|
2003-02-14 12:20:57 +00:00
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void save_TR(void) {
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_REGS.TR_ = TR;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void restore_TR(void) {
|
2002-11-18 18:18:05 +00:00
|
|
|
TR = Yap_REGS.TR_;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2005-12-23 00:20:14 +00:00
|
|
|
#elif defined(__GNUC__) && (defined(_POWER) || defined(__POWERPC__))
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Because of a bug in GCC, we should always start from the first available
|
|
|
|
general register. According to rs6000.h, this is r13 everywhere
|
|
|
|
except for svr4 machines, where r13 is fixed.
|
|
|
|
|
|
|
|
If we don't do so, GCC will generate move multiple instructions for
|
|
|
|
entering complex functions. These instructions will save and
|
|
|
|
restore the global registers :-(.
|
|
|
|
|
|
|
|
*/
|
2006-03-03 23:11:30 +00:00
|
|
|
#define CreepFlag Yap_REGS.CreepFlag_
|
|
|
|
/*
|
|
|
|
vsc: this MUST start from register 13, otherwise GCC will break down in flames and
|
|
|
|
use the registers for evil purposes. :-(
|
|
|
|
*/
|
2001-04-09 20:54:03 +01:00
|
|
|
#ifndef __svr4__
|
2006-03-03 23:11:30 +00:00
|
|
|
register tr_fr_ptr TR asm ("r13");
|
2001-04-09 20:54:03 +01:00
|
|
|
#else
|
2006-03-03 23:11:30 +00:00
|
|
|
register tr_fr_ptr TR asm ("r21");
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif
|
2014-01-19 21:15:05 +00:00
|
|
|
register CELL *HR asm ("r14");
|
2001-04-09 20:54:03 +01:00
|
|
|
register CELL *HB asm ("r15");
|
|
|
|
register choiceptr B asm ("r16");
|
|
|
|
register yamop *CP asm ("r17");
|
|
|
|
register CELL *S asm ("r18");
|
|
|
|
register CELL *YENV asm ("r19");
|
2002-11-18 18:18:05 +00:00
|
|
|
#define P Yap_REGS.P_ /* prolog machine program counter */
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2006-01-17 14:10:42 +00:00
|
|
|
#undef YENV2MEM
|
|
|
|
#undef YENV_ADDRESS (&(YENV))
|
|
|
|
#undef MEM2YENV
|
|
|
|
|
|
|
|
#define YENV2MEM { CELL *YENV_MEM = YENV
|
|
|
|
#define YENV_ADDRESS (&YENV_MEM)
|
|
|
|
#define MEM2YENV YENV = YENV_MEM; }
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void save_machine_regs(void) {
|
2014-01-19 21:15:05 +00:00
|
|
|
Yap_REGS.H_ = HR;
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_REGS.HB_ = HB;
|
|
|
|
Yap_REGS.B_ = B;
|
|
|
|
Yap_REGS.CP_ = CP;
|
|
|
|
Yap_REGS.YENV_ = YENV;
|
|
|
|
Yap_REGS.TR_ = TR;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
2014-01-19 21:15:05 +00:00
|
|
|
HR = Yap_REGS.H_;
|
2002-11-18 18:18:05 +00:00
|
|
|
HB = Yap_REGS.HB_;
|
|
|
|
B = Yap_REGS.B_;
|
|
|
|
CP = Yap_REGS.CP_;
|
|
|
|
YENV = Yap_REGS.YENV_;
|
|
|
|
TR = Yap_REGS.TR_;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define BACKUP_MACHINE_REGS() \
|
2014-01-19 21:15:05 +00:00
|
|
|
CELL *BK_H = HR; \
|
2001-04-09 20:54:03 +01:00
|
|
|
CELL *BK_HB = HB; \
|
|
|
|
choiceptr BK_B = B; \
|
|
|
|
yamop *BK_CP = CP; \
|
|
|
|
tr_fr_ptr BK_TR = TR; \
|
|
|
|
restore_machine_regs()
|
|
|
|
|
|
|
|
#define RECOVER_MACHINE_REGS() \
|
|
|
|
save_machine_regs(); \
|
2014-01-19 21:15:05 +00:00
|
|
|
HR = BK_H; \
|
2001-04-09 20:54:03 +01:00
|
|
|
HB = BK_HB; \
|
|
|
|
B = BK_B; \
|
|
|
|
CP = BK_CP; \
|
|
|
|
TR = BK_TR
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void save_H(void) {
|
2014-01-19 21:15:05 +00:00
|
|
|
Yap_REGS.H_ = HR;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void restore_H(void) {
|
2014-01-19 21:15:05 +00:00
|
|
|
HR = Yap_REGS.H_;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2014-01-19 21:15:05 +00:00
|
|
|
#define BACKUP_H() CELL *BK_H = HR; restore_H()
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2014-01-19 21:15:05 +00:00
|
|
|
#define RECOVER_H() save_H(); HR = BK_H
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void save_B(void) {
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_REGS.B_ = B;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void restore_B(void) {
|
2002-11-18 18:18:05 +00:00
|
|
|
B = Yap_REGS.B_;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define BACKUP_B() choiceptr BK_B = B; restore_B()
|
|
|
|
|
|
|
|
#define RECOVER_B() save_B(); B = BK_B
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN void restore_TR(void);
|
|
|
|
INLINE_ONLY EXTERN void save_TR(void);
|
2006-02-13 16:58:55 +00:00
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void save_TR(void) {
|
2006-02-13 16:58:55 +00:00
|
|
|
Yap_REGS.TR_ = TR;
|
|
|
|
}
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void restore_TR(void) {
|
2006-02-13 16:58:55 +00:00
|
|
|
TR = Yap_REGS.TR_;
|
|
|
|
}
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
#else
|
|
|
|
|
2002-11-18 18:18:05 +00:00
|
|
|
#define CP Yap_REGS.CP_ /* continuation program counter */
|
|
|
|
#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 */
|
2014-01-19 21:15:05 +00:00
|
|
|
#define HR Yap_REGS.H_ /* top of heap (global) stack */
|
2002-11-18 18:18:05 +00:00
|
|
|
#define B Yap_REGS.B_ /* latest choice point */
|
|
|
|
#define TR Yap_REGS.TR_ /* top of trail */
|
|
|
|
#define HB Yap_REGS.HB_ /* heap (global) stack top at time of latest c.p. */
|
|
|
|
#define CreepFlag Yap_REGS.CreepFlag_
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void save_machine_regs(void) {
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define BACKUP_MACHINE_REGS()
|
|
|
|
|
|
|
|
#define RECOVER_MACHINE_REGS()
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void save_H(void) {
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void restore_H(void) {
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define BACKUP_H()
|
|
|
|
|
|
|
|
#define RECOVER_H()
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void save_B(void) {
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2012-06-30 19:42:14 +01:00
|
|
|
INLINE_ONLY EXTERN inline void restore_B(void) {
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define BACKUP_B()
|
|
|
|
|
|
|
|
#define RECOVER_B()
|
|
|
|
|
2006-02-13 16:58:55 +00:00
|
|
|
#define restore_TR()
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif
|
|
|
|
|
2009-05-23 00:35:24 +01:00
|
|
|
#define AuxBase Yap_REGS.AuxBase_
|
2004-01-23 02:23:51 +00:00
|
|
|
#define AuxSp Yap_REGS.AuxSp_
|
|
|
|
#define AuxTop Yap_REGS.AuxTop_
|
2011-10-02 20:18:09 +01:00
|
|
|
#define CurrentTrailTop Yap_REGS.CurrentTrailTop_
|
2004-01-23 02:23:51 +00:00
|
|
|
#define EX Yap_REGS.EX_
|
|
|
|
#define DEPTH Yap_REGS.DEPTH_
|
2011-03-30 15:32:59 +01:00
|
|
|
#if defined(YAPOR_SBA) || defined(TABLING)
|
2002-11-18 18:18:05 +00:00
|
|
|
#define H_FZ Yap_REGS.H_FZ_
|
|
|
|
#define B_FZ Yap_REGS.B_FZ_
|
|
|
|
#define TR_FZ Yap_REGS.TR_FZ_
|
2011-03-30 15:32:59 +01:00
|
|
|
#endif /* YAPOR_SBA || TABLING */
|
2008-08-30 02:39:36 +01:00
|
|
|
#define PP (Yap_REGS.PP_)
|
2002-10-21 23:14:29 +01:00
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
2011-05-09 19:36:51 +01:00
|
|
|
#define worker_id (Yap_REGS.worker_id_)
|
|
|
|
#define LOCAL (Yap_REGS.worker_local_)
|
|
|
|
#define PREG_ADDR (Yap_REGS.PREG_ADDR_)
|
2011-03-30 15:32:59 +01:00
|
|
|
#ifdef YAPOR_SBA
|
2002-11-18 18:18:05 +00:00
|
|
|
#define BSEG Yap_REGS.BSEG_
|
|
|
|
#define binding_array Yap_REGS.binding_array_
|
|
|
|
#define sba_offset Yap_REGS.sba_offset_
|
|
|
|
#define sba_end Yap_REGS.sba_end_
|
|
|
|
#define sba_size Yap_REGS.sba_size_
|
|
|
|
#define frame_head Yap_REGS.frame_head_
|
|
|
|
#define frame_tail Yap_REGS.frame_tail_
|
2011-03-30 15:32:59 +01:00
|
|
|
#endif /* YAPOR_SBA */
|
2011-05-09 19:36:51 +01:00
|
|
|
#else
|
|
|
|
#define LOCAL (&Yap_local)
|
|
|
|
#endif /* YAPOR || THREADS */
|
2002-11-18 18:18:05 +00:00
|
|
|
#define CurrentModule Yap_REGS.CurrentModule_
|
2008-12-09 12:54:27 +00:00
|
|
|
#define ARITH_EXCEPTION Yap_REGS.ARITH_EXCEPTION_
|
|
|
|
#define Yap_isint Yap_REGS.isint_
|
|
|
|
#define Yap_Floats Yap_REGS.Floats_
|
|
|
|
#define Yap_Ints Yap_REGS.Ints_
|
2013-12-12 14:24:40 +00:00
|
|
|
#define EventFlag Yap_REGS.EventFlag_
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
#define REG_SIZE sizeof(REGS)/sizeof(CELL *)
|
|
|
|
|
|
|
|
#define ARG1 XREGS[1]
|
|
|
|
#define ARG2 XREGS[2]
|
|
|
|
#define ARG3 XREGS[3]
|
|
|
|
#define ARG4 XREGS[4]
|
|
|
|
#define ARG5 XREGS[5]
|
|
|
|
#define ARG6 XREGS[6]
|
|
|
|
#define ARG7 XREGS[7]
|
|
|
|
#define ARG8 XREGS[8]
|
|
|
|
#define ARG9 XREGS[9]
|
|
|
|
#define ARG10 XREGS[10]
|
|
|
|
#define ARG11 XREGS[11]
|
|
|
|
#define ARG12 XREGS[12]
|
|
|
|
#define ARG13 XREGS[13]
|
|
|
|
#define ARG14 XREGS[14]
|
|
|
|
#define ARG15 XREGS[15]
|
|
|
|
#define ARG16 XREGS[16]
|
|
|
|
|
|
|
|
/* by default, define HBREG to be HB */
|
|
|
|
|
|
|
|
#define HBREG HB
|
|
|
|
|
2011-03-30 15:32:59 +01:00
|
|
|
#if defined(YAPOR_SBA) || defined(TABLING)
|
2002-11-18 18:18:05 +00:00
|
|
|
#define BB Yap_REGS.BB_
|
2001-04-09 20:54:03 +01:00
|
|
|
#define BBREG BB
|
2011-03-30 15:32:59 +01:00
|
|
|
#endif /* YAPOR_SBA || TABLING */
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2008-03-25 22:03:14 +00:00
|
|
|
#if !defined(THREADS)
|
2001-04-09 20:54:03 +01:00
|
|
|
/* use actual addresses for regs */
|
|
|
|
#define PRECOMPUTE_REGADDRESS 1
|
|
|
|
#endif /* THREADS */
|
|
|
|
|
|
|
|
|
|
|
|
/* aggregate several abstract machine operations in a single */
|
|
|
|
#define AGGREGATE_OPS 1
|
|
|
|
|
|
|
|
/* make standard registers globally accessible so that they are there
|
|
|
|
when we come from a longjmp */
|
|
|
|
#if PUSH_REGS
|
|
|
|
/* In this case we need to initialise the abstract registers */
|
2008-08-08 15:05:34 +01:00
|
|
|
extern REGSTORE Yap_standard_regs;
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif /* PUSH_REGS */
|
|
|
|
|
2002-03-08 06:33:16 +00:00
|
|
|
/******************* controlling debugging ****************************/
|
2001-05-21 21:00:05 +01:00
|
|
|
static inline UInt
|
2013-12-12 14:24:40 +00:00
|
|
|
StackGap( USES_REGS1 )
|
2001-05-21 21:00:05 +01:00
|
|
|
{
|
2008-10-24 10:35:53 +01:00
|
|
|
UInt gmin = (LCL0-H0)>>2;
|
2004-09-16 18:29:08 +01:00
|
|
|
|
|
|
|
if (gmin < MinStackGap) gmin = MinStackGap;
|
2009-04-26 17:16:56 +01:00
|
|
|
// if (gmin > 1024*1024) return 1024*1024;
|
2004-09-16 18:29:08 +01:00
|
|
|
return gmin;
|
2001-05-21 21:00:05 +01:00
|
|
|
}
|
2013-11-16 00:27:02 +00:00
|
|
|
|
2013-12-12 14:24:40 +00:00
|
|
|
static inline void
|
|
|
|
CalculateStackGap( USES_REGS1 )
|
|
|
|
{
|
|
|
|
CreepFlag = EventFlag = StackGap( PASS_REGS1 );
|
|
|
|
}
|
|
|
|
|