removed unnecessary cut_c macros (always on)

This commit is contained in:
David Vaz 2014-02-11 07:15:39 -08:00
parent 1d7407ba4d
commit 3cad9c37b1
21 changed files with 16 additions and 163 deletions

View File

@ -497,9 +497,7 @@
#include "absmi.h" #include "absmi.h"
#include "heapgc.h" #include "heapgc.h"
#ifdef CUT_C
#include "cut_c.h" #include "cut_c.h"
#endif
#ifdef PUSH_X #ifdef PUSH_X
#else #else
@ -2688,14 +2686,12 @@ Yap_absmi(int inp)
/* trust_fail */ /* trust_fail */
BOp(trust_fail, e); BOp(trust_fail, e);
#ifdef CUT_C
{ {
while (POP_CHOICE_POINT(B->cp_b)) while (POP_CHOICE_POINT(B->cp_b))
{ {
POP_EXECUTE(); POP_EXECUTE();
} }
} }
#endif /* CUT_C */
#ifdef YAPOR #ifdef YAPOR
{ {
choiceptr cut_pt; choiceptr cut_pt;
@ -3603,11 +3599,9 @@ Yap_absmi(int inp)
/* cut */ /* cut */
BACKUP_B(); BACKUP_B();
#ifdef CUT_C
while (POP_CHOICE_POINT(B->cp_b)) { while (POP_CHOICE_POINT(B->cp_b)) {
POP_EXECUTE(); POP_EXECUTE();
} }
#endif /* CUT_C */
B = B->cp_b; /* cut_fail */ B = B->cp_b; /* cut_fail */
HB = B->cp_h; /* cut_fail */ HB = B->cp_h; /* cut_fail */
RECOVER_B(); RECOVER_B();
@ -7659,10 +7653,8 @@ Yap_absmi(int inp)
CUT_wait_leftmost(); CUT_wait_leftmost();
#endif /* YAPOR */ #endif /* YAPOR */
CACHE_Y(YREG); CACHE_Y(YREG);
#ifdef CUT_C
/* Alocate space for the cut_c structure*/ /* Alocate space for the cut_c structure*/
CUT_C_PUSH(NEXTOP(NEXTOP(PREG,OtapFs),OtapFs),S_YREG); CUT_C_PUSH(NEXTOP(NEXTOP(PREG,OtapFs),OtapFs),S_YREG);
#endif
S_YREG = S_YREG - PREG->u.OtapFs.extra; S_YREG = S_YREG - PREG->u.OtapFs.extra;
store_args(PREG->u.OtapFs.s); store_args(PREG->u.OtapFs.s);
store_yaam_regs(NEXTOP(PREG, OtapFs), 0); store_yaam_regs(NEXTOP(PREG, OtapFs), 0);
@ -7680,21 +7672,17 @@ Yap_absmi(int inp)
saveregs(); saveregs();
SREG = (CELL *) ((f) (PASS_REGS1)); SREG = (CELL *) ((f) (PASS_REGS1));
/* This last instruction changes B B*/ /* This last instruction changes B B*/
#ifdef CUT_C
while (POP_CHOICE_POINT(B)){ while (POP_CHOICE_POINT(B)){
cut_c_pop(); cut_c_pop();
} }
#endif
setregs(); setregs();
} }
if (!SREG) { if (!SREG) {
#ifdef CUT_C
/* Removes the cut functions from the stack /* Removes the cut functions from the stack
without executing them because we have fail without executing them because we have fail
and not cuted the predicate*/ and not cuted the predicate*/
while(POP_CHOICE_POINT(B)) while(POP_CHOICE_POINT(B))
cut_c_pop(); cut_c_pop();
#endif
FAIL(); FAIL();
} }
if ((CELL *) B == YREG && ASP != (CELL *) B) { if ((CELL *) B == YREG && ASP != (CELL *) B) {
@ -7727,7 +7715,6 @@ Yap_absmi(int inp)
goto TRYCC; goto TRYCC;
ENDBOp(); ENDBOp();
#ifdef CUT_C
BOp(cut_c, OtapFs); BOp(cut_c, OtapFs);
/*This is a phantom instruction. This is not executed by the WAM*/ /*This is a phantom instruction. This is not executed by the WAM*/
#ifdef DEBUG #ifdef DEBUG
@ -7736,17 +7723,14 @@ Yap_absmi(int inp)
printf ("ERROR: Should not print this message FILE: absmi.c %d\n",__LINE__); printf ("ERROR: Should not print this message FILE: absmi.c %d\n",__LINE__);
#endif /*DEBUG*/ #endif /*DEBUG*/
ENDBOp(); ENDBOp();
#endif
BOp(try_userc, OtapFs); BOp(try_userc, OtapFs);
#ifdef YAPOR #ifdef YAPOR
CUT_wait_leftmost(); CUT_wait_leftmost();
#endif /* YAPOR */ #endif /* YAPOR */
CACHE_Y(YREG); CACHE_Y(YREG);
#ifdef CUT_C
/* Alocate space for the cut_c structure*/ /* Alocate space for the cut_c structure*/
CUT_C_PUSH(NEXTOP(NEXTOP(PREG,OtapFs),OtapFs),S_YREG); CUT_C_PUSH(NEXTOP(NEXTOP(PREG,OtapFs),OtapFs),S_YREG);
#endif
S_YREG = S_YREG - PREG->u.OtapFs.extra; S_YREG = S_YREG - PREG->u.OtapFs.extra;
store_args(PREG->u.OtapFs.s); store_args(PREG->u.OtapFs.s);
store_yaam_regs(NEXTOP(PREG, OtapFs), 0); store_yaam_regs(NEXTOP(PREG, OtapFs), 0);
@ -7806,13 +7790,11 @@ Yap_absmi(int inp)
setregs(); setregs();
LOCAL_PrologMode &= ~UserCCallMode; LOCAL_PrologMode &= ~UserCCallMode;
if (!SREG) { if (!SREG) {
#ifdef CUT_C
/* Removes the cut functions from the stack /* Removes the cut functions from the stack
without executing them because we have fail without executing them because we have fail
and not cuted the predicate*/ and not cuted the predicate*/
while(POP_CHOICE_POINT(B)) while(POP_CHOICE_POINT(B))
cut_c_pop(); cut_c_pop();
#endif
FAIL(); FAIL();
} }
if ((CELL *) B == YREG && ASP != (CELL *) B) { if ((CELL *) B == YREG && ASP != (CELL *) B) {
@ -7828,7 +7810,6 @@ Yap_absmi(int inp)
JMPNext(); JMPNext();
ENDBOp(); ENDBOp();
#ifdef CUT_C
BOp(cut_userc, OtapFs); BOp(cut_userc, OtapFs);
/*This is a phantom instruction. This is not executed by the WAM*/ /*This is a phantom instruction. This is not executed by the WAM*/
#ifdef DEBUG #ifdef DEBUG
@ -7839,7 +7820,6 @@ Yap_absmi(int inp)
CACHE_A1(); CACHE_A1();
JMPNext(); JMPNext();
ENDBOp(); ENDBOp();
#endif
/************************************************************************\ /************************************************************************\

View File

@ -363,9 +363,7 @@
#include "or.macros.h" #include "or.macros.h"
#endif /* YAPOR */ #endif /* YAPOR */
#include "threads.h" #include "threads.h"
#ifdef CUT_C
#include "cut_c.h" #include "cut_c.h"
#endif /* CUT_C */
#if HAVE_MALLOC_H #if HAVE_MALLOC_H
#include <malloc.h> #include <malloc.h>
#endif #endif
@ -515,10 +513,8 @@ X_API void YAP_PredicateInfo(void *,Atom *,UInt *,Term *);
X_API void YAP_UserCPredicate(char *,CPredicate,UInt); X_API void YAP_UserCPredicate(char *,CPredicate,UInt);
X_API void YAP_UserBackCPredicate(char *,CPredicate,CPredicate,UInt,unsigned int); X_API void YAP_UserBackCPredicate(char *,CPredicate,CPredicate,UInt,unsigned int);
X_API void YAP_UserCPredicateWithArgs(char *,CPredicate,UInt,Term); X_API void YAP_UserCPredicateWithArgs(char *,CPredicate,UInt,Term);
#ifdef CUT_C
X_API void YAP_UserBackCutCPredicate(char *,CPredicate,CPredicate,CPredicate,UInt,unsigned int); X_API void YAP_UserBackCutCPredicate(char *,CPredicate,CPredicate,CPredicate,UInt,unsigned int);
X_API void *YAP_ExtraSpaceCut(void); X_API void *YAP_ExtraSpaceCut(void);
#endif
X_API Term YAP_SetCurrentModule(Term); X_API Term YAP_SetCurrentModule(Term);
X_API Term YAP_CurrentModule(void); X_API Term YAP_CurrentModule(void);
X_API Term YAP_CreateModule(Atom); X_API Term YAP_CreateModule(Atom);
@ -1166,7 +1162,6 @@ YAP_ArityOfFunctor(Functor f)
return (ArityOfFunctor(f)); return (ArityOfFunctor(f));
} }
#ifdef CUT_C
X_API void * X_API void *
YAP_ExtraSpaceCut(void) YAP_ExtraSpaceCut(void)
{ {
@ -1179,7 +1174,6 @@ YAP_ExtraSpaceCut(void)
RECOVER_B(); RECOVER_B();
return(ptr); return(ptr);
} }
#endif /*CUT_C*/
X_API void * X_API void *
YAP_ExtraSpace(void) YAP_ExtraSpace(void)
@ -1203,14 +1197,12 @@ YAP_cut_up(void)
{ {
CACHE_REGS CACHE_REGS
BACKUP_B(); BACKUP_B();
#ifdef CUT_C
{ {
while (POP_CHOICE_POINT(B->cp_b)) while (POP_CHOICE_POINT(B->cp_b))
{ {
POP_EXECUTE(); POP_EXECUTE();
} }
} }
#endif /* CUT_C */
/* This is complicated: make sure we can restore the ASP /* This is complicated: make sure we can restore the ASP
pointer back to where cut_up called it. Slots depend on it. */ pointer back to where cut_up called it. Slots depend on it. */
if (ENV > B->cp_env) { if (ENV > B->cp_env) {
@ -3505,23 +3497,16 @@ X_API void
YAP_UserBackCPredicate(char *name, CPredicate init, CPredicate cont, YAP_UserBackCPredicate(char *name, CPredicate init, CPredicate cont,
UInt arity, unsigned int extra) UInt arity, unsigned int extra)
{ {
#ifdef CUT_C
Yap_InitCPredBackCut(name, arity, extra, init, cont, NULL ,UserCPredFlag); Yap_InitCPredBackCut(name, arity, extra, init, cont, NULL ,UserCPredFlag);
#else
Yap_InitCPredBack(name, arity, extra, init, cont, UserCPredFlag);
#endif
} }
#ifdef CUT_C
X_API void X_API void
YAP_UserBackCutCPredicate(char *name, CPredicate init, CPredicate cont, CPredicate cut, YAP_UserBackCutCPredicate(char *name, CPredicate init, CPredicate cont, CPredicate cut,
UInt arity, unsigned int extra) UInt arity, unsigned int extra)
{ {
Yap_InitCPredBackCut(name, arity, extra, init, cont, cut, UserCPredFlag); Yap_InitCPredBackCut(name, arity, extra, init, cont, cut, UserCPredFlag);
} }
#endif
X_API void X_API void
YAP_UserCPredicateWithArgs(char *a, CPredicate f, UInt arity, Term mod) YAP_UserCPredicateWithArgs(char *a, CPredicate f, UInt arity, Term mod)

View File

@ -1,5 +1,3 @@
#ifdef CUT_C
#include "Yap.h" #include "Yap.h"
#include "cut_c.h" #include "cut_c.h"
#include <stdio.h> #include <stdio.h>
@ -33,5 +31,3 @@ void cut_c_push(cut_c_str_ptr new_top){
Yap_REGS.CUT_C_TOP=new_top; Yap_REGS.CUT_C_TOP=new_top;
return; return;
} }
#endif /*CUT_C*/

View File

@ -22,9 +22,7 @@ static char SccsId[] = "@(#)cdmgr.c 1.1 05/02/98";
#include "pl-shared.h" #include "pl-shared.h"
#include "yapio.h" #include "yapio.h"
#include "attvar.h" #include "attvar.h"
#ifdef CUT_C
#include "cut_c.h" #include "cut_c.h"
#endif
static Int CallPredicate(PredEntry *, choiceptr, yamop * CACHE_TYPE); static Int CallPredicate(PredEntry *, choiceptr, yamop * CACHE_TYPE);
static Int EnterCreepMode(Term, Term CACHE_TYPE); static Int EnterCreepMode(Term, Term CACHE_TYPE);
@ -1229,7 +1227,6 @@ execute_pred(PredEntry *ppe, CELL *pt USES_REGS)
/* restore the old environment */ /* restore the old environment */
/* get to previous environment */ /* get to previous environment */
cut_B = (choiceptr)ENV[E_CB]; cut_B = (choiceptr)ENV[E_CB];
#ifdef CUT_C
{ {
/* Note that /* Note that
cut_B == (choiceptr)ENV[E_CB] */ cut_B == (choiceptr)ENV[E_CB] */
@ -1238,7 +1235,6 @@ execute_pred(PredEntry *ppe, CELL *pt USES_REGS)
POP_EXECUTE(); POP_EXECUTE();
} }
} }
#endif /* CUT_C */
#ifdef YAPOR #ifdef YAPOR
CUT_prune_to(cut_B); CUT_prune_to(cut_B);
#endif /* YAPOR */ #endif /* YAPOR */
@ -1799,9 +1795,7 @@ Yap_InitYaamRegs( int myworker_id )
#endif #endif
Yap_AllocateDefaultArena(128*1024, 2, myworker_id); Yap_AllocateDefaultArena(128*1024, 2, myworker_id);
Yap_InitPreAllocCodeSpace( myworker_id ); Yap_InitPreAllocCodeSpace( myworker_id );
#ifdef CUT_C
cut_c_initialize( myworker_id ); cut_c_initialize( myworker_id );
#endif
Yap_PrepGoal(0, NULL, NULL PASS_REGS); Yap_PrepGoal(0, NULL, NULL PASS_REGS);
#ifdef TABLING #ifdef TABLING
/* ensure that LOCAL_top_dep_fr is always valid */ /* ensure that LOCAL_top_dep_fr is always valid */

View File

@ -22,9 +22,7 @@
#include "sshift.h" #include "sshift.h"
#include "compile.h" #include "compile.h"
#include "attvar.h" #include "attvar.h"
#ifdef CUT_C
#include "cut_c.h" #include "cut_c.h"
#endif /* CUT_C */
#if HAVE_STRING_H #if HAVE_STRING_H
#include <string.h> #include <string.h>
#endif #endif
@ -137,10 +135,8 @@ SetHeapRegs(int copying_threads USES_REGS)
UNLOCK(LOCAL_SignalLock); UNLOCK(LOCAL_SignalLock);
if (HR) if (HR)
HR = PtoGloAdjust(HR); HR = PtoGloAdjust(HR);
#ifdef CUT_C
if (Yap_REGS.CUT_C_TOP) if (Yap_REGS.CUT_C_TOP)
Yap_REGS.CUT_C_TOP = CutCAdjust(Yap_REGS.CUT_C_TOP); Yap_REGS.CUT_C_TOP = CutCAdjust(Yap_REGS.CUT_C_TOP);
#endif
if (HB) if (HB)
HB = PtoGloAdjust(HB); HB = PtoGloAdjust(HB);
if (LOCAL_OpenArray) if (LOCAL_OpenArray)
@ -1986,9 +1982,7 @@ Yap_CopyThreadStacks(int worker_q, int worker_p, int incremental)
if (ASP > CellPtr(B)) if (ASP > CellPtr(B))
ASP = CellPtr(B); ASP = CellPtr(B);
LCL0 = REMOTE_ThreadHandle(worker_p).current_yaam_regs->LCL0_; LCL0 = REMOTE_ThreadHandle(worker_p).current_yaam_regs->LCL0_;
#ifdef CUT_C
Yap_REGS.CUT_C_TOP = REMOTE_ThreadHandle(worker_p).current_yaam_regs->CUT_C_TOP; Yap_REGS.CUT_C_TOP = REMOTE_ThreadHandle(worker_p).current_yaam_regs->CUT_C_TOP;
#endif
LOCAL_DynamicArrays = NULL; LOCAL_DynamicArrays = NULL;
LOCAL_StaticArrays = NULL; LOCAL_StaticArrays = NULL;
LOCAL_GlobalVariables = NULL; LOCAL_GlobalVariables = NULL;

View File

@ -492,9 +492,7 @@ static char SccsId[] = "%W% %G%";
#if HAVE_STRING_H #if HAVE_STRING_H
#include <string.h> #include <string.h>
#endif #endif
#ifdef CUT_C
#include "cut_c.h" #include "cut_c.h"
#endif
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
#define SET_JLBL(X) jlbl = &(ipc->u.X) #define SET_JLBL(X) jlbl = &(ipc->u.X)
@ -6200,14 +6198,12 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
#if TABLING #if TABLING
case _table_trust: case _table_trust:
#endif #endif
#ifdef CUT_C
{ {
while (POP_CHOICE_POINT(B->cp_b)) while (POP_CHOICE_POINT(B->cp_b))
{ {
POP_EXECUTE(); POP_EXECUTE();
} }
} }
#endif /* CUT_C */
#ifdef YAPOR #ifdef YAPOR
{ {
choiceptr cut_pt; choiceptr cut_pt;
@ -6230,14 +6226,12 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
case _table_trust_me: case _table_trust_me:
#endif #endif
b0 = B; b0 = B;
#ifdef CUT_C
{ {
while (POP_CHOICE_POINT(B->cp_b)) while (POP_CHOICE_POINT(B->cp_b))
{ {
POP_EXECUTE(); POP_EXECUTE();
} }
} }
#endif /* CUT_C */
#ifdef YAPOR #ifdef YAPOR
{ {
choiceptr cut_pt; choiceptr cut_pt;
@ -6369,7 +6363,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
LogUpdClause *lcl = ipc->u.OtILl.d; LogUpdClause *lcl = ipc->u.OtILl.d;
/* make sure we don't erase the clause we are jumping to, notice that /* make sure we don't erase the clause we are jumping to, notice that
ErLogUpdIndex may remove several references in one go. ErLogUpdIndex may remove several references in one go.
Notice we only need to do this if we´ re jumping to the clause. Notice we only need to do this if we´ re jumping to the clause.
*/ */
if (newpc && !(lcl->ClFlags & (DirtyMask|InUseMask))) { if (newpc && !(lcl->ClFlags & (DirtyMask|InUseMask))) {
lcl->ClFlags |= InUseMask; lcl->ClFlags |= InUseMask;
@ -6383,14 +6377,12 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
} }
} }
#endif #endif
#ifdef CUT_C
{ {
while (POP_CHOICE_POINT(B->cp_b)) while (POP_CHOICE_POINT(B->cp_b))
{ {
POP_EXECUTE(); POP_EXECUTE();
} }
} }
#endif /* CUT_C */
#ifdef YAPOR #ifdef YAPOR
{ {
choiceptr cut_pt; choiceptr cut_pt;
@ -6657,14 +6649,12 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
return NULL; return NULL;
default: default:
if (b0) { if (b0) {
#ifdef CUT_C
{ {
while (POP_CHOICE_POINT(B->cp_b)) while (POP_CHOICE_POINT(B->cp_b))
{ {
POP_EXECUTE(); POP_EXECUTE();
} }
} }
#endif /* CUT_C */
#ifdef YAPOR #ifdef YAPOR
{ {
choiceptr cut_pt; choiceptr cut_pt;
@ -6687,14 +6677,12 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
} }
if (b0) { if (b0) {
/* I did a trust */ /* I did a trust */
#ifdef CUT_C
{ {
while (POP_CHOICE_POINT(B->cp_b)) while (POP_CHOICE_POINT(B->cp_b))
{ {
POP_EXECUTE(); POP_EXECUTE();
} }
} }
#endif /* CUT_C */
#ifdef YAPOR #ifdef YAPOR
{ {
choiceptr cut_pt; choiceptr cut_pt;

View File

@ -69,11 +69,7 @@ static void InTTYLine(char *);
static void SetOp(int, int, char *, Term); static void SetOp(int, int, char *, Term);
static void InitOps(void); static void InitOps(void);
static void InitDebug(void); static void InitDebug(void);
#ifdef CUT_C
static void CleanBack(PredEntry *, CPredicate, CPredicate, CPredicate); static void CleanBack(PredEntry *, CPredicate, CPredicate, CPredicate);
#else
static void CleanBack(PredEntry *, CPredicate, CPredicate);
#endif
static void InitStdPreds(void); static void InitStdPreds(void);
static void InitFlags(void); static void InitFlags(void);
static void InitCodes(void); static void InitCodes(void);
@ -682,11 +678,7 @@ Yap_InitAsmPred(char *Name, unsigned long int Arity, int code, CPredicate def,
static void static void
#ifdef CUT_C
CleanBack(PredEntry *pe, CPredicate Start, CPredicate Cont, CPredicate Cut) CleanBack(PredEntry *pe, CPredicate Start, CPredicate Cont, CPredicate Cut)
#else
CleanBack(PredEntry *pe, CPredicate Start, CPredicate Cont)
#endif
{ {
yamop *code; yamop *code;
if (pe->cs.p_code.FirstClause != pe->cs.p_code.LastClause || if (pe->cs.p_code.FirstClause != pe->cs.p_code.LastClause ||
@ -717,7 +709,6 @@ CleanBack(PredEntry *pe, CPredicate Start, CPredicate Cont)
PUT_YAMOP_SEQ(code); PUT_YAMOP_SEQ(code);
#endif /* YAPOR */ #endif /* YAPOR */
code->u.OtapFs.f = Cont; code->u.OtapFs.f = Cont;
#ifdef CUT_C
code = NEXTOP(code,OtapFs); code = NEXTOP(code,OtapFs);
if (pe->PredFlags & UserCPredFlag) if (pe->PredFlags & UserCPredFlag)
code->opc = Yap_opcode(_cut_c); code->opc = Yap_opcode(_cut_c);
@ -725,11 +716,8 @@ CleanBack(PredEntry *pe, CPredicate Start, CPredicate Cont)
code->opc = Yap_opcode(_cut_userc); code->opc = Yap_opcode(_cut_userc);
code->u.OtapFs.p = pe; code->u.OtapFs.p = pe;
code->u.OtapFs.f = Cut; code->u.OtapFs.f = Cut;
#endif
} }
#ifdef CUT_C
void void
Yap_InitCPredBack(char *Name, unsigned long int Arity, Yap_InitCPredBack(char *Name, unsigned long int Arity,
unsigned int Extra, CPredicate Start, unsigned int Extra, CPredicate Start,
@ -743,24 +731,11 @@ Yap_InitCPredBackCut(char *Name, unsigned long int Arity,
CPredicate Cont,CPredicate Cut, UInt flags){ CPredicate Cont,CPredicate Cut, UInt flags){
Yap_InitCPredBack_(Name,Arity,Extra,Start,Cont,Cut,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 void
#ifdef CUT_C
Yap_InitCPredBack_(char *Name, unsigned long int Arity, Yap_InitCPredBack_(char *Name, unsigned long int Arity,
unsigned int Extra, CPredicate Start, unsigned int Extra, CPredicate Start,
CPredicate Cont, CPredicate Cut, UInt flags) CPredicate Cont, CPredicate Cut, UInt flags)
#else
Yap_InitCPredBack(char *Name, unsigned long int Arity,
unsigned int Extra, CPredicate Start,
CPredicate Cont, UInt flags)
#endif
{ {
CACHE_REGS CACHE_REGS
PredEntry *pe = NULL; PredEntry *pe = NULL;
@ -796,11 +771,7 @@ Yap_InitCPredBack(char *Name, unsigned long int Arity,
if (pe->cs.p_code.FirstClause != NIL) if (pe->cs.p_code.FirstClause != NIL)
{ {
flags = update_flags_from_prolog(flags, pe); flags = update_flags_from_prolog(flags, pe);
#ifdef CUT_C
CleanBack(pe, Start, Cont, Cut); CleanBack(pe, Start, Cont, Cut);
#else
CleanBack(pe, Start, Cont);
#endif /*CUT_C*/
} }
else { else {
StaticClause *cl; StaticClause *cl;
@ -814,11 +785,7 @@ Yap_InitCPredBack(char *Name, unsigned long int Arity,
pe->PredFlags |= SequentialPredFlag; pe->PredFlags |= SequentialPredFlag;
#endif /* YAPOR */ #endif /* YAPOR */
#ifdef CUT_C
cl = (StaticClause *)Yap_AllocCodeSpace((CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(code,OtapFs),OtapFs),OtapFs),l)); cl = (StaticClause *)Yap_AllocCodeSpace((CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(code,OtapFs),OtapFs),OtapFs),l));
#else
cl = (StaticClause *)Yap_AllocCodeSpace((CELL)NEXTOP(NEXTOP(NEXTOP(code,OtapFs),OtapFs),l));
#endif
if (cl == NULL) { if (cl == NULL) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"No Heap Space in InitCPredBack"); Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"No Heap Space in InitCPredBack");
@ -826,15 +793,9 @@ Yap_InitCPredBack(char *Name, unsigned long int Arity,
} }
cl->ClFlags = StaticMask; cl->ClFlags = StaticMask;
cl->ClNext = NULL; cl->ClNext = NULL;
#ifdef CUT_C
Yap_ClauseSpace += (CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(code,OtapFs),OtapFs),OtapFs),l); Yap_ClauseSpace += (CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(code,OtapFs),OtapFs),OtapFs),l);
cl->ClSize = cl->ClSize =
(CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(code,OtapFs),OtapFs),OtapFs),e); (CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(code,OtapFs),OtapFs),OtapFs),e);
#else
Yap_ClauseSpace += (CELL)NEXTOP(NEXTOP(NEXTOP(code,OtapFs),OtapFs),l);
cl->ClSize =
(CELL)NEXTOP(NEXTOP(NEXTOP(code,OtapFs),OtapFs),e);
#endif
cl->usc.ClLine = Yap_source_line_no(); cl->usc.ClLine = Yap_source_line_no();
code = cl->ClCode; code = cl->ClCode;
@ -866,7 +827,6 @@ Yap_InitCPredBack(char *Name, unsigned long int Arity,
PUT_YAMOP_SEQ(code); PUT_YAMOP_SEQ(code);
#endif /* YAPOR */ #endif /* YAPOR */
code = NEXTOP(code,OtapFs); code = NEXTOP(code,OtapFs);
#ifdef CUT_C
if (flags & UserCPredFlag) if (flags & UserCPredFlag)
code->opc = Yap_opcode(_cut_userc); code->opc = Yap_opcode(_cut_userc);
else else
@ -876,7 +836,6 @@ Yap_InitCPredBack(char *Name, unsigned long int Arity,
code->u.OtapFs.s = Arity; code->u.OtapFs.s = Arity;
code->u.OtapFs.extra = Extra; code->u.OtapFs.extra = Extra;
code = NEXTOP(code,OtapFs); code = NEXTOP(code,OtapFs);
#endif /* CUT_C */
code->opc = Yap_opcode(_Ystop); code->opc = Yap_opcode(_Ystop);
code->u.l.l = cl->ClCode; code->u.l.l = cl->ClCode;
} }

View File

@ -19,9 +19,7 @@
#include "absmi.h" #include "absmi.h"
#ifdef CUT_C
#include "cut_c.h" #include "cut_c.h"
#endif
static Int p_atom( USES_REGS1 ); static Int p_atom( USES_REGS1 );
static Int p_atomic( USES_REGS1 ); static Int p_atomic( USES_REGS1 );
@ -797,14 +795,12 @@ p_cut_by( USES_REGS1 )
#else #else
pt0 = (choiceptr)(LCL0-IntOfTerm(d0)); pt0 = (choiceptr)(LCL0-IntOfTerm(d0));
#endif #endif
#ifdef CUT_C
{ {
while (POP_CHOICE_POINT(pt0)) while (POP_CHOICE_POINT(pt0))
{ {
POP_EXECUTE(); POP_EXECUTE();
} }
} }
#endif /* CUT_C */
#ifdef YAPOR #ifdef YAPOR
CUT_prune_to(pt0); CUT_prune_to(pt0);
#endif /* YAPOR */ #endif /* YAPOR */

View File

@ -16,12 +16,9 @@
/********* abstract machine registers **********************************/ /********* abstract machine registers **********************************/
#ifdef YAP_H #ifdef YAP_H
#ifdef CUT_C
#include "cut_c.h" #include "cut_c.h"
#endif #endif
#endif
#define MaxTemps 512 #define MaxTemps 512
#define MaxArithms 32 #define MaxArithms 32
@ -104,10 +101,8 @@ typedef struct regstore_t
#endif /* DEPTH_LIMIT */ #endif /* DEPTH_LIMIT */
yamop *CP_; /* 28 continuation program counter */ yamop *CP_; /* 28 continuation program counter */
CELL *ENV_; /* 1 current environment */ CELL *ENV_; /* 1 current environment */
#ifdef CUT_C
struct cut_c_str *CUT_C_TOP; struct cut_c_str *CUT_C_TOP;
#endif #if defined MYDDAS_ODBC || defined MYDDAS_MYSQL
#if defined CUT_C && (defined MYDDAS_ODBC || defined MYDDAS_MYSQL)
struct myddas_global *MYDDAS_GLOBAL_POINTER; struct myddas_global *MYDDAS_GLOBAL_POINTER;
#endif #endif
yamop *P_; /* 7 prolog machine program counter */ yamop *P_; /* 7 prolog machine program counter */

View File

@ -203,14 +203,10 @@
OPCODE(call_c_wfail ,slp), OPCODE(call_c_wfail ,slp),
OPCODE(try_c ,OtapFs), OPCODE(try_c ,OtapFs),
OPCODE(retry_c ,OtapFs), OPCODE(retry_c ,OtapFs),
#ifdef CUT_C
OPCODE(cut_c ,OtapFs), OPCODE(cut_c ,OtapFs),
#endif
OPCODE(try_userc ,OtapFs), OPCODE(try_userc ,OtapFs),
OPCODE(retry_userc ,OtapFs), OPCODE(retry_userc ,OtapFs),
#ifdef CUT_C
OPCODE(cut_userc ,OtapFs), OPCODE(cut_userc ,OtapFs),
#endif
OPCODE(lock_pred ,e), OPCODE(lock_pred ,e),
OPCODE(index_pred ,e), OPCODE(index_pred ,e),
#ifdef THREADS #ifdef THREADS

View File

@ -238,9 +238,7 @@ void Yap_InitAsmPred(char *, unsigned long int, int, CPredicate, UInt);
void Yap_InitCmpPred(char *, unsigned long int, CmpPredicate, UInt); void Yap_InitCmpPred(char *, unsigned long int, CmpPredicate, UInt);
void Yap_InitCPredBack(char *, unsigned long int, unsigned int, CPredicate,CPredicate,UInt); void Yap_InitCPredBack(char *, unsigned long int, unsigned int, CPredicate,CPredicate,UInt);
void Yap_InitCPredBackCut(char *, unsigned long int, unsigned int, CPredicate,CPredicate,CPredicate,UInt); void Yap_InitCPredBackCut(char *, unsigned long int, unsigned int, CPredicate,CPredicate,CPredicate,UInt);
#ifdef CUT_C
void Yap_InitCPredBack_(char *, unsigned long int, unsigned int, CPredicate,CPredicate,CPredicate,UInt); void Yap_InitCPredBack_(char *, unsigned long int, unsigned int, CPredicate,CPredicate,CPredicate,UInt);
#endif
void Yap_InitWorkspace(UInt,UInt,UInt,UInt,UInt,int,int,int); void Yap_InitWorkspace(UInt,UInt,UInt,UInt,UInt,int,int,int);
#ifdef YAPOR #ifdef YAPOR

View File

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

View File

@ -107,12 +107,8 @@ restore_opcodes(yamop *pc, yamop *max USES_REGS)
pc = pc->u.OtaLl.n; pc = pc->u.OtaLl.n;
break; break;
/* instructions type OtapFs */ /* instructions type OtapFs */
#ifdef CUT_C
case _cut_c: case _cut_c:
#endif
#ifdef CUT_C
case _cut_userc: case _cut_userc:
#endif
case _retry_c: case _retry_c:
case _retry_userc: case _retry_userc:
case _try_c: case _try_c:

View File

@ -117,12 +117,8 @@
pc = NEXTOP(pc,OtaLl); pc = NEXTOP(pc,OtaLl);
break; break;
/* instructions type OtapFs */ /* instructions type OtapFs */
#ifdef CUT_C
case _cut_c: case _cut_c:
#endif
#ifdef CUT_C
case _cut_userc: case _cut_userc:
#endif
case _retry_c: case _retry_c:
case _retry_userc: case _retry_userc:
case _try_c: case _try_c:

View File

@ -67,12 +67,8 @@
pc = pc->u.OtaLl.n; pc = pc->u.OtaLl.n;
break; break;
/* instructions type OtapFs */ /* instructions type OtapFs */
#ifdef CUT_C
case _cut_c: case _cut_c:
#endif
#ifdef CUT_C
case _cut_userc: case _cut_userc:
#endif
case _retry_c: case _retry_c:
case _retry_userc: case _retry_userc:
case _try_c: case _try_c:

8
configure vendored
View File

@ -7085,7 +7085,7 @@ else
YAPLIB_CFLAGS="$CFLAGS" YAPLIB_CFLAGS="$CFLAGS"
fi fi
YAP_EXTRAS="$YAP_EXTRAS -DCOROUTINING=1 -DCUT_C=1 -DRATIONAL_TREES=1" YAP_EXTRAS="$YAP_EXTRAS -DCOROUTINING=1 -DRATIONAL_TREES=1"
if test "$debugyap" = "yes" if test "$debugyap" = "yes"
then then
@ -7166,12 +7166,6 @@ else
esac esac
fi fi
if test "$cutc" = "yes"
then
YAP_EXTRAS="$YAP_EXTRAS -DCUT_C=1"
fi
if test "$tabling" = "yes" if test "$tabling" = "yes"
then then
YAP_EXTRAS="$YAP_EXTRAS -DTABLING=1" YAP_EXTRAS="$YAP_EXTRAS -DTABLING=1"

View File

@ -1045,7 +1045,7 @@ else
YAPLIB_CFLAGS="$CFLAGS" YAPLIB_CFLAGS="$CFLAGS"
fi fi
YAP_EXTRAS="$YAP_EXTRAS -DCOROUTINING=1 -DCUT_C=1 -DRATIONAL_TREES=1" YAP_EXTRAS="$YAP_EXTRAS -DCOROUTINING=1 -DRATIONAL_TREES=1"
if test "$debugyap" = "yes" if test "$debugyap" = "yes"
then then
@ -1119,12 +1119,6 @@ else
;; ;;
esac esac
fi fi
if test "$cutc" = "yes"
then
YAP_EXTRAS="$YAP_EXTRAS -DCUT_C=1"
fi
if test "$tabling" = "yes" if test "$tabling" = "yes"
then then

View File

@ -19,9 +19,7 @@
#include "config.h" #include "config.h"
#include "YapInterface.h" #include "YapInterface.h"
#ifdef CUT_C
#include "cut_c.h" #include "cut_c.h"
#endif
#ifdef _MSC_VER /* Microsoft's Visual C++ Compiler */ #ifdef _MSC_VER /* Microsoft's Visual C++ Compiler */
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H

View File

@ -166,8 +166,8 @@ end_special(_, _).
special_op("clause_with_cut","TABLING_INNER_CUTS"). special_op("clause_with_cut","TABLING_INNER_CUTS").
special_op("table_answer_resolution_completion","THREADS_CONSUMER_SHARING"). special_op("table_answer_resolution_completion","THREADS_CONSUMER_SHARING").
special_op("cut_c","CUT_C"). /*special_op("cut_c","CUT_C").*/
special_op("cut_userc","CUT_C"). /*special_op("cut_userc","CUT_C").*/
special_op("run_eam","BEAM"). special_op("run_eam","BEAM").
special_op("retry_eam","BEAM"). special_op("retry_eam","BEAM").
special_op("thread_local","THREADS"). special_op("thread_local","THREADS").

View File

@ -15,7 +15,7 @@
* * * *
*************************************************************************/ *************************************************************************/
#if defined MYDDAS_ODBC && defined CUT_C #if defined MYDDAS_ODBC
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -765,7 +765,7 @@ c_db_odbc_get_fields_properties( USES_REGS1 ) {
list = fields_properties_list; list = fields_properties_list;
SQLSMALLINT bind_prim_key; SQLSMALLINT bind_prim_key;
//por causa de as rows em odbc começam em 1 :) //por causa de as rows em odbc come<EFBFBD>am em 1 :)
Short *null=(Short *)malloc(sizeof(Short)*(1+num_fields)); Short *null=(Short *)malloc(sizeof(Short)*(1+num_fields));
if (!SQLALLOCHANDLE(SQL_HANDLE_STMT, hdbc, &hstmt2, "db_get_fields_properties")) if (!SQLALLOCHANDLE(SQL_HANDLE_STMT, hdbc, &hstmt2, "db_get_fields_properties"))

View File

@ -268,7 +268,7 @@ c_db_preds_conn_start ( USES_REGS1 ){
MYDDAS_UTIL_CONNECTION node = MYDDAS_UTIL_CONNECTION node =
myddas_util_search_connection(conn); myddas_util_search_connection(conn);
/* Caso a ligacao já tenha sido apagada*/ /* Caso a ligacao já tenha sido apagada*/
if (node == NULL) if (node == NULL)
{ {
cut_fail(); cut_fail();
@ -699,22 +699,22 @@ void
init_myddas(void) init_myddas(void)
{ {
CACHE_REGS CACHE_REGS
#if defined MYDDAS_MYSQL && defined CUT_C #if defined MYDDAS_MYSQL
Yap_InitBackMYDDAS_MySQLPreds(); Yap_InitBackMYDDAS_MySQLPreds();
#endif #endif
#if defined MYDDAS_ODBC && defined CUT_C #if defined MYDDAS_ODBC
Yap_InitBackMYDDAS_ODBCPreds(); Yap_InitBackMYDDAS_ODBCPreds();
#endif #endif
#if defined CUT_C && (defined MYDDAS_ODBC || defined MYDDAS_MYSQL) #if defined MYDDAS_ODBC || defined MYDDAS_MYSQL
Yap_InitBackMYDDAS_SharedPreds(); Yap_InitBackMYDDAS_SharedPreds();
#endif #endif
#if defined CUT_C && defined MYDDAS_MYSQL #if defined MYDDAS_MYSQL
Yap_InitMYDDAS_MySQLPreds(); Yap_InitMYDDAS_MySQLPreds();
#endif #endif
#if defined CUT_C && defined MYDDAS_ODBC #if defined MYDDAS_ODBC
Yap_InitMYDDAS_ODBCPreds(); Yap_InitMYDDAS_ODBCPreds();
#endif #endif
#if defined CUT_C && (defined MYDDAS_ODBC || defined MYDDAS_MYSQL) #if defined MYDDAS_ODBC || defined MYDDAS_MYSQL
Yap_InitMYDDAS_SharedPreds(); Yap_InitMYDDAS_SharedPreds();
#endif #endif
#if defined MYDDAS_TOP_LEVEL && defined MYDDAS_MYSQL // && defined HAVE_LIBREADLINE #if defined MYDDAS_TOP_LEVEL && defined MYDDAS_MYSQL // && defined HAVE_LIBREADLINE
@ -767,4 +767,4 @@ int WINAPI win_myddas(HANDLE hinst, DWORD reason, LPVOID reserved)
#endif /*CUT_C && (MYDDAS_MYSQL || MYDDAS_ODBC)*/ #endif /*MYDDAS_MYSQL || MYDDAS_ODBC*/