small fixes for CUT_C

This commit is contained in:
Vítor Manuel de Morais Santos Costa 2010-01-28 15:42:49 +00:00
parent 995e8f6dc7
commit 139fc6c440
5 changed files with 25 additions and 5 deletions

View File

@ -157,16 +157,16 @@ SetHeapRegs(void)
UNLOCK(SignalLock);
if (H)
H = PtoGloAdjust(H);
#ifdef CUT_C
if (Yap_REGS.CUT_C_TOP)
Yap_REGS.CUT_C_TOP = CutCAdjust(Yap_REGS.CUT_C_TOP);
#endif
if (HB)
HB = PtoGloAdjust(HB);
if (B)
B = ChoicePtrAdjust(B);
if (CurrentDelayTop)
CurrentDelayTop = PtoDelayAdjust(CurrentDelayTop);
#ifdef CUT_C
if (Yap_REGS.CUT_C_TOP)
Yap_REGS.CUT_C_TOP = (cut_c_str_ptr)ChoicePtrAdjust((choiceptr)Yap_REGS.CUT_C_TOP);
#endif
#ifdef TABLING
if (B_FZ)
B_FZ = ChoicePtrAdjust(B_FZ);
@ -1730,6 +1730,9 @@ Yap_CopyThreadStacks(int worker_q, int worker_p)
if (ASP > CellPtr(B))
ASP = CellPtr(B);
LCL0 = ThreadHandle[worker_p].current_yaam_regs->LCL0_;
#ifdef CUT_C
Yap_REGS.CUT_C_TOP = ThreadHandle[worker_p].current_yaam_regs->CUT_C_TOP;
#endif
DelayedVars = ThreadHandle[worker_p].current_yaam_regs->DelayedVars_;
TR = ThreadHandle[worker_p].current_yaam_regs->TR_;
CurrentDelayTop = (CELL *)DelayTop();

View File

@ -806,6 +806,12 @@ Yap_InitCPredBackCut(char *Name, unsigned long int Arity,
CPredicate Cont,CPredicate Cut, UInt flags){
Yap_InitCPredBack_(Name,Arity,Extra,Start,Cont,Cut,flags);
}
#else
Yap_InitCPredBackCut(char *Name, unsigned long int Arity,
unsigned int Extra, CPredicate Start,
CPredicate Cont,CPredicate Cut, UInt flags){
Yap_InitCPredBack(Name,Arity,Extra,Start,Cont,flags);
}
#endif /* CUT_C */
void

View File

@ -228,8 +228,8 @@ void STD_PROTO(Yap_InitCPred,(char *, unsigned long int, CPredicate, UInt));
void STD_PROTO(Yap_InitAsmPred,(char *, unsigned long int, int, CPredicate, UInt));
void STD_PROTO(Yap_InitCmpPred,(char *, unsigned long int, CmpPredicate, UInt));
void STD_PROTO(Yap_InitCPredBack,(char *, unsigned long int, unsigned int, CPredicate,CPredicate,UInt));
#ifdef CUT_C
void STD_PROTO(Yap_InitCPredBackCut,(char *, unsigned long int, unsigned int, CPredicate,CPredicate,CPredicate,UInt));
#ifdef CUT_C
void STD_PROTO(Yap_InitCPredBack_,(char *, unsigned long int, unsigned int, CPredicate,CPredicate,CPredicate,UInt));
#endif
void STD_PROTO(Yap_InitWorkspace,(UInt,UInt,UInt,UInt,UInt,int,int,int));

View File

@ -515,9 +515,11 @@ Yap_unify_constant(register Term a, register Term cons)
static inline int
do_cut(int i) {
#ifdef CUT_C
while (POP_CHOICE_POINT(B->cp_b)) {
cut_c_pop();
}
#endif
Yap_TrimTrail();
B = B->cp_b;
return i;

View File

@ -106,6 +106,15 @@ PtoLocAdjust (CELL * ptr)
}
inline EXTERN struct cut_c_str *CutCAdjust (struct cut_c_str *);
inline EXTERN struct cut_c_str *
CutCAdjust (struct cut_c_str * ptr)
{
return (struct cut_c_str *) (CharP (ptr) + LDiff);
}
inline EXTERN choiceptr ChoicePtrAdjust (choiceptr);