new Atts Code.

This commit is contained in:
Vitor Santos Costa 2010-03-08 09:24:11 +00:00
parent 34ca485e42
commit 53b4828000
8 changed files with 45 additions and 27 deletions

View File

@ -110,9 +110,6 @@ typedef struct
ADDR AuxTop_; /* 10 Auxiliary stack top */ ADDR AuxTop_; /* 10 Auxiliary stack top */
/* visualc*/ /* visualc*/
CELL EX_; /* 18 */ CELL EX_; /* 18 */
#ifdef COROUTINING
Term DelayedVars_; /* maximum number of attributed variables */
#endif
Term CurrentModule_; Term CurrentModule_;
#if defined(SBA) || defined(TABLING) #if defined(SBA) || defined(TABLING)
CELL *H_FZ_; CELL *H_FZ_;
@ -697,9 +694,6 @@ EXTERN inline void restore_B(void) {
#define frame_tail Yap_REGS.frame_tail_ #define frame_tail Yap_REGS.frame_tail_
#endif /* SBA */ #endif /* SBA */
#endif /* YAPOR */ #endif /* YAPOR */
#ifdef COROUTINING
#define DelayedVars Yap_REGS.DelayedVars_
#endif
#if defined(YAPOR) || defined(TABLING) #if defined(YAPOR) || defined(TABLING)
#define LOCAL Yap_REGS.LOCAL_ #define LOCAL Yap_REGS.LOCAL_
#endif #endif

View File

@ -58,6 +58,14 @@ blob_type;
#define FunctorDouble ((Functor)(double_e)) #define FunctorDouble ((Functor)(double_e))
#define EndSpecials (double_e+sizeof(Functor *)) #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 typedef enum
{ {
BIG_INT = 0x01, BIG_INT = 0x01,
@ -452,7 +460,7 @@ inline EXTERN Int IsAttachedTerm (Term);
inline EXTERN Int inline EXTERN Int
IsAttachedTerm (Term t) 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 inline EXTERN Int
SafeIsAttachedTerm (Term t) SafeIsAttachedTerm (Term t)
{ {
return (Int) ((IsVarTerm (t) && VarOfTerm (t) < H0 return (Int) (IsVarTerm (t) && IsAttVar(VarOfTerm(t)));
&& VarOfTerm (t) >= (CELL *) Yap_GlobalBase));
} }

View File

@ -91,7 +91,6 @@ typedef struct restore_info {
CELL *g_split; CELL *g_split;
tr_fr_ptr old_TR; tr_fr_ptr old_TR;
CELL *old_GlobalBase, *old_H, *old_H0; CELL *old_GlobalBase, *old_H, *old_H0;
CELL *old_DelayTop, *current_DelayTop;
ADDR old_TrailBase, old_TrailTop; ADDR old_TrailBase, old_TrailTop;
ADDR old_HeapBase, old_HeapTop; ADDR old_HeapBase, old_HeapTop;
} restoreinfo; } restoreinfo;
@ -183,7 +182,6 @@ typedef struct worker_local_struct {
int allow_restart; int allow_restart;
Term global_arena; Term global_arena;
UInt global_arena_overflows; UInt global_arena_overflows;
Term global_delay_arena;
yamop trust_lu_code[3]; yamop trust_lu_code[3];
#if (defined(YAPOR) || defined(TABLING) ) && defined(THREADS) #if (defined(YAPOR) || defined(TABLING) ) && defined(THREADS)
#ifdef YAPOR #ifdef YAPOR
@ -293,8 +291,6 @@ extern struct various_codes *Yap_heap_regs;
#define OldTrailTop RINFO.old_TrailTop #define OldTrailTop RINFO.old_TrailTop
#define OldHeapBase RINFO.old_HeapBase #define OldHeapBase RINFO.old_HeapBase
#define OldHeapTop RINFO.old_HeapTop #define OldHeapTop RINFO.old_HeapTop
#define OldDelayTop RINFO.old_DelayTop
#define CurrentDelayTop RINFO.current_DelayTop
#define ClDiff RINFO.cl_diff #define ClDiff RINFO.cl_diff
#define GDiff RINFO.g_diff #define GDiff RINFO.g_diff
#define GDiff0 RINFO.g_diff0 #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 GlobalArena Yap_heap_regs->WL.global_arena
#define GlobalArenaOverflows Yap_heap_regs->WL.global_arena_overflows #define GlobalArenaOverflows Yap_heap_regs->WL.global_arena_overflows
#define Yap_AllowRestart Yap_heap_regs->WL.allow_restart #define Yap_AllowRestart Yap_heap_regs->WL.allow_restart
#define GlobalDelayArena Yap_heap_regs->WL.global_delay_arena
#define PredHashInitialSize 1039L #define PredHashInitialSize 1039L
#define PredHashIncrement 7919L #define PredHashIncrement 7919L

View File

@ -190,6 +190,7 @@ void STD_PROTO(Yap_inform_profiler_of_clause,(struct yami *,struct yami *,struct
/* globals.c */ /* globals.c */
Term STD_PROTO(Yap_NewArena,(UInt,CELL *)); Term STD_PROTO(Yap_NewArena,(UInt,CELL *));
CELL *STD_PROTO(Yap_GetFromArena,(Term *,UInt,UInt));
void STD_PROTO(Yap_InitGlobals,(void)); void STD_PROTO(Yap_InitGlobals,(void));
Term STD_PROTO(Yap_SaveTerm, (Term)); Term STD_PROTO(Yap_SaveTerm, (Term));
Term STD_PROTO(Yap_SetGlobalVal, (Atom, Term)); Term STD_PROTO(Yap_SetGlobalVal, (Atom, Term));

View File

@ -216,6 +216,7 @@ typedef struct global_entry
struct AtomEntryStruct *AtomOfGE; /* parent atom for deletion */ struct AtomEntryStruct *AtomOfGE; /* parent atom for deletion */
struct global_entry *NextGE; /* linked list of global entries */ struct global_entry *NextGE; /* linked list of global entries */
Term global; /* index in module table */ Term global; /* index in module table */
Term AttChain; /* index in module table */
} GlobalEntry; } GlobalEntry;

View File

@ -65,6 +65,30 @@
#include <stdio.h> #include <stdio.h>
#endif #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 #if ALIGN_LONGS
/* */ typedef Int DISPREG; /* */ typedef Int DISPREG;
/* */ typedef CELL SMALLUNSGN; /* */ typedef CELL SMALLUNSGN;

View File

@ -42,24 +42,24 @@ Each attribute contains;
*/ */
typedef struct attvar_struct { typedef struct attvar_struct {
Functor AttFunc; /* functor for attvar */
Term Done; /* if unbound suspension active, if bound terminated */ Term Done; /* if unbound suspension active, if bound terminated */
Term Value; /* value the variable will take */ Term Value; /* value the variable will take */
Term Atts; /* actual data */ Term Atts; /* actual data */
} attvar_record; } attvar_record;
#define ATT_RECORD_ARITY 3
/*********** tags for suspension variables */ /*********** tags for suspension variables */
#define AbsAttVar(attvar_ptr) AbsAppl(((CELL *)(attvar_ptr))) static inline Term
#define RepAttVar(val) ((attvar_record *)RepAppl(val)) AbsAttVar(attvar_record *attvar_ptr) {
return attvar_ptr->Done;
static inline attvar_record *
DelayTop(void) {
return (attvar_record *)Yap_ReadTimedVar(DelayedVars);
} }
static inline void static inline attvar_record *
SetDelayTop(attvar_record *new_top) { RepAttVar(Term *var_ptr) {
Yap_UpdateTimedVar(DelayedVars, (CELL)new_top); return (attvar_record *)(var_ptr-1);
} }
#endif #endif

View File

@ -1024,10 +1024,6 @@ restore_codes(void)
AbsAppl(PtoGloAdjust(RepAppl(Yap_heap_regs->wl.global_arena))); 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; Yap_heap_regs->wl.allow_restart = FALSE;
#endif #endif
#endif #endif