diff --git a/C/grow.c b/C/grow.c index bf611e534..db92dd39d 100644 --- a/C/grow.c +++ b/C/grow.c @@ -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(); diff --git a/C/init.c b/C/init.c index c2ddbb2c7..f486b8297 100644 --- a/C/init.c +++ b/C/init.c @@ -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 diff --git a/H/Yapproto.h b/H/Yapproto.h index 8ecc2e24a..a7614c55d 100644 --- a/H/Yapproto.h +++ b/H/Yapproto.h @@ -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)); diff --git a/H/amiops.h b/H/amiops.h index cd8744ee6..a4111c514 100644 --- a/H/amiops.h +++ b/H/amiops.h @@ -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; diff --git a/H/sshift.h b/H/sshift.h index 7ca8e16dd..7dab5c8ea 100644 --- a/H/sshift.h +++ b/H/sshift.h @@ -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);