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 */
/* 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

View File

@ -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)));
}

View File

@ -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

View File

@ -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));

View File

@ -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;

View File

@ -65,6 +65,30 @@
#include <stdio.h>
#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;

View File

@ -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

View File

@ -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