diff --git a/H/Regs.h b/H/Regs.h index 934c67d67..d51a155b0 100644 --- a/H/Regs.h +++ b/H/Regs.h @@ -110,9 +110,6 @@ typedef struct ADDR AuxTop_; /* 10 Auxiliary stack top */ /* visualc*/ CELL EX_; /* 18 */ -#ifdef COROUTINING - Term DelayedVars_; /* maximum number of attributed variables */ -#endif Term CurrentModule_; #if defined(SBA) || defined(TABLING) CELL *H_FZ_; @@ -697,9 +694,6 @@ EXTERN inline void restore_B(void) { #define frame_tail Yap_REGS.frame_tail_ #endif /* SBA */ #endif /* YAPOR */ -#ifdef COROUTINING -#define DelayedVars Yap_REGS.DelayedVars_ -#endif #if defined(YAPOR) || defined(TABLING) #define LOCAL Yap_REGS.LOCAL_ #endif diff --git a/H/TermExt.h b/H/TermExt.h index b893ac534..55359db18 100644 --- a/H/TermExt.h +++ b/H/TermExt.h @@ -58,6 +58,14 @@ blob_type; #define FunctorDouble ((Functor)(double_e)) #define EndSpecials (double_e+sizeof(Functor *)) +inline EXTERN int IsAttVar (CELL *pt); + +inline EXTERN int +IsAttVar (CELL *pt) +{ + return (pt)[-1] == (CELL)attvar_e; +} + typedef enum { BIG_INT = 0x01, @@ -452,7 +460,7 @@ inline EXTERN Int IsAttachedTerm (Term); inline EXTERN Int IsAttachedTerm (Term t) { - return (Int) ((IsVarTerm (t) && VarOfTerm (t) < H0)); + return (Int) ((IsVarTerm (t) && IsAttVar(VarOfTerm(t)))); } @@ -463,8 +471,7 @@ inline EXTERN Int SafeIsAttachedTerm (Term); inline EXTERN Int SafeIsAttachedTerm (Term t) { - return (Int) ((IsVarTerm (t) && VarOfTerm (t) < H0 - && VarOfTerm (t) >= (CELL *) Yap_GlobalBase)); + return (Int) (IsVarTerm (t) && IsAttVar(VarOfTerm(t))); } diff --git a/H/YapHeap.h b/H/YapHeap.h index 86eca7411..29ba8e612 100755 --- a/H/YapHeap.h +++ b/H/YapHeap.h @@ -91,7 +91,6 @@ typedef struct restore_info { CELL *g_split; tr_fr_ptr old_TR; CELL *old_GlobalBase, *old_H, *old_H0; - CELL *old_DelayTop, *current_DelayTop; ADDR old_TrailBase, old_TrailTop; ADDR old_HeapBase, old_HeapTop; } restoreinfo; @@ -183,7 +182,6 @@ typedef struct worker_local_struct { int allow_restart; Term global_arena; UInt global_arena_overflows; - Term global_delay_arena; yamop trust_lu_code[3]; #if (defined(YAPOR) || defined(TABLING) ) && defined(THREADS) #ifdef YAPOR @@ -293,8 +291,6 @@ extern struct various_codes *Yap_heap_regs; #define OldTrailTop RINFO.old_TrailTop #define OldHeapBase RINFO.old_HeapBase #define OldHeapTop RINFO.old_HeapTop -#define OldDelayTop RINFO.old_DelayTop -#define CurrentDelayTop RINFO.current_DelayTop #define ClDiff RINFO.cl_diff #define GDiff RINFO.g_diff #define GDiff0 RINFO.g_diff0 @@ -360,7 +356,6 @@ extern struct various_codes *Yap_heap_regs; #define GlobalArena Yap_heap_regs->WL.global_arena #define GlobalArenaOverflows Yap_heap_regs->WL.global_arena_overflows #define Yap_AllowRestart Yap_heap_regs->WL.allow_restart -#define GlobalDelayArena Yap_heap_regs->WL.global_delay_arena #define PredHashInitialSize 1039L #define PredHashIncrement 7919L diff --git a/H/Yapproto.h b/H/Yapproto.h index 65826d352..6bf271e5c 100644 --- a/H/Yapproto.h +++ b/H/Yapproto.h @@ -190,6 +190,7 @@ void STD_PROTO(Yap_inform_profiler_of_clause,(struct yami *,struct yami *,struct /* globals.c */ Term STD_PROTO(Yap_NewArena,(UInt,CELL *)); +CELL *STD_PROTO(Yap_GetFromArena,(Term *,UInt,UInt)); void STD_PROTO(Yap_InitGlobals,(void)); Term STD_PROTO(Yap_SaveTerm, (Term)); Term STD_PROTO(Yap_SetGlobalVal, (Atom, Term)); diff --git a/H/Yatom.h b/H/Yatom.h index 900f0596a..5496ed230 100644 --- a/H/Yatom.h +++ b/H/Yatom.h @@ -216,6 +216,7 @@ typedef struct global_entry struct AtomEntryStruct *AtomOfGE; /* parent atom for deletion */ struct global_entry *NextGE; /* linked list of global entries */ Term global; /* index in module table */ + Term AttChain; /* index in module table */ } GlobalEntry; diff --git a/H/amidefs.h b/H/amidefs.h index 5e7dc7553..428cf8d9d 100644 --- a/H/amidefs.h +++ b/H/amidefs.h @@ -65,6 +65,30 @@ #include #endif +#ifdef FROZEN_STACKS +#ifdef SBA +#define PROTECT_FROZEN_H(CPTR) \ + ((Unsigned((Int)((CPTR)->cp_h)-(Int)(H_FZ)) < \ + Unsigned((Int)(B_FZ)-(Int)(H_FZ))) ? \ + (CPTR)->cp_h : H_FZ) +#define PROTECT_FROZEN_B(CPTR) \ + ((Unsigned((Int)(CPTR)-(Int)(H_FZ)) < \ + Unsigned((Int)(B_FZ)-(Int)(H_FZ))) ? \ + (CPTR) : B_FZ) + /* +#define PROTECT_FROZEN_H(CPTR) ((CPTR)->cp_h > H_FZ && (CPTR)->cp_h < (CELL *)B_FZ ? (CPTR)->cp_h : H_FZ ) + +#define PROTECT_FROZEN_B(CPTR) ((CPTR) < B_FZ && (CPTR) > (choiceptr)H_FZ ? (CPTR) : B_FZ ) + */ +#else /* TABLING */ +#define PROTECT_FROZEN_B(CPTR) (YOUNGER_CP(CPTR, B_FZ) ? CPTR : B_FZ) +#define PROTECT_FROZEN_H(CPTR) (((CPTR)->cp_h > H_FZ) ? (CPTR)->cp_h : H_FZ) +#endif /* SBA */ +#else +#define PROTECT_FROZEN_B(CPTR) (CPTR) +#define PROTECT_FROZEN_H(CPTR) (CPTR)->cp_h +#endif /* FROZEN_STACKS */ + #if ALIGN_LONGS /* */ typedef Int DISPREG; /* */ typedef CELL SMALLUNSGN; diff --git a/H/attvar.h b/H/attvar.h index efe4493b7..e1ed2747c 100644 --- a/H/attvar.h +++ b/H/attvar.h @@ -42,24 +42,24 @@ Each attribute contains; */ typedef struct attvar_struct { + Functor AttFunc; /* functor for attvar */ Term Done; /* if unbound suspension active, if bound terminated */ Term Value; /* value the variable will take */ Term Atts; /* actual data */ } attvar_record; +#define ATT_RECORD_ARITY 3 + /*********** tags for suspension variables */ -#define AbsAttVar(attvar_ptr) AbsAppl(((CELL *)(attvar_ptr))) -#define RepAttVar(val) ((attvar_record *)RepAppl(val)) - -static inline attvar_record * -DelayTop(void) { - return (attvar_record *)Yap_ReadTimedVar(DelayedVars); +static inline Term +AbsAttVar(attvar_record *attvar_ptr) { + return attvar_ptr->Done; } -static inline void -SetDelayTop(attvar_record *new_top) { - Yap_UpdateTimedVar(DelayedVars, (CELL)new_top); +static inline attvar_record * +RepAttVar(Term *var_ptr) { + return (attvar_record *)(var_ptr-1); } #endif diff --git a/H/rheap.h b/H/rheap.h index 1c4041c1a..9e125abca 100755 --- a/H/rheap.h +++ b/H/rheap.h @@ -1024,10 +1024,6 @@ restore_codes(void) AbsAppl(PtoGloAdjust(RepAppl(Yap_heap_regs->wl.global_arena))); } } - if (Yap_heap_regs->wl.global_delay_arena) { - Yap_heap_regs->wl.global_delay_arena = - GlobalAdjust(Yap_heap_regs->wl.global_delay_arena); - } Yap_heap_regs->wl.allow_restart = FALSE; #endif #endif