Merge branch 'master' of ssh://yap.git.sourceforge.net/gitroot/yap/yap-6.3
This commit is contained in:
commit
bb9552f6f6
@ -1322,7 +1322,7 @@ Yap_ArrayToList(register Term *tp, int nof)
|
|||||||
t = MkAtomTerm(AtomNil);
|
t = MkAtomTerm(AtomNil);
|
||||||
while (pt > tp) {
|
while (pt > tp) {
|
||||||
Term tm = *--pt;
|
Term tm = *--pt;
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
if (tm == 0)
|
if (tm == 0)
|
||||||
t = MkPairTerm((CELL)pt, t);
|
t = MkPairTerm((CELL)pt, t);
|
||||||
else
|
else
|
||||||
|
8
C/agc.c
8
C/agc.c
@ -384,7 +384,7 @@ clean_atom_list(AtomHashEntry *HashPtr)
|
|||||||
AtomEntry *at = RepAtom(atm);
|
AtomEntry *at = RepAtom(atm);
|
||||||
if (AtomResetMark(at) ||
|
if (AtomResetMark(at) ||
|
||||||
at->PropsOfAE != NIL ||
|
at->PropsOfAE != NIL ||
|
||||||
(AGCHook != NULL && !AGCHook(atm))) {
|
(Yap_AGCHook != NULL && !Yap_AGCHook(atm))) {
|
||||||
patm = &(at->NextOfAE);
|
patm = &(at->NextOfAE);
|
||||||
atm = at->NextOfAE;
|
atm = at->NextOfAE;
|
||||||
} else {
|
} else {
|
||||||
@ -463,7 +463,7 @@ atom_gc(USES_REGS1)
|
|||||||
mark_stacks(PASS_REGS1);
|
mark_stacks(PASS_REGS1);
|
||||||
restore_codes();
|
restore_codes();
|
||||||
clean_atoms();
|
clean_atoms();
|
||||||
AGcLastCall = NOfAtoms;
|
Yap_AGcLastCall = NOfAtoms;
|
||||||
YAPLeaveCriticalSection();
|
YAPLeaveCriticalSection();
|
||||||
agc_time = Yap_cputime()-time_start;
|
agc_time = Yap_cputime()-time_start;
|
||||||
tot_agc_time += agc_time;
|
tot_agc_time += agc_time;
|
||||||
@ -511,7 +511,7 @@ p_agc_threshold(USES_REGS1)
|
|||||||
{
|
{
|
||||||
Term t = Deref(ARG1);
|
Term t = Deref(ARG1);
|
||||||
if (IsVarTerm(t)) {
|
if (IsVarTerm(t)) {
|
||||||
return Yap_unify(ARG1, MkIntegerTerm(AGcThreshold));
|
return Yap_unify(ARG1, MkIntegerTerm(Yap_AGcThreshold));
|
||||||
} else if (!IsIntegerTerm(t)) {
|
} else if (!IsIntegerTerm(t)) {
|
||||||
Yap_Error(TYPE_ERROR_INTEGER,t,"prolog_flag/2 agc_margin");
|
Yap_Error(TYPE_ERROR_INTEGER,t,"prolog_flag/2 agc_margin");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -521,7 +521,7 @@ p_agc_threshold(USES_REGS1)
|
|||||||
Yap_Error(DOMAIN_ERROR_NOT_LESS_THAN_ZERO,t,"prolog_flag/2 agc_margin");
|
Yap_Error(DOMAIN_ERROR_NOT_LESS_THAN_ZERO,t,"prolog_flag/2 agc_margin");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
AGcThreshold = i;
|
Yap_AGcThreshold = i;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -704,8 +704,8 @@ AllocHeap(unsigned long int size)
|
|||||||
UNLOCK(HeapTopLock);
|
UNLOCK(HeapTopLock);
|
||||||
Yap_signal(YAP_CDOVF_SIGNAL);
|
Yap_signal(YAP_CDOVF_SIGNAL);
|
||||||
} else {
|
} else {
|
||||||
if (size > SizeOfOverflow)
|
if (size > Yap_SizeOfOverflow)
|
||||||
SizeOfOverflow = size*sizeof(CELL) + sizeof(YAP_SEG_SIZE);
|
Yap_SizeOfOverflow = size*sizeof(CELL) + sizeof(YAP_SEG_SIZE);
|
||||||
/* big allocations, the caller must handle the problem */
|
/* big allocations, the caller must handle the problem */
|
||||||
UNLOCK(HeapUsedLock);
|
UNLOCK(HeapUsedLock);
|
||||||
UNLOCK(HeapTopLock);
|
UNLOCK(HeapTopLock);
|
||||||
|
10
C/arith0.c
10
C/arith0.c
@ -114,25 +114,25 @@ eval0(Int fi) {
|
|||||||
case op_heapused:
|
case op_heapused:
|
||||||
RINT(HeapUsed);
|
RINT(HeapUsed);
|
||||||
case op_localsp:
|
case op_localsp:
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
RINT((Int)ASP);
|
RINT((Int)ASP);
|
||||||
#else
|
#else
|
||||||
RINT(LCL0 - ASP);
|
RINT(LCL0 - ASP);
|
||||||
#endif
|
#endif
|
||||||
case op_b:
|
case op_b:
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
RINT((Int)B);
|
RINT((Int)B);
|
||||||
#else
|
#else
|
||||||
RINT(LCL0 - (CELL *)B);
|
RINT(LCL0 - (CELL *)B);
|
||||||
#endif
|
#endif
|
||||||
case op_env:
|
case op_env:
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
RINT((Int)YENV);
|
RINT((Int)YENV);
|
||||||
#else
|
#else
|
||||||
RINT(LCL0 - YENV);
|
RINT(LCL0 - YENV);
|
||||||
#endif
|
#endif
|
||||||
case op_tr:
|
case op_tr:
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
RINT(TR);
|
RINT(TR);
|
||||||
#else
|
#else
|
||||||
RINT(((CELL *)TR)-LCL0);
|
RINT(((CELL *)TR)-LCL0);
|
||||||
@ -140,7 +140,7 @@ eval0(Int fi) {
|
|||||||
case op_stackfree:
|
case op_stackfree:
|
||||||
RINT(Unsigned(ASP) - Unsigned(H));
|
RINT(Unsigned(ASP) - Unsigned(H));
|
||||||
case op_globalsp:
|
case op_globalsp:
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
RINT((Int)H);
|
RINT((Int)H);
|
||||||
#else
|
#else
|
||||||
RINT(H - H0);
|
RINT(H - H0);
|
||||||
|
@ -2828,7 +2828,7 @@ YAP_Init(YAP_init_args *yap_init)
|
|||||||
#if defined(YAPOR) || defined(TABLING)
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
/* make sure we initialise this field */
|
/* make sure we initialise this field */
|
||||||
GLOBAL_root_dep_fr = NULL;
|
Yap_root_dep_fr = NULL;
|
||||||
#endif
|
#endif
|
||||||
make_root_frames();
|
make_root_frames();
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
@ -2837,13 +2837,13 @@ YAP_Init(YAP_init_args *yap_init)
|
|||||||
Yap_init_local();
|
Yap_init_local();
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
if (worker_id != 0) {
|
if (worker_id != 0) {
|
||||||
#if SBA||ENV_COPY
|
#if YAPOR_SBA||YAPOR_COPY
|
||||||
/*
|
/*
|
||||||
In the SBA we cannot just happily inherit registers
|
In the SBA we cannot just happily inherit registers
|
||||||
from the other workers
|
from the other workers
|
||||||
*/
|
*/
|
||||||
Yap_InitYaamRegs();
|
Yap_InitYaamRegs();
|
||||||
#endif /* SBA */
|
#endif /* YAPOR_SBA */
|
||||||
#ifndef THREADS
|
#ifndef THREADS
|
||||||
Yap_InitPreAllocCodeSpace();
|
Yap_InitPreAllocCodeSpace();
|
||||||
#endif
|
#endif
|
||||||
@ -3300,8 +3300,8 @@ YAP_AtomReleaseHold(Atom at)
|
|||||||
X_API Agc_hook
|
X_API Agc_hook
|
||||||
YAP_AGCRegisterHook(Agc_hook hook)
|
YAP_AGCRegisterHook(Agc_hook hook)
|
||||||
{
|
{
|
||||||
Agc_hook old = AGCHook;
|
Agc_hook old = Yap_AGCHook;
|
||||||
AGCHook = hook;
|
Yap_AGCHook = hook;
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3537,9 +3537,9 @@ YAP_SetYAPFlag(yap_flag_t flag, int val)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
case YAPC_ENABLE_AGC:
|
case YAPC_ENABLE_AGC:
|
||||||
if (val) {
|
if (val) {
|
||||||
AGcThreshold = 10000;
|
Yap_AGcThreshold = 10000;
|
||||||
} else {
|
} else {
|
||||||
AGcThreshold = 0;
|
Yap_AGcThreshold = 0;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
default:
|
default:
|
||||||
|
@ -2564,7 +2564,7 @@ init_consult(int mode, char *file)
|
|||||||
ConsultSp--;
|
ConsultSp--;
|
||||||
ConsultSp->c = (ConsultBase-ConsultSp);
|
ConsultSp->c = (ConsultBase-ConsultSp);
|
||||||
ConsultBase = ConsultSp;
|
ConsultBase = ConsultSp;
|
||||||
#if !defined(YAPOR) && !defined(SBA)
|
#if !defined(YAPOR) && !defined(YAPOR_SBA)
|
||||||
/* if (consult_level == 0)
|
/* if (consult_level == 0)
|
||||||
do_toggle_static_predicates_in_use(TRUE); */
|
do_toggle_static_predicates_in_use(TRUE); */
|
||||||
#endif
|
#endif
|
||||||
@ -2608,7 +2608,7 @@ end_consult( USES_REGS1 )
|
|||||||
ConsultSp += 3;
|
ConsultSp += 3;
|
||||||
consult_level--;
|
consult_level--;
|
||||||
LastAssertedPred = NULL;
|
LastAssertedPred = NULL;
|
||||||
#if !defined(YAPOR) && !defined(SBA)
|
#if !defined(YAPOR) && !defined(YAPOR_SBA)
|
||||||
/* if (consult_level == 0)
|
/* if (consult_level == 0)
|
||||||
do_toggle_static_predicates_in_use(FALSE);*/
|
do_toggle_static_predicates_in_use(FALSE);*/
|
||||||
#endif
|
#endif
|
||||||
|
@ -328,7 +328,7 @@ check_var(Term t, unsigned int level, Int argno, compiler_struct *cglobs) {
|
|||||||
|
|
||||||
if (IsNewVar(v)) { /* new var */
|
if (IsNewVar(v)) { /* new var */
|
||||||
v = (Ventry *) Yap_AllocCMem(sizeof(*v), &cglobs->cint);
|
v = (Ventry *) Yap_AllocCMem(sizeof(*v), &cglobs->cint);
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
v->SelfOfVE = 0;
|
v->SelfOfVE = 0;
|
||||||
#else
|
#else
|
||||||
v->SelfOfVE = (CELL) v;
|
v->SelfOfVE = (CELL) v;
|
||||||
|
@ -858,7 +858,7 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end,
|
|||||||
deref_var:
|
deref_var:
|
||||||
if (!DB_MARKED(d0)) {
|
if (!DB_MARKED(d0)) {
|
||||||
if (
|
if (
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
d0 != 0
|
d0 != 0
|
||||||
#else
|
#else
|
||||||
d0 != (CELL)ptd0
|
d0 != (CELL)ptd0
|
||||||
@ -884,7 +884,7 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end,
|
|||||||
CheckDBOverflow(1);
|
CheckDBOverflow(1);
|
||||||
/* variables need to be offset at read time */
|
/* variables need to be offset at read time */
|
||||||
*ptd0 = (CELL)StoPoint;
|
*ptd0 = (CELL)StoPoint;
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
/* the copy we keep will be an empty variable */
|
/* the copy we keep will be an empty variable */
|
||||||
*StoPoint++ = 0;
|
*StoPoint++ = 0;
|
||||||
#else
|
#else
|
||||||
|
@ -212,8 +212,8 @@ yapsbrk(long size)
|
|||||||
UNLOCK(HeapTopLock);
|
UNLOCK(HeapTopLock);
|
||||||
Yap_signal(YAP_CDOVF_SIGNAL);
|
Yap_signal(YAP_CDOVF_SIGNAL);
|
||||||
} else {
|
} else {
|
||||||
if (size > SizeOfOverflow)
|
if (size > Yap_SizeOfOverflow)
|
||||||
SizeOfOverflow = size;
|
Yap_SizeOfOverflow = size;
|
||||||
/* big allocations, the caller must handle the problem */
|
/* big allocations, the caller must handle the problem */
|
||||||
UNLOCK(HeapUsedLock);
|
UNLOCK(HeapUsedLock);
|
||||||
UNLOCK(HeapTopLock);
|
UNLOCK(HeapTopLock);
|
||||||
|
18
C/exec.c
18
C/exec.c
@ -215,7 +215,7 @@ do_execute(Term t, Term mod USES_REGS)
|
|||||||
might skip a svar */
|
might skip a svar */
|
||||||
pt = RepAppl(t)+1;
|
pt = RepAppl(t)+1;
|
||||||
for (i = 1; i <= arity; i++) {
|
for (i = 1; i <= arity; i++) {
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
Term d0 = *pt++;
|
Term d0 = *pt++;
|
||||||
if (d0 == 0)
|
if (d0 == 0)
|
||||||
` XREGS[i] = (CELL)(pt-1);
|
` XREGS[i] = (CELL)(pt-1);
|
||||||
@ -358,7 +358,7 @@ do_execute_n(Term t, Term mod, unsigned int n USES_REGS)
|
|||||||
otherwise I would dereference the argument and
|
otherwise I would dereference the argument and
|
||||||
might skip a svar */
|
might skip a svar */
|
||||||
for (i = 1; i <= arity-n; i++) {
|
for (i = 1; i <= arity-n; i++) {
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
Term d0 = *pt++;
|
Term d0 = *pt++;
|
||||||
if (d0 == 0)
|
if (d0 == 0)
|
||||||
XREGS[i] = (CELL)(pt-1);
|
XREGS[i] = (CELL)(pt-1);
|
||||||
@ -610,7 +610,7 @@ p_execute_clause( USES_REGS1 )
|
|||||||
might skip a svar */
|
might skip a svar */
|
||||||
pt = RepAppl(t)+1;
|
pt = RepAppl(t)+1;
|
||||||
for (i = 1; i <= arity; ++i) {
|
for (i = 1; i <= arity; ++i) {
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
Term d0 = *pt++;
|
Term d0 = *pt++;
|
||||||
if (d0 == 0)
|
if (d0 == 0)
|
||||||
XREGS[i] = (CELL)(pt-1);
|
XREGS[i] = (CELL)(pt-1);
|
||||||
@ -693,7 +693,7 @@ p_execute0( USES_REGS1 )
|
|||||||
might skip a svar */
|
might skip a svar */
|
||||||
pt = RepAppl(t)+1;
|
pt = RepAppl(t)+1;
|
||||||
for (i = 1; i <= arity; ++i) {
|
for (i = 1; i <= arity; ++i) {
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
Term d0 = *pt++;
|
Term d0 = *pt++;
|
||||||
if (d0 == 0)
|
if (d0 == 0)
|
||||||
XREGS[i] = (CELL)(pt-1);
|
XREGS[i] = (CELL)(pt-1);
|
||||||
@ -764,7 +764,7 @@ p_execute_nonstop( USES_REGS1 )
|
|||||||
might skip a svar */
|
might skip a svar */
|
||||||
pt = RepAppl(t)+1;
|
pt = RepAppl(t)+1;
|
||||||
for (i = 1; i <= arity; ++i) {
|
for (i = 1; i <= arity; ++i) {
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
Term d0 = *pt++;
|
Term d0 = *pt++;
|
||||||
if (d0 == 0)
|
if (d0 == 0)
|
||||||
XREGS[i] = (CELL)(pt-1);
|
XREGS[i] = (CELL)(pt-1);
|
||||||
@ -1341,7 +1341,7 @@ p_restore_regs2( USES_REGS1 )
|
|||||||
if (!IsIntegerTerm(d0)) {
|
if (!IsIntegerTerm(d0)) {
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
pt0 = (choiceptr)IntegerOfTerm(d0);
|
pt0 = (choiceptr)IntegerOfTerm(d0);
|
||||||
#else
|
#else
|
||||||
pt0 = (choiceptr)(LCL0-IntOfTerm(d0));
|
pt0 = (choiceptr)(LCL0-IntOfTerm(d0));
|
||||||
@ -1386,7 +1386,7 @@ p_clean_ifcp( USES_REGS1 ) {
|
|||||||
Yap_Error(TYPE_ERROR_INTEGER, t, "cut_at/1");
|
Yap_Error(TYPE_ERROR_INTEGER, t, "cut_at/1");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
pt0 = (choiceptr)IntegerOfTerm(t);
|
pt0 = (choiceptr)IntegerOfTerm(t);
|
||||||
#else
|
#else
|
||||||
pt0 = cp_from_integer(t PASS_REGS);
|
pt0 = cp_from_integer(t PASS_REGS);
|
||||||
@ -1633,9 +1633,9 @@ Yap_InitYaamRegs(void)
|
|||||||
STATIC_PREDICATES_MARKED = FALSE;
|
STATIC_PREDICATES_MARKED = FALSE;
|
||||||
#ifdef FROZEN_STACKS
|
#ifdef FROZEN_STACKS
|
||||||
H_FZ = H;
|
H_FZ = H;
|
||||||
#ifdef SBA
|
#ifdef YAPOR_SBA
|
||||||
BSEG =
|
BSEG =
|
||||||
#endif /* SBA */
|
#endif /* YAPOR_SBA */
|
||||||
BBREG = B_FZ = (choiceptr) Yap_LocalBase;
|
BBREG = B_FZ = (choiceptr) Yap_LocalBase;
|
||||||
TR = TR_FZ = (tr_fr_ptr) Yap_TrailBase;
|
TR = TR_FZ = (tr_fr_ptr) Yap_TrailBase;
|
||||||
#endif /* FROZEN_STACKS */
|
#endif /* FROZEN_STACKS */
|
||||||
|
10
C/grow.c
10
C/grow.c
@ -1256,10 +1256,10 @@ do_growheap(int fix_code, UInt in_size, struct intermediates *cip, tr_fr_ptr *ol
|
|||||||
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"cannot grow Heap: more than a worker/thread running");
|
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"cannot grow Heap: more than a worker/thread running");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#endif
|
#endif
|
||||||
if (SizeOfOverflow > sz) {
|
if (Yap_SizeOfOverflow > sz) {
|
||||||
if (size < YAP_ALLOC_SIZE)
|
if (size < YAP_ALLOC_SIZE)
|
||||||
size = YAP_ALLOC_SIZE;
|
size = YAP_ALLOC_SIZE;
|
||||||
sz = AdjustPageSize(SizeOfOverflow);
|
sz = AdjustPageSize(Yap_SizeOfOverflow);
|
||||||
}
|
}
|
||||||
while(sz >= sizeof(CELL) * K16 && !static_growheap(sz, fix_code, cip, old_trp, tksp, vep PASS_REGS)) {
|
while(sz >= sizeof(CELL) * K16 && !static_growheap(sz, fix_code, cip, old_trp, tksp, vep PASS_REGS)) {
|
||||||
size = size/2;
|
size = size/2;
|
||||||
@ -1401,7 +1401,7 @@ Yap_growheap(int fix_code, UInt in_size, void *cip)
|
|||||||
|
|
||||||
if (NOfAtoms > 2*AtomHashTableSize) {
|
if (NOfAtoms > 2*AtomHashTableSize) {
|
||||||
UInt n = NOfAtoms;
|
UInt n = NOfAtoms;
|
||||||
if (AGcThreshold)
|
if (Yap_AGcThreshold)
|
||||||
Yap_atom_gc( PASS_REGS1 );
|
Yap_atom_gc( PASS_REGS1 );
|
||||||
/* check if we have a significant improvement from agc */
|
/* check if we have a significant improvement from agc */
|
||||||
if (n > NOfAtoms+ NOfAtoms/10 ||
|
if (n > NOfAtoms+ NOfAtoms/10 ||
|
||||||
@ -1442,12 +1442,12 @@ Yap_growglobal(CELL **ptr)
|
|||||||
unsigned long sz = sizeof(CELL) * K16;
|
unsigned long sz = sizeof(CELL) * K16;
|
||||||
|
|
||||||
#if defined(YAPOR) && !defined(THREADS)
|
#if defined(YAPOR) && !defined(THREADS)
|
||||||
if (number_workers != 1) {
|
if (Yap_number_workers != 1) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR,TermNil,"cannot grow Global: more than a worker/thread running");
|
Yap_Error(OUT_OF_STACK_ERROR,TermNil,"cannot grow Global: more than a worker/thread running");
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
#elif defined(THREADS)
|
#elif defined(THREADS)
|
||||||
if (NOfThreads != 1) {
|
if (Yap_NOfThreads != 1) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR,TermNil,"cannot grow Global: more than a worker/thread running");
|
Yap_Error(OUT_OF_STACK_ERROR,TermNil,"cannot grow Global: more than a worker/thread running");
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
@ -929,7 +929,7 @@ init_dbtable(tr_fr_ptr trail_ptr USES_REGS) {
|
|||||||
#ifdef FROZEN_STACKS /* TRAIL */
|
#ifdef FROZEN_STACKS /* TRAIL */
|
||||||
/* avoid frozen segments */
|
/* avoid frozen segments */
|
||||||
if (
|
if (
|
||||||
#ifdef SBA
|
#ifdef YAPOR_SBA
|
||||||
(ADDR) pt0 >= HeapTop
|
(ADDR) pt0 >= HeapTop
|
||||||
#else
|
#else
|
||||||
(ADDR) pt0 >= Yap_TrailBase && (ADDR) pt0 < Yap_TrailTop
|
(ADDR) pt0 >= Yap_TrailBase && (ADDR) pt0 < Yap_TrailTop
|
||||||
@ -2499,7 +2499,7 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR USES_REGS)
|
|||||||
#ifdef FROZEN_STACKS /* TRAIL */
|
#ifdef FROZEN_STACKS /* TRAIL */
|
||||||
/* process all segments */
|
/* process all segments */
|
||||||
if (
|
if (
|
||||||
#ifdef SBA
|
#ifdef YAPOR_SBA
|
||||||
(ADDR) pt0 >= Yap_GlobalBase
|
(ADDR) pt0 >= Yap_GlobalBase
|
||||||
#else
|
#else
|
||||||
(ADDR) pt0 >= Yap_TrailBase
|
(ADDR) pt0 >= Yap_TrailBase
|
||||||
|
@ -839,6 +839,7 @@ sort_group(GroupDef *grp, CELL *top, struct intermediates *cint)
|
|||||||
base = top;
|
base = top;
|
||||||
while (top+2*max > (CELL *)Yap_TrailTop) {
|
while (top+2*max > (CELL *)Yap_TrailTop) {
|
||||||
if (!Yap_growtrail(2*max*CellSize, TRUE)) {
|
if (!Yap_growtrail(2*max*CellSize, TRUE)) {
|
||||||
|
Yap_Error_Size = 2*max*CellSize;
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(cint->CompilerBotch,4);
|
siglongjmp(cint->CompilerBotch,4);
|
||||||
return;
|
return;
|
||||||
@ -2066,6 +2067,7 @@ groups_in(ClauseDef *min, ClauseDef *max, GroupDef *grp, struct intermediates *c
|
|||||||
siglongjmp(cint->CompilerBotch,4);
|
siglongjmp(cint->CompilerBotch,4);
|
||||||
#else
|
#else
|
||||||
if (!Yap_growtrail(sz, TRUE)) {
|
if (!Yap_growtrail(sz, TRUE)) {
|
||||||
|
Yap_Error_Size = sz;
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(cint->CompilerBotch,4);
|
siglongjmp(cint->CompilerBotch,4);
|
||||||
return 0;
|
return 0;
|
||||||
@ -2194,6 +2196,7 @@ emit_switch_space(UInt n, UInt item_size, struct intermediates *cint, CELL func_
|
|||||||
UInt sz = sizeof(LogUpdIndex)+n*item_size;
|
UInt sz = sizeof(LogUpdIndex)+n*item_size;
|
||||||
LogUpdIndex *cl = (LogUpdIndex *)Yap_AllocCodeSpace(sz);
|
LogUpdIndex *cl = (LogUpdIndex *)Yap_AllocCodeSpace(sz);
|
||||||
if (cl == NULL) {
|
if (cl == NULL) {
|
||||||
|
Yap_Error_Size = sz;
|
||||||
/* grow stack */
|
/* grow stack */
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(cint->CompilerBotch,2);
|
siglongjmp(cint->CompilerBotch,2);
|
||||||
@ -2214,6 +2217,7 @@ emit_switch_space(UInt n, UInt item_size, struct intermediates *cint, CELL func_
|
|||||||
UInt sz = sizeof(StaticIndex)+n*item_size;
|
UInt sz = sizeof(StaticIndex)+n*item_size;
|
||||||
StaticIndex *cl = (StaticIndex *)Yap_AllocCodeSpace(sz);
|
StaticIndex *cl = (StaticIndex *)Yap_AllocCodeSpace(sz);
|
||||||
if (cl == NULL) {
|
if (cl == NULL) {
|
||||||
|
Yap_Error_Size = sz;
|
||||||
/* grow stack */
|
/* grow stack */
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(cint->CompilerBotch,2);
|
siglongjmp(cint->CompilerBotch,2);
|
||||||
|
37
C/init.c
37
C/init.c
@ -1218,9 +1218,9 @@ InitFirstWorkerThreadHandle(void)
|
|||||||
static void
|
static void
|
||||||
InitScratchPad(int wid)
|
InitScratchPad(int wid)
|
||||||
{
|
{
|
||||||
FOREIGN_WL(wid)->scratchpad.ptr = NULL;
|
FOREIGN(wid)->scratchpad.ptr = NULL;
|
||||||
FOREIGN_WL(wid)->scratchpad.sz = SCRATCH_START_SIZE;
|
FOREIGN(wid)->scratchpad.sz = SCRATCH_START_SIZE;
|
||||||
FOREIGN_WL(wid)->scratchpad.msz = SCRATCH_START_SIZE;
|
FOREIGN(wid)->scratchpad.msz = SCRATCH_START_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1235,22 +1235,17 @@ Yap_CloseScratchPad(void)
|
|||||||
#include "iglobals.h"
|
#include "iglobals.h"
|
||||||
#include "ilocals.h"
|
#include "ilocals.h"
|
||||||
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
|
||||||
#define MAX_INITS MAX_AGENTS
|
|
||||||
#else
|
|
||||||
#define MAX_INITS 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(YAPOR) && !defined(THREADS)
|
#if defined(YAPOR) && !defined(THREADS)
|
||||||
struct worker_shared *Yap_global;
|
struct global_data *Yap_global;
|
||||||
#else
|
#else
|
||||||
struct worker_shared Yap_Global;
|
struct global_data Yap_Global;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(YAPOR) && !defined(THREADS)
|
#if defined(THREADS)
|
||||||
|
struct worker_local *Yap_WLocal[MAX_THREADS];
|
||||||
|
#elif defined(YAPOR)
|
||||||
struct worker_local *Yap_WLocal;
|
struct worker_local *Yap_WLocal;
|
||||||
#elif defined(YAPOR) || defined(THREADS)
|
|
||||||
struct worker_local *Yap_WLocal[MAX_AGENTS];
|
|
||||||
#else
|
#else
|
||||||
struct worker_local Yap_WLocal;
|
struct worker_local Yap_WLocal;
|
||||||
#endif
|
#endif
|
||||||
@ -1261,7 +1256,7 @@ InitCodes(void)
|
|||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
#if THREADS
|
#if THREADS
|
||||||
int wid;
|
int wid;
|
||||||
for (wid = 1; wid < MAX_INITS; wid++) {
|
for (wid = 1; wid < MAX_THREADS; wid++) {
|
||||||
Yap_WLocal[wid] = NULL;
|
Yap_WLocal[wid] = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1349,19 +1344,19 @@ Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt Atts, UInt max_table_s
|
|||||||
worker_id = 0;
|
worker_id = 0;
|
||||||
if (n_workers > MAX_WORKERS)
|
if (n_workers > MAX_WORKERS)
|
||||||
Yap_Error(INTERNAL_ERROR, TermNil, "excessive number of workers (Yap_InitWorkspace)");
|
Yap_Error(INTERNAL_ERROR, TermNil, "excessive number of workers (Yap_InitWorkspace)");
|
||||||
#ifdef ENV_COPY
|
#ifdef YAPOR_COPY
|
||||||
INFORMATION_MESSAGE("YapOr: copy model with %d worker%s", n_workers, n_workers == 1 ? "":"s");
|
INFORMATION_MESSAGE("YapOr: copy model with %d worker%s", n_workers, n_workers == 1 ? "":"s");
|
||||||
#elif ACOW
|
#elif YAPOR_COW
|
||||||
INFORMATION_MESSAGE("YapOr: acow model with %d worker%s", n_workers, n_workers == 1 ? "":"s");
|
INFORMATION_MESSAGE("YapOr: acow model with %d worker%s", n_workers, n_workers == 1 ? "":"s");
|
||||||
#else /* SBA */
|
#else /* YAPOR_SBA */
|
||||||
INFORMATION_MESSAGE("YapOr: sba model with %d worker%s", n_workers, n_workers == 1 ? "":"s");
|
INFORMATION_MESSAGE("YapOr: sba model with %d worker%s", n_workers, n_workers == 1 ? "":"s");
|
||||||
#endif /* ENV_COPY - ACOW - SBA */
|
#endif /* YAPOR_COPY - YAPOR_COW - YAPOR_SBA */
|
||||||
map_memory(Heap, Stack+Atts, Trail, n_workers);
|
map_memory(Heap, Stack+Atts, Trail, n_workers);
|
||||||
#else
|
#else
|
||||||
Yap_InitMemory (Trail, Heap, Stack+Atts);
|
Yap_InitMemory (Trail, Heap, Stack+Atts);
|
||||||
#endif /* YAPOR && !THREADS */
|
#endif /* YAPOR && !THREADS */
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
Yap_init_global(max_table_size, n_workers, sch_loop, delay_load);
|
Yap_init_optyap_global(max_table_size, n_workers, sch_loop, delay_load);
|
||||||
#endif /* YAPOR || TABLING */
|
#endif /* YAPOR || TABLING */
|
||||||
Yap_AttsSize = Atts;
|
Yap_AttsSize = Atts;
|
||||||
|
|
||||||
@ -1397,10 +1392,10 @@ Yap_HaltRegisterHook (HaltHookFunc f, void * env)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
h->environment = env;
|
h->environment = env;
|
||||||
h->hook = f;
|
h->hook = f;
|
||||||
LOCK(BGL);
|
LOCK(Yap_BGL);
|
||||||
h->next = Yap_HaltHooks;
|
h->next = Yap_HaltHooks;
|
||||||
Yap_HaltHooks = h;
|
Yap_HaltHooks = h;
|
||||||
UNLOCK(BGL);
|
UNLOCK(Yap_BGL);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,7 +442,7 @@ p_dif( USES_REGS1 )
|
|||||||
BEGD(d1);
|
BEGD(d1);
|
||||||
d1 = TrailTerm(--TR);
|
d1 = TrailTerm(--TR);
|
||||||
if (IsVarTerm(d1)) {
|
if (IsVarTerm(d1)) {
|
||||||
#if defined(SBA) && defined(YAPOR)
|
#if defined(YAPOR_SBA) && defined(YAPOR)
|
||||||
/* clean up the trail when we backtrack */
|
/* clean up the trail when we backtrack */
|
||||||
if (Unsigned((Int)(d1)-(Int)(H_FZ)) >
|
if (Unsigned((Int)(d1)-(Int)(H_FZ)) >
|
||||||
Unsigned((Int)(B_FZ)-(Int)(H_FZ))) {
|
Unsigned((Int)(B_FZ)-(Int)(H_FZ))) {
|
||||||
@ -767,7 +767,7 @@ p_cut_by( USES_REGS1 )
|
|||||||
d0 = ARG1;
|
d0 = ARG1;
|
||||||
deref_head(d0, cutby_x_unk);
|
deref_head(d0, cutby_x_unk);
|
||||||
cutby_x_nvar:
|
cutby_x_nvar:
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
if (!IsIntegerTerm(d0)) {
|
if (!IsIntegerTerm(d0)) {
|
||||||
#else
|
#else
|
||||||
if (!IsIntTerm(d0)) {
|
if (!IsIntTerm(d0)) {
|
||||||
@ -775,7 +775,7 @@ p_cut_by( USES_REGS1 )
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
BEGCHO(pt0);
|
BEGCHO(pt0);
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
pt0 = (choiceptr)IntegerOfTerm(d0);
|
pt0 = (choiceptr)IntegerOfTerm(d0);
|
||||||
#else
|
#else
|
||||||
pt0 = (choiceptr)(LCL0-IntOfTerm(d0));
|
pt0 = (choiceptr)(LCL0-IntOfTerm(d0));
|
||||||
|
@ -192,7 +192,7 @@ UpdateTimedVar(Term inv, Term new USES_REGS)
|
|||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
/* last assignment more recent than last B */
|
/* last assignment more recent than last B */
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
if (Unsigned((Int)(tv)-(Int)(H_FZ)) >
|
if (Unsigned((Int)(tv)-(Int)(H_FZ)) >
|
||||||
Unsigned((Int)(B_FZ)-(Int)(H_FZ)))
|
Unsigned((Int)(B_FZ)-(Int)(H_FZ)))
|
||||||
*STACK_TO_SBA(&(tv->value)) = new;
|
*STACK_TO_SBA(&(tv->value)) = new;
|
||||||
|
16
C/save.c
16
C/save.c
@ -409,14 +409,14 @@ save_regs(int mode USES_REGS)
|
|||||||
return -1;
|
return -1;
|
||||||
if (putcellptr((CELL *)EX) < 0)
|
if (putcellptr((CELL *)EX) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
#if defined(SBA) || defined(TABLING)
|
#if defined(YAPOR_SBA) || defined(TABLING)
|
||||||
if (putcellptr(H_FZ) < 0)
|
if (putcellptr(H_FZ) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (putcellptr((CELL *)B_FZ) < 0)
|
if (putcellptr((CELL *)B_FZ) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (putcellptr((CELL *)TR_FZ) < 0)
|
if (putcellptr((CELL *)TR_FZ) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
#endif /* SBA || TABLING */
|
#endif /* YAPOR_SBA || TABLING */
|
||||||
}
|
}
|
||||||
if (putout(CurrentModule) < 0)
|
if (putout(CurrentModule) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -616,13 +616,13 @@ p_save2( USES_REGS1 )
|
|||||||
|
|
||||||
Term t;
|
Term t;
|
||||||
#if defined(YAPOR) && !defined(THREADS)
|
#if defined(YAPOR) && !defined(THREADS)
|
||||||
if (number_workers != 1) {
|
if (Yap_number_workers != 1) {
|
||||||
Yap_Error(SYSTEM_ERROR,TermNil,
|
Yap_Error(SYSTEM_ERROR,TermNil,
|
||||||
"cannot perform save: more than a worker/thread running");
|
"cannot perform save: more than a worker/thread running");
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
#elif defined(THREADS)
|
#elif defined(THREADS)
|
||||||
if (NOfThreads != 1) {
|
if (Yap_NOfThreads != 1) {
|
||||||
Yap_Error(SYSTEM_ERROR,TermNil,
|
Yap_Error(SYSTEM_ERROR,TermNil,
|
||||||
"cannot perform save: more than a worker/thread running");
|
"cannot perform save: more than a worker/thread running");
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
@ -853,7 +853,7 @@ get_regs(int flag USES_REGS)
|
|||||||
EX = (struct DB_TERM *)get_cellptr();
|
EX = (struct DB_TERM *)get_cellptr();
|
||||||
if (Yap_ErrorMessage)
|
if (Yap_ErrorMessage)
|
||||||
return -1;
|
return -1;
|
||||||
#if defined(SBA) || defined(TABLING)
|
#if defined(YAPOR_SBA) || defined(TABLING)
|
||||||
H_FZ = get_cellptr();
|
H_FZ = get_cellptr();
|
||||||
if (Yap_ErrorMessage)
|
if (Yap_ErrorMessage)
|
||||||
return -1;
|
return -1;
|
||||||
@ -863,7 +863,7 @@ get_regs(int flag USES_REGS)
|
|||||||
TR_FZ = (tr_fr_ptr)get_cellptr();
|
TR_FZ = (tr_fr_ptr)get_cellptr();
|
||||||
if (Yap_ErrorMessage)
|
if (Yap_ErrorMessage)
|
||||||
return -1;
|
return -1;
|
||||||
#endif /* SBA || TABLING */
|
#endif /* YAPOR_SBA || TABLING */
|
||||||
}
|
}
|
||||||
CurrentModule = get_cell();
|
CurrentModule = get_cell();
|
||||||
if (Yap_ErrorMessage)
|
if (Yap_ErrorMessage)
|
||||||
@ -1795,12 +1795,12 @@ p_restore( USES_REGS1 )
|
|||||||
|
|
||||||
Term t1 = Deref(ARG1);
|
Term t1 = Deref(ARG1);
|
||||||
#if defined(YAPOR) && !defined(THREADS)
|
#if defined(YAPOR) && !defined(THREADS)
|
||||||
if (number_workers != 1) {
|
if (Yap_number_workers != 1) {
|
||||||
Yap_Error(SYSTEM_ERROR,TermNil,"cannot perform save: more than a worker/thread running");
|
Yap_Error(SYSTEM_ERROR,TermNil,"cannot perform save: more than a worker/thread running");
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
#elif defined(THREADS)
|
#elif defined(THREADS)
|
||||||
if (NOfThreads != 1) {
|
if (Yap_NOfThreads != 1) {
|
||||||
Yap_Error(SYSTEM_ERROR,TermNil,"cannot perform save: more than a worker/thread running");
|
Yap_Error(SYSTEM_ERROR,TermNil,"cannot perform save: more than a worker/thread running");
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
18
C/stdpreds.c
18
C/stdpreds.c
@ -3832,49 +3832,49 @@ p_set_yap_flags( USES_REGS1 )
|
|||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
case TABLING_MODE_FLAG:
|
case TABLING_MODE_FLAG:
|
||||||
if (value == 0) { /* default */
|
if (value == 0) { /* default */
|
||||||
tab_ent_ptr tab_ent = GLOBAL_root_tab_ent;
|
tab_ent_ptr tab_ent = Yap_root_tab_ent;
|
||||||
while(tab_ent) {
|
while(tab_ent) {
|
||||||
TabEnt_mode(tab_ent) = TabEnt_flags(tab_ent);
|
TabEnt_mode(tab_ent) = TabEnt_flags(tab_ent);
|
||||||
tab_ent = TabEnt_next(tab_ent);
|
tab_ent = TabEnt_next(tab_ent);
|
||||||
}
|
}
|
||||||
yap_flags[TABLING_MODE_FLAG] = 0;
|
yap_flags[TABLING_MODE_FLAG] = 0;
|
||||||
} else if (value == 1) { /* batched */
|
} else if (value == 1) { /* batched */
|
||||||
tab_ent_ptr tab_ent = GLOBAL_root_tab_ent;
|
tab_ent_ptr tab_ent = Yap_root_tab_ent;
|
||||||
while(tab_ent) {
|
while(tab_ent) {
|
||||||
SetMode_Batched(TabEnt_mode(tab_ent));
|
SetMode_Batched(TabEnt_mode(tab_ent));
|
||||||
tab_ent = TabEnt_next(tab_ent);
|
tab_ent = TabEnt_next(tab_ent);
|
||||||
}
|
}
|
||||||
SetMode_Batched(yap_flags[TABLING_MODE_FLAG]);
|
SetMode_Batched(yap_flags[TABLING_MODE_FLAG]);
|
||||||
} else if (value == 2) { /* local */
|
} else if (value == 2) { /* local */
|
||||||
tab_ent_ptr tab_ent = GLOBAL_root_tab_ent;
|
tab_ent_ptr tab_ent = Yap_root_tab_ent;
|
||||||
while(tab_ent) {
|
while(tab_ent) {
|
||||||
SetMode_Local(TabEnt_mode(tab_ent));
|
SetMode_Local(TabEnt_mode(tab_ent));
|
||||||
tab_ent = TabEnt_next(tab_ent);
|
tab_ent = TabEnt_next(tab_ent);
|
||||||
}
|
}
|
||||||
SetMode_Local(yap_flags[TABLING_MODE_FLAG]);
|
SetMode_Local(yap_flags[TABLING_MODE_FLAG]);
|
||||||
} else if (value == 3) { /* exec_answers */
|
} else if (value == 3) { /* exec_answers */
|
||||||
tab_ent_ptr tab_ent = GLOBAL_root_tab_ent;
|
tab_ent_ptr tab_ent = Yap_root_tab_ent;
|
||||||
while(tab_ent) {
|
while(tab_ent) {
|
||||||
SetMode_ExecAnswers(TabEnt_mode(tab_ent));
|
SetMode_ExecAnswers(TabEnt_mode(tab_ent));
|
||||||
tab_ent = TabEnt_next(tab_ent);
|
tab_ent = TabEnt_next(tab_ent);
|
||||||
}
|
}
|
||||||
SetMode_ExecAnswers(yap_flags[TABLING_MODE_FLAG]);
|
SetMode_ExecAnswers(yap_flags[TABLING_MODE_FLAG]);
|
||||||
} else if (value == 4) { /* load_answers */
|
} else if (value == 4) { /* load_answers */
|
||||||
tab_ent_ptr tab_ent = GLOBAL_root_tab_ent;
|
tab_ent_ptr tab_ent = Yap_root_tab_ent;
|
||||||
while(tab_ent) {
|
while(tab_ent) {
|
||||||
SetMode_LoadAnswers(TabEnt_mode(tab_ent));
|
SetMode_LoadAnswers(TabEnt_mode(tab_ent));
|
||||||
tab_ent = TabEnt_next(tab_ent);
|
tab_ent = TabEnt_next(tab_ent);
|
||||||
}
|
}
|
||||||
SetMode_LoadAnswers(yap_flags[TABLING_MODE_FLAG]);
|
SetMode_LoadAnswers(yap_flags[TABLING_MODE_FLAG]);
|
||||||
} else if (value == 5) { /* local_trie */
|
} else if (value == 5) { /* local_trie */
|
||||||
tab_ent_ptr tab_ent = GLOBAL_root_tab_ent;
|
tab_ent_ptr tab_ent = Yap_root_tab_ent;
|
||||||
while(tab_ent) {
|
while(tab_ent) {
|
||||||
SetMode_LocalTrie(TabEnt_mode(tab_ent));
|
SetMode_LocalTrie(TabEnt_mode(tab_ent));
|
||||||
tab_ent = TabEnt_next(tab_ent);
|
tab_ent = TabEnt_next(tab_ent);
|
||||||
}
|
}
|
||||||
SetMode_LocalTrie(yap_flags[TABLING_MODE_FLAG]);
|
SetMode_LocalTrie(yap_flags[TABLING_MODE_FLAG]);
|
||||||
} else if (value == 6) { /* global_trie */
|
} else if (value == 6) { /* global_trie */
|
||||||
tab_ent_ptr tab_ent = GLOBAL_root_tab_ent;
|
tab_ent_ptr tab_ent = Yap_root_tab_ent;
|
||||||
while(tab_ent) {
|
while(tab_ent) {
|
||||||
SetMode_GlobalTrie(TabEnt_mode(tab_ent));
|
SetMode_GlobalTrie(TabEnt_mode(tab_ent));
|
||||||
tab_ent = TabEnt_next(tab_ent);
|
tab_ent = TabEnt_next(tab_ent);
|
||||||
@ -3913,14 +3913,14 @@ p_system_mode( USES_REGS1 )
|
|||||||
static Int
|
static Int
|
||||||
p_lock_system( USES_REGS1 )
|
p_lock_system( USES_REGS1 )
|
||||||
{
|
{
|
||||||
LOCK(BGL);
|
LOCK(Yap_BGL);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
p_unlock_system( USES_REGS1 )
|
p_unlock_system( USES_REGS1 )
|
||||||
{
|
{
|
||||||
UNLOCK(BGL);
|
UNLOCK(Yap_BGL);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1830,7 +1830,7 @@ InitSignals (void)
|
|||||||
#if HAVE_SIGSEGV && !defined(THREADS)
|
#if HAVE_SIGSEGV && !defined(THREADS)
|
||||||
my_signal_info (SIGSEGV, HandleSIGSEGV);
|
my_signal_info (SIGSEGV, HandleSIGSEGV);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ACOW
|
#ifdef YAPOR_COW
|
||||||
signal(SIGCHLD, SIG_IGN); /* avoid ghosts */
|
signal(SIGCHLD, SIG_IGN); /* avoid ghosts */
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
54
C/threads.c
54
C/threads.c
@ -51,7 +51,7 @@ static int
|
|||||||
allocate_new_tid(void)
|
allocate_new_tid(void)
|
||||||
{
|
{
|
||||||
int new_worker_id = 0;
|
int new_worker_id = 0;
|
||||||
LOCK(ThreadHandlesLock);
|
LOCK(Yap_ThreadHandlesLock);
|
||||||
while(new_worker_id < MAX_THREADS &&
|
while(new_worker_id < MAX_THREADS &&
|
||||||
Yap_WLocal[new_worker_id] &&
|
Yap_WLocal[new_worker_id] &&
|
||||||
(FOREIGN_ThreadHandle(new_worker_id).in_use == TRUE ||
|
(FOREIGN_ThreadHandle(new_worker_id).in_use == TRUE ||
|
||||||
@ -73,7 +73,7 @@ allocate_new_tid(void)
|
|||||||
} else {
|
} else {
|
||||||
new_worker_id = -1;
|
new_worker_id = -1;
|
||||||
}
|
}
|
||||||
UNLOCK(ThreadHandlesLock);
|
UNLOCK(Yap_ThreadHandlesLock);
|
||||||
return new_worker_id;
|
return new_worker_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,9 +92,9 @@ store_specs(int new_worker_id, UInt ssize, UInt tsize, UInt sysize, Term *tpgoal
|
|||||||
FOREIGN_ThreadHandle(new_worker_id).ssize = ssize;
|
FOREIGN_ThreadHandle(new_worker_id).ssize = ssize;
|
||||||
FOREIGN_ThreadHandle(new_worker_id).tsize = tsize;
|
FOREIGN_ThreadHandle(new_worker_id).tsize = tsize;
|
||||||
FOREIGN_ThreadHandle(new_worker_id).sysize = sysize;
|
FOREIGN_ThreadHandle(new_worker_id).sysize = sysize;
|
||||||
FOREIGN_WL(new_worker_id)->c_input_stream = Yap_c_input_stream;
|
FOREIGN(new_worker_id)->c_input_stream = Yap_c_input_stream;
|
||||||
FOREIGN_WL(new_worker_id)->c_output_stream = Yap_c_output_stream;
|
FOREIGN(new_worker_id)->c_output_stream = Yap_c_output_stream;
|
||||||
FOREIGN_WL(new_worker_id)->c_error_stream = Yap_c_error_stream;
|
FOREIGN(new_worker_id)->c_error_stream = Yap_c_error_stream;
|
||||||
pm = (ssize + tsize)*1024;
|
pm = (ssize + tsize)*1024;
|
||||||
if (!(FOREIGN_ThreadHandle(new_worker_id).stack_address = malloc(pm))) {
|
if (!(FOREIGN_ThreadHandle(new_worker_id).stack_address = malloc(pm))) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -140,14 +140,14 @@ kill_thread_engine (int wid, int always_die)
|
|||||||
gl = gl->NextGE;
|
gl = gl->NextGE;
|
||||||
}
|
}
|
||||||
Yap_KillStacks(wid);
|
Yap_KillStacks(wid);
|
||||||
FOREIGN_WL(wid)->active_signals = 0L;
|
FOREIGN(wid)->active_signals = 0L;
|
||||||
free(FOREIGN_WL(wid)->scratchpad.ptr);
|
free(FOREIGN(wid)->scratchpad.ptr);
|
||||||
free(FOREIGN_ThreadHandle(wid).default_yaam_regs);
|
free(FOREIGN_ThreadHandle(wid).default_yaam_regs);
|
||||||
FOREIGN_ThreadHandle(wid).current_yaam_regs = NULL;
|
FOREIGN_ThreadHandle(wid).current_yaam_regs = NULL;
|
||||||
free(FOREIGN_ThreadHandle(wid).start_of_timesp);
|
free(FOREIGN_ThreadHandle(wid).start_of_timesp);
|
||||||
free(FOREIGN_ThreadHandle(wid).last_timep);
|
free(FOREIGN_ThreadHandle(wid).last_timep);
|
||||||
Yap_FreeCodeSpace((ADDR)FOREIGN_ThreadHandle(wid).texit);
|
Yap_FreeCodeSpace((ADDR)FOREIGN_ThreadHandle(wid).texit);
|
||||||
LOCK(ThreadHandlesLock);
|
LOCK(Yap_ThreadHandlesLock);
|
||||||
if (FOREIGN_ThreadHandle(wid).tdetach == MkAtomTerm(AtomTrue) ||
|
if (FOREIGN_ThreadHandle(wid).tdetach == MkAtomTerm(AtomTrue) ||
|
||||||
always_die) {
|
always_die) {
|
||||||
FOREIGN_ThreadHandle(wid).zombie = FALSE;
|
FOREIGN_ThreadHandle(wid).zombie = FALSE;
|
||||||
@ -155,7 +155,7 @@ kill_thread_engine (int wid, int always_die)
|
|||||||
DEBUG_TLOCK_ACCESS(1, wid);
|
DEBUG_TLOCK_ACCESS(1, wid);
|
||||||
pthread_mutex_unlock(&(FOREIGN_ThreadHandle(wid).tlock));
|
pthread_mutex_unlock(&(FOREIGN_ThreadHandle(wid).tlock));
|
||||||
}
|
}
|
||||||
UNLOCK(ThreadHandlesLock);
|
UNLOCK(Yap_ThreadHandlesLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -163,7 +163,7 @@ thread_die(int wid, int always_die)
|
|||||||
{
|
{
|
||||||
if (!always_die) {
|
if (!always_die) {
|
||||||
/* called by thread itself */
|
/* called by thread itself */
|
||||||
ThreadsTotalTime += Yap_cputime();
|
Yap_ThreadsTotalTime += Yap_cputime();
|
||||||
}
|
}
|
||||||
kill_thread_engine(wid, always_die);
|
kill_thread_engine(wid, always_die);
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ setup_engine(int myworker_id, int init_thread)
|
|||||||
#endif
|
#endif
|
||||||
Yap_ReleasePreAllocCodeSpace(Yap_PreAllocCodeSpace());
|
Yap_ReleasePreAllocCodeSpace(Yap_PreAllocCodeSpace());
|
||||||
/* I exist */
|
/* I exist */
|
||||||
NOfThreadsCreated++;
|
Yap_NOfThreadsCreated++;
|
||||||
DEBUG_TLOCK_ACCESS(2, myworker_id);
|
DEBUG_TLOCK_ACCESS(2, myworker_id);
|
||||||
pthread_mutex_unlock(&(FOREIGN_ThreadHandle(myworker_id).tlock));
|
pthread_mutex_unlock(&(FOREIGN_ThreadHandle(myworker_id).tlock));
|
||||||
}
|
}
|
||||||
@ -487,17 +487,17 @@ p_thread_join( USES_REGS1 )
|
|||||||
{
|
{
|
||||||
Int tid = IntegerOfTerm(Deref(ARG1));
|
Int tid = IntegerOfTerm(Deref(ARG1));
|
||||||
|
|
||||||
LOCK(ThreadHandlesLock);
|
LOCK(Yap_ThreadHandlesLock);
|
||||||
if (!FOREIGN_ThreadHandle(tid).in_use &&
|
if (!FOREIGN_ThreadHandle(tid).in_use &&
|
||||||
!FOREIGN_ThreadHandle(tid).zombie) {
|
!FOREIGN_ThreadHandle(tid).zombie) {
|
||||||
UNLOCK(ThreadHandlesLock);
|
UNLOCK(Yap_ThreadHandlesLock);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!FOREIGN_ThreadHandle(tid).tdetach == MkAtomTerm(AtomTrue)) {
|
if (!FOREIGN_ThreadHandle(tid).tdetach == MkAtomTerm(AtomTrue)) {
|
||||||
UNLOCK(ThreadHandlesLock);
|
UNLOCK(Yap_ThreadHandlesLock);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
UNLOCK(ThreadHandlesLock);
|
UNLOCK(Yap_ThreadHandlesLock);
|
||||||
/* make sure this lock is accessible */
|
/* make sure this lock is accessible */
|
||||||
if (pthread_join(FOREIGN_ThreadHandle(tid).pthread_handle, NULL) < 0) {
|
if (pthread_join(FOREIGN_ThreadHandle(tid).pthread_handle, NULL) < 0) {
|
||||||
/* ERROR */
|
/* ERROR */
|
||||||
@ -512,12 +512,12 @@ p_thread_destroy( USES_REGS1 )
|
|||||||
{
|
{
|
||||||
Int tid = IntegerOfTerm(Deref(ARG1));
|
Int tid = IntegerOfTerm(Deref(ARG1));
|
||||||
|
|
||||||
LOCK(ThreadHandlesLock);
|
LOCK(Yap_ThreadHandlesLock);
|
||||||
FOREIGN_ThreadHandle(tid).zombie = FALSE;
|
FOREIGN_ThreadHandle(tid).zombie = FALSE;
|
||||||
FOREIGN_ThreadHandle(tid).in_use = FALSE;
|
FOREIGN_ThreadHandle(tid).in_use = FALSE;
|
||||||
DEBUG_TLOCK_ACCESS(32, tid);
|
DEBUG_TLOCK_ACCESS(32, tid);
|
||||||
pthread_mutex_unlock(&(FOREIGN_ThreadHandle(tid).tlock));
|
pthread_mutex_unlock(&(FOREIGN_ThreadHandle(tid).tlock));
|
||||||
UNLOCK(ThreadHandlesLock);
|
UNLOCK(Yap_ThreadHandlesLock);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -753,16 +753,16 @@ p_thread_stacks( USES_REGS1 )
|
|||||||
Int tid = IntegerOfTerm(Deref(ARG1));
|
Int tid = IntegerOfTerm(Deref(ARG1));
|
||||||
Int status= TRUE;
|
Int status= TRUE;
|
||||||
|
|
||||||
LOCK(ThreadHandlesLock);
|
LOCK(Yap_ThreadHandlesLock);
|
||||||
if (!FOREIGN_ThreadHandle(tid).in_use &&
|
if (!FOREIGN_ThreadHandle(tid).in_use &&
|
||||||
!FOREIGN_ThreadHandle(tid).zombie) {
|
!FOREIGN_ThreadHandle(tid).zombie) {
|
||||||
UNLOCK(ThreadHandlesLock);
|
UNLOCK(Yap_ThreadHandlesLock);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
status &= Yap_unify(ARG2,MkIntegerTerm(FOREIGN_ThreadHandle(tid).ssize));
|
status &= Yap_unify(ARG2,MkIntegerTerm(FOREIGN_ThreadHandle(tid).ssize));
|
||||||
status &= Yap_unify(ARG3,MkIntegerTerm(FOREIGN_ThreadHandle(tid).tsize));
|
status &= Yap_unify(ARG3,MkIntegerTerm(FOREIGN_ThreadHandle(tid).tsize));
|
||||||
status &= Yap_unify(ARG4,MkIntegerTerm(FOREIGN_ThreadHandle(tid).sysize));
|
status &= Yap_unify(ARG4,MkIntegerTerm(FOREIGN_ThreadHandle(tid).sysize));
|
||||||
UNLOCK(ThreadHandlesLock);
|
UNLOCK(Yap_ThreadHandlesLock);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -814,11 +814,11 @@ p_thread_signal( USES_REGS1 )
|
|||||||
pthread_mutex_unlock(&(FOREIGN_ThreadHandle(wid).tlock));
|
pthread_mutex_unlock(&(FOREIGN_ThreadHandle(wid).tlock));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
LOCK(FOREIGN_WL(wid)->signal_lock);
|
LOCK(FOREIGN(wid)->signal_lock);
|
||||||
FOREIGN_ThreadHandle(wid).current_yaam_regs->CreepFlag_ =
|
FOREIGN_ThreadHandle(wid).current_yaam_regs->CreepFlag_ =
|
||||||
Unsigned(FOREIGN_ThreadHandle(wid).current_yaam_regs->LCL0_);
|
Unsigned(FOREIGN_ThreadHandle(wid).current_yaam_regs->LCL0_);
|
||||||
FOREIGN_WL(wid)->active_signals |= YAP_ITI_SIGNAL;
|
FOREIGN(wid)->active_signals |= YAP_ITI_SIGNAL;
|
||||||
UNLOCK(FOREIGN_WL(wid)->signal_lock);
|
UNLOCK(FOREIGN(wid)->signal_lock);
|
||||||
DEBUG_TLOCK_ACCESS(18, wid);
|
DEBUG_TLOCK_ACCESS(18, wid);
|
||||||
pthread_mutex_unlock(&(FOREIGN_ThreadHandle(wid).tlock));
|
pthread_mutex_unlock(&(FOREIGN_ThreadHandle(wid).tlock));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -834,13 +834,13 @@ static Int
|
|||||||
p_nof_threads( USES_REGS1 )
|
p_nof_threads( USES_REGS1 )
|
||||||
{ /* '$nof_threads'(+P) */
|
{ /* '$nof_threads'(+P) */
|
||||||
int i = 0, wid;
|
int i = 0, wid;
|
||||||
LOCK(ThreadHandlesLock);
|
LOCK(Yap_ThreadHandlesLock);
|
||||||
for (wid = 0; wid < MAX_THREADS; wid++) {
|
for (wid = 0; wid < MAX_THREADS; wid++) {
|
||||||
if (!Yap_WLocal[wid]) break;
|
if (!Yap_WLocal[wid]) break;
|
||||||
if (FOREIGN_ThreadHandle(wid).in_use)
|
if (FOREIGN_ThreadHandle(wid).in_use)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
UNLOCK(ThreadHandlesLock);
|
UNLOCK(Yap_ThreadHandlesLock);
|
||||||
return Yap_unify(ARG1,MkIntegerTerm(i));
|
return Yap_unify(ARG1,MkIntegerTerm(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -859,13 +859,13 @@ p_max_threads( USES_REGS1 )
|
|||||||
static Int
|
static Int
|
||||||
p_nof_threads_created( USES_REGS1 )
|
p_nof_threads_created( USES_REGS1 )
|
||||||
{ /* '$nof_threads'(+P) */
|
{ /* '$nof_threads'(+P) */
|
||||||
return Yap_unify(ARG1,MkIntTerm(NOfThreadsCreated));
|
return Yap_unify(ARG1,MkIntTerm(Yap_NOfThreadsCreated));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
p_thread_runtime( USES_REGS1 )
|
p_thread_runtime( USES_REGS1 )
|
||||||
{ /* '$thread_runtime'(+P) */
|
{ /* '$thread_runtime'(+P) */
|
||||||
return Yap_unify(ARG1,MkIntegerTerm(ThreadsTotalTime));
|
return Yap_unify(ARG1,MkIntegerTerm(Yap_ThreadsTotalTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
|
24
H/Regs.h
24
H/Regs.h
@ -90,9 +90,9 @@ typedef struct regstore_t
|
|||||||
Int CurSlot_;
|
Int CurSlot_;
|
||||||
CELL CreepFlag_; /* 13 */
|
CELL CreepFlag_; /* 13 */
|
||||||
CELL *HB_; /* 4 heap (global) stack top at latest c.p. */
|
CELL *HB_; /* 4 heap (global) stack top at latest c.p. */
|
||||||
#if defined(SBA) || defined(TABLING)
|
#if defined(YAPOR_SBA) || defined(TABLING)
|
||||||
choiceptr BB_; /* 4 local stack top at latest c.p. */
|
choiceptr BB_; /* 4 local stack top at latest c.p. */
|
||||||
#endif /* SBA || TABLING */
|
#endif /* YAPOR_SBA || TABLING */
|
||||||
CELL *H0_; /* 2 base of heap (global) stack */
|
CELL *H0_; /* 2 base of heap (global) stack */
|
||||||
tr_fr_ptr TR_; /* 24 top of trail */
|
tr_fr_ptr TR_; /* 24 top of trail */
|
||||||
CELL *H_; /* 25 top of heap (global) stack */
|
CELL *H_; /* 25 top of heap (global) stack */
|
||||||
@ -119,24 +119,24 @@ typedef struct regstore_t
|
|||||||
/* visualc*/
|
/* visualc*/
|
||||||
struct DB_TERM * EX_; /* 18 */
|
struct DB_TERM * EX_; /* 18 */
|
||||||
Term CurrentModule_;
|
Term CurrentModule_;
|
||||||
#if defined(SBA) || defined(TABLING)
|
#if defined(YAPOR_SBA) || defined(TABLING)
|
||||||
CELL *H_FZ_;
|
CELL *H_FZ_;
|
||||||
choiceptr B_FZ_;
|
choiceptr B_FZ_;
|
||||||
tr_fr_ptr TR_FZ_;
|
tr_fr_ptr TR_FZ_;
|
||||||
#endif /* SBA || TABLING */
|
#endif /* YAPOR_SBA || TABLING */
|
||||||
struct pred_entry *PP_;
|
struct pred_entry *PP_;
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
/* recursive write-locks for PredEntry */
|
/* recursive write-locks for PredEntry */
|
||||||
yamop **PREG_ADDR_;
|
yamop **PREG_ADDR_;
|
||||||
unsigned int worker_id_;
|
unsigned int worker_id_;
|
||||||
#ifdef SBA
|
#ifdef YAPOR_SBA
|
||||||
choiceptr BSEG_;
|
choiceptr BSEG_;
|
||||||
struct or_frame *frame_head_, *frame_tail_;
|
struct or_frame *frame_head_, *frame_tail_;
|
||||||
char *binding_array_;
|
char *binding_array_;
|
||||||
int sba_offset_;
|
int sba_offset_;
|
||||||
int sba_end_;
|
int sba_end_;
|
||||||
int sba_size_;
|
int sba_size_;
|
||||||
#endif /* SBA */
|
#endif /* YAPOR_SBA */
|
||||||
#endif /* YAPOR || THREADS */
|
#endif /* YAPOR || THREADS */
|
||||||
#if (defined(YAPOR) || defined(TABLING))
|
#if (defined(YAPOR) || defined(TABLING))
|
||||||
struct local_data *LOCAL_;
|
struct local_data *LOCAL_;
|
||||||
@ -635,16 +635,16 @@ EXTERN inline void restore_B(void) {
|
|||||||
#define AuxTop Yap_REGS.AuxTop_
|
#define AuxTop Yap_REGS.AuxTop_
|
||||||
#define EX Yap_REGS.EX_
|
#define EX Yap_REGS.EX_
|
||||||
#define DEPTH Yap_REGS.DEPTH_
|
#define DEPTH Yap_REGS.DEPTH_
|
||||||
#if defined(SBA) || defined(TABLING)
|
#if defined(YAPOR_SBA) || defined(TABLING)
|
||||||
#define H_FZ Yap_REGS.H_FZ_
|
#define H_FZ Yap_REGS.H_FZ_
|
||||||
#define B_FZ Yap_REGS.B_FZ_
|
#define B_FZ Yap_REGS.B_FZ_
|
||||||
#define TR_FZ Yap_REGS.TR_FZ_
|
#define TR_FZ Yap_REGS.TR_FZ_
|
||||||
#endif /* SBA || TABLING */
|
#endif /* YAPOR_SBA || TABLING */
|
||||||
#define PP (Yap_REGS.PP_)
|
#define PP (Yap_REGS.PP_)
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
#define worker_id (Yap_REGS.worker_id_)
|
#define worker_id (Yap_REGS.worker_id_)
|
||||||
#define PREG_ADDR (Yap_REGS.PREG_ADDR_)
|
#define PREG_ADDR (Yap_REGS.PREG_ADDR_)
|
||||||
#ifdef SBA
|
#ifdef YAPOR_SBA
|
||||||
#define BSEG Yap_REGS.BSEG_
|
#define BSEG Yap_REGS.BSEG_
|
||||||
#define binding_array Yap_REGS.binding_array_
|
#define binding_array Yap_REGS.binding_array_
|
||||||
#define sba_offset Yap_REGS.sba_offset_
|
#define sba_offset Yap_REGS.sba_offset_
|
||||||
@ -652,7 +652,7 @@ EXTERN inline void restore_B(void) {
|
|||||||
#define sba_size Yap_REGS.sba_size_
|
#define sba_size Yap_REGS.sba_size_
|
||||||
#define frame_head Yap_REGS.frame_head_
|
#define frame_head Yap_REGS.frame_head_
|
||||||
#define frame_tail Yap_REGS.frame_tail_
|
#define frame_tail Yap_REGS.frame_tail_
|
||||||
#endif /* SBA */
|
#endif /* YAPOR_SBA */
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
#define LOCAL Yap_REGS.LOCAL_
|
#define LOCAL Yap_REGS.LOCAL_
|
||||||
@ -686,10 +686,10 @@ EXTERN inline void restore_B(void) {
|
|||||||
|
|
||||||
#define HBREG HB
|
#define HBREG HB
|
||||||
|
|
||||||
#if defined(SBA) || defined(TABLING)
|
#if defined(YAPOR_SBA) || defined(TABLING)
|
||||||
#define BB Yap_REGS.BB_
|
#define BB Yap_REGS.BB_
|
||||||
#define BBREG BB
|
#define BBREG BB
|
||||||
#endif /* SBA || TABLING */
|
#endif /* YAPOR_SBA || TABLING */
|
||||||
|
|
||||||
#if !defined(THREADS)
|
#if !defined(THREADS)
|
||||||
/* use actual addresses for regs */
|
/* use actual addresses for regs */
|
||||||
|
53
H/Yap.h
53
H/Yap.h
@ -17,7 +17,7 @@
|
|||||||
#define YAP_H 1
|
#define YAP_H 1
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#if defined(ENV_COPY) || defined(TABLING) || defined(THREADS)
|
#if defined(YAPOR_COPY) || defined(TABLING) || defined(THREADS)
|
||||||
#include "opt.config.h"
|
#include "opt.config.h"
|
||||||
#endif /* YAPOR || TABLING */
|
#endif /* YAPOR || TABLING */
|
||||||
|
|
||||||
@ -39,24 +39,24 @@
|
|||||||
#error Do not explicitly define YAPOR
|
#error Do not explicitly define YAPOR
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
|
|
||||||
#if (defined(ENV_COPY) && (defined(ACOW) || defined(SBA))) || (defined(ACOW) && defined(SBA))
|
#if (defined(YAPOR_COPY) && (defined(YAPOR_COW) || defined(YAPOR_SBA))) || (defined(YAPOR_COW) && defined(YAPOR_SBA))
|
||||||
#error Do not define multiple or-parallel models
|
#error Do not define multiple or-parallel models
|
||||||
#endif /* (ENV_COPY && (ACOW || SBA)) || (ACOW && SBA) */
|
#endif /* (YAPOR_COPY && (YAPOR_COW || YAPOR_SBA)) || (YAPOR_COW && YAPOR_SBA) */
|
||||||
|
|
||||||
#if defined(ENV_COPY) || defined(ACOW) || defined(SBA) || defined(THREADS)
|
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA) || defined(THREADS)
|
||||||
#define YAPOR 1
|
#define YAPOR 1
|
||||||
#endif /* ENV_COPY || ACOW || SBA */
|
#endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA */
|
||||||
|
|
||||||
#if defined(TABLING) && (defined(ACOW) || defined(SBA))
|
#if defined(TABLING) && (defined(YAPOR_COW) || defined(YAPOR_SBA))
|
||||||
#error Currently TABLING only works with ENV_COPY
|
#error Currently TABLING only works with YAPOR_COPY
|
||||||
#endif /* TABLING && (ACOW || SBA) */
|
#endif /* TABLING && (YAPOR_COW || YAPOR_SBA) */
|
||||||
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
#define FIXED_STACKS 1
|
#define FIXED_STACKS 1
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
#undef ACOW
|
#undef YAPOR_COW
|
||||||
#undef SBA
|
#undef YAPOR_SBA
|
||||||
#undef ENV_COPY
|
#undef YAPOR_COPY
|
||||||
#endif
|
#endif
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
|
|
||||||
@ -80,9 +80,9 @@
|
|||||||
#define USE_SYSTEM_MALLOC 1
|
#define USE_SYSTEM_MALLOC 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(TABLING) || defined(SBA)
|
#if defined(TABLING) || defined(YAPOR_YAPOR_SBA)
|
||||||
#define FROZEN_STACKS 1
|
#define FROZEN_STACKS 1
|
||||||
#endif /* TABLING || SBA */
|
#endif /* TABLING || YAPOR_YAPOR_SBA */
|
||||||
|
|
||||||
#ifdef _MSC_VER /* Microsoft's Visual C++ Compiler */
|
#ifdef _MSC_VER /* Microsoft's Visual C++ Compiler */
|
||||||
/* adjust a config.h from mingw32 to work with vc++ */
|
/* adjust a config.h from mingw32 to work with vc++ */
|
||||||
@ -428,11 +428,6 @@ typedef pthread_rwlock_t rwlock_t;
|
|||||||
#ifdef __alpha
|
#ifdef __alpha
|
||||||
#include <locks_alpha_funcs.h>
|
#include <locks_alpha_funcs.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(THREADS)
|
|
||||||
#define MAX_AGENTS MAX_THREADS
|
|
||||||
#elif defined(YAPOR)
|
|
||||||
#define MAX_AGENTS MAX_WORKERS
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************ variables concerned with Error Handling *************/
|
/************ variables concerned with Error Handling *************/
|
||||||
@ -732,7 +727,7 @@ typedef enum
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
#if !GC_NO_TAGS
|
#if !GC_NO_TAGS
|
||||||
#if defined(SBA) && defined(__linux__)
|
#if defined(YAPOR_SBA) && defined(__linux__)
|
||||||
#define MBIT /* 0x20000000 */ MKTAG(0x1,0) /* mark bit */
|
#define MBIT /* 0x20000000 */ MKTAG(0x1,0) /* mark bit */
|
||||||
#else
|
#else
|
||||||
#define RBIT /* 0x20000000 */ MKTAG(0x1,0) /* relocation chain bit */
|
#define RBIT /* 0x20000000 */ MKTAG(0x1,0) /* relocation chain bit */
|
||||||
@ -829,7 +824,7 @@ VarOfTerm (Term t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef SBA
|
#ifdef YAPOR_SBA
|
||||||
|
|
||||||
inline EXTERN Term MkVarTerm__ ( USES_REGS1 );
|
inline EXTERN Term MkVarTerm__ ( USES_REGS1 );
|
||||||
|
|
||||||
@ -1065,8 +1060,8 @@ IntegerOfTerm (Term t)
|
|||||||
|
|
||||||
/*************** unification routines ***********************************/
|
/*************** unification routines ***********************************/
|
||||||
|
|
||||||
#ifdef SBA
|
#ifdef YAPOR_SBA
|
||||||
#include "or.sbaamiops.h"
|
#include "or.sba_amiops.h"
|
||||||
#else
|
#else
|
||||||
#include "amiops.h"
|
#include "amiops.h"
|
||||||
#endif
|
#endif
|
||||||
@ -1212,9 +1207,9 @@ extern int Yap_PrologShouldHandleInterrupts;
|
|||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
#define YAPEnterCriticalSection() \
|
#define YAPEnterCriticalSection() \
|
||||||
{ \
|
{ \
|
||||||
if (worker_id != GLOBAL_LOCKS_who_locked_heap) { \
|
if (worker_id != Yap_locks_who_locked_heap) { \
|
||||||
LOCK(GLOBAL_LOCKS_heap_access); \
|
LOCK(Yap_locks_heap_access); \
|
||||||
GLOBAL_LOCKS_who_locked_heap = worker_id; \
|
Yap_locks_who_locked_heap = worker_id; \
|
||||||
} \
|
} \
|
||||||
Yap_PrologMode |= CritMode; \
|
Yap_PrologMode |= CritMode; \
|
||||||
Yap_CritLocks++; \
|
Yap_CritLocks++; \
|
||||||
@ -1232,8 +1227,8 @@ extern int Yap_PrologShouldHandleInterrupts;
|
|||||||
Yap_PrologMode &= ~AbortMode; \
|
Yap_PrologMode &= ~AbortMode; \
|
||||||
Yap_Error(PURE_ABORT, 0, ""); \
|
Yap_Error(PURE_ABORT, 0, ""); \
|
||||||
} \
|
} \
|
||||||
GLOBAL_LOCKS_who_locked_heap = MAX_WORKERS; \
|
Yap_locks_who_locked_heap = MAX_WORKERS; \
|
||||||
UNLOCK(GLOBAL_LOCKS_heap_access); \
|
UNLOCK(Yap_locks_heap_access); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#elif defined(THREADS)
|
#elif defined(THREADS)
|
||||||
@ -1304,8 +1299,8 @@ extern char emacs_tmp[], emacs_tmp2[];
|
|||||||
#include "opt.macros.h"
|
#include "opt.macros.h"
|
||||||
#endif /* YAPOR || TABLING */
|
#endif /* YAPOR || TABLING */
|
||||||
|
|
||||||
#ifdef SBA
|
#ifdef YAPOR_SBA
|
||||||
#include "or.sbaunify.h"
|
#include "or.sba_unify.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/********* execution mode ***********************/
|
/********* execution mode ***********************/
|
||||||
|
12
H/YapHeap.h
12
H/YapHeap.h
@ -181,26 +181,26 @@ typedef struct various_codes {
|
|||||||
#include "hlocals.h"
|
#include "hlocals.h"
|
||||||
|
|
||||||
#if defined(YAPOR) && !defined(THREADS)
|
#if defined(YAPOR) && !defined(THREADS)
|
||||||
extern struct worker_shared *Yap_global;
|
extern struct global_data *Yap_global;
|
||||||
#else
|
#else
|
||||||
extern struct worker_shared Yap_Global;
|
extern struct global_data Yap_Global;
|
||||||
#define Yap_global (&Yap_Global)
|
#define Yap_global (&Yap_Global)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
#if defined(THREADS)
|
#if defined(THREADS)
|
||||||
extern struct worker_local *Yap_WLocal[MAX_AGENTS];
|
extern struct worker_local *Yap_WLocal[MAX_THREADS];
|
||||||
#define WL (Yap_WLocal[worker_id])
|
#define WL (Yap_WLocal[worker_id])
|
||||||
#define FOREIGN_WL(wid) (Yap_WLocal[(wid)])
|
#define FOREIGN(wid) (Yap_WLocal[(wid)])
|
||||||
#else
|
#else
|
||||||
extern struct worker_local *Yap_WLocal;
|
extern struct worker_local *Yap_WLocal;
|
||||||
#define WL (Yap_WLocal+worker_id)
|
#define WL (Yap_WLocal+worker_id)
|
||||||
#define FOREIGN_WL(wid) (Yap_WLocal+wid)
|
#define FOREIGN(wid) (Yap_WLocal+wid)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
extern struct worker_local Yap_WLocal;
|
extern struct worker_local Yap_WLocal;
|
||||||
#define WL (&Yap_WLocal)
|
#define WL (&Yap_WLocal)
|
||||||
#define FOREIGN_WL(wid) (&Yap_WLocal)
|
#define FOREIGN(wid) (&Yap_WLocal)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -690,13 +690,13 @@ Macros to check the limits of stacks
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(SBA) && defined(YAPOR)) || defined(TABLING)
|
#if (defined(YAPOR_SBA) && defined(YAPOR)) || defined(TABLING)
|
||||||
#define check_stack(Label, GLOB) \
|
#define check_stack(Label, GLOB) \
|
||||||
if ( (Int)(Unsigned(YOUNGEST_CP((choiceptr)ENV_YREG,B_FZ)) - Unsigned(YOUNGEST_H(H_FZ,GLOB))) < CreepFlag ) goto Label
|
if ( (Int)(Unsigned(YOUNGEST_CP((choiceptr)ENV_YREG,B_FZ)) - Unsigned(YOUNGEST_H(H_FZ,GLOB))) < CreepFlag ) goto Label
|
||||||
#else
|
#else
|
||||||
#define check_stack(Label, GLOB) \
|
#define check_stack(Label, GLOB) \
|
||||||
if ( (Int)(Unsigned(ENV_YREG) - Unsigned(GLOB)) < CreepFlag ) goto Label
|
if ( (Int)(Unsigned(ENV_YREG) - Unsigned(GLOB)) < CreepFlag ) goto Label
|
||||||
#endif /* SBA && YAPOR */
|
#endif /* YAPOR_SBA && YAPOR */
|
||||||
|
|
||||||
/***************************************************************
|
/***************************************************************
|
||||||
* Macros for choice point manipulation *
|
* Macros for choice point manipulation *
|
||||||
@ -813,7 +813,7 @@ Macros to check the limits of stacks
|
|||||||
|
|
||||||
|
|
||||||
#ifdef FROZEN_STACKS
|
#ifdef FROZEN_STACKS
|
||||||
#ifdef SBA
|
#ifdef YAPOR_SBA
|
||||||
#define PROTECT_FROZEN_H(CPTR) \
|
#define PROTECT_FROZEN_H(CPTR) \
|
||||||
((Unsigned((Int)((CPTR)->cp_h)-(Int)(H_FZ)) < \
|
((Unsigned((Int)((CPTR)->cp_h)-(Int)(H_FZ)) < \
|
||||||
Unsigned((Int)(B_FZ)-(Int)(H_FZ))) ? \
|
Unsigned((Int)(B_FZ)-(Int)(H_FZ))) ? \
|
||||||
@ -830,7 +830,7 @@ Macros to check the limits of stacks
|
|||||||
#else /* TABLING */
|
#else /* TABLING */
|
||||||
#define PROTECT_FROZEN_B(CPTR) (YOUNGER_CP(CPTR, B_FZ) ? CPTR : B_FZ)
|
#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)
|
#define PROTECT_FROZEN_H(CPTR) (((CPTR)->cp_h > H_FZ) ? (CPTR)->cp_h : H_FZ)
|
||||||
#endif /* SBA */
|
#endif /* YAPOR_SBA */
|
||||||
#else
|
#else
|
||||||
#define PROTECT_FROZEN_B(CPTR) (CPTR)
|
#define PROTECT_FROZEN_B(CPTR) (CPTR)
|
||||||
#define PROTECT_FROZEN_H(CPTR) (CPTR)->cp_h
|
#define PROTECT_FROZEN_H(CPTR) (CPTR)->cp_h
|
||||||
|
14
H/amidefs.h
14
H/amidefs.h
@ -66,7 +66,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FROZEN_STACKS
|
#ifdef FROZEN_STACKS
|
||||||
#ifdef SBA
|
#ifdef YAPOR_SBA
|
||||||
#define PROTECT_FROZEN_H(CPTR) \
|
#define PROTECT_FROZEN_H(CPTR) \
|
||||||
((Unsigned((Int)((CPTR)->cp_h)-(Int)(H_FZ)) < \
|
((Unsigned((Int)((CPTR)->cp_h)-(Int)(H_FZ)) < \
|
||||||
Unsigned((Int)(B_FZ)-(Int)(H_FZ))) ? \
|
Unsigned((Int)(B_FZ)-(Int)(H_FZ))) ? \
|
||||||
@ -83,7 +83,7 @@
|
|||||||
#else /* TABLING */
|
#else /* TABLING */
|
||||||
#define PROTECT_FROZEN_B(CPTR) (YOUNGER_CP(CPTR, B_FZ) ? CPTR : B_FZ)
|
#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)
|
#define PROTECT_FROZEN_H(CPTR) (((CPTR)->cp_h > H_FZ) ? (CPTR)->cp_h : H_FZ)
|
||||||
#endif /* SBA */
|
#endif /* YAPOR_SBA */
|
||||||
#else
|
#else
|
||||||
#define PROTECT_FROZEN_B(CPTR) (CPTR)
|
#define PROTECT_FROZEN_B(CPTR) (CPTR)
|
||||||
#define PROTECT_FROZEN_H(CPTR) (CPTR)->cp_h
|
#define PROTECT_FROZEN_H(CPTR) (CPTR)->cp_h
|
||||||
@ -875,7 +875,7 @@ typedef yamop yamopp;
|
|||||||
|
|
||||||
#define PREVOP(V,TYPE) ((yamop *)((CODEADDR)(V)-(CELL)NEXTOP((yamop *)NULL,TYPE)))
|
#define PREVOP(V,TYPE) ((yamop *)((CODEADDR)(V)-(CELL)NEXTOP((yamop *)NULL,TYPE)))
|
||||||
|
|
||||||
#if defined(TABLING) || defined(SBA)
|
#if defined(TABLING) || defined(YAPOR_SBA)
|
||||||
typedef struct trail_frame {
|
typedef struct trail_frame {
|
||||||
Term term;
|
Term term;
|
||||||
CELL value;
|
CELL value;
|
||||||
@ -888,7 +888,7 @@ typedef Term *tr_fr_ptr;
|
|||||||
|
|
||||||
#define TrailTerm(X) (*(X))
|
#define TrailTerm(X) (*(X))
|
||||||
#define TrailVal(X) OOOOOOPS: this program should not compile
|
#define TrailVal(X) OOOOOOPS: this program should not compile
|
||||||
#endif /* TABLING || SBA */
|
#endif /* TABLING || YAPOR_SBA */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -978,7 +978,7 @@ typedef struct choicept {
|
|||||||
#define SHOULD_CUT_UP_TO(X,Y) ((X) != (Y))
|
#define SHOULD_CUT_UP_TO(X,Y) ((X) != (Y))
|
||||||
/* #define SHOULD_CUT_UP_TO(X,Y) ((X) (Y)) */
|
/* #define SHOULD_CUT_UP_TO(X,Y) ((X) (Y)) */
|
||||||
|
|
||||||
#ifdef SBA
|
#ifdef YAPOR_SBA
|
||||||
#define SHARED_CP(CP) ((CP) >= B_FZ || (CP) < (choiceptr)H_FZ)
|
#define SHARED_CP(CP) ((CP) >= B_FZ || (CP) < (choiceptr)H_FZ)
|
||||||
|
|
||||||
#define YOUNGER_CP(CP1, CP2) \
|
#define YOUNGER_CP(CP1, CP2) \
|
||||||
@ -998,13 +998,13 @@ typedef struct choicept {
|
|||||||
#define YOUNGER_H(H1, H2) FIXMEE!!!!
|
#define YOUNGER_H(H1, H2) FIXMEE!!!!
|
||||||
|
|
||||||
|
|
||||||
#else /* ENV_COPY || ACOW */
|
#else /* YAPOR_COPY || YAPOR_COW */
|
||||||
#define YOUNGER_CP(CP1, CP2) ((CP1) < (CP2))
|
#define YOUNGER_CP(CP1, CP2) ((CP1) < (CP2))
|
||||||
#define EQUAL_OR_YOUNGER_CP(CP1, CP2) ((CP1) <= (CP2))
|
#define EQUAL_OR_YOUNGER_CP(CP1, CP2) ((CP1) <= (CP2))
|
||||||
|
|
||||||
#define YOUNGER_H(H1, H2) ((CELL *)(H1) > (CELL *)(H2))
|
#define YOUNGER_H(H1, H2) ((CELL *)(H1) > (CELL *)(H2))
|
||||||
|
|
||||||
#endif /* SBA */
|
#endif /* YAPOR_SBA */
|
||||||
|
|
||||||
#define YOUNGEST_CP(CP1, CP2) (YOUNGER_CP(CP1,CP2) ? (CP1) : (CP2))
|
#define YOUNGEST_CP(CP1, CP2) (YOUNGER_CP(CP1,CP2) ? (CP1) : (CP2))
|
||||||
|
|
||||||
|
25
H/dglobals.h
25
H/dglobals.h
@ -24,39 +24,34 @@
|
|||||||
|
|
||||||
#if THREADS
|
#if THREADS
|
||||||
|
|
||||||
#define NOfThreads Yap_global->n_of_threads
|
#define Yap_NOfThreads Yap_global->n_of_threads
|
||||||
|
|
||||||
#define NOfThreadsCreated Yap_global->n_of_threads_created
|
#define Yap_NOfThreadsCreated Yap_global->n_of_threads_created
|
||||||
|
|
||||||
#define ThreadsTotalTime Yap_global->threads_total_time
|
#define Yap_ThreadsTotalTime Yap_global->threads_total_time
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
|
||||||
#define BGL Yap_global->bgl
|
#define Yap_BGL Yap_global->bgl
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define Yap_AllowLocalExpansion Yap_global->allow_local_expansion
|
#define Yap_AllowLocalExpansion Yap_global->allow_local_expansion
|
||||||
#define Yap_AllowGlobalExpansion Yap_global->allow_global_expansion
|
#define Yap_AllowGlobalExpansion Yap_global->allow_global_expansion
|
||||||
#define Yap_AllowTrailExpansion Yap_global->allow_trail_expansion
|
#define Yap_AllowTrailExpansion Yap_global->allow_trail_expansion
|
||||||
#define SizeOfOverflow Yap_global->size_of_overflow
|
#define Yap_SizeOfOverflow Yap_global->size_of_overflow
|
||||||
|
|
||||||
#define AGcLastCall Yap_global->agc_last_call
|
#define Yap_AGcLastCall Yap_global->agc_last_call
|
||||||
|
|
||||||
#define AGcThreshold Yap_global->agc_threshold
|
#define Yap_AGcThreshold Yap_global->agc_threshold
|
||||||
#define AGCHook Yap_global->agc_hook
|
#define Yap_AGCHook Yap_global->agc_hook
|
||||||
|
|
||||||
#if HAVE_LIBREADLINE
|
|
||||||
#define ReadlineBuf Yap_global->readline_buf
|
|
||||||
#define ReadlinePos Yap_global->readline_pos
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
#define ThreadHandlesLock Yap_global->thread_handles_lock
|
#define Yap_ThreadHandlesLock Yap_global->thread_handles_lock
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
#define GLOBAL Yap_global->global
|
#define Yap_optyap_data Yap_global->optyap_data
|
||||||
#define REMOTE Yap_global->remote
|
#define REMOTE Yap_global->remote
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@
|
|||||||
#if GC_NO_TAGS
|
#if GC_NO_TAGS
|
||||||
#define Yap_bp WL->b_p
|
#define Yap_bp WL->b_p
|
||||||
#endif
|
#endif
|
||||||
#if defined(TABLING) || defined(SBA)
|
#if defined(TABLING) || defined(YAPOR_SBA)
|
||||||
#define sTR WL->wl_sTR
|
#define sTR WL->wl_sTR
|
||||||
#define sTR0 WL->wl_sTR0
|
#define sTR0 WL->wl_sTR0
|
||||||
#define new_TR WL->new_tr
|
#define new_TR WL->new_tr
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct worker_shared {
|
typedef struct global_data {
|
||||||
|
|
||||||
#if THREADS
|
#if THREADS
|
||||||
|
|
||||||
@ -46,17 +46,12 @@ typedef struct worker_shared {
|
|||||||
UInt agc_threshold;
|
UInt agc_threshold;
|
||||||
Agc_hook agc_hook;
|
Agc_hook agc_hook;
|
||||||
|
|
||||||
#if HAVE_LIBREADLINE
|
|
||||||
char *readline_buf;
|
|
||||||
char *readline_pos;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
lockvar thread_handles_lock;
|
lockvar thread_handles_lock;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
struct global_data global;
|
struct optyap_global_data optyap_data;
|
||||||
struct local_data remote[MAX_WORKERS];
|
struct local_data remote[MAX_WORKERS];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ typedef struct worker_local {
|
|||||||
#if GC_NO_TAGS
|
#if GC_NO_TAGS
|
||||||
char* b_p;
|
char* b_p;
|
||||||
#endif
|
#endif
|
||||||
#if defined(TABLING) || defined(SBA)
|
#if defined(TABLING) || defined(YAPOR_SBA)
|
||||||
struct trail_frame* wl_sTR;
|
struct trail_frame* wl_sTR;
|
||||||
struct trail_frame* wl_sTR0;
|
struct trail_frame* wl_sTR0;
|
||||||
struct trail_frame* new_tr;
|
struct trail_frame* new_tr;
|
||||||
|
@ -46,11 +46,6 @@ static void InitGlobal(void) {
|
|||||||
Yap_global->agc_threshold = 10000;
|
Yap_global->agc_threshold = 10000;
|
||||||
Yap_global->agc_hook = NULL;
|
Yap_global->agc_hook = NULL;
|
||||||
|
|
||||||
#if HAVE_LIBREADLINE
|
|
||||||
Yap_global->readline_buf = NULL;
|
|
||||||
Yap_global->readline_pos = 0L;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
INIT_LOCK(Yap_global->thread_handles_lock);
|
INIT_LOCK(Yap_global->thread_handles_lock);
|
||||||
#endif
|
#endif
|
||||||
|
198
H/ilocals.h
198
H/ilocals.h
@ -5,134 +5,134 @@
|
|||||||
|
|
||||||
static void InitWorker(int wid) {
|
static void InitWorker(int wid) {
|
||||||
|
|
||||||
FOREIGN_WL(wid)->c_input_stream = 0;
|
FOREIGN(wid)->c_input_stream = 0;
|
||||||
FOREIGN_WL(wid)->c_output_stream = 1;
|
FOREIGN(wid)->c_output_stream = 1;
|
||||||
FOREIGN_WL(wid)->c_error_stream = 2;
|
FOREIGN(wid)->c_error_stream = 2;
|
||||||
|
|
||||||
FOREIGN_WL(wid)->rinfo.old_ASP = NULL;
|
FOREIGN(wid)->rinfo.old_ASP = NULL;
|
||||||
FOREIGN_WL(wid)->rinfo.old_LCL0 = NULL;
|
FOREIGN(wid)->rinfo.old_LCL0 = NULL;
|
||||||
FOREIGN_WL(wid)->rinfo.old_TR = NULL;
|
FOREIGN(wid)->rinfo.old_TR = NULL;
|
||||||
FOREIGN_WL(wid)->rinfo.old_GlobalBase = NULL;
|
FOREIGN(wid)->rinfo.old_GlobalBase = NULL;
|
||||||
FOREIGN_WL(wid)->rinfo.old_H = NULL;
|
FOREIGN(wid)->rinfo.old_H = NULL;
|
||||||
FOREIGN_WL(wid)->rinfo.old_H0 = NULL;
|
FOREIGN(wid)->rinfo.old_H0 = NULL;
|
||||||
FOREIGN_WL(wid)->rinfo.old_TrailBase = NULL;
|
FOREIGN(wid)->rinfo.old_TrailBase = NULL;
|
||||||
FOREIGN_WL(wid)->rinfo.old_TrailTop = NULL;
|
FOREIGN(wid)->rinfo.old_TrailTop = NULL;
|
||||||
FOREIGN_WL(wid)->rinfo.old_HeapBase = NULL;
|
FOREIGN(wid)->rinfo.old_HeapBase = NULL;
|
||||||
FOREIGN_WL(wid)->rinfo.old_HeapTop = NULL;
|
FOREIGN(wid)->rinfo.old_HeapTop = NULL;
|
||||||
FOREIGN_WL(wid)->rinfo.cl_diff = 0L;
|
FOREIGN(wid)->rinfo.cl_diff = 0L;
|
||||||
FOREIGN_WL(wid)->rinfo.g_diff = 0L;
|
FOREIGN(wid)->rinfo.g_diff = 0L;
|
||||||
FOREIGN_WL(wid)->rinfo.h_diff = 0L;
|
FOREIGN(wid)->rinfo.h_diff = 0L;
|
||||||
FOREIGN_WL(wid)->rinfo.g_diff0 = 0L;
|
FOREIGN(wid)->rinfo.g_diff0 = 0L;
|
||||||
FOREIGN_WL(wid)->rinfo.g_split = NULL;
|
FOREIGN(wid)->rinfo.g_split = NULL;
|
||||||
FOREIGN_WL(wid)->rinfo.l_diff = 0L;
|
FOREIGN(wid)->rinfo.l_diff = 0L;
|
||||||
FOREIGN_WL(wid)->rinfo.tr_diff = 0L;
|
FOREIGN(wid)->rinfo.tr_diff = 0L;
|
||||||
FOREIGN_WL(wid)->rinfo.x_diff = 0L;
|
FOREIGN(wid)->rinfo.x_diff = 0L;
|
||||||
FOREIGN_WL(wid)->rinfo.delay_diff = 0L;
|
FOREIGN(wid)->rinfo.delay_diff = 0L;
|
||||||
FOREIGN_WL(wid)->rinfo.base_diff = 0L;
|
FOREIGN(wid)->rinfo.base_diff = 0L;
|
||||||
FOREIGN_WL(wid)->call_counters.reductions = 0L;
|
FOREIGN(wid)->call_counters.reductions = 0L;
|
||||||
FOREIGN_WL(wid)->call_counters.reductions_retries = 0L;
|
FOREIGN(wid)->call_counters.reductions_retries = 0L;
|
||||||
FOREIGN_WL(wid)->call_counters.retries = 0L;
|
FOREIGN(wid)->call_counters.retries = 0L;
|
||||||
FOREIGN_WL(wid)->call_counters.reductions_on = 0L;
|
FOREIGN(wid)->call_counters.reductions_on = 0L;
|
||||||
FOREIGN_WL(wid)->call_counters.reductions_retries_on = 0L;
|
FOREIGN(wid)->call_counters.reductions_retries_on = 0L;
|
||||||
FOREIGN_WL(wid)->call_counters.retries_on = 0L;
|
FOREIGN(wid)->call_counters.retries_on = 0L;
|
||||||
FOREIGN_WL(wid)->interrupts_disabled = FALSE;
|
FOREIGN(wid)->interrupts_disabled = FALSE;
|
||||||
|
|
||||||
|
|
||||||
FOREIGN_WL(wid)->consultsp = NULL;
|
FOREIGN(wid)->consultsp = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FOREIGN_WL(wid)->consultbase = NULL;
|
FOREIGN(wid)->consultbase = NULL;
|
||||||
|
|
||||||
FOREIGN_WL(wid)->consultlow = NULL;
|
FOREIGN(wid)->consultlow = NULL;
|
||||||
|
|
||||||
FOREIGN_WL(wid)->global_arena = 0L;
|
FOREIGN(wid)->global_arena = 0L;
|
||||||
FOREIGN_WL(wid)->global_arena_overflows = 0L;
|
FOREIGN(wid)->global_arena_overflows = 0L;
|
||||||
FOREIGN_WL(wid)->delay_arena_overflows = 0L;
|
FOREIGN(wid)->delay_arena_overflows = 0L;
|
||||||
FOREIGN_WL(wid)->arena_overflows = 0L;
|
FOREIGN(wid)->arena_overflows = 0L;
|
||||||
FOREIGN_WL(wid)->depth_arenas = 0;
|
FOREIGN(wid)->depth_arenas = 0;
|
||||||
FOREIGN_WL(wid)->arith_error = FALSE;
|
FOREIGN(wid)->arith_error = FALSE;
|
||||||
FOREIGN_WL(wid)->last_asserted_pred = NULL;
|
FOREIGN(wid)->last_asserted_pred = NULL;
|
||||||
FOREIGN_WL(wid)->debug_on = FALSE;
|
FOREIGN(wid)->debug_on = FALSE;
|
||||||
FOREIGN_WL(wid)->f_info = NULL;
|
FOREIGN(wid)->f_info = NULL;
|
||||||
FOREIGN_WL(wid)->scanner_stack = NULL;
|
FOREIGN(wid)->scanner_stack = NULL;
|
||||||
FOREIGN_WL(wid)->scanner_extra_blocks = NULL;
|
FOREIGN(wid)->scanner_extra_blocks = NULL;
|
||||||
FOREIGN_WL(wid)->ball_term = NULL;
|
FOREIGN(wid)->ball_term = NULL;
|
||||||
FOREIGN_WL(wid)->active_signals = 0L;
|
FOREIGN(wid)->active_signals = 0L;
|
||||||
FOREIGN_WL(wid)->i_pred_arity = 0L;
|
FOREIGN(wid)->i_pred_arity = 0L;
|
||||||
FOREIGN_WL(wid)->prof_end = NULL;
|
FOREIGN(wid)->prof_end = NULL;
|
||||||
FOREIGN_WL(wid)->uncaught_throw = FALSE;
|
FOREIGN(wid)->uncaught_throw = FALSE;
|
||||||
FOREIGN_WL(wid)->doing_undefp = FALSE;
|
FOREIGN(wid)->doing_undefp = FALSE;
|
||||||
FOREIGN_WL(wid)->start_line = 0L;
|
FOREIGN(wid)->start_line = 0L;
|
||||||
InitScratchPad(wid);
|
InitScratchPad(wid);
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
FOREIGN_WL(wid)->woken_goals = 0L;
|
FOREIGN(wid)->woken_goals = 0L;
|
||||||
FOREIGN_WL(wid)->atts_mutable_list = 0L;
|
FOREIGN(wid)->atts_mutable_list = 0L;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FOREIGN_WL(wid)->gc_generation = 0L;
|
FOREIGN(wid)->gc_generation = 0L;
|
||||||
FOREIGN_WL(wid)->gc_phase = 0L;
|
FOREIGN(wid)->gc_phase = 0L;
|
||||||
FOREIGN_WL(wid)->gc_current_phase = 0L;
|
FOREIGN(wid)->gc_current_phase = 0L;
|
||||||
FOREIGN_WL(wid)->gc_calls = 0L;
|
FOREIGN(wid)->gc_calls = 0L;
|
||||||
FOREIGN_WL(wid)->tot_gc_time = 0L;
|
FOREIGN(wid)->tot_gc_time = 0L;
|
||||||
FOREIGN_WL(wid)->tot_gc_recovered = 0L;
|
FOREIGN(wid)->tot_gc_recovered = 0L;
|
||||||
FOREIGN_WL(wid)->last_gc_time = 0L;
|
FOREIGN(wid)->last_gc_time = 0L;
|
||||||
FOREIGN_WL(wid)->last_ss_time = 0L;
|
FOREIGN(wid)->last_ss_time = 0L;
|
||||||
#if LOW_LEVEL_TRACER
|
#if LOW_LEVEL_TRACER
|
||||||
FOREIGN_WL(wid)->total_cps = 0;
|
FOREIGN(wid)->total_cps = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
INIT_LOCK(FOREIGN_WL(wid)->signal_lock);
|
INIT_LOCK(FOREIGN(wid)->signal_lock);
|
||||||
FOREIGN_WL(wid)->wpp = NULL;
|
FOREIGN(wid)->wpp = NULL;
|
||||||
|
|
||||||
FOREIGN_WL(wid)->tot_marked = 0L;
|
FOREIGN(wid)->tot_marked = 0L;
|
||||||
FOREIGN_WL(wid)->tot_oldies = 0L;
|
FOREIGN(wid)->tot_oldies = 0L;
|
||||||
#if DEBUG && COROUTINING
|
#if DEBUG && COROUTINING
|
||||||
FOREIGN_WL(wid)->tot_smarked = 0L;
|
FOREIGN(wid)->tot_smarked = 0L;
|
||||||
#endif
|
#endif
|
||||||
FOREIGN_WL(wid)->wl_current_B = NULL;
|
FOREIGN(wid)->wl_current_B = NULL;
|
||||||
FOREIGN_WL(wid)->wl_prev_HB = NULL;
|
FOREIGN(wid)->wl_prev_HB = NULL;
|
||||||
FOREIGN_WL(wid)->hgen = NULL;
|
FOREIGN(wid)->hgen = NULL;
|
||||||
FOREIGN_WL(wid)->ip_top = NULL;
|
FOREIGN(wid)->ip_top = NULL;
|
||||||
#if GC_NO_TAGS
|
#if GC_NO_TAGS
|
||||||
FOREIGN_WL(wid)->b_p = NULL;
|
FOREIGN(wid)->b_p = NULL;
|
||||||
#endif
|
#endif
|
||||||
#if defined(TABLING) || defined(SBA)
|
#if defined(TABLING) || defined(YAPOR_SBA)
|
||||||
FOREIGN_WL(wid)->wl_sTR = NULL;
|
FOREIGN(wid)->wl_sTR = NULL;
|
||||||
FOREIGN_WL(wid)->wl_sTR0 = NULL;
|
FOREIGN(wid)->wl_sTR0 = NULL;
|
||||||
FOREIGN_WL(wid)->new_tr = NULL;
|
FOREIGN(wid)->new_tr = NULL;
|
||||||
#else
|
#else
|
||||||
FOREIGN_WL(wid)->wl_sTR = NULL;
|
FOREIGN(wid)->wl_sTR = NULL;
|
||||||
FOREIGN_WL(wid)->wl_sTR0 = NULL;
|
FOREIGN(wid)->wl_sTR0 = NULL;
|
||||||
FOREIGN_WL(wid)->new_tr = NULL;
|
FOREIGN(wid)->new_tr = NULL;
|
||||||
#endif
|
#endif
|
||||||
FOREIGN_WL(wid)->conttop0 = NULL;
|
FOREIGN(wid)->conttop0 = NULL;
|
||||||
FOREIGN_WL(wid)->conttop = NULL;
|
FOREIGN(wid)->conttop = NULL;
|
||||||
FOREIGN_WL(wid)->disc_trail_entries = 0;
|
FOREIGN(wid)->disc_trail_entries = 0;
|
||||||
|
|
||||||
FOREIGN_WL(wid)->Gc_ma_h_top = NULL;
|
FOREIGN(wid)->Gc_ma_h_top = NULL;
|
||||||
FOREIGN_WL(wid)->Gc_ma_h_list = NULL;
|
FOREIGN(wid)->Gc_ma_h_list = NULL;
|
||||||
FOREIGN_WL(wid)->Gc_timestamp = 0L;
|
FOREIGN(wid)->Gc_timestamp = 0L;
|
||||||
FOREIGN_WL(wid)->DB_vec = NULL;
|
FOREIGN(wid)->DB_vec = NULL;
|
||||||
FOREIGN_WL(wid)->DB_vec0 = NULL;
|
FOREIGN(wid)->DB_vec0 = NULL;
|
||||||
FOREIGN_WL(wid)->DB_root = NULL;
|
FOREIGN(wid)->DB_root = NULL;
|
||||||
FOREIGN_WL(wid)->DB_nil = NULL;
|
FOREIGN(wid)->DB_nil = NULL;
|
||||||
#endif /* defined(YAPOR) || defined(THREADS) */
|
#endif /* defined(YAPOR) || defined(THREADS) */
|
||||||
|
|
||||||
FOREIGN_WL(wid)->dynamic_arrays = NULL;
|
FOREIGN(wid)->dynamic_arrays = NULL;
|
||||||
FOREIGN_WL(wid)->static_arrays = NULL;
|
FOREIGN(wid)->static_arrays = NULL;
|
||||||
FOREIGN_WL(wid)->global_variables = NULL;
|
FOREIGN(wid)->global_variables = NULL;
|
||||||
FOREIGN_WL(wid)->allow_restart = FALSE;
|
FOREIGN(wid)->allow_restart = FALSE;
|
||||||
|
|
||||||
FOREIGN_WL(wid)->cmem_first_block = NULL;
|
FOREIGN(wid)->cmem_first_block = NULL;
|
||||||
FOREIGN_WL(wid)->cmem_first_block_sz = 0L;
|
FOREIGN(wid)->cmem_first_block_sz = 0L;
|
||||||
|
|
||||||
FOREIGN_WL(wid)->label_first_array = NULL;
|
FOREIGN(wid)->label_first_array = NULL;
|
||||||
FOREIGN_WL(wid)->label_first_array_sz = 0L;
|
FOREIGN(wid)->label_first_array_sz = 0L;
|
||||||
|
|
||||||
FOREIGN_WL(wid)->Yap_ld_ = Yap_InitThreadIO(wid);
|
FOREIGN(wid)->Yap_ld_ = Yap_InitThreadIO(wid);
|
||||||
FOREIGN_WL(wid)->_execution = NULL;
|
FOREIGN(wid)->_execution = NULL;
|
||||||
|
|
||||||
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
|
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
|
||||||
|
|
||||||
|
@ -46,11 +46,6 @@ static void RestoreGlobal(void) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if HAVE_LIBREADLINE
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
REINIT_LOCK(Yap_global->thread_handles_lock);
|
REINIT_LOCK(Yap_global->thread_handles_lock);
|
||||||
#endif
|
#endif
|
||||||
|
20
H/rlocals.h
20
H/rlocals.h
@ -46,7 +46,7 @@ static void RestoreWorker(int wid USES_REGS) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
FOREIGN_WL(wid)->global_arena = TermToGlobalOrAtomAdjust(FOREIGN_WL(wid)->global_arena);
|
FOREIGN(wid)->global_arena = TermToGlobalOrAtomAdjust(FOREIGN(wid)->global_arena);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -66,12 +66,12 @@ static void RestoreWorker(int wid USES_REGS) {
|
|||||||
|
|
||||||
|
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
FOREIGN_WL(wid)->woken_goals = TermToGlobalAdjust(FOREIGN_WL(wid)->woken_goals);
|
FOREIGN(wid)->woken_goals = TermToGlobalAdjust(FOREIGN(wid)->woken_goals);
|
||||||
FOREIGN_WL(wid)->atts_mutable_list = TermToGlobalAdjust(FOREIGN_WL(wid)->atts_mutable_list);
|
FOREIGN(wid)->atts_mutable_list = TermToGlobalAdjust(FOREIGN(wid)->atts_mutable_list);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FOREIGN_WL(wid)->gc_generation = TermToGlobalAdjust(FOREIGN_WL(wid)->gc_generation);
|
FOREIGN(wid)->gc_generation = TermToGlobalAdjust(FOREIGN(wid)->gc_generation);
|
||||||
FOREIGN_WL(wid)->gc_phase = TermToGlobalAdjust(FOREIGN_WL(wid)->gc_phase);
|
FOREIGN(wid)->gc_phase = TermToGlobalAdjust(FOREIGN(wid)->gc_phase);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ static void RestoreWorker(int wid USES_REGS) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
REINIT_LOCK(FOREIGN_WL(wid)->signal_lock);
|
REINIT_LOCK(FOREIGN(wid)->signal_lock);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ static void RestoreWorker(int wid USES_REGS) {
|
|||||||
#if GC_NO_TAGS
|
#if GC_NO_TAGS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(TABLING) || defined(SBA)
|
#if defined(TABLING) || defined(YAPOR_SBA)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -120,9 +120,9 @@ static void RestoreWorker(int wid USES_REGS) {
|
|||||||
|
|
||||||
#endif /* defined(YAPOR) || defined(THREADS) */
|
#endif /* defined(YAPOR) || defined(THREADS) */
|
||||||
|
|
||||||
FOREIGN_WL(wid)->dynamic_arrays = PtoArrayEAdjust(FOREIGN_WL(wid)->dynamic_arrays);
|
FOREIGN(wid)->dynamic_arrays = PtoArrayEAdjust(FOREIGN(wid)->dynamic_arrays);
|
||||||
FOREIGN_WL(wid)->static_arrays = PtoArraySAdjust(FOREIGN_WL(wid)->static_arrays);
|
FOREIGN(wid)->static_arrays = PtoArraySAdjust(FOREIGN(wid)->static_arrays);
|
||||||
FOREIGN_WL(wid)->global_variables = PtoGlobalEAdjust(FOREIGN_WL(wid)->global_variables);
|
FOREIGN(wid)->global_variables = PtoGlobalEAdjust(FOREIGN(wid)->global_variables);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
2
INSTALL
2
INSTALL
@ -62,7 +62,7 @@ quality:
|
|||||||
|
|
||||||
o -DYAPOR gives or-parallelism in Muse style. If you add -DSBA to it
|
o -DYAPOR gives or-parallelism in Muse style. If you add -DSBA to it
|
||||||
you will have the Sparse Binding Array instead of copying. If you add
|
you will have the Sparse Binding Array instead of copying. If you add
|
||||||
-DACOW instead you will have the \alphaCOW model, that is, forking
|
-DYAPOR_COW instead you will have the \alphaCOW model, that is, forking
|
||||||
instead of copying.
|
instead of copying.
|
||||||
|
|
||||||
1.3 Porting Yap
|
1.3 Porting Yap
|
||||||
|
32
Makefile.in
32
Makefile.in
@ -42,9 +42,9 @@ DOCSDIR=$(SHAREDIR)/doc/Yap
|
|||||||
#
|
#
|
||||||
# very experimental stuff, you'll need to contact the developers
|
# very experimental stuff, you'll need to contact the developers
|
||||||
# if you want to use this:
|
# if you want to use this:
|
||||||
# -DENV_COPY: or-parallelism with environment copying, in Muse style.
|
# -DYAPOR_COPY: or-parallelism with environment copying, in Muse style.
|
||||||
# -DSBA: or-parallelism with sparse binding arrays.
|
# -DYAPOR_SBA: or-parallelism with sparse binding arrays.
|
||||||
# -DACOW: or-parallelism with copy-on-write.
|
# -DYAPOR_COW: or-parallelism with copy-on-write.
|
||||||
# -DTABLING: support for tabling
|
# -DTABLING: support for tabling
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -187,7 +187,7 @@ HEADERS = \
|
|||||||
$(srcdir)/OPTYap/opt.config.h \
|
$(srcdir)/OPTYap/opt.config.h \
|
||||||
$(srcdir)/OPTYap/opt.proto.h $(srcdir)/OPTYap/opt.structs.h \
|
$(srcdir)/OPTYap/opt.proto.h $(srcdir)/OPTYap/opt.structs.h \
|
||||||
$(srcdir)/OPTYap/opt.macros.h $(srcdir)/OPTYap/or.macros.h \
|
$(srcdir)/OPTYap/opt.macros.h $(srcdir)/OPTYap/or.macros.h \
|
||||||
$(srcdir)/OPTYap/or.sbaamiops.h $(srcdir)/OPTYap/or.sbaunify.h \
|
$(srcdir)/OPTYap/or.sba_amiops.h $(srcdir)/OPTYap/or.sba_unify.h \
|
||||||
$(srcdir)/OPTYap/tab.structs.h $(srcdir)/OPTYap/locks_x86.h \
|
$(srcdir)/OPTYap/tab.structs.h $(srcdir)/OPTYap/locks_x86.h \
|
||||||
$(srcdir)/OPTYap/locks_sparc.h $(srcdir)/OPTYap/locks_mips.h \
|
$(srcdir)/OPTYap/locks_sparc.h $(srcdir)/OPTYap/locks_mips.h \
|
||||||
$(srcdir)/OPTYap/locks_mips_funcs.h $(srcdir)/OPTYap/locks_alpha.h \
|
$(srcdir)/OPTYap/locks_mips_funcs.h $(srcdir)/OPTYap/locks_alpha.h \
|
||||||
@ -261,9 +261,9 @@ C_SOURCES= \
|
|||||||
$(srcdir)/BEAM/eamindex.c $(srcdir)/BEAM/eamamasm.c \
|
$(srcdir)/BEAM/eamindex.c $(srcdir)/BEAM/eamamasm.c \
|
||||||
$(srcdir)/BEAM/eam_gc.c $(srcdir)/BEAM/eam_split.c \
|
$(srcdir)/BEAM/eam_gc.c $(srcdir)/BEAM/eam_split.c \
|
||||||
$(srcdir)/OPTYap/opt.memory.c $(srcdir)/OPTYap/opt.init.c \
|
$(srcdir)/OPTYap/opt.memory.c $(srcdir)/OPTYap/opt.init.c \
|
||||||
$(srcdir)/OPTYap/opt.preds.c $(srcdir)/OPTYap/or.engine.c \
|
$(srcdir)/OPTYap/opt.preds.c $(srcdir)/OPTYap/or.copy_engine.c \
|
||||||
$(srcdir)/OPTYap/or.cowengine.c $(srcdir)/OPTYap/or.sbaengine.c \
|
$(srcdir)/OPTYap/or.cow_engine.c $(srcdir)/OPTYap/or.sba_engine.c \
|
||||||
$(srcdir)/OPTYap/or.threadengine.c \
|
$(srcdir)/OPTYap/or.thread_engine.c \
|
||||||
$(srcdir)/OPTYap/or.scheduler.c $(srcdir)/OPTYap/or.cut.c \
|
$(srcdir)/OPTYap/or.scheduler.c $(srcdir)/OPTYap/or.cut.c \
|
||||||
$(srcdir)/OPTYap/tab.tries.c $(srcdir)/OPTYap/tab.completion.c \
|
$(srcdir)/OPTYap/tab.tries.c $(srcdir)/OPTYap/tab.completion.c \
|
||||||
$(srcdir)/library/mpi/mpi.c $(srcdir)/library/mpi/mpe.c \
|
$(srcdir)/library/mpi/mpi.c $(srcdir)/library/mpi/mpe.c \
|
||||||
@ -378,7 +378,7 @@ C_INTERFACE_OBJECTS = \
|
|||||||
|
|
||||||
OR_OBJECTS = \
|
OR_OBJECTS = \
|
||||||
opt.memory.o opt.init.o opt.preds.o \
|
opt.memory.o opt.init.o opt.preds.o \
|
||||||
or.engine.o or.cowengine.o or.sbaengine.o or.threadengine.o \
|
or.copy_engine.o or.cow_engine.o or.sba_engine.o or.thread_engine.o \
|
||||||
or.scheduler.o or.cut.o \
|
or.scheduler.o or.cut.o \
|
||||||
tab.tries.o tab.completion.o
|
tab.tries.o tab.completion.o
|
||||||
|
|
||||||
@ -500,17 +500,17 @@ opt.preds.o: $(srcdir)/OPTYap/opt.preds.c config.h
|
|||||||
or.cut.o: $(srcdir)/OPTYap/or.cut.c config.h
|
or.cut.o: $(srcdir)/OPTYap/or.cut.c config.h
|
||||||
$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/or.cut.c -o $@
|
$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/or.cut.c -o $@
|
||||||
|
|
||||||
or.engine.o: $(srcdir)/OPTYap/or.engine.c config.h
|
or.copy_engine.o: $(srcdir)/OPTYap/or.copy_engine.c config.h
|
||||||
$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/or.engine.c -o $@
|
$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/or.copy_engine.c -o $@
|
||||||
|
|
||||||
or.cowengine.o: $(srcdir)/OPTYap/or.cowengine.c config.h
|
or.cow_engine.o: $(srcdir)/OPTYap/or.cow_engine.c config.h
|
||||||
$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/or.cowengine.c -o $@
|
$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/or.cow_engine.c -o $@
|
||||||
|
|
||||||
or.sbaengine.o: $(srcdir)/OPTYap/or.sbaengine.c config.h
|
or.sba_engine.o: $(srcdir)/OPTYap/or.sba_engine.c config.h
|
||||||
$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/or.sbaengine.c -o $@
|
$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/or.sba_engine.c -o $@
|
||||||
|
|
||||||
or.threadengine.o: $(srcdir)/OPTYap/or.threadengine.c config.h
|
or.thread_engine.o: $(srcdir)/OPTYap/or.thread_engine.c config.h
|
||||||
$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/or.threadengine.c -o $@
|
$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/or.thread_engine.c -o $@
|
||||||
|
|
||||||
or.scheduler.o: $(srcdir)/OPTYap/or.scheduler.c config.h
|
or.scheduler.o: $(srcdir)/OPTYap/or.scheduler.c config.h
|
||||||
$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/or.scheduler.c -o $@
|
$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/or.scheduler.c -o $@
|
||||||
|
@ -28,19 +28,19 @@
|
|||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
#include "tab.macros.h"
|
#include "tab.macros.h"
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
#if defined(TABLING) || !defined(ACOW)
|
#if defined(TABLING) || !defined(YAPOR_COW)
|
||||||
#ifndef TABLING
|
#ifndef TABLING
|
||||||
#include "opt.mavar.h"
|
#include "opt.mavar.h"
|
||||||
#endif /* !TABLING */
|
#endif /* !TABLING */
|
||||||
#ifdef MULTI_ASSIGNMENT_VARIABLES
|
#ifdef MULTI_ASSIGNMENT_VARIABLES
|
||||||
ma_hash_entry Yap_ma_hash_table[MAVARS_HASH_SIZE];
|
ma_hash_entry Yap_ma_hash_table[MAVARS_HASH_SIZE];
|
||||||
UInt Yap_timestamp; /* an unsigned int */
|
UInt Yap_ma_timestamp; /* an unsigned int */
|
||||||
ma_h_inner_struct *Yap_ma_h_top;
|
ma_h_inner_struct *Yap_ma_h_top;
|
||||||
#endif /* MULTI_ASSIGNMENT_VARIABLES */
|
#endif /* MULTI_ASSIGNMENT_VARIABLES */
|
||||||
#endif /* TABLING || !ACOW */
|
#endif /* TABLING || !YAPOR_COW */
|
||||||
#ifdef ACOW
|
#ifdef YAPOR_COW
|
||||||
#include "sys/wait.h"
|
#include "sys/wait.h"
|
||||||
#endif /* ACOW */
|
#endif /* YAPOR_COW */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -78,99 +78,99 @@ struct worker WORKER;
|
|||||||
** Global functions **
|
** Global functions **
|
||||||
*******************************/
|
*******************************/
|
||||||
|
|
||||||
void Yap_init_global(int max_table_size, int n_workers, int sch_loop, int delay_load) {
|
void Yap_init_optyap_global(int max_table_size, int n_workers, int sch_loop, int delay_load) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* global data related to memory management */
|
/* global data related to memory management */
|
||||||
#ifdef LIMIT_TABLING
|
#ifdef LIMIT_TABLING
|
||||||
if (max_table_size)
|
if (max_table_size)
|
||||||
GLOBAL_MAX_PAGES = ((max_table_size - 1) * 1024 * 1024 / SHMMAX + 1) * SHMMAX / Yap_page_size;
|
Yap_max_pages = ((max_table_size - 1) * 1024 * 1024 / SHMMAX + 1) * SHMMAX / Yap_page_size;
|
||||||
else
|
else
|
||||||
GLOBAL_MAX_PAGES = -1;
|
Yap_max_pages = -1;
|
||||||
#endif /* LIMIT_TABLING */
|
#endif /* LIMIT_TABLING */
|
||||||
INIT_PAGES(GLOBAL_PAGES_void, void *);
|
INIT_PAGES(Yap_pages_void, void *);
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
INIT_PAGES(GLOBAL_PAGES_or_fr, struct or_frame);
|
INIT_PAGES(Yap_pages_or_fr , struct or_frame);
|
||||||
INIT_PAGES(GLOBAL_PAGES_qg_sol_fr, struct query_goal_solution_frame);
|
INIT_PAGES(Yap_pages_qg_sol_fr , struct query_goal_solution_frame);
|
||||||
INIT_PAGES(GLOBAL_PAGES_qg_ans_fr, struct query_goal_answer_frame);
|
INIT_PAGES(Yap_pages_qg_ans_fr, struct query_goal_answer_frame);
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
#ifdef TABLING_INNER_CUTS
|
#ifdef TABLING_INNER_CUTS
|
||||||
INIT_PAGES(GLOBAL_PAGES_tg_sol_fr, struct table_subgoal_solution_frame);
|
INIT_PAGES(Yap_pages_tg_sol_fr, struct table_subgoal_solution_frame);
|
||||||
INIT_PAGES(GLOBAL_PAGES_tg_ans_fr, struct table_subgoal_answer_frame);
|
INIT_PAGES(Yap_pages_tg_ans_fr, struct table_subgoal_answer_frame);
|
||||||
#endif /* TABLING_INNER_CUTS */
|
#endif /* TABLING_INNER_CUTS */
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
INIT_PAGES(GLOBAL_PAGES_tab_ent, struct table_entry);
|
INIT_PAGES(Yap_pages_tab_ent, struct table_entry);
|
||||||
INIT_PAGES(GLOBAL_PAGES_sg_fr, struct subgoal_frame);
|
INIT_PAGES(Yap_pages_sg_fr, struct subgoal_frame);
|
||||||
INIT_PAGES(GLOBAL_PAGES_dep_fr, struct dependency_frame);
|
INIT_PAGES(Yap_pages_dep_fr, struct dependency_frame);
|
||||||
INIT_PAGES(GLOBAL_PAGES_sg_node, struct subgoal_trie_node);
|
INIT_PAGES(Yap_pages_sg_node, struct subgoal_trie_node);
|
||||||
INIT_PAGES(GLOBAL_PAGES_ans_node, struct answer_trie_node);
|
INIT_PAGES(Yap_pages_ans_node, struct answer_trie_node);
|
||||||
INIT_PAGES(GLOBAL_PAGES_gt_node, struct global_trie_node);
|
INIT_PAGES(Yap_pages_gt_node, struct global_trie_node);
|
||||||
INIT_PAGES(GLOBAL_PAGES_sg_hash, struct subgoal_trie_hash);
|
INIT_PAGES(Yap_pages_sg_hash, struct subgoal_trie_hash);
|
||||||
INIT_PAGES(GLOBAL_PAGES_ans_hash, struct answer_trie_hash);
|
INIT_PAGES(Yap_pages_ans_hash, struct answer_trie_hash);
|
||||||
INIT_PAGES(GLOBAL_PAGES_gt_hash, struct global_trie_hash);
|
INIT_PAGES(Yap_pages_gt_hash, struct global_trie_hash);
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
#if defined(YAPOR) && defined(TABLING)
|
#if defined(YAPOR) && defined(TABLING)
|
||||||
INIT_PAGES(GLOBAL_PAGES_susp_fr, struct suspension_frame);
|
INIT_PAGES(Yap_pages_susp_fr, struct suspension_frame);
|
||||||
#endif /* YAPOR && TABLING */
|
#endif /* YAPOR && TABLING */
|
||||||
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
/* global static data */
|
/* global static data */
|
||||||
number_workers = n_workers;
|
Yap_number_workers= n_workers;
|
||||||
worker_pid(0) = getpid();
|
Yap_worker_pid(0) = getpid();
|
||||||
for (i = 1; i < number_workers; i++) worker_pid(i) = 0;
|
for (i = 1; i < Yap_number_workers; i++) Yap_worker_pid(i) = 0;
|
||||||
SCHEDULER_LOOP = sch_loop;
|
Yap_scheduler_loop = sch_loop;
|
||||||
DELAYED_RELEASE_LOAD = delay_load;
|
Yap_delayed_release_load = delay_load;
|
||||||
|
|
||||||
/* global data related to or-performance */
|
/* global data related to or-performance */
|
||||||
GLOBAL_number_goals = 0;
|
Yap_number_goals = 0;
|
||||||
GLOBAL_best_times(0) = 0;
|
Yap_best_times(0) = 0;
|
||||||
GLOBAL_performance_mode = PERFORMANCE_OFF;
|
Yap_performance_mode = PERFORMANCE_OFF;
|
||||||
|
|
||||||
/* global data related to or-parallelism */
|
/* global data related to or-parallelism */
|
||||||
BITMAP_clear(GLOBAL_bm_present_workers);
|
BITMAP_clear(Yap_bm_present_workers);
|
||||||
for (i = 0; i < number_workers; i++)
|
for (i = 0; i < Yap_number_workers; i++)
|
||||||
BITMAP_insert(GLOBAL_bm_present_workers, i);
|
BITMAP_insert(Yap_bm_present_workers, i);
|
||||||
BITMAP_copy(GLOBAL_bm_idle_workers, GLOBAL_bm_present_workers);
|
BITMAP_copy(Yap_bm_idle_workers, Yap_bm_present_workers);
|
||||||
BITMAP_clear(GLOBAL_bm_root_cp_workers);
|
BITMAP_clear(Yap_bm_root_cp_workers);
|
||||||
BITMAP_clear(GLOBAL_bm_invisible_workers);
|
BITMAP_clear(Yap_bm_invisible_workers);
|
||||||
BITMAP_clear(GLOBAL_bm_requestable_workers);
|
BITMAP_clear(Yap_bm_requestable_workers);
|
||||||
BITMAP_clear(GLOBAL_bm_executing_workers);
|
BITMAP_clear(Yap_bm_executing_workers);
|
||||||
BITMAP_copy(GLOBAL_bm_finished_workers, GLOBAL_bm_present_workers);
|
BITMAP_copy(Yap_bm_finished_workers, Yap_bm_present_workers);
|
||||||
INIT_LOCK(GLOBAL_LOCKS_bm_idle_workers);
|
INIT_LOCK(Yap_locks_bm_idle_workers);
|
||||||
INIT_LOCK(GLOBAL_LOCKS_bm_root_cp_workers);
|
INIT_LOCK(Yap_locks_bm_root_cp_workers);
|
||||||
INIT_LOCK(GLOBAL_LOCKS_bm_invisible_workers);
|
INIT_LOCK(Yap_locks_bm_invisible_workers);
|
||||||
INIT_LOCK(GLOBAL_LOCKS_bm_requestable_workers);
|
INIT_LOCK(Yap_locks_bm_requestable_workers);
|
||||||
INIT_LOCK(GLOBAL_LOCKS_bm_executing_workers);
|
INIT_LOCK(Yap_locks_bm_executing_workers);
|
||||||
INIT_LOCK(GLOBAL_LOCKS_bm_finished_workers);
|
INIT_LOCK(Yap_locks_bm_finished_workers);
|
||||||
#ifdef TABLING_INNER_CUTS
|
#ifdef TABLING_INNER_CUTS
|
||||||
INIT_LOCK(GLOBAL_LOCKS_bm_pruning_workers);
|
INIT_LOCK(Yap_locks_bm_pruning_workers);
|
||||||
#endif /* TABLING_INNER_CUTS */
|
#endif /* TABLING_INNER_CUTS */
|
||||||
GLOBAL_LOCKS_who_locked_heap = MAX_WORKERS;
|
Yap_locks_who_locked_heap = MAX_WORKERS;
|
||||||
INIT_LOCK(GLOBAL_LOCKS_heap_access);
|
INIT_LOCK(Yap_locks_heap_access);
|
||||||
INIT_LOCK(GLOBAL_LOCKS_alloc_block);
|
INIT_LOCK(Yap_locks_alloc_block);
|
||||||
if (number_workers == 1)
|
if (Yap_number_workers== 1)
|
||||||
PARALLEL_EXECUTION_MODE = FALSE;
|
Yap_parallel_execution_mode = FALSE;
|
||||||
else
|
else
|
||||||
PARALLEL_EXECUTION_MODE = TRUE;
|
Yap_parallel_execution_mode = TRUE;
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
|
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
/* global data related to tabling */
|
/* global data related to tabling */
|
||||||
new_global_trie_node(GLOBAL_root_gt, 0, NULL, NULL, NULL);
|
new_global_trie_node(Yap_root_gt, 0, NULL, NULL, NULL);
|
||||||
GLOBAL_root_tab_ent = NULL;
|
Yap_root_tab_ent = NULL;
|
||||||
#ifdef LIMIT_TABLING
|
#ifdef LIMIT_TABLING
|
||||||
GLOBAL_first_sg_fr = NULL;
|
Yap_first_sg_fr = NULL;
|
||||||
GLOBAL_last_sg_fr = NULL;
|
Yap_last_sg_fr = NULL;
|
||||||
GLOBAL_check_sg_fr = NULL;
|
Yap_check_sg_fr = NULL;
|
||||||
#endif /* LIMIT_TABLING */
|
#endif /* LIMIT_TABLING */
|
||||||
GLOBAL_root_dep_fr = NULL;
|
Yap_root_dep_fr = NULL;
|
||||||
for (i = 0; i < MAX_TABLE_VARS; i++) {
|
for (i = 0; i < MAX_TABLE_VARS; i++) {
|
||||||
CELL *pt = GLOBAL_table_var_enumerator_addr(i);
|
CELL *pt = Yap_table_var_enumerator_addr(i);
|
||||||
RESET_VARIABLE(pt);
|
RESET_VARIABLE(pt);
|
||||||
}
|
}
|
||||||
#ifdef TABLE_LOCK_AT_WRITE_LEVEL
|
#ifdef TABLE_LOCK_AT_WRITE_LEVEL
|
||||||
for (i = 0; i < TABLE_LOCK_BUCKETS; i++)
|
for (i = 0; i < TABLE_LOCK_BUCKETS; i++)
|
||||||
INIT_LOCK(GLOBAL_table_lock(i));
|
INIT_LOCK(Yap_table_lock(i));
|
||||||
#endif /* TABLE_LOCK_AT_WRITE_LEVEL */
|
#endif /* TABLE_LOCK_AT_WRITE_LEVEL */
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
|
|
||||||
@ -184,13 +184,13 @@ void Yap_init_local(void) {
|
|||||||
/* local data related to or-parallelism */
|
/* local data related to or-parallelism */
|
||||||
LOCAL = REMOTE + worker_id;
|
LOCAL = REMOTE + worker_id;
|
||||||
Set_LOCAL_top_cp((choiceptr) Yap_LocalBase);
|
Set_LOCAL_top_cp((choiceptr) Yap_LocalBase);
|
||||||
LOCAL_top_or_fr = GLOBAL_root_or_fr;
|
LOCAL_top_or_fr = Yap_root_or_fr;
|
||||||
LOCAL_load = 0;
|
LOCAL_load = 0;
|
||||||
LOCAL_share_request = MAX_WORKERS;
|
LOCAL_share_request = MAX_WORKERS;
|
||||||
LOCAL_reply_signal = worker_ready;
|
LOCAL_reply_signal = worker_ready;
|
||||||
#ifdef ENV_COPY
|
#ifdef YAPOR_COPY
|
||||||
INIT_LOCK(LOCAL_lock_signals);
|
INIT_LOCK(LOCAL_lock_signals);
|
||||||
#endif /* ENV_COPY */
|
#endif /* YAPOR_COPY */
|
||||||
Set_LOCAL_prune_request(NULL);
|
Set_LOCAL_prune_request(NULL);
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
INIT_LOCK(LOCAL_lock);
|
INIT_LOCK(LOCAL_lock);
|
||||||
@ -198,10 +198,10 @@ void Yap_init_local(void) {
|
|||||||
/* local data related to tabling */
|
/* local data related to tabling */
|
||||||
LOCAL_next_free_ans_node = NULL;
|
LOCAL_next_free_ans_node = NULL;
|
||||||
LOCAL_top_sg_fr = NULL;
|
LOCAL_top_sg_fr = NULL;
|
||||||
LOCAL_top_dep_fr = GLOBAL_root_dep_fr;
|
LOCAL_top_dep_fr = Yap_root_dep_fr;
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
Set_LOCAL_top_cp_on_stack((choiceptr) Yap_LocalBase); /* ??? */
|
Set_LOCAL_top_cp_on_stack((choiceptr) Yap_LocalBase); /* ??? */
|
||||||
LOCAL_top_susp_or_fr = GLOBAL_root_or_fr;
|
LOCAL_top_susp_or_fr = Yap_root_or_fr;
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
return;
|
return;
|
||||||
@ -217,7 +217,7 @@ void make_root_frames(void) {
|
|||||||
ALLOC_OR_FRAME(or_fr);
|
ALLOC_OR_FRAME(or_fr);
|
||||||
INIT_LOCK(OrFr_lock(or_fr));
|
INIT_LOCK(OrFr_lock(or_fr));
|
||||||
OrFr_alternative(or_fr) = NULL;
|
OrFr_alternative(or_fr) = NULL;
|
||||||
BITMAP_copy(OrFr_members(or_fr), GLOBAL_bm_present_workers);
|
BITMAP_copy(OrFr_members(or_fr), Yap_bm_present_workers);
|
||||||
SetOrFr_node(or_fr, (choiceptr) Yap_LocalBase);
|
SetOrFr_node(or_fr, (choiceptr) Yap_LocalBase);
|
||||||
OrFr_nearest_livenode(or_fr) = NULL;
|
OrFr_nearest_livenode(or_fr) = NULL;
|
||||||
OrFr_depth(or_fr) = 0;
|
OrFr_depth(or_fr) = 0;
|
||||||
@ -228,21 +228,21 @@ void make_root_frames(void) {
|
|||||||
OrFr_tg_solutions(or_fr) = NULL;
|
OrFr_tg_solutions(or_fr) = NULL;
|
||||||
#endif /* TABLING_INNER_CUTS */
|
#endif /* TABLING_INNER_CUTS */
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
OrFr_owners(or_fr) = number_workers;
|
OrFr_owners(or_fr) = Yap_number_workers;
|
||||||
OrFr_next_on_stack(or_fr) = NULL;
|
OrFr_next_on_stack(or_fr) = NULL;
|
||||||
OrFr_suspensions(or_fr) = NULL;
|
OrFr_suspensions(or_fr) = NULL;
|
||||||
OrFr_nearest_suspnode(or_fr) = or_fr;
|
OrFr_nearest_suspnode(or_fr) = or_fr;
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
OrFr_next(or_fr) = NULL;
|
OrFr_next(or_fr) = NULL;
|
||||||
GLOBAL_root_or_fr = or_fr;
|
Yap_root_or_fr = or_fr;
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
|
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
/* root dependency frame */
|
/* root dependency frame */
|
||||||
if (!GLOBAL_root_dep_fr) {
|
if (!Yap_root_dep_fr) {
|
||||||
new_dependency_frame(GLOBAL_root_dep_fr, FALSE, NULL, NULL, NULL, NULL, NULL);
|
new_dependency_frame(Yap_root_dep_fr, FALSE, NULL, NULL, NULL, NULL, NULL);
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
DepFr_cons_cp(GLOBAL_root_dep_fr) = B;
|
DepFr_cons_cp(Yap_root_dep_fr) = B;
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
}
|
}
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
@ -255,8 +255,8 @@ void init_workers(void) {
|
|||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ACOW
|
#ifdef YAPOR_COW
|
||||||
if (number_workers > 1) {
|
if (Yap_number_workers> 1) {
|
||||||
int son;
|
int son;
|
||||||
son = fork();
|
son = fork();
|
||||||
if (son == -1)
|
if (son == -1)
|
||||||
@ -265,17 +265,17 @@ void init_workers(void) {
|
|||||||
/* I am the father, I must stay here and wait for my children to all die */
|
/* I am the father, I must stay here and wait for my children to all die */
|
||||||
struct sigaction sigact;
|
struct sigaction sigact;
|
||||||
|
|
||||||
GLOBAL_master_worker = getpid();
|
Yap_master_worker = getpid();
|
||||||
sigact.sa_handler = SIG_DFL;
|
sigact.sa_handler = SIG_DFL;
|
||||||
sigemptyset(&sigact.sa_mask);
|
sigemptyset(&sigact.sa_mask);
|
||||||
sigact.sa_flags = SA_RESTART;
|
sigact.sa_flags = SA_RESTART;
|
||||||
sigaction(SIGINT, &sigact, NULL);
|
sigaction(SIGINT, &sigact, NULL);
|
||||||
pause();
|
pause();
|
||||||
exit(0);
|
exit(0);
|
||||||
} else worker_pid(0) = getpid();
|
} else Yap_worker_pid(0) = getpid();
|
||||||
}
|
}
|
||||||
#endif /* ACOW */
|
#endif /* YAPOR_COW */
|
||||||
for (proc = 1; proc < number_workers; proc++) {
|
for (proc = 1; proc < Yap_number_workers; proc++) {
|
||||||
int son;
|
int son;
|
||||||
son = fork();
|
son = fork();
|
||||||
if (son == -1)
|
if (son == -1)
|
||||||
@ -286,7 +286,7 @@ void init_workers(void) {
|
|||||||
remap_memory();
|
remap_memory();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else worker_pid(proc) = son;
|
else Yap_worker_pid(proc) = son;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
|
@ -124,22 +124,22 @@ extern int Yap_page_size;
|
|||||||
if (shmctl(shmid, IPC_RMID, 0) != 0) \
|
if (shmctl(shmid, IPC_RMID, 0) != 0) \
|
||||||
Yap_Error(FATAL_ERROR, TermNil, "shmctl error (ALLOC_PAGE)"); \
|
Yap_Error(FATAL_ERROR, TermNil, "shmctl error (ALLOC_PAGE)"); \
|
||||||
aux_pg_hd = (pg_hd_ptr)(((void *)PG_HD) + Yap_page_size); \
|
aux_pg_hd = (pg_hd_ptr)(((void *)PG_HD) + Yap_page_size); \
|
||||||
Pg_free_pg(GLOBAL_PAGES_void) = aux_pg_hd; \
|
Pg_free_pg(Yap_pages_void) = aux_pg_hd; \
|
||||||
for (i = 2; i < SHMMAX / Yap_page_size; i++) { \
|
for (i = 2; i < SHMMAX / Yap_page_size; i++) { \
|
||||||
PgHd_next(aux_pg_hd) = (pg_hd_ptr)(((void *)aux_pg_hd) + Yap_page_size); \
|
PgHd_next(aux_pg_hd) = (pg_hd_ptr)(((void *)aux_pg_hd) + Yap_page_size); \
|
||||||
aux_pg_hd = PgHd_next(aux_pg_hd); \
|
aux_pg_hd = PgHd_next(aux_pg_hd); \
|
||||||
} \
|
} \
|
||||||
PgHd_next(aux_pg_hd) = NULL; \
|
PgHd_next(aux_pg_hd) = NULL; \
|
||||||
UPDATE_STATS(Pg_pg_alloc(GLOBAL_PAGES_void), SHMMAX / Yap_page_size); \
|
UPDATE_STATS(Pg_pg_alloc(Yap_pages_void), SHMMAX / Yap_page_size); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RECOVER_UNUSED_SPACE(STR_PAGES) \
|
#define RECOVER_UNUSED_SPACE(STR_PAGES) \
|
||||||
{ sg_fr_ptr sg_fr = GLOBAL_check_sg_fr; \
|
{ sg_fr_ptr sg_fr = Yap_check_sg_fr; \
|
||||||
do { \
|
do { \
|
||||||
if (sg_fr) \
|
if (sg_fr) \
|
||||||
sg_fr = SgFr_next(sg_fr); \
|
sg_fr = SgFr_next(sg_fr); \
|
||||||
else \
|
else \
|
||||||
sg_fr = GLOBAL_first_sg_fr; \
|
sg_fr = Yap_first_sg_fr; \
|
||||||
if (sg_fr == NULL) \
|
if (sg_fr == NULL) \
|
||||||
Yap_Error(FATAL_ERROR, TermNil, "no space left (RECOVER_UNUSED_SPACE)"); \
|
Yap_Error(FATAL_ERROR, TermNil, "no space left (RECOVER_UNUSED_SPACE)"); \
|
||||||
/* see function 'InteractSIGINT' in file 'sysbits.c' */ \
|
/* see function 'InteractSIGINT' in file 'sysbits.c' */ \
|
||||||
@ -157,8 +157,8 @@ extern int Yap_page_size;
|
|||||||
TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST); \
|
TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST); \
|
||||||
TrNode_child(SgFr_answer_trie(sg_fr)) = NULL; \
|
TrNode_child(SgFr_answer_trie(sg_fr)) = NULL; \
|
||||||
} \
|
} \
|
||||||
} while (Pg_free_pg(GLOBAL_PAGES_void) == Pg_free_pg(STR_PAGES)); \
|
} while (Pg_free_pg(Yap_pages_void) == Pg_free_pg(STR_PAGES)); \
|
||||||
GLOBAL_check_sg_fr = sg_fr; \
|
Yap_check_sg_fr = sg_fr; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ALLOC_STRUCT(STR, STR_PAGES, STR_TYPE) \
|
#define ALLOC_STRUCT(STR, STR_PAGES, STR_TYPE) \
|
||||||
@ -167,20 +167,20 @@ extern int Yap_page_size;
|
|||||||
pg_hd = Pg_free_pg(STR_PAGES); \
|
pg_hd = Pg_free_pg(STR_PAGES); \
|
||||||
while (pg_hd == NULL) { \
|
while (pg_hd == NULL) { \
|
||||||
UNLOCK(Pg_lock(STR_PAGES)); \
|
UNLOCK(Pg_lock(STR_PAGES)); \
|
||||||
LOCK(Pg_lock(GLOBAL_PAGES_void)); \
|
LOCK(Pg_lock(Yap_pages_void)); \
|
||||||
if (Pg_free_pg(GLOBAL_PAGES_void)) { \
|
if (Pg_free_pg(Yap_pages_void)) { \
|
||||||
pg_hd = Pg_free_pg(GLOBAL_PAGES_void); \
|
pg_hd = Pg_free_pg(Yap_pages_void); \
|
||||||
Pg_free_pg(GLOBAL_PAGES_void) = PgHd_next(pg_hd); \
|
Pg_free_pg(Yap_pages_void) = PgHd_next(pg_hd); \
|
||||||
UPDATE_STATS(Pg_str_in_use(GLOBAL_PAGES_void), 1); \
|
UPDATE_STATS(Pg_str_in_use(Yap_pages_void), 1); \
|
||||||
UNLOCK(Pg_lock(GLOBAL_PAGES_void)); \
|
UNLOCK(Pg_lock(Yap_pages_void)); \
|
||||||
INIT_PAGE(pg_hd, STR_PAGES, STR_TYPE); \
|
INIT_PAGE(pg_hd, STR_PAGES, STR_TYPE); \
|
||||||
} else if (GLOBAL_MAX_PAGES != Pg_pg_alloc(GLOBAL_PAGES_void)) { \
|
} else if (Yap_max_pages != Pg_pg_alloc(Yap_pages_void)) { \
|
||||||
ALLOC_PAGE(pg_hd); \
|
ALLOC_PAGE(pg_hd); \
|
||||||
UPDATE_STATS(Pg_str_in_use(GLOBAL_PAGES_void), 1); \
|
UPDATE_STATS(Pg_str_in_use(Yap_pages_void), 1); \
|
||||||
UNLOCK(Pg_lock(GLOBAL_PAGES_void)); \
|
UNLOCK(Pg_lock(Yap_pages_void)); \
|
||||||
INIT_PAGE(pg_hd, STR_PAGES, STR_TYPE); \
|
INIT_PAGE(pg_hd, STR_PAGES, STR_TYPE); \
|
||||||
} else { \
|
} else { \
|
||||||
UNLOCK(Pg_lock(GLOBAL_PAGES_void)); \
|
UNLOCK(Pg_lock(Yap_pages_void)); \
|
||||||
RECOVER_UNUSED_SPACE(STR_PAGES); \
|
RECOVER_UNUSED_SPACE(STR_PAGES); \
|
||||||
LOCK(Pg_lock(STR_PAGES)); \
|
LOCK(Pg_lock(STR_PAGES)); \
|
||||||
pg_hd = Pg_free_pg(STR_PAGES); \
|
pg_hd = Pg_free_pg(STR_PAGES); \
|
||||||
@ -202,20 +202,20 @@ extern int Yap_page_size;
|
|||||||
pg_hd = Pg_free_pg(STR_PAGES); \
|
pg_hd = Pg_free_pg(STR_PAGES); \
|
||||||
while (pg_hd == NULL) { \
|
while (pg_hd == NULL) { \
|
||||||
UNLOCK(Pg_lock(STR_PAGES)); \
|
UNLOCK(Pg_lock(STR_PAGES)); \
|
||||||
LOCK(Pg_lock(GLOBAL_PAGES_void)); \
|
LOCK(Pg_lock(Yap_pages_void)); \
|
||||||
if (Pg_free_pg(GLOBAL_PAGES_void)) { \
|
if (Pg_free_pg(Yap_pages_void)) { \
|
||||||
pg_hd = Pg_free_pg(GLOBAL_PAGES_void); \
|
pg_hd = Pg_free_pg(Yap_pages_void); \
|
||||||
Pg_free_pg(GLOBAL_PAGES_void) = PgHd_next(pg_hd); \
|
Pg_free_pg(Yap_pages_void) = PgHd_next(pg_hd); \
|
||||||
UPDATE_STATS(Pg_str_in_use(GLOBAL_PAGES_void), 1); \
|
UPDATE_STATS(Pg_str_in_use(Yap_pages_void), 1); \
|
||||||
UNLOCK(Pg_lock(GLOBAL_PAGES_void)); \
|
UNLOCK(Pg_lock(Yap_pages_void)); \
|
||||||
INIT_PAGE(pg_hd, STR_PAGES, STR_TYPE); \
|
INIT_PAGE(pg_hd, STR_PAGES, STR_TYPE); \
|
||||||
} else if (GLOBAL_MAX_PAGES != Pg_pg_alloc(GLOBAL_PAGES_void)) { \
|
} else if (Yap_max_pages != Pg_pg_alloc(Yap_pages_void)) { \
|
||||||
ALLOC_PAGE(pg_hd); \
|
ALLOC_PAGE(pg_hd); \
|
||||||
UPDATE_STATS(Pg_str_in_use(GLOBAL_PAGES_void), 1); \
|
UPDATE_STATS(Pg_str_in_use(Yap_pages_void), 1); \
|
||||||
UNLOCK(Pg_lock(GLOBAL_PAGES_void)); \
|
UNLOCK(Pg_lock(Yap_pages_void)); \
|
||||||
INIT_PAGE(pg_hd, STR_PAGES, STR_TYPE); \
|
INIT_PAGE(pg_hd, STR_PAGES, STR_TYPE); \
|
||||||
} else { \
|
} else { \
|
||||||
UNLOCK(Pg_lock(GLOBAL_PAGES_void)); \
|
UNLOCK(Pg_lock(Yap_pages_void)); \
|
||||||
RECOVER_UNUSED_SPACE(STR_PAGES); \
|
RECOVER_UNUSED_SPACE(STR_PAGES); \
|
||||||
LOCK(Pg_lock(STR_PAGES)); \
|
LOCK(Pg_lock(STR_PAGES)); \
|
||||||
pg_hd = Pg_free_pg(STR_PAGES); \
|
pg_hd = Pg_free_pg(STR_PAGES); \
|
||||||
@ -235,8 +235,8 @@ extern int Yap_page_size;
|
|||||||
** SHM_MEMORY_ALLOC_SCHEME && !LIMIT_TABLING **
|
** SHM_MEMORY_ALLOC_SCHEME && !LIMIT_TABLING **
|
||||||
*************************************************************************************************/
|
*************************************************************************************************/
|
||||||
#define ALLOC_PAGE(PG_HD) \
|
#define ALLOC_PAGE(PG_HD) \
|
||||||
LOCK(Pg_lock(GLOBAL_PAGES_void)); \
|
LOCK(Pg_lock(Yap_pages_void)); \
|
||||||
if (Pg_free_pg(GLOBAL_PAGES_void) == NULL) { \
|
if (Pg_free_pg(Yap_pages_void) == NULL) { \
|
||||||
int i, shmid; \
|
int i, shmid; \
|
||||||
pg_hd_ptr pg_hd, aux_pg_hd; \
|
pg_hd_ptr pg_hd, aux_pg_hd; \
|
||||||
if ((shmid = shmget(IPC_PRIVATE, SHMMAX, SHM_R|SHM_W)) == -1) \
|
if ((shmid = shmget(IPC_PRIVATE, SHMMAX, SHM_R|SHM_W)) == -1) \
|
||||||
@ -245,19 +245,19 @@ extern int Yap_page_size;
|
|||||||
Yap_Error(FATAL_ERROR, TermNil, "shmat error (ALLOC_PAGE)"); \
|
Yap_Error(FATAL_ERROR, TermNil, "shmat error (ALLOC_PAGE)"); \
|
||||||
if (shmctl(shmid, IPC_RMID, 0) != 0) \
|
if (shmctl(shmid, IPC_RMID, 0) != 0) \
|
||||||
Yap_Error(FATAL_ERROR, TermNil, "shmctl error (ALLOC_PAGE)"); \
|
Yap_Error(FATAL_ERROR, TermNil, "shmctl error (ALLOC_PAGE)"); \
|
||||||
Pg_free_pg(GLOBAL_PAGES_void) = pg_hd; \
|
Pg_free_pg(Yap_pages_void) = pg_hd; \
|
||||||
for (i = 1; i < SHMMAX / Yap_page_size; i++) { \
|
for (i = 1; i < SHMMAX / Yap_page_size; i++) { \
|
||||||
aux_pg_hd = (pg_hd_ptr)(((void *)pg_hd) + Yap_page_size); \
|
aux_pg_hd = (pg_hd_ptr)(((void *)pg_hd) + Yap_page_size); \
|
||||||
PgHd_next(pg_hd) = aux_pg_hd; \
|
PgHd_next(pg_hd) = aux_pg_hd; \
|
||||||
pg_hd = aux_pg_hd; \
|
pg_hd = aux_pg_hd; \
|
||||||
} \
|
} \
|
||||||
PgHd_next(pg_hd) = NULL; \
|
PgHd_next(pg_hd) = NULL; \
|
||||||
UPDATE_STATS(Pg_pg_alloc(GLOBAL_PAGES_void), SHMMAX / Yap_page_size); \
|
UPDATE_STATS(Pg_pg_alloc(Yap_pages_void), SHMMAX / Yap_page_size); \
|
||||||
} \
|
} \
|
||||||
UPDATE_STATS(Pg_str_in_use(GLOBAL_PAGES_void), 1); \
|
UPDATE_STATS(Pg_str_in_use(Yap_pages_void), 1); \
|
||||||
PG_HD = Pg_free_pg(GLOBAL_PAGES_void); \
|
PG_HD = Pg_free_pg(Yap_pages_void); \
|
||||||
Pg_free_pg(GLOBAL_PAGES_void) = PgHd_next(PG_HD); \
|
Pg_free_pg(Yap_pages_void) = PgHd_next(PG_HD); \
|
||||||
UNLOCK(Pg_lock(GLOBAL_PAGES_void))
|
UNLOCK(Pg_lock(Yap_pages_void))
|
||||||
|
|
||||||
#define ALLOC_STRUCT(STR, STR_PAGES, STR_TYPE) \
|
#define ALLOC_STRUCT(STR, STR_PAGES, STR_TYPE) \
|
||||||
{ pg_hd_ptr pg_hd; \
|
{ pg_hd_ptr pg_hd; \
|
||||||
@ -331,11 +331,11 @@ extern int Yap_page_size;
|
|||||||
** SHM_MEMORY_ALLOC_SCHEME **
|
** SHM_MEMORY_ALLOC_SCHEME **
|
||||||
*************************************************************************************************/
|
*************************************************************************************************/
|
||||||
#define FREE_PAGE(PG_HD) \
|
#define FREE_PAGE(PG_HD) \
|
||||||
LOCK(Pg_lock(GLOBAL_PAGES_void)); \
|
LOCK(Pg_lock(Yap_pages_void)); \
|
||||||
UPDATE_STATS(Pg_str_in_use(GLOBAL_PAGES_void), -1); \
|
UPDATE_STATS(Pg_str_in_use(Yap_pages_void), -1); \
|
||||||
PgHd_next(PG_HD) = Pg_free_pg(GLOBAL_PAGES_void); \
|
PgHd_next(PG_HD) = Pg_free_pg(Yap_pages_void); \
|
||||||
Pg_free_pg(GLOBAL_PAGES_void) = PG_HD; \
|
Pg_free_pg(Yap_pages_void) = PG_HD; \
|
||||||
UNLOCK(Pg_lock(GLOBAL_PAGES_void))
|
UNLOCK(Pg_lock(Yap_pages_void))
|
||||||
|
|
||||||
#define FREE_STRUCT(STR, STR_PAGES, STR_TYPE) \
|
#define FREE_STRUCT(STR, STR_PAGES, STR_TYPE) \
|
||||||
{ pg_hd_ptr pg_hd; \
|
{ pg_hd_ptr pg_hd; \
|
||||||
@ -375,55 +375,55 @@ extern int Yap_page_size;
|
|||||||
}
|
}
|
||||||
#define FREE_HASH_BUCKETS(BUCKET_PTR) FREE_BLOCK(BUCKET_PTR)
|
#define FREE_HASH_BUCKETS(BUCKET_PTR) FREE_BLOCK(BUCKET_PTR)
|
||||||
|
|
||||||
#define ALLOC_OR_FRAME(STR) ALLOC_STRUCT(STR, GLOBAL_PAGES_or_fr, struct or_frame)
|
#define ALLOC_OR_FRAME(STR) ALLOC_STRUCT(STR, Yap_pages_or_fr , struct or_frame)
|
||||||
#define FREE_OR_FRAME(STR) FREE_STRUCT(STR, GLOBAL_PAGES_or_fr, struct or_frame)
|
#define FREE_OR_FRAME(STR) FREE_STRUCT(STR, Yap_pages_or_fr , struct or_frame)
|
||||||
|
|
||||||
#define ALLOC_QG_SOLUTION_FRAME(STR) ALLOC_STRUCT(STR, GLOBAL_PAGES_qg_sol_fr, struct query_goal_solution_frame)
|
#define ALLOC_QG_SOLUTION_FRAME(STR) ALLOC_STRUCT(STR, Yap_pages_qg_sol_fr , struct query_goal_solution_frame)
|
||||||
#define FREE_QG_SOLUTION_FRAME(STR) FREE_STRUCT(STR, GLOBAL_PAGES_qg_sol_fr, struct query_goal_solution_frame)
|
#define FREE_QG_SOLUTION_FRAME(STR) FREE_STRUCT(STR, Yap_pages_qg_sol_fr , struct query_goal_solution_frame)
|
||||||
|
|
||||||
#define ALLOC_QG_ANSWER_FRAME(STR) ALLOC_STRUCT(STR, GLOBAL_PAGES_qg_ans_fr, struct query_goal_answer_frame)
|
#define ALLOC_QG_ANSWER_FRAME(STR) ALLOC_STRUCT(STR, Yap_pages_qg_ans_fr, struct query_goal_answer_frame)
|
||||||
#define FREE_QG_ANSWER_FRAME(STR) FREE_STRUCT(STR, GLOBAL_PAGES_qg_ans_fr, struct query_goal_answer_frame)
|
#define FREE_QG_ANSWER_FRAME(STR) FREE_STRUCT(STR, Yap_pages_qg_ans_fr, struct query_goal_answer_frame)
|
||||||
|
|
||||||
#define ALLOC_TG_SOLUTION_FRAME(STR) ALLOC_STRUCT(STR, GLOBAL_PAGES_tg_sol_fr, struct table_subgoal_solution_frame)
|
#define ALLOC_TG_SOLUTION_FRAME(STR) ALLOC_STRUCT(STR, Yap_pages_tg_sol_fr, struct table_subgoal_solution_frame)
|
||||||
#define FREE_TG_SOLUTION_FRAME(STR) FREE_STRUCT(STR, GLOBAL_PAGES_tg_sol_fr, struct table_subgoal_solution_frame)
|
#define FREE_TG_SOLUTION_FRAME(STR) FREE_STRUCT(STR, Yap_pages_tg_sol_fr, struct table_subgoal_solution_frame)
|
||||||
|
|
||||||
#define ALLOC_TG_ANSWER_FRAME(STR) ALLOC_STRUCT(STR, GLOBAL_PAGES_tg_ans_fr, struct table_subgoal_answer_frame)
|
#define ALLOC_TG_ANSWER_FRAME(STR) ALLOC_STRUCT(STR, Yap_pages_tg_ans_fr, struct table_subgoal_answer_frame)
|
||||||
#define FREE_TG_ANSWER_FRAME(STR) FREE_STRUCT(STR, GLOBAL_PAGES_tg_ans_fr, struct table_subgoal_answer_frame)
|
#define FREE_TG_ANSWER_FRAME(STR) FREE_STRUCT(STR, Yap_pages_tg_ans_fr, struct table_subgoal_answer_frame)
|
||||||
|
|
||||||
#define ALLOC_TABLE_ENTRY(STR) ALLOC_STRUCT(STR, GLOBAL_PAGES_tab_ent, struct table_entry)
|
#define ALLOC_TABLE_ENTRY(STR) ALLOC_STRUCT(STR, Yap_pages_tab_ent, struct table_entry)
|
||||||
#define FREE_TABLE_ENTRY(STR) FREE_STRUCT(STR, GLOBAL_PAGES_tab_ent, struct table_entry)
|
#define FREE_TABLE_ENTRY(STR) FREE_STRUCT(STR, Yap_pages_tab_ent, struct table_entry)
|
||||||
|
|
||||||
#define ALLOC_SUBGOAL_FRAME(STR) ALLOC_STRUCT(STR, GLOBAL_PAGES_sg_fr, struct subgoal_frame)
|
#define ALLOC_SUBGOAL_FRAME(STR) ALLOC_STRUCT(STR, Yap_pages_sg_fr, struct subgoal_frame)
|
||||||
#define FREE_SUBGOAL_FRAME(STR) FREE_STRUCT(STR, GLOBAL_PAGES_sg_fr, struct subgoal_frame)
|
#define FREE_SUBGOAL_FRAME(STR) FREE_STRUCT(STR, Yap_pages_sg_fr, struct subgoal_frame)
|
||||||
|
|
||||||
#define ALLOC_DEPENDENCY_FRAME(STR) ALLOC_STRUCT(STR, GLOBAL_PAGES_dep_fr, struct dependency_frame)
|
#define ALLOC_DEPENDENCY_FRAME(STR) ALLOC_STRUCT(STR, Yap_pages_dep_fr, struct dependency_frame)
|
||||||
#define FREE_DEPENDENCY_FRAME(STR) FREE_STRUCT(STR, GLOBAL_PAGES_dep_fr, struct dependency_frame)
|
#define FREE_DEPENDENCY_FRAME(STR) FREE_STRUCT(STR, Yap_pages_dep_fr, struct dependency_frame)
|
||||||
|
|
||||||
#define ALLOC_SUSPENSION_FRAME(STR) ALLOC_STRUCT(STR, GLOBAL_PAGES_susp_fr, struct suspension_frame)
|
#define ALLOC_SUSPENSION_FRAME(STR) ALLOC_STRUCT(STR, Yap_pages_susp_fr, struct suspension_frame)
|
||||||
#define FREE_SUSPENSION_FRAME(STR) FREE_BLOCK(SuspFr_global_start(STR)); \
|
#define FREE_SUSPENSION_FRAME(STR) FREE_BLOCK(SuspFr_global_start(STR)); \
|
||||||
FREE_STRUCT(STR, GLOBAL_PAGES_susp_fr, struct suspension_frame)
|
FREE_STRUCT(STR, Yap_pages_susp_fr, struct suspension_frame)
|
||||||
|
|
||||||
#define ALLOC_GLOBAL_TRIE_NODE(STR) ALLOC_STRUCT(STR, GLOBAL_PAGES_gt_node, struct global_trie_node)
|
#define ALLOC_GLOBAL_TRIE_NODE(STR) ALLOC_STRUCT(STR, Yap_pages_gt_node, struct global_trie_node)
|
||||||
#define FREE_GLOBAL_TRIE_NODE(STR) FREE_STRUCT(STR, GLOBAL_PAGES_gt_node, struct global_trie_node)
|
#define FREE_GLOBAL_TRIE_NODE(STR) FREE_STRUCT(STR, Yap_pages_gt_node, struct global_trie_node)
|
||||||
|
|
||||||
#define ALLOC_SUBGOAL_TRIE_NODE(STR) ALLOC_STRUCT(STR, GLOBAL_PAGES_sg_node, struct subgoal_trie_node)
|
#define ALLOC_SUBGOAL_TRIE_NODE(STR) ALLOC_STRUCT(STR, Yap_pages_sg_node, struct subgoal_trie_node)
|
||||||
#define FREE_SUBGOAL_TRIE_NODE(STR) FREE_STRUCT(STR, GLOBAL_PAGES_sg_node, struct subgoal_trie_node)
|
#define FREE_SUBGOAL_TRIE_NODE(STR) FREE_STRUCT(STR, Yap_pages_sg_node, struct subgoal_trie_node)
|
||||||
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
#define ALLOC_ANSWER_TRIE_NODE(STR) ALLOC_NEXT_FREE_STRUCT(STR, GLOBAL_PAGES_ans_node, struct answer_trie_node)
|
#define ALLOC_ANSWER_TRIE_NODE(STR) ALLOC_NEXT_FREE_STRUCT(STR, Yap_pages_ans_node, struct answer_trie_node)
|
||||||
#else /* TABLING */
|
#else /* TABLING */
|
||||||
#define ALLOC_ANSWER_TRIE_NODE(STR) ALLOC_STRUCT(STR, GLOBAL_PAGES_ans_node, struct answer_trie_node)
|
#define ALLOC_ANSWER_TRIE_NODE(STR) ALLOC_STRUCT(STR, Yap_pages_ans_node, struct answer_trie_node)
|
||||||
#endif /* YAPOR - TABLING */
|
#endif /* YAPOR - TABLING */
|
||||||
#define FREE_ANSWER_TRIE_NODE(STR) FREE_STRUCT(STR, GLOBAL_PAGES_ans_node, struct answer_trie_node)
|
#define FREE_ANSWER_TRIE_NODE(STR) FREE_STRUCT(STR, Yap_pages_ans_node, struct answer_trie_node)
|
||||||
|
|
||||||
#define ALLOC_GLOBAL_TRIE_HASH(STR) ALLOC_STRUCT(STR, GLOBAL_PAGES_gt_hash, struct global_trie_hash)
|
#define ALLOC_GLOBAL_TRIE_HASH(STR) ALLOC_STRUCT(STR, Yap_pages_gt_hash, struct global_trie_hash)
|
||||||
#define FREE_GLOBAL_TRIE_HASH(STR) FREE_STRUCT(STR, GLOBAL_PAGES_gt_hash, struct global_trie_hash)
|
#define FREE_GLOBAL_TRIE_HASH(STR) FREE_STRUCT(STR, Yap_pages_gt_hash, struct global_trie_hash)
|
||||||
|
|
||||||
#define ALLOC_SUBGOAL_TRIE_HASH(STR) ALLOC_STRUCT(STR, GLOBAL_PAGES_sg_hash, struct subgoal_trie_hash)
|
#define ALLOC_SUBGOAL_TRIE_HASH(STR) ALLOC_STRUCT(STR, Yap_pages_sg_hash, struct subgoal_trie_hash)
|
||||||
#define FREE_SUBGOAL_TRIE_HASH(STR) FREE_STRUCT(STR, GLOBAL_PAGES_sg_hash, struct subgoal_trie_hash)
|
#define FREE_SUBGOAL_TRIE_HASH(STR) FREE_STRUCT(STR, Yap_pages_sg_hash, struct subgoal_trie_hash)
|
||||||
|
|
||||||
#define ALLOC_ANSWER_TRIE_HASH(STR) ALLOC_STRUCT(STR, GLOBAL_PAGES_ans_hash, struct answer_trie_hash)
|
#define ALLOC_ANSWER_TRIE_HASH(STR) ALLOC_STRUCT(STR, Yap_pages_ans_hash, struct answer_trie_hash)
|
||||||
#define FREE_ANSWER_TRIE_HASH(STR) FREE_STRUCT(STR, GLOBAL_PAGES_ans_hash, struct answer_trie_hash)
|
#define FREE_ANSWER_TRIE_HASH(STR) FREE_STRUCT(STR, Yap_pages_ans_hash, struct answer_trie_hash)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ typedef struct {
|
|||||||
|
|
||||||
extern ma_hash_entry Yap_ma_hash_table[MAVARS_HASH_SIZE];
|
extern ma_hash_entry Yap_ma_hash_table[MAVARS_HASH_SIZE];
|
||||||
|
|
||||||
extern UInt Yap_timestamp; /* an unsigned int */
|
extern UInt Yap_ma_timestamp; /* an unsigned int */
|
||||||
|
|
||||||
OPT_MAVAR_STATIC unsigned int Yap_MAVAR_HASH(CELL *);
|
OPT_MAVAR_STATIC unsigned int Yap_MAVAR_HASH(CELL *);
|
||||||
OPT_MAVAR_STATIC struct ma_h_entry *Yap_ALLOC_NEW_MASPACE(void);
|
OPT_MAVAR_STATIC struct ma_h_entry *Yap_ALLOC_NEW_MASPACE(void);
|
||||||
@ -66,8 +66,8 @@ Yap_lookup_ma_var(CELL *addr) {
|
|||||||
unsigned int i = Yap_MAVAR_HASH(addr);
|
unsigned int i = Yap_MAVAR_HASH(addr);
|
||||||
struct ma_h_entry *nptr, *optr;
|
struct ma_h_entry *nptr, *optr;
|
||||||
|
|
||||||
if (Yap_ma_hash_table[i].timestmp != Yap_timestamp) {
|
if (Yap_ma_hash_table[i].timestmp != Yap_ma_timestamp) {
|
||||||
Yap_ma_hash_table[i].timestmp = Yap_timestamp;
|
Yap_ma_hash_table[i].timestmp = Yap_ma_timestamp;
|
||||||
Yap_ma_hash_table[i].val.addr = addr;
|
Yap_ma_hash_table[i].val.addr = addr;
|
||||||
Yap_ma_hash_table[i].val.next = NULL;
|
Yap_ma_hash_table[i].val.next = NULL;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -91,13 +91,13 @@ Yap_lookup_ma_var(CELL *addr) {
|
|||||||
|
|
||||||
OPT_MAVAR_STATIC UInt
|
OPT_MAVAR_STATIC UInt
|
||||||
Yap_NEW_MAHASH(ma_h_inner_struct *top) {
|
Yap_NEW_MAHASH(ma_h_inner_struct *top) {
|
||||||
UInt time = ++Yap_timestamp;
|
UInt time = ++Yap_ma_timestamp;
|
||||||
if (time == 0) {
|
if (time == 0) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
/* damn, we overflowed */
|
/* damn, we overflowed */
|
||||||
for (i = 0; i < MAVARS_HASH_SIZE; i++)
|
for (i = 0; i < MAVARS_HASH_SIZE; i++)
|
||||||
Yap_ma_hash_table[i].timestmp = 0;
|
Yap_ma_hash_table[i].timestmp = 0;
|
||||||
time = ++Yap_timestamp;
|
time = ++Yap_ma_timestamp;
|
||||||
}
|
}
|
||||||
Yap_ma_h_top = top;
|
Yap_ma_h_top = top;
|
||||||
return time;
|
return time;
|
||||||
|
@ -82,12 +82,12 @@ close_mapfile(void) {
|
|||||||
|
|
||||||
void map_memory(long HeapArea, long GlobalLocalArea, long TrailAuxArea, int n_workers) {
|
void map_memory(long HeapArea, long GlobalLocalArea, long TrailAuxArea, int n_workers) {
|
||||||
void *mmap_addr = (void *)MMAP_ADDR;
|
void *mmap_addr = (void *)MMAP_ADDR;
|
||||||
#ifdef ACOW
|
#ifdef YAPOR_COW
|
||||||
int private_fd_mapfile;
|
int private_fd_mapfile;
|
||||||
#if MMAP_MEMORY_MAPPING_SCHEME
|
#if MMAP_MEMORY_MAPPING_SCHEME
|
||||||
long TotalArea;
|
long TotalArea;
|
||||||
#endif /* MMAP_MEMORY_MAPPING_SCHEME */
|
#endif /* MMAP_MEMORY_MAPPING_SCHEME */
|
||||||
#else /* ENV_COPY || SBA */
|
#else /* YAPOR_COPY || YAPOR_SBA */
|
||||||
int i;
|
int i;
|
||||||
long WorkerArea;
|
long WorkerArea;
|
||||||
long TotalArea;
|
long TotalArea;
|
||||||
@ -100,21 +100,21 @@ void map_memory(long HeapArea, long GlobalLocalArea, long TrailAuxArea, int n_wo
|
|||||||
|
|
||||||
/* we'll need this later */
|
/* we'll need this later */
|
||||||
#if defined(YAPOR) && !defined(THREADS)
|
#if defined(YAPOR) && !defined(THREADS)
|
||||||
Yap_global = (struct worker_shared *)( mmap_addr - sizeof(struct worker_shared));
|
Yap_global = (struct global_data *)( mmap_addr - sizeof(struct global_data));
|
||||||
Yap_WLocal = (struct worker_local *)( mmap_addr - (sizeof(struct worker_shared)+MAX_WORKERS*sizeof(struct worker_local)));
|
Yap_WLocal = (struct worker_local *)( mmap_addr - (sizeof(struct global_data)+MAX_WORKERS*sizeof(struct worker_local)));
|
||||||
extra_area = ADJUST_SIZE_TO_PAGE(sizeof(struct worker_shared)+MAX_WORKERS*sizeof(struct worker_local));
|
extra_area = ADJUST_SIZE_TO_PAGE(sizeof(struct global_data)+MAX_WORKERS*sizeof(struct worker_local));
|
||||||
#endif
|
#endif
|
||||||
Yap_HeapBase = (ADDR)mmap_addr;
|
Yap_HeapBase = (ADDR)mmap_addr;
|
||||||
Yap_GlobalBase = mmap_addr + HeapArea;
|
Yap_GlobalBase = mmap_addr + HeapArea;
|
||||||
|
|
||||||
/* shared memory allocation - model dependent */
|
/* shared memory allocation - model dependent */
|
||||||
#ifdef ACOW
|
#ifdef YAPOR_COW
|
||||||
/* acow just needs one stack */
|
/* acow just needs one stack */
|
||||||
#ifdef MMAP_MEMORY_MAPPING_SCHEME
|
#ifdef MMAP_MEMORY_MAPPING_SCHEME
|
||||||
/* I need this for MMAP to know what it must allocate */
|
/* I need this for MMAP to know what it must allocate */
|
||||||
TotalArea = HeapArea;
|
TotalArea = HeapArea;
|
||||||
#endif /* MMAP_MEMORY_MAPPING_SCHEME */
|
#endif /* MMAP_MEMORY_MAPPING_SCHEME */
|
||||||
#else /* ENV_COPY || SBA */
|
#else /* YAPOR_COPY || YAPOR_SBA */
|
||||||
/* the others need n stacks */
|
/* the others need n stacks */
|
||||||
WorkerArea = ADJUST_SIZE_TO_PAGE(GlobalLocalArea + TrailAuxArea);
|
WorkerArea = ADJUST_SIZE_TO_PAGE(GlobalLocalArea + TrailAuxArea);
|
||||||
TotalArea = HeapArea + WorkerArea * n_workers;
|
TotalArea = HeapArea + WorkerArea * n_workers;
|
||||||
@ -131,16 +131,16 @@ void map_memory(long HeapArea, long GlobalLocalArea, long TrailAuxArea, int n_wo
|
|||||||
#endif
|
#endif
|
||||||
#else /* SHM_MEMORY_MAPPING_SCHEME */
|
#else /* SHM_MEMORY_MAPPING_SCHEME */
|
||||||
/* Most systems are limited regarding what we can allocate */
|
/* Most systems are limited regarding what we can allocate */
|
||||||
#ifdef ACOW
|
#ifdef YAPOR_COW
|
||||||
/* single shared segment in ACOW */
|
/* single shared segment in ACOW */
|
||||||
shm_map_memory(0, HeapArea, mmap_addr);
|
shm_map_memory(0, HeapArea, mmap_addr);
|
||||||
#else /* ENV_COPY || SBA */
|
#else /* YAPOR_COPY || YAPOR_SBA */
|
||||||
/* place as segment n otherwise (0..n-1 reserved for worker areas */
|
/* place as segment n otherwise (0..n-1 reserved for worker areas */
|
||||||
shm_map_memory(n_workers, HeapArea, mmap_addr);
|
shm_map_memory(n_workers, HeapArea, mmap_addr);
|
||||||
#endif /* YAPOR_MODEL */
|
#endif /* YAPOR_MODEL */
|
||||||
#endif /* MEMORY_MAPPING_SCHEME */
|
#endif /* MEMORY_MAPPING_SCHEME */
|
||||||
|
|
||||||
#ifdef ACOW
|
#ifdef YAPOR_COW
|
||||||
/* just allocate local space for stacks */
|
/* just allocate local space for stacks */
|
||||||
if ((private_fd_mapfile = open("/dev/zero", O_RDWR)) < 0)
|
if ((private_fd_mapfile = open("/dev/zero", O_RDWR)) < 0)
|
||||||
Yap_Error(FATAL_ERROR, TermNil, "open error (map_memory)");
|
Yap_Error(FATAL_ERROR, TermNil, "open error (map_memory)");
|
||||||
@ -148,7 +148,7 @@ void map_memory(long HeapArea, long GlobalLocalArea, long TrailAuxArea, int n_wo
|
|||||||
MAP_PRIVATE|MAP_FIXED, private_fd_mapfile, 0) == (void *) -1)
|
MAP_PRIVATE|MAP_FIXED, private_fd_mapfile, 0) == (void *) -1)
|
||||||
Yap_Error(FATAL_ERROR, TermNil, "mmap error (map_memory)");
|
Yap_Error(FATAL_ERROR, TermNil, "mmap error (map_memory)");
|
||||||
close(private_fd_mapfile);
|
close(private_fd_mapfile);
|
||||||
#else /* ENV_COPY || SBA */
|
#else /* YAPOR_COPY || YAPOR_SBA */
|
||||||
for (i = 0; i < n_workers; i++) {
|
for (i = 0; i < n_workers; i++) {
|
||||||
/* initialize worker vars */
|
/* initialize worker vars */
|
||||||
worker_area(i) = Yap_GlobalBase + i * WorkerArea;
|
worker_area(i) = Yap_GlobalBase + i * WorkerArea;
|
||||||
@ -160,7 +160,7 @@ void map_memory(long HeapArea, long GlobalLocalArea, long TrailAuxArea, int n_wo
|
|||||||
}
|
}
|
||||||
#endif /* YAPOR_MODEL */
|
#endif /* YAPOR_MODEL */
|
||||||
|
|
||||||
#ifdef SBA
|
#ifdef YAPOR_SBA
|
||||||
/* alloc space for the sparse binding array */
|
/* alloc space for the sparse binding array */
|
||||||
sba_size = WorkerArea * n_workers;
|
sba_size = WorkerArea * n_workers;
|
||||||
if ((binding_array = (char *)malloc(sba_size)) == NULL)
|
if ((binding_array = (char *)malloc(sba_size)) == NULL)
|
||||||
@ -170,7 +170,7 @@ void map_memory(long HeapArea, long GlobalLocalArea, long TrailAuxArea, int n_wo
|
|||||||
}
|
}
|
||||||
sba_offset = binding_array - Yap_GlobalBase;
|
sba_offset = binding_array - Yap_GlobalBase;
|
||||||
sba_end = (int)binding_array + sba_size;
|
sba_end = (int)binding_array + sba_size;
|
||||||
#endif /* SBA */
|
#endif /* YAPOR_SBA */
|
||||||
Yap_TrailBase = Yap_GlobalBase + GlobalLocalArea;
|
Yap_TrailBase = Yap_GlobalBase + GlobalLocalArea;
|
||||||
Yap_LocalBase = Yap_TrailBase - CellSize;
|
Yap_LocalBase = Yap_TrailBase - CellSize;
|
||||||
|
|
||||||
@ -193,30 +193,30 @@ void unmap_memory (void) {
|
|||||||
{
|
{
|
||||||
int proc;
|
int proc;
|
||||||
INFORMATION_MESSAGE("Worker %d exiting...", worker_id);
|
INFORMATION_MESSAGE("Worker %d exiting...", worker_id);
|
||||||
for (proc = 0; proc < number_workers; proc++) {
|
for (proc = 0; proc < Yap_number_workers; proc++) {
|
||||||
if (proc != worker_id && worker_pid(proc) != 0) {
|
if (proc != worker_id && Yap_worker_pid(proc) != 0) {
|
||||||
if (kill(worker_pid(proc), SIGKILL) != 0)
|
if (kill(Yap_worker_pid(proc), SIGKILL) != 0)
|
||||||
INFORMATION_MESSAGE("Can't kill process %d", worker_pid(proc));
|
INFORMATION_MESSAGE("Can't kill process %d", Yap_worker_pid(proc));
|
||||||
else
|
else
|
||||||
INFORMATION_MESSAGE("Killing process %d", worker_pid(proc));
|
INFORMATION_MESSAGE("Killing process %d", Yap_worker_pid(proc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef ACOW
|
#ifdef YAPOR_COW
|
||||||
if (number_workers > 1) {
|
if (Yap_number_workers > 1) {
|
||||||
if (kill(GLOBAL_master_worker, SIGINT) != 0)
|
if (kill(Yap_master_worker, SIGINT) != 0)
|
||||||
INFORMATION_MESSAGE("Can't kill process %d", GLOBAL_master_worker);
|
INFORMATION_MESSAGE("Can't kill process %d", Yap_master_worker);
|
||||||
else
|
else
|
||||||
INFORMATION_MESSAGE("Killing process %d", GLOBAL_master_worker);
|
INFORMATION_MESSAGE("Killing process %d", Yap_master_worker);
|
||||||
}
|
}
|
||||||
#endif /* ACOW */
|
#endif /* YAPOR_COW */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SHM_MEMORY_MAPPING_SCHEME
|
#ifdef SHM_MEMORY_MAPPING_SCHEME
|
||||||
#ifdef ACOW
|
#ifdef YAPOR_COW
|
||||||
i = 0;
|
i = 0;
|
||||||
#else
|
#else
|
||||||
for (i = 0; i < number_workers + 1; i++)
|
for (i = 0; i < Yap_number_workers + 1; i++)
|
||||||
#endif /* ACOW */
|
#endif /* YAPOR_COW */
|
||||||
{
|
{
|
||||||
if (shmctl(shm_mapid[i], IPC_RMID, 0) == 0)
|
if (shmctl(shm_mapid[i], IPC_RMID, 0) == 0)
|
||||||
INFORMATION_MESSAGE("Removing shared memory segment %d", shm_mapid[i]);
|
INFORMATION_MESSAGE("Removing shared memory segment %d", shm_mapid[i]);
|
||||||
@ -224,10 +224,10 @@ void unmap_memory (void) {
|
|||||||
}
|
}
|
||||||
#else /* MMAP_MEMORY_MAPPING_SCHEME */
|
#else /* MMAP_MEMORY_MAPPING_SCHEME */
|
||||||
strcpy(MapFile,"./mapfile");
|
strcpy(MapFile,"./mapfile");
|
||||||
#ifdef ACOW
|
#ifdef YAPOR_COW
|
||||||
itos(GLOBAL_master_worker, &MapFile[9]);
|
itos(Yap_master_worker, &MapFile[9]);
|
||||||
#else /* ENV_COPY || SBA */
|
#else /* YAPOR_COPY || YAPOR_SBA */
|
||||||
itos(worker_pid(0), &MapFile[9]);
|
itos(Yap_worker_pid(0), &MapFile[9]);
|
||||||
#endif
|
#endif
|
||||||
if (remove(MapFile) == 0)
|
if (remove(MapFile) == 0)
|
||||||
INFORMATION_MESSAGE("Removing mapfile \"%s\"", MapFile);
|
INFORMATION_MESSAGE("Removing mapfile \"%s\"", MapFile);
|
||||||
@ -238,10 +238,10 @@ void unmap_memory (void) {
|
|||||||
|
|
||||||
|
|
||||||
void remap_memory(void) {
|
void remap_memory(void) {
|
||||||
#ifdef ACOW
|
#ifdef YAPOR_COW
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
#endif /* ACOW */
|
#endif /* YAPOR_COW */
|
||||||
#ifdef SBA
|
#ifdef YAPOR_SBA
|
||||||
/* setup workers so that they have different areas */
|
/* setup workers so that they have different areas */
|
||||||
long WorkerArea = worker_offset(1);
|
long WorkerArea = worker_offset(1);
|
||||||
|
|
||||||
@ -249,8 +249,8 @@ void remap_memory(void) {
|
|||||||
Yap_TrailBase += worker_id * WorkerArea;
|
Yap_TrailBase += worker_id * WorkerArea;
|
||||||
Yap_LocalBase += worker_id * WorkerArea;
|
Yap_LocalBase += worker_id * WorkerArea;
|
||||||
Yap_TrailTop += worker_id * WorkerArea;
|
Yap_TrailTop += worker_id * WorkerArea;
|
||||||
#endif /* SBA */
|
#endif /* YAPOR_SBA */
|
||||||
#ifdef ENV_COPY
|
#ifdef YAPOR_COPY
|
||||||
void *remap_addr;
|
void *remap_addr;
|
||||||
long remap_offset;
|
long remap_offset;
|
||||||
long WorkerArea;
|
long WorkerArea;
|
||||||
@ -260,28 +260,28 @@ void remap_memory(void) {
|
|||||||
remap_offset = (char *)remap_addr - (char *)Yap_HeapBase;
|
remap_offset = (char *)remap_addr - (char *)Yap_HeapBase;
|
||||||
WorkerArea = worker_offset(1);
|
WorkerArea = worker_offset(1);
|
||||||
#ifdef SHM_MEMORY_MAPPING_SCHEME
|
#ifdef SHM_MEMORY_MAPPING_SCHEME
|
||||||
for (i = 0; i < number_workers; i++) {
|
for (i = 0; i < Yap_number_workers; i++) {
|
||||||
if (shmdt(worker_area(i)) == -1)
|
if (shmdt(worker_area(i)) == -1)
|
||||||
Yap_Error(FATAL_ERROR, TermNil, "shmdt error (remap_memory)");
|
Yap_Error(FATAL_ERROR, TermNil, "shmdt error (remap_memory)");
|
||||||
}
|
}
|
||||||
for (i = 0; i < number_workers; i++) {
|
for (i = 0; i < Yap_number_workers; i++) {
|
||||||
worker_area(i) = remap_addr + ((number_workers + i - worker_id) % number_workers) * WorkerArea;
|
worker_area(i) = remap_addr + ((Yap_number_workers + i - worker_id) % Yap_number_workers) * WorkerArea;
|
||||||
if(shmat(shm_mapid[i], worker_area(i), 0) == (void *) -1)
|
if(shmat(shm_mapid[i], worker_area(i), 0) == (void *) -1)
|
||||||
Yap_Error(FATAL_ERROR, TermNil, "shmat error (remap_memory)");
|
Yap_Error(FATAL_ERROR, TermNil, "shmat error (remap_memory)");
|
||||||
}
|
}
|
||||||
#else /* MMAP_MEMORY_MAPPING_SCHEME */
|
#else /* MMAP_MEMORY_MAPPING_SCHEME */
|
||||||
if (munmap(remap_addr, (size_t)(WorkerArea * number_workers)) == -1)
|
if (munmap(remap_addr, (size_t)(WorkerArea * Yap_number_workers)) == -1)
|
||||||
Yap_Error(FATAL_ERROR, TermNil, "munmap error (remap_memory)");
|
Yap_Error(FATAL_ERROR, TermNil, "munmap error (remap_memory)");
|
||||||
for (i = 0; i < number_workers; i++) {
|
for (i = 0; i < Yap_number_workers; i++) {
|
||||||
worker_area(i) = remap_addr + ((number_workers + i - worker_id) % number_workers) * WorkerArea;
|
worker_area(i) = remap_addr + ((Yap_number_workers + i - worker_id) % Yap_number_workers) * WorkerArea;
|
||||||
if (mmap(worker_area(i), (size_t)WorkerArea, PROT_READ|PROT_WRITE,
|
if (mmap(worker_area(i), (size_t)WorkerArea, PROT_READ|PROT_WRITE,
|
||||||
MAP_SHARED|MAP_FIXED, fd_mapfile, remap_offset + i * WorkerArea + extra_area) == (void *) -1)
|
MAP_SHARED|MAP_FIXED, fd_mapfile, remap_offset + i * WorkerArea + extra_area) == (void *) -1)
|
||||||
Yap_Error(FATAL_ERROR, TermNil, "mmap error (remap_memory)");
|
Yap_Error(FATAL_ERROR, TermNil, "mmap error (remap_memory)");
|
||||||
}
|
}
|
||||||
#endif /* MEMORY_MAPPING_SCHEME */
|
#endif /* MEMORY_MAPPING_SCHEME */
|
||||||
for (i = 0; i < number_workers; i++) {
|
for (i = 0; i < Yap_number_workers; i++) {
|
||||||
worker_offset(i) = worker_area(i) - worker_area(worker_id);
|
worker_offset(i) = worker_area(i) - worker_area(worker_id);
|
||||||
}
|
}
|
||||||
#endif /* ENV_COPY */
|
#endif /* YAPOR_COPY */
|
||||||
}
|
}
|
||||||
#endif /* YAPOR && !THREADS */
|
#endif /* YAPOR && !THREADS */
|
||||||
|
@ -159,7 +159,7 @@ void Yap_init_optyap_preds(void) {
|
|||||||
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
void finish_yapor(void) {
|
void finish_yapor(void) {
|
||||||
GLOBAL_execution_time = current_time() - GLOBAL_execution_time;
|
Yap_execution_time = current_time() - Yap_execution_time;
|
||||||
show_answers();
|
show_answers();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -360,7 +360,7 @@ static Int p_abolish_all_tables( USES_REGS1 ) {
|
|||||||
sg_hash_ptr hash;
|
sg_hash_ptr hash;
|
||||||
sg_node_ptr sg_node;
|
sg_node_ptr sg_node;
|
||||||
|
|
||||||
tab_ent = GLOBAL_root_tab_ent;
|
tab_ent = Yap_root_tab_ent;
|
||||||
while(tab_ent) {
|
while(tab_ent) {
|
||||||
hash = TabEnt_hash_chain(tab_ent);
|
hash = TabEnt_hash_chain(tab_ent);
|
||||||
TabEnt_hash_chain(tab_ent) = NULL;
|
TabEnt_hash_chain(tab_ent) = NULL;
|
||||||
@ -388,7 +388,7 @@ static Int p_abolish_all_tables( USES_REGS1 ) {
|
|||||||
static Int p_show_tabled_predicates( USES_REGS1 ) {
|
static Int p_show_tabled_predicates( USES_REGS1 ) {
|
||||||
tab_ent_ptr tab_ent;
|
tab_ent_ptr tab_ent;
|
||||||
|
|
||||||
tab_ent = GLOBAL_root_tab_ent;
|
tab_ent = Yap_root_tab_ent;
|
||||||
fprintf(Yap_stdout, "Tabled predicates\n");
|
fprintf(Yap_stdout, "Tabled predicates\n");
|
||||||
if (tab_ent == NULL)
|
if (tab_ent == NULL)
|
||||||
fprintf(Yap_stdout, " NONE\n");
|
fprintf(Yap_stdout, " NONE\n");
|
||||||
@ -421,7 +421,7 @@ static Int p_show_table( USES_REGS1 ) {
|
|||||||
static Int p_show_all_tables( USES_REGS1 ) {
|
static Int p_show_all_tables( USES_REGS1 ) {
|
||||||
tab_ent_ptr tab_ent;
|
tab_ent_ptr tab_ent;
|
||||||
|
|
||||||
tab_ent = GLOBAL_root_tab_ent;
|
tab_ent = Yap_root_tab_ent;
|
||||||
while(tab_ent) {
|
while(tab_ent) {
|
||||||
show_table(tab_ent, SHOW_MODE_STRUCTURE);
|
show_table(tab_ent, SHOW_MODE_STRUCTURE);
|
||||||
tab_ent = TabEnt_next(tab_ent);
|
tab_ent = TabEnt_next(tab_ent);
|
||||||
@ -479,9 +479,9 @@ static Int p_show_statistics_tabling( USES_REGS1 ) {
|
|||||||
total_bytes += aux_bytes;
|
total_bytes += aux_bytes;
|
||||||
#ifdef SHM_MEMORY_ALLOC_SCHEME
|
#ifdef SHM_MEMORY_ALLOC_SCHEME
|
||||||
fprintf(Yap_stdout, "Total memory in use (I+II+III): %10ld bytes (%ld pages in use)\n",
|
fprintf(Yap_stdout, "Total memory in use (I+II+III): %10ld bytes (%ld pages in use)\n",
|
||||||
total_bytes, Pg_str_in_use(GLOBAL_PAGES_void));
|
total_bytes, Pg_str_in_use(Yap_pages_void));
|
||||||
fprintf(Yap_stdout, "Total memory allocated: %10ld bytes (%ld pages in total)\n",
|
fprintf(Yap_stdout, "Total memory allocated: %10ld bytes (%ld pages in total)\n",
|
||||||
Pg_pg_alloc(GLOBAL_PAGES_void) * Yap_page_size, Pg_pg_alloc(GLOBAL_PAGES_void));
|
Pg_pg_alloc(Yap_pages_void) * Yap_page_size, Pg_pg_alloc(Yap_pages_void));
|
||||||
#else
|
#else
|
||||||
fprintf(Yap_stdout, "Total memory in use (I+II+III): %10ld bytes\n", total_bytes);
|
fprintf(Yap_stdout, "Total memory in use (I+II+III): %10ld bytes\n", total_bytes);
|
||||||
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
||||||
@ -502,7 +502,7 @@ static Int p_show_statistics_global_trie( USES_REGS1 ) {
|
|||||||
|
|
||||||
static Int p_yapor_threads( USES_REGS1 ) {
|
static Int p_yapor_threads( USES_REGS1 ) {
|
||||||
#if defined(YAPOR) && defined(THREADS)
|
#if defined(YAPOR) && defined(THREADS)
|
||||||
return Yap_unify(MkIntegerTerm(number_workers),ARG1);
|
return Yap_unify(MkIntegerTerm(Yap_number_workers),ARG1);
|
||||||
#else
|
#else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#endif
|
#endif
|
||||||
@ -518,25 +518,25 @@ static Int p_worker( USES_REGS1 ) {
|
|||||||
|
|
||||||
|
|
||||||
static Int p_yapor_on( USES_REGS1 ) {
|
static Int p_yapor_on( USES_REGS1 ) {
|
||||||
return (PARALLEL_EXECUTION_MODE);
|
return (Yap_parallel_execution_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Int p_start_yapor( USES_REGS1 ) {
|
static Int p_start_yapor( USES_REGS1 ) {
|
||||||
#ifdef TIMESTAMP_CHECK
|
#ifdef TIMESTAMP_CHECK
|
||||||
GLOBAL_timestamp = 0;
|
Yap_timestamp = 0;
|
||||||
#endif /* TIMESTAMP_CHECK */
|
#endif /* TIMESTAMP_CHECK */
|
||||||
GLOBAL_answers = NO_ANSWER;
|
Yap_answers = NO_ANSWER;
|
||||||
BITMAP_delete(GLOBAL_bm_idle_workers, 0);
|
BITMAP_delete(Yap_bm_idle_workers, 0);
|
||||||
BITMAP_clear(GLOBAL_bm_invisible_workers);
|
BITMAP_clear(Yap_bm_invisible_workers);
|
||||||
BITMAP_clear(GLOBAL_bm_requestable_workers);
|
BITMAP_clear(Yap_bm_requestable_workers);
|
||||||
#ifdef TABLING_INNER_CUTS
|
#ifdef TABLING_INNER_CUTS
|
||||||
BITMAP_clear(GLOBAL_bm_pruning_workers);
|
BITMAP_clear(Yap_bm_pruning_workers);
|
||||||
#endif /* TABLING_INNER_CUTS */
|
#endif /* TABLING_INNER_CUTS */
|
||||||
make_root_choice_point();
|
make_root_choice_point();
|
||||||
GLOBAL_performance_mode &= ~PERFORMANCE_IN_EXECUTION;
|
Yap_performance_mode &= ~PERFORMANCE_IN_EXECUTION;
|
||||||
GLOBAL_execution_time = current_time();
|
Yap_execution_time = current_time();
|
||||||
BITMAP_clear(GLOBAL_bm_finished_workers);
|
BITMAP_clear(Yap_bm_finished_workers);
|
||||||
PUT_IN_EXECUTING(worker_id);
|
PUT_IN_EXECUTING(worker_id);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
@ -575,7 +575,7 @@ static Int p_execution_mode( USES_REGS1 ) {
|
|||||||
t = Deref(ARG1);
|
t = Deref(ARG1);
|
||||||
if (IsVarTerm(t)) {
|
if (IsVarTerm(t)) {
|
||||||
Term ta;
|
Term ta;
|
||||||
if (PARALLEL_EXECUTION_MODE)
|
if (Yap_parallel_execution_mode)
|
||||||
ta = MkAtomTerm(Yap_LookupAtom("parallel"));
|
ta = MkAtomTerm(Yap_LookupAtom("parallel"));
|
||||||
else
|
else
|
||||||
ta = MkAtomTerm(Yap_LookupAtom("sequential"));
|
ta = MkAtomTerm(Yap_LookupAtom("sequential"));
|
||||||
@ -586,11 +586,11 @@ static Int p_execution_mode( USES_REGS1 ) {
|
|||||||
char *s;
|
char *s;
|
||||||
s = RepAtom(AtomOfTerm(t))->StrOfAE;
|
s = RepAtom(AtomOfTerm(t))->StrOfAE;
|
||||||
if (strcmp(s,"parallel") == 0) {
|
if (strcmp(s,"parallel") == 0) {
|
||||||
PARALLEL_EXECUTION_MODE = TRUE;
|
Yap_parallel_execution_mode = TRUE;
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
if (strcmp(s,"sequential") == 0) {
|
if (strcmp(s,"sequential") == 0) {
|
||||||
PARALLEL_EXECUTION_MODE = FALSE;
|
Yap_parallel_execution_mode = FALSE;
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -603,11 +603,11 @@ static Int p_performance( USES_REGS1 ) {
|
|||||||
realtime one_worker_execution_time = 0;
|
realtime one_worker_execution_time = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
GLOBAL_performance_mode |= PERFORMANCE_IN_EXECUTION;
|
Yap_performance_mode |= PERFORMANCE_IN_EXECUTION;
|
||||||
t = Deref(ARG1);
|
t = Deref(ARG1);
|
||||||
if (IsVarTerm(t)) {
|
if (IsVarTerm(t)) {
|
||||||
Term ta;
|
Term ta;
|
||||||
if (GLOBAL_performance_mode & PERFORMANCE_ON) {
|
if (Yap_performance_mode & PERFORMANCE_ON) {
|
||||||
ta = MkAtomTerm(Yap_LookupAtom("on"));
|
ta = MkAtomTerm(Yap_LookupAtom("on"));
|
||||||
} else {
|
} else {
|
||||||
ta = MkAtomTerm(Yap_LookupAtom("off"));
|
ta = MkAtomTerm(Yap_LookupAtom("off"));
|
||||||
@ -619,16 +619,16 @@ static Int p_performance( USES_REGS1 ) {
|
|||||||
char *s;
|
char *s;
|
||||||
s = RepAtom(AtomOfTerm(t))->StrOfAE;
|
s = RepAtom(AtomOfTerm(t))->StrOfAE;
|
||||||
if (strcmp(s, "on") == 0) {
|
if (strcmp(s, "on") == 0) {
|
||||||
GLOBAL_performance_mode |= PERFORMANCE_ON;
|
Yap_performance_mode |= PERFORMANCE_ON;
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
if (strcmp(s,"off") == 0) {
|
if (strcmp(s,"off") == 0) {
|
||||||
GLOBAL_performance_mode &= ~PERFORMANCE_ON;
|
Yap_performance_mode &= ~PERFORMANCE_ON;
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
if (strcmp(s,"clear") == 0) {
|
if (strcmp(s,"clear") == 0) {
|
||||||
GLOBAL_number_goals = 0;
|
Yap_number_goals = 0;
|
||||||
GLOBAL_best_times(0) = 0;
|
Yap_best_times(0) = 0;
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -639,31 +639,31 @@ static Int p_performance( USES_REGS1 ) {
|
|||||||
else
|
else
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
|
||||||
if (GLOBAL_number_goals) {
|
if (Yap_number_goals) {
|
||||||
fprintf(Yap_stdout, "[\n Best execution times:\n");
|
fprintf(Yap_stdout, "[\n Best execution times:\n");
|
||||||
for (i = 1; i <= GLOBAL_number_goals; i++) {
|
for (i = 1; i <= Yap_number_goals; i++) {
|
||||||
fprintf(Yap_stdout, " %d. time: %f seconds", i, GLOBAL_best_times(i));
|
fprintf(Yap_stdout, " %d. time: %f seconds", i, Yap_best_times(i));
|
||||||
if (one_worker_execution_time != 0)
|
if (one_worker_execution_time != 0)
|
||||||
fprintf(Yap_stdout, " --> speedup %f (%6.2f %% )\n",
|
fprintf(Yap_stdout, " --> speedup %f (%6.2f %% )\n",
|
||||||
one_worker_execution_time / GLOBAL_best_times(i),
|
one_worker_execution_time / Yap_best_times(i),
|
||||||
one_worker_execution_time / GLOBAL_best_times(i) / number_workers * 100 );
|
one_worker_execution_time / Yap_best_times(i) / Yap_number_workers* 100 );
|
||||||
else fprintf(Yap_stdout, "\n");
|
else fprintf(Yap_stdout, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(Yap_stdout, " Average : %f seconds",
|
fprintf(Yap_stdout, " Average : %f seconds",
|
||||||
GLOBAL_best_times(0) / GLOBAL_number_goals);
|
Yap_best_times(0) / Yap_number_goals);
|
||||||
if (one_worker_execution_time != 0)
|
if (one_worker_execution_time != 0)
|
||||||
fprintf(Yap_stdout, " --> speedup %f (%6.2f %% )",
|
fprintf(Yap_stdout, " --> speedup %f (%6.2f %% )",
|
||||||
one_worker_execution_time * GLOBAL_number_goals / GLOBAL_best_times(0),
|
one_worker_execution_time * Yap_number_goals / Yap_best_times(0),
|
||||||
one_worker_execution_time * GLOBAL_number_goals / GLOBAL_best_times(0) / number_workers * 100 );
|
one_worker_execution_time * Yap_number_goals / Yap_best_times(0) / Yap_number_workers* 100 );
|
||||||
|
|
||||||
if (GLOBAL_number_goals >= 3) {
|
if (Yap_number_goals >= 3) {
|
||||||
fprintf(Yap_stdout, "\n Average (best three): %f seconds",
|
fprintf(Yap_stdout, "\n Average (best three): %f seconds",
|
||||||
(GLOBAL_best_times(1) + GLOBAL_best_times(2) + GLOBAL_best_times(3)) / 3);
|
(Yap_best_times(1) + Yap_best_times(2) + Yap_best_times(3)) / 3);
|
||||||
if (one_worker_execution_time != 0)
|
if (one_worker_execution_time != 0)
|
||||||
fprintf(Yap_stdout, " --> speedup %f (%6.2f %% ) ]\n\n",
|
fprintf(Yap_stdout, " --> speedup %f (%6.2f %% ) ]\n\n",
|
||||||
one_worker_execution_time * 3 / (GLOBAL_best_times(1) + GLOBAL_best_times(2) + GLOBAL_best_times(3)),
|
one_worker_execution_time * 3 / (Yap_best_times(1) + Yap_best_times(2) + Yap_best_times(3)),
|
||||||
one_worker_execution_time * 3 / (GLOBAL_best_times(1) + GLOBAL_best_times(2) + GLOBAL_best_times(3)) / number_workers * 100 );
|
one_worker_execution_time * 3 / (Yap_best_times(1) + Yap_best_times(2) + Yap_best_times(3)) / Yap_number_workers* 100 );
|
||||||
else fprintf(Yap_stdout, "\n]\n\n");
|
else fprintf(Yap_stdout, "\n]\n\n");
|
||||||
} else fprintf(Yap_stdout, "\n]\n\n");
|
} else fprintf(Yap_stdout, "\n]\n\n");
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
@ -694,7 +694,7 @@ static Int p_parallel_new_answer( USES_REGS1 ) {
|
|||||||
|
|
||||||
|
|
||||||
static Int p_parallel_yes_answer( USES_REGS1 ) {
|
static Int p_parallel_yes_answer( USES_REGS1 ) {
|
||||||
GLOBAL_answers = YES_ANSWER;
|
Yap_answers = YES_ANSWER;
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -715,9 +715,9 @@ static Int p_show_statistics_or( USES_REGS1 ) {
|
|||||||
total_bytes += aux_bytes;
|
total_bytes += aux_bytes;
|
||||||
#ifdef SHM_MEMORY_ALLOC_SCHEME
|
#ifdef SHM_MEMORY_ALLOC_SCHEME
|
||||||
fprintf(Yap_stdout, "Total memory in use (I+II+III): %10ld bytes (%ld pages in use)\n",
|
fprintf(Yap_stdout, "Total memory in use (I+II+III): %10ld bytes (%ld pages in use)\n",
|
||||||
total_bytes, Pg_str_in_use(GLOBAL_PAGES_void));
|
total_bytes, Pg_str_in_use(Yap_pages_void));
|
||||||
fprintf(Yap_stdout, "Total memory allocated: %10ld bytes (%ld pages in total)\n",
|
fprintf(Yap_stdout, "Total memory allocated: %10ld bytes (%ld pages in total)\n",
|
||||||
Pg_pg_alloc(GLOBAL_PAGES_void) * Yap_page_size, Pg_pg_alloc(GLOBAL_PAGES_void));
|
Pg_pg_alloc(Yap_pages_void) * Yap_page_size, Pg_pg_alloc(Yap_pages_void));
|
||||||
#else
|
#else
|
||||||
fprintf(Yap_stdout, "Total memory in use (I+II+III): %10ld bytes\n", total_bytes);
|
fprintf(Yap_stdout, "Total memory in use (I+II+III): %10ld bytes\n", total_bytes);
|
||||||
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
||||||
@ -771,9 +771,9 @@ static Int p_show_statistics_opt( USES_REGS1 ) {
|
|||||||
total_bytes += aux_bytes;
|
total_bytes += aux_bytes;
|
||||||
#ifdef SHM_MEMORY_ALLOC_SCHEME
|
#ifdef SHM_MEMORY_ALLOC_SCHEME
|
||||||
fprintf(Yap_stdout, "Total memory in use (I+II+III+IV): %10ld bytes (%ld pages in use)\n",
|
fprintf(Yap_stdout, "Total memory in use (I+II+III+IV): %10ld bytes (%ld pages in use)\n",
|
||||||
total_bytes, Pg_str_in_use(GLOBAL_PAGES_void));
|
total_bytes, Pg_str_in_use(Yap_pages_void));
|
||||||
fprintf(Yap_stdout, "Total memory allocated: %10ld bytes (%ld pages in total)\n",
|
fprintf(Yap_stdout, "Total memory allocated: %10ld bytes (%ld pages in total)\n",
|
||||||
Pg_pg_alloc(GLOBAL_PAGES_void) * Yap_page_size, Pg_pg_alloc(GLOBAL_PAGES_void));
|
Pg_pg_alloc(Yap_pages_void) * Yap_page_size, Pg_pg_alloc(Yap_pages_void));
|
||||||
#else
|
#else
|
||||||
fprintf(Yap_stdout, "Total memory in use (I+II+III+IV): %10ld bytes\n", total_bytes);
|
fprintf(Yap_stdout, "Total memory in use (I+II+III+IV): %10ld bytes\n", total_bytes);
|
||||||
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
||||||
@ -791,99 +791,99 @@ static Int p_get_optyap_statistics( USES_REGS1 ) {
|
|||||||
if (value == 0) { /* total_memory */
|
if (value == 0) { /* total_memory */
|
||||||
bytes = 0;
|
bytes = 0;
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
bytes += Pg_str_in_use(GLOBAL_PAGES_tab_ent) * sizeof(struct table_entry);
|
bytes += Pg_str_in_use(Yap_pages_tab_ent) * sizeof(struct table_entry);
|
||||||
bytes += Pg_str_in_use(GLOBAL_PAGES_sg_fr) * sizeof(struct subgoal_frame);
|
bytes += Pg_str_in_use(Yap_pages_sg_fr) * sizeof(struct subgoal_frame);
|
||||||
bytes += Pg_str_in_use(GLOBAL_PAGES_dep_fr) * sizeof(struct dependency_frame);
|
bytes += Pg_str_in_use(Yap_pages_dep_fr) * sizeof(struct dependency_frame);
|
||||||
bytes += Pg_str_in_use(GLOBAL_PAGES_sg_node) * sizeof(struct subgoal_trie_node);
|
bytes += Pg_str_in_use(Yap_pages_sg_node) * sizeof(struct subgoal_trie_node);
|
||||||
bytes += Pg_str_in_use(GLOBAL_PAGES_ans_node) * sizeof(struct answer_trie_node);
|
bytes += Pg_str_in_use(Yap_pages_ans_node) * sizeof(struct answer_trie_node);
|
||||||
bytes += Pg_str_in_use(GLOBAL_PAGES_sg_hash) * sizeof(struct subgoal_trie_hash);
|
bytes += Pg_str_in_use(Yap_pages_sg_hash) * sizeof(struct subgoal_trie_hash);
|
||||||
bytes += Pg_str_in_use(GLOBAL_PAGES_ans_hash) * sizeof(struct answer_trie_hash);
|
bytes += Pg_str_in_use(Yap_pages_ans_hash) * sizeof(struct answer_trie_hash);
|
||||||
bytes += Pg_str_in_use(GLOBAL_PAGES_gt_node) * sizeof(struct global_trie_node);
|
bytes += Pg_str_in_use(Yap_pages_gt_node) * sizeof(struct global_trie_node);
|
||||||
bytes += Pg_str_in_use(GLOBAL_PAGES_gt_hash) * sizeof(struct global_trie_hash);
|
bytes += Pg_str_in_use(Yap_pages_gt_hash) * sizeof(struct global_trie_hash);
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
bytes += Pg_str_in_use(GLOBAL_PAGES_or_fr) * sizeof(struct or_frame);
|
bytes += Pg_str_in_use(Yap_pages_or_fr ) * sizeof(struct or_frame);
|
||||||
bytes += Pg_str_in_use(GLOBAL_PAGES_qg_sol_fr) * sizeof(struct query_goal_solution_frame);
|
bytes += Pg_str_in_use(Yap_pages_qg_sol_fr ) * sizeof(struct query_goal_solution_frame);
|
||||||
bytes += Pg_str_in_use(GLOBAL_PAGES_qg_ans_fr) * sizeof(struct query_goal_answer_frame);
|
bytes += Pg_str_in_use(Yap_pages_qg_ans_fr) * sizeof(struct query_goal_answer_frame);
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
#if defined(YAPOR) && defined(TABLING)
|
#if defined(YAPOR) && defined(TABLING)
|
||||||
bytes += Pg_str_in_use(GLOBAL_PAGES_susp_fr) * sizeof(struct suspension_frame);
|
bytes += Pg_str_in_use(Yap_pages_susp_fr) * sizeof(struct suspension_frame);
|
||||||
#ifdef TABLING_INNER_CUTS
|
#ifdef TABLING_INNER_CUTS
|
||||||
bytes += Pg_str_in_use(GLOBAL_PAGES_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame);
|
bytes += Pg_str_in_use(Yap_pages_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame);
|
||||||
bytes += Pg_str_in_use(GLOBAL_PAGES_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame);
|
bytes += Pg_str_in_use(Yap_pages_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame);
|
||||||
#endif /* TABLING_INNER_CUTS */
|
#endif /* TABLING_INNER_CUTS */
|
||||||
#endif /* YAPOR && TABLING */
|
#endif /* YAPOR && TABLING */
|
||||||
#ifdef SHM_MEMORY_ALLOC_SCHEME
|
#ifdef SHM_MEMORY_ALLOC_SCHEME
|
||||||
structs = Pg_pg_alloc(GLOBAL_PAGES_void) * Yap_page_size;
|
structs = Pg_pg_alloc(Yap_pages_void) * Yap_page_size;
|
||||||
#else
|
#else
|
||||||
structs = bytes;
|
structs = bytes;
|
||||||
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
||||||
}
|
}
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
if (value == 1) { /* table_entries */
|
if (value == 1) { /* table_entries */
|
||||||
bytes = Pg_str_in_use(GLOBAL_PAGES_tab_ent) * sizeof(struct table_entry);
|
bytes = Pg_str_in_use(Yap_pages_tab_ent) * sizeof(struct table_entry);
|
||||||
structs = Pg_str_in_use(GLOBAL_PAGES_tab_ent);
|
structs = Pg_str_in_use(Yap_pages_tab_ent);
|
||||||
}
|
}
|
||||||
if (value == 2) { /* subgoal_frames */
|
if (value == 2) { /* subgoal_frames */
|
||||||
bytes = Pg_str_in_use(GLOBAL_PAGES_sg_fr) * sizeof(struct subgoal_frame);
|
bytes = Pg_str_in_use(Yap_pages_sg_fr) * sizeof(struct subgoal_frame);
|
||||||
structs = Pg_str_in_use(GLOBAL_PAGES_sg_fr);
|
structs = Pg_str_in_use(Yap_pages_sg_fr);
|
||||||
}
|
}
|
||||||
if (value == 3) { /* dependency_frames */
|
if (value == 3) { /* dependency_frames */
|
||||||
bytes = Pg_str_in_use(GLOBAL_PAGES_dep_fr) * sizeof(struct dependency_frame);
|
bytes = Pg_str_in_use(Yap_pages_dep_fr) * sizeof(struct dependency_frame);
|
||||||
structs = Pg_str_in_use(GLOBAL_PAGES_dep_fr);
|
structs = Pg_str_in_use(Yap_pages_dep_fr);
|
||||||
}
|
}
|
||||||
if (value == 6) { /* subgoal_trie_nodes */
|
if (value == 6) { /* subgoal_trie_nodes */
|
||||||
bytes = Pg_str_in_use(GLOBAL_PAGES_sg_node) * sizeof(struct subgoal_trie_node);
|
bytes = Pg_str_in_use(Yap_pages_sg_node) * sizeof(struct subgoal_trie_node);
|
||||||
structs = Pg_str_in_use(GLOBAL_PAGES_sg_node);
|
structs = Pg_str_in_use(Yap_pages_sg_node);
|
||||||
}
|
}
|
||||||
if (value == 7) { /* answer_trie_nodes */
|
if (value == 7) { /* answer_trie_nodes */
|
||||||
bytes = Pg_str_in_use(GLOBAL_PAGES_ans_node) * sizeof(struct answer_trie_node);
|
bytes = Pg_str_in_use(Yap_pages_ans_node) * sizeof(struct answer_trie_node);
|
||||||
structs = Pg_str_in_use(GLOBAL_PAGES_ans_node);
|
structs = Pg_str_in_use(Yap_pages_ans_node);
|
||||||
}
|
}
|
||||||
if (value == 8) { /* subgoal_trie_hashes */
|
if (value == 8) { /* subgoal_trie_hashes */
|
||||||
bytes = Pg_str_in_use(GLOBAL_PAGES_sg_hash) * sizeof(struct subgoal_trie_hash);
|
bytes = Pg_str_in_use(Yap_pages_sg_hash) * sizeof(struct subgoal_trie_hash);
|
||||||
structs = Pg_str_in_use(GLOBAL_PAGES_sg_hash);
|
structs = Pg_str_in_use(Yap_pages_sg_hash);
|
||||||
}
|
}
|
||||||
if (value == 9) { /* answer_trie_hashes */
|
if (value == 9) { /* answer_trie_hashes */
|
||||||
bytes = Pg_str_in_use(GLOBAL_PAGES_ans_hash) * sizeof(struct answer_trie_hash);
|
bytes = Pg_str_in_use(Yap_pages_ans_hash) * sizeof(struct answer_trie_hash);
|
||||||
structs = Pg_str_in_use(GLOBAL_PAGES_ans_hash);
|
structs = Pg_str_in_use(Yap_pages_ans_hash);
|
||||||
}
|
}
|
||||||
if (value == 10) { /* global_trie_nodes */
|
if (value == 10) { /* global_trie_nodes */
|
||||||
bytes = Pg_str_in_use(GLOBAL_PAGES_gt_node) * sizeof(struct global_trie_node);
|
bytes = Pg_str_in_use(Yap_pages_gt_node) * sizeof(struct global_trie_node);
|
||||||
structs = Pg_str_in_use(GLOBAL_PAGES_gt_node);
|
structs = Pg_str_in_use(Yap_pages_gt_node);
|
||||||
}
|
}
|
||||||
if (value == 11) { /* global_trie_hashes */
|
if (value == 11) { /* global_trie_hashes */
|
||||||
bytes = Pg_str_in_use(GLOBAL_PAGES_gt_hash) * sizeof(struct global_trie_hash);
|
bytes = Pg_str_in_use(Yap_pages_gt_hash) * sizeof(struct global_trie_hash);
|
||||||
structs = Pg_str_in_use(GLOBAL_PAGES_gt_hash);
|
structs = Pg_str_in_use(Yap_pages_gt_hash);
|
||||||
}
|
}
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
if (value == 4) { /* or_frames */
|
if (value == 4) { /* or_frames */
|
||||||
bytes = Pg_str_in_use(GLOBAL_PAGES_or_fr) * sizeof(struct or_frame);
|
bytes = Pg_str_in_use(Yap_pages_or_fr ) * sizeof(struct or_frame);
|
||||||
structs = Pg_str_in_use(GLOBAL_PAGES_or_fr);
|
structs = Pg_str_in_use(Yap_pages_or_fr );
|
||||||
}
|
}
|
||||||
if (value == 12) { /* query_goal_solution_frames */
|
if (value == 12) { /* query_goal_solution_frames */
|
||||||
bytes = Pg_str_in_use(GLOBAL_PAGES_qg_sol_fr) * sizeof(struct query_goal_solution_frame);
|
bytes = Pg_str_in_use(Yap_pages_qg_sol_fr ) * sizeof(struct query_goal_solution_frame);
|
||||||
structs = Pg_str_in_use(GLOBAL_PAGES_qg_sol_fr);
|
structs = Pg_str_in_use(Yap_pages_qg_sol_fr );
|
||||||
}
|
}
|
||||||
if (value == 13) { /* query_goal_answer_frames */
|
if (value == 13) { /* query_goal_answer_frames */
|
||||||
bytes = Pg_str_in_use(GLOBAL_PAGES_qg_ans_fr) * sizeof(struct query_goal_answer_frame);
|
bytes = Pg_str_in_use(Yap_pages_qg_ans_fr) * sizeof(struct query_goal_answer_frame);
|
||||||
structs = Pg_str_in_use(GLOBAL_PAGES_qg_ans_fr);
|
structs = Pg_str_in_use(Yap_pages_qg_ans_fr);
|
||||||
}
|
}
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
#if defined(YAPOR) && defined(TABLING)
|
#if defined(YAPOR) && defined(TABLING)
|
||||||
if (value == 5) { /* suspension_frames */
|
if (value == 5) { /* suspension_frames */
|
||||||
bytes = Pg_str_in_use(GLOBAL_PAGES_susp_fr) * sizeof(struct suspension_frame);
|
bytes = Pg_str_in_use(Yap_pages_susp_fr) * sizeof(struct suspension_frame);
|
||||||
structs = Pg_str_in_use(GLOBAL_PAGES_susp_fr);
|
structs = Pg_str_in_use(Yap_pages_susp_fr);
|
||||||
}
|
}
|
||||||
#ifdef TABLING_INNER_CUTS
|
#ifdef TABLING_INNER_CUTS
|
||||||
if (value == 14) { /* table_subgoal_solution_frames */
|
if (value == 14) { /* table_subgoal_solution_frames */
|
||||||
bytes = Pg_str_in_use(GLOBAL_PAGES_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame);
|
bytes = Pg_str_in_use(Yap_pages_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame);
|
||||||
structs = Pg_str_in_use(GLOBAL_PAGES_tg_sol_fr);
|
structs = Pg_str_in_use(Yap_pages_tg_sol_fr);
|
||||||
}
|
}
|
||||||
if (value == 15) { /* table_subgoal_answer_frames */
|
if (value == 15) { /* table_subgoal_answer_frames */
|
||||||
bytes = Pg_str_in_use(GLOBAL_PAGES_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame);
|
bytes = Pg_str_in_use(Yap_pages_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame);
|
||||||
structs = Pg_str_in_use(GLOBAL_PAGES_tg_ans_fr);
|
structs = Pg_str_in_use(Yap_pages_tg_ans_fr);
|
||||||
}
|
}
|
||||||
#endif /* TABLING_INNER_CUTS */
|
#endif /* TABLING_INNER_CUTS */
|
||||||
#endif /* YAPOR && TABLING */
|
#endif /* YAPOR && TABLING */
|
||||||
@ -938,12 +938,12 @@ static inline void show_answers(void) {
|
|||||||
aux_answer2 = aux_answer1;
|
aux_answer2 = aux_answer1;
|
||||||
aux_answer1 = AnsFr_next(aux_answer1);
|
aux_answer1 = AnsFr_next(aux_answer1);
|
||||||
FREE_QG_ANSWER_FRAME(aux_answer2);
|
FREE_QG_ANSWER_FRAME(aux_answer2);
|
||||||
GLOBAL_answers++;
|
Yap_answers++;
|
||||||
}
|
}
|
||||||
FREE_QG_SOLUTION_FRAME(OrFr_qg_solutions(LOCAL_top_or_fr));
|
FREE_QG_SOLUTION_FRAME(OrFr_qg_solutions(LOCAL_top_or_fr));
|
||||||
OrFr_qg_solutions(LOCAL_top_or_fr) = NULL;
|
OrFr_qg_solutions(LOCAL_top_or_fr) = NULL;
|
||||||
}
|
}
|
||||||
switch(GLOBAL_answers) {
|
switch(Yap_answers) {
|
||||||
case YES_ANSWER:
|
case YES_ANSWER:
|
||||||
fprintf(Yap_stderr, "[ yes");
|
fprintf(Yap_stderr, "[ yes");
|
||||||
break;
|
break;
|
||||||
@ -954,27 +954,27 @@ static inline void show_answers(void) {
|
|||||||
fprintf(Yap_stderr, "[ 1 answer found");
|
fprintf(Yap_stderr, "[ 1 answer found");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(Yap_stderr, "[ %d answers found", GLOBAL_answers);
|
fprintf(Yap_stderr, "[ %d answers found", Yap_answers);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fprintf(Yap_stderr, " (in %f seconds) ]\n\n", GLOBAL_execution_time);
|
fprintf(Yap_stderr, " (in %f seconds) ]\n\n", Yap_execution_time);
|
||||||
|
|
||||||
if (GLOBAL_performance_mode == PERFORMANCE_ON) {
|
if (Yap_performance_mode == PERFORMANCE_ON) {
|
||||||
for (i = GLOBAL_number_goals; i > 0; i--) {
|
for (i = Yap_number_goals; i > 0; i--) {
|
||||||
if (GLOBAL_best_times(i) > GLOBAL_execution_time) {
|
if (Yap_best_times(i) > Yap_execution_time) {
|
||||||
if (i + 1 < MAX_BEST_TIMES)
|
if (i + 1 < MAX_BEST_TIMES)
|
||||||
GLOBAL_best_times(i + 1) = GLOBAL_best_times(i);
|
Yap_best_times(i + 1) = Yap_best_times(i);
|
||||||
else {
|
else {
|
||||||
GLOBAL_best_times(0) -= GLOBAL_best_times(i);
|
Yap_best_times(0) -= Yap_best_times(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
if (i + 1 < MAX_BEST_TIMES) {
|
if (i + 1 < MAX_BEST_TIMES) {
|
||||||
GLOBAL_best_times(0) += GLOBAL_execution_time;
|
Yap_best_times(0) += Yap_execution_time;
|
||||||
GLOBAL_best_times(i + 1) = GLOBAL_execution_time;
|
Yap_best_times(i + 1) = Yap_execution_time;
|
||||||
if (GLOBAL_number_goals + 1 < MAX_BEST_TIMES)
|
if (Yap_number_goals + 1 < MAX_BEST_TIMES)
|
||||||
GLOBAL_number_goals++;
|
Yap_number_goals++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1031,7 +1031,7 @@ static inline long show_statistics_table_entries(void) {
|
|||||||
tab_ent_ptr aux_ptr;
|
tab_ent_ptr aux_ptr;
|
||||||
long cont = 0;
|
long cont = 0;
|
||||||
|
|
||||||
pg_hd = Pg_free_pg(GLOBAL_PAGES_tab_ent);
|
pg_hd = Pg_free_pg(Yap_pages_tab_ent);
|
||||||
while (pg_hd) {
|
while (pg_hd) {
|
||||||
aux_ptr = PgHd_free_str(pg_hd);
|
aux_ptr = PgHd_free_str(pg_hd);
|
||||||
while (aux_ptr) {
|
while (aux_ptr) {
|
||||||
@ -1040,15 +1040,15 @@ static inline long show_statistics_table_entries(void) {
|
|||||||
}
|
}
|
||||||
pg_hd = PgHd_next(pg_hd);
|
pg_hd = PgHd_next(pg_hd);
|
||||||
}
|
}
|
||||||
TABLING_ERROR_CHECKING(statistics_table_entries, Pg_str_free(GLOBAL_PAGES_tab_ent) != cont);
|
TABLING_ERROR_CHECKING(statistics_table_entries, Pg_str_free(Yap_pages_tab_ent) != cont);
|
||||||
#endif /* DEBUG_TABLING */
|
#endif /* DEBUG_TABLING */
|
||||||
fprintf(Yap_stdout, " Table entries: %10ld bytes (%ld pages and %ld structs in use)\n",
|
fprintf(Yap_stdout, " Table entries: %10ld bytes (%ld pages and %ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_tab_ent) * sizeof(struct table_entry), Pg_pg_alloc(GLOBAL_PAGES_tab_ent), Pg_str_in_use(GLOBAL_PAGES_tab_ent));
|
Pg_str_in_use(Yap_pages_tab_ent) * sizeof(struct table_entry), Pg_pg_alloc(Yap_pages_tab_ent), Pg_str_in_use(Yap_pages_tab_ent));
|
||||||
#else
|
#else
|
||||||
fprintf(Yap_stdout, " Table entries: %10ld bytes (%ld structs in use)\n",
|
fprintf(Yap_stdout, " Table entries: %10ld bytes (%ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_tab_ent) * sizeof(struct table_entry), Pg_str_in_use(GLOBAL_PAGES_tab_ent));
|
Pg_str_in_use(Yap_pages_tab_ent) * sizeof(struct table_entry), Pg_str_in_use(Yap_pages_tab_ent));
|
||||||
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
||||||
return Pg_str_in_use(GLOBAL_PAGES_tab_ent) * sizeof(struct table_entry);
|
return Pg_str_in_use(Yap_pages_tab_ent) * sizeof(struct table_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1059,7 +1059,7 @@ static inline long show_statistics_subgoal_frames(void) {
|
|||||||
sg_fr_ptr aux_ptr;
|
sg_fr_ptr aux_ptr;
|
||||||
long cont = 0;
|
long cont = 0;
|
||||||
|
|
||||||
pg_hd = Pg_free_pg(GLOBAL_PAGES_sg_fr);
|
pg_hd = Pg_free_pg(Yap_pages_sg_fr);
|
||||||
while (pg_hd) {
|
while (pg_hd) {
|
||||||
aux_ptr = PgHd_free_str(pg_hd);
|
aux_ptr = PgHd_free_str(pg_hd);
|
||||||
while (aux_ptr) {
|
while (aux_ptr) {
|
||||||
@ -1068,15 +1068,15 @@ static inline long show_statistics_subgoal_frames(void) {
|
|||||||
}
|
}
|
||||||
pg_hd = PgHd_next(pg_hd);
|
pg_hd = PgHd_next(pg_hd);
|
||||||
}
|
}
|
||||||
TABLING_ERROR_CHECKING(statistics_subgoal_frames, Pg_str_free(GLOBAL_PAGES_sg_fr) != cont);
|
TABLING_ERROR_CHECKING(statistics_subgoal_frames, Pg_str_free(Yap_pages_sg_fr) != cont);
|
||||||
#endif /* DEBUG_TABLING */
|
#endif /* DEBUG_TABLING */
|
||||||
fprintf(Yap_stdout, " Subgoal frames: %10ld bytes (%ld pages and %ld structs in use)\n",
|
fprintf(Yap_stdout, " Subgoal frames: %10ld bytes (%ld pages and %ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_sg_fr) * sizeof(struct subgoal_frame), Pg_pg_alloc(GLOBAL_PAGES_sg_fr), Pg_str_in_use(GLOBAL_PAGES_sg_fr));
|
Pg_str_in_use(Yap_pages_sg_fr) * sizeof(struct subgoal_frame), Pg_pg_alloc(Yap_pages_sg_fr), Pg_str_in_use(Yap_pages_sg_fr));
|
||||||
#else
|
#else
|
||||||
fprintf(Yap_stdout, " Subgoal frames: %10ld bytes (%ld structs in use)\n",
|
fprintf(Yap_stdout, " Subgoal frames: %10ld bytes (%ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_sg_fr) * sizeof(struct subgoal_frame), Pg_str_in_use(GLOBAL_PAGES_sg_fr));
|
Pg_str_in_use(Yap_pages_sg_fr) * sizeof(struct subgoal_frame), Pg_str_in_use(Yap_pages_sg_fr));
|
||||||
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
||||||
return Pg_str_in_use(GLOBAL_PAGES_sg_fr) * sizeof(struct subgoal_frame);
|
return Pg_str_in_use(Yap_pages_sg_fr) * sizeof(struct subgoal_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1087,7 +1087,7 @@ static inline long show_statistics_dependency_frames(void) {
|
|||||||
dep_fr_ptr aux_ptr;
|
dep_fr_ptr aux_ptr;
|
||||||
long cont = 0;
|
long cont = 0;
|
||||||
|
|
||||||
pg_hd = Pg_free_pg(GLOBAL_PAGES_dep_fr);
|
pg_hd = Pg_free_pg(Yap_pages_dep_fr);
|
||||||
while (pg_hd) {
|
while (pg_hd) {
|
||||||
aux_ptr = PgHd_free_str(pg_hd);
|
aux_ptr = PgHd_free_str(pg_hd);
|
||||||
while (aux_ptr) {
|
while (aux_ptr) {
|
||||||
@ -1096,15 +1096,15 @@ static inline long show_statistics_dependency_frames(void) {
|
|||||||
}
|
}
|
||||||
pg_hd = PgHd_next(pg_hd);
|
pg_hd = PgHd_next(pg_hd);
|
||||||
}
|
}
|
||||||
TABLING_ERROR_CHECKING(statistics_dependency_frames, Pg_str_free(GLOBAL_PAGES_dep_fr) != cont);
|
TABLING_ERROR_CHECKING(statistics_dependency_frames, Pg_str_free(Yap_pages_dep_fr) != cont);
|
||||||
#endif /* DEBUG_TABLING */
|
#endif /* DEBUG_TABLING */
|
||||||
fprintf(Yap_stdout, " Dependency frames: %10ld bytes (%ld pages and %ld structs in use)\n",
|
fprintf(Yap_stdout, " Dependency frames: %10ld bytes (%ld pages and %ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_dep_fr) * sizeof(struct dependency_frame), Pg_pg_alloc(GLOBAL_PAGES_dep_fr), Pg_str_in_use(GLOBAL_PAGES_dep_fr));
|
Pg_str_in_use(Yap_pages_dep_fr) * sizeof(struct dependency_frame), Pg_pg_alloc(Yap_pages_dep_fr), Pg_str_in_use(Yap_pages_dep_fr));
|
||||||
#else
|
#else
|
||||||
fprintf(Yap_stdout, " Dependency frames: %10ld bytes (%ld structs in use)\n",
|
fprintf(Yap_stdout, " Dependency frames: %10ld bytes (%ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_dep_fr) * sizeof(struct dependency_frame), Pg_str_in_use(GLOBAL_PAGES_dep_fr));
|
Pg_str_in_use(Yap_pages_dep_fr) * sizeof(struct dependency_frame), Pg_str_in_use(Yap_pages_dep_fr));
|
||||||
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
||||||
return Pg_str_in_use(GLOBAL_PAGES_dep_fr) * sizeof(struct dependency_frame);
|
return Pg_str_in_use(Yap_pages_dep_fr) * sizeof(struct dependency_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1115,7 +1115,7 @@ static inline long show_statistics_subgoal_trie_nodes(void) {
|
|||||||
sg_node_ptr aux_ptr;
|
sg_node_ptr aux_ptr;
|
||||||
long cont = 0;
|
long cont = 0;
|
||||||
|
|
||||||
pg_hd = Pg_free_pg(GLOBAL_PAGES_sg_node);
|
pg_hd = Pg_free_pg(Yap_pages_sg_node);
|
||||||
while (pg_hd) {
|
while (pg_hd) {
|
||||||
aux_ptr = PgHd_free_str(pg_hd);
|
aux_ptr = PgHd_free_str(pg_hd);
|
||||||
while (aux_ptr) {
|
while (aux_ptr) {
|
||||||
@ -1124,15 +1124,15 @@ static inline long show_statistics_subgoal_trie_nodes(void) {
|
|||||||
}
|
}
|
||||||
pg_hd = PgHd_next(pg_hd);
|
pg_hd = PgHd_next(pg_hd);
|
||||||
}
|
}
|
||||||
TABLING_ERROR_CHECKING(statistics_subgoal_trie_nodes, Pg_str_free(GLOBAL_PAGES_sg_node) != cont);
|
TABLING_ERROR_CHECKING(statistics_subgoal_trie_nodes, Pg_str_free(Yap_pages_sg_node) != cont);
|
||||||
#endif /* DEBUG_TABLING */
|
#endif /* DEBUG_TABLING */
|
||||||
fprintf(Yap_stdout, " Subgoal trie nodes: %10ld bytes (%ld pages and %ld structs in use)\n",
|
fprintf(Yap_stdout, " Subgoal trie nodes: %10ld bytes (%ld pages and %ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_sg_node) * sizeof(struct subgoal_trie_node), Pg_pg_alloc(GLOBAL_PAGES_sg_node), Pg_str_in_use(GLOBAL_PAGES_sg_node));
|
Pg_str_in_use(Yap_pages_sg_node) * sizeof(struct subgoal_trie_node), Pg_pg_alloc(Yap_pages_sg_node), Pg_str_in_use(Yap_pages_sg_node));
|
||||||
#else
|
#else
|
||||||
fprintf(Yap_stdout, " Subgoal trie nodes: %10ld bytes (%ld structs in use)\n",
|
fprintf(Yap_stdout, " Subgoal trie nodes: %10ld bytes (%ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_sg_node) * sizeof(struct subgoal_trie_node), Pg_str_in_use(GLOBAL_PAGES_sg_node));
|
Pg_str_in_use(Yap_pages_sg_node) * sizeof(struct subgoal_trie_node), Pg_str_in_use(Yap_pages_sg_node));
|
||||||
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
||||||
return Pg_str_in_use(GLOBAL_PAGES_sg_node) * sizeof(struct subgoal_trie_node);
|
return Pg_str_in_use(Yap_pages_sg_node) * sizeof(struct subgoal_trie_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1143,7 +1143,7 @@ static inline long show_statistics_answer_trie_nodes(void) {
|
|||||||
ans_node_ptr aux_ptr;
|
ans_node_ptr aux_ptr;
|
||||||
long cont = 0;
|
long cont = 0;
|
||||||
|
|
||||||
pg_hd = Pg_free_pg(GLOBAL_PAGES_ans_node);
|
pg_hd = Pg_free_pg(Yap_pages_ans_node);
|
||||||
while (pg_hd) {
|
while (pg_hd) {
|
||||||
aux_ptr = PgHd_free_str(pg_hd);
|
aux_ptr = PgHd_free_str(pg_hd);
|
||||||
while (aux_ptr) {
|
while (aux_ptr) {
|
||||||
@ -1152,15 +1152,15 @@ static inline long show_statistics_answer_trie_nodes(void) {
|
|||||||
}
|
}
|
||||||
pg_hd = PgHd_next(pg_hd);
|
pg_hd = PgHd_next(pg_hd);
|
||||||
}
|
}
|
||||||
TABLING_ERROR_CHECKING(statistics_answer_trie_nodes, Pg_str_free(GLOBAL_PAGES_ans_node) != cont);
|
TABLING_ERROR_CHECKING(statistics_answer_trie_nodes, Pg_str_free(Yap_pages_ans_node) != cont);
|
||||||
#endif /* DEBUG_TABLING */
|
#endif /* DEBUG_TABLING */
|
||||||
fprintf(Yap_stdout, " Answer trie nodes: %10ld bytes (%ld pages and %ld structs in use)\n",
|
fprintf(Yap_stdout, " Answer trie nodes: %10ld bytes (%ld pages and %ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_ans_node) * sizeof(struct answer_trie_node), Pg_pg_alloc(GLOBAL_PAGES_ans_node), Pg_str_in_use(GLOBAL_PAGES_ans_node));
|
Pg_str_in_use(Yap_pages_ans_node) * sizeof(struct answer_trie_node), Pg_pg_alloc(Yap_pages_ans_node), Pg_str_in_use(Yap_pages_ans_node));
|
||||||
#else
|
#else
|
||||||
fprintf(Yap_stdout, " Answer trie nodes: %10ld bytes (%ld structs in use)\n",
|
fprintf(Yap_stdout, " Answer trie nodes: %10ld bytes (%ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_ans_node) * sizeof(struct answer_trie_node), Pg_str_in_use(GLOBAL_PAGES_ans_node));
|
Pg_str_in_use(Yap_pages_ans_node) * sizeof(struct answer_trie_node), Pg_str_in_use(Yap_pages_ans_node));
|
||||||
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
||||||
return Pg_str_in_use(GLOBAL_PAGES_ans_node) * sizeof(struct answer_trie_node);
|
return Pg_str_in_use(Yap_pages_ans_node) * sizeof(struct answer_trie_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1171,7 +1171,7 @@ static inline long show_statistics_subgoal_trie_hashes(void) {
|
|||||||
sg_hash_ptr aux_ptr;
|
sg_hash_ptr aux_ptr;
|
||||||
long cont = 0;
|
long cont = 0;
|
||||||
|
|
||||||
pg_hd = Pg_free_pg(GLOBAL_PAGES_sg_hash);
|
pg_hd = Pg_free_pg(Yap_pages_sg_hash);
|
||||||
while (pg_hd) {
|
while (pg_hd) {
|
||||||
aux_ptr = PgHd_free_str(pg_hd);
|
aux_ptr = PgHd_free_str(pg_hd);
|
||||||
while (aux_ptr) {
|
while (aux_ptr) {
|
||||||
@ -1180,15 +1180,15 @@ static inline long show_statistics_subgoal_trie_hashes(void) {
|
|||||||
}
|
}
|
||||||
pg_hd = PgHd_next(pg_hd);
|
pg_hd = PgHd_next(pg_hd);
|
||||||
}
|
}
|
||||||
TABLING_ERROR_CHECKING(statistics_subgoal_trie_hashes, Pg_str_free(GLOBAL_PAGES_sg_hash) != cont);
|
TABLING_ERROR_CHECKING(statistics_subgoal_trie_hashes, Pg_str_free(Yap_pages_sg_hash) != cont);
|
||||||
#endif /* DEBUG_TABLING */
|
#endif /* DEBUG_TABLING */
|
||||||
fprintf(Yap_stdout, " Subgoal trie hashes: %10ld bytes (%ld pages and %ld structs in use)\n",
|
fprintf(Yap_stdout, " Subgoal trie hashes: %10ld bytes (%ld pages and %ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_sg_hash) * sizeof(struct subgoal_trie_hash), Pg_pg_alloc(GLOBAL_PAGES_sg_hash), Pg_str_in_use(GLOBAL_PAGES_sg_hash));
|
Pg_str_in_use(Yap_pages_sg_hash) * sizeof(struct subgoal_trie_hash), Pg_pg_alloc(Yap_pages_sg_hash), Pg_str_in_use(Yap_pages_sg_hash));
|
||||||
#else
|
#else
|
||||||
fprintf(Yap_stdout, " Subgoal trie hashes: %10ld bytes (%ld structs in use)\n",
|
fprintf(Yap_stdout, " Subgoal trie hashes: %10ld bytes (%ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_sg_hash) * sizeof(struct subgoal_trie_hash), Pg_str_in_use(GLOBAL_PAGES_sg_hash));
|
Pg_str_in_use(Yap_pages_sg_hash) * sizeof(struct subgoal_trie_hash), Pg_str_in_use(Yap_pages_sg_hash));
|
||||||
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
||||||
return Pg_str_in_use(GLOBAL_PAGES_sg_hash) * sizeof(struct subgoal_trie_hash);
|
return Pg_str_in_use(Yap_pages_sg_hash) * sizeof(struct subgoal_trie_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1199,7 +1199,7 @@ static inline long show_statistics_answer_trie_hashes(void) {
|
|||||||
ans_hash_ptr aux_ptr;
|
ans_hash_ptr aux_ptr;
|
||||||
long cont = 0;
|
long cont = 0;
|
||||||
|
|
||||||
pg_hd = Pg_free_pg(GLOBAL_PAGES_ans_hash);
|
pg_hd = Pg_free_pg(Yap_pages_ans_hash);
|
||||||
while (pg_hd) {
|
while (pg_hd) {
|
||||||
aux_ptr = PgHd_free_str(pg_hd);
|
aux_ptr = PgHd_free_str(pg_hd);
|
||||||
while (aux_ptr) {
|
while (aux_ptr) {
|
||||||
@ -1208,15 +1208,15 @@ static inline long show_statistics_answer_trie_hashes(void) {
|
|||||||
}
|
}
|
||||||
pg_hd = PgHd_next(pg_hd);
|
pg_hd = PgHd_next(pg_hd);
|
||||||
}
|
}
|
||||||
TABLING_ERROR_CHECKING(statistics_answer_trie_hashes, Pg_str_free(GLOBAL_PAGES_ans_hash) != cont);
|
TABLING_ERROR_CHECKING(statistics_answer_trie_hashes, Pg_str_free(Yap_pages_ans_hash) != cont);
|
||||||
#endif /* DEBUG_TABLING */
|
#endif /* DEBUG_TABLING */
|
||||||
fprintf(Yap_stdout, " Answer trie hashes: %10ld bytes (%ld pages and %ld structs in use)\n",
|
fprintf(Yap_stdout, " Answer trie hashes: %10ld bytes (%ld pages and %ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_ans_hash) * sizeof(struct answer_trie_hash), Pg_pg_alloc(GLOBAL_PAGES_ans_hash), Pg_str_in_use(GLOBAL_PAGES_ans_hash));
|
Pg_str_in_use(Yap_pages_ans_hash) * sizeof(struct answer_trie_hash), Pg_pg_alloc(Yap_pages_ans_hash), Pg_str_in_use(Yap_pages_ans_hash));
|
||||||
#else
|
#else
|
||||||
fprintf(Yap_stdout, " Answer trie hashes: %10ld bytes (%ld structs in use)\n",
|
fprintf(Yap_stdout, " Answer trie hashes: %10ld bytes (%ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_ans_hash) * sizeof(struct answer_trie_hash), Pg_str_in_use(GLOBAL_PAGES_ans_hash));
|
Pg_str_in_use(Yap_pages_ans_hash) * sizeof(struct answer_trie_hash), Pg_str_in_use(Yap_pages_ans_hash));
|
||||||
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
||||||
return Pg_str_in_use(GLOBAL_PAGES_ans_hash) * sizeof(struct answer_trie_hash);
|
return Pg_str_in_use(Yap_pages_ans_hash) * sizeof(struct answer_trie_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1227,7 +1227,7 @@ static inline long show_statistics_global_trie_nodes(void) {
|
|||||||
gt_node_ptr aux_ptr;
|
gt_node_ptr aux_ptr;
|
||||||
long cont = 0;
|
long cont = 0;
|
||||||
|
|
||||||
pg_hd = Pg_free_pg(GLOBAL_PAGES_gt_node);
|
pg_hd = Pg_free_pg(Yap_pages_gt_node);
|
||||||
while (pg_hd) {
|
while (pg_hd) {
|
||||||
aux_ptr = PgHd_free_str(pg_hd);
|
aux_ptr = PgHd_free_str(pg_hd);
|
||||||
while (aux_ptr) {
|
while (aux_ptr) {
|
||||||
@ -1236,15 +1236,15 @@ static inline long show_statistics_global_trie_nodes(void) {
|
|||||||
}
|
}
|
||||||
pg_hd = PgHd_next(pg_hd);
|
pg_hd = PgHd_next(pg_hd);
|
||||||
}
|
}
|
||||||
TABLING_ERROR_CHECKING(statistics_global_trie_nodes, Pg_str_free(GLOBAL_PAGES_gt_node) != cont);
|
TABLING_ERROR_CHECKING(statistics_global_trie_nodes, Pg_str_free(Yap_pages_gt_node) != cont);
|
||||||
#endif /* DEBUG_TABLING */
|
#endif /* DEBUG_TABLING */
|
||||||
fprintf(Yap_stdout, " Global trie nodes: %10ld bytes (%ld pages and %ld structs in use)\n",
|
fprintf(Yap_stdout, " Global trie nodes: %10ld bytes (%ld pages and %ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_gt_node) * sizeof(struct global_trie_node), Pg_pg_alloc(GLOBAL_PAGES_gt_node), Pg_str_in_use(GLOBAL_PAGES_gt_node));
|
Pg_str_in_use(Yap_pages_gt_node) * sizeof(struct global_trie_node), Pg_pg_alloc(Yap_pages_gt_node), Pg_str_in_use(Yap_pages_gt_node));
|
||||||
#else
|
#else
|
||||||
fprintf(Yap_stdout, " Global trie nodes: %10ld bytes (%ld structs in use)\n",
|
fprintf(Yap_stdout, " Global trie nodes: %10ld bytes (%ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_gt_node) * sizeof(struct global_trie_node), Pg_str_in_use(GLOBAL_PAGES_gt_node));
|
Pg_str_in_use(Yap_pages_gt_node) * sizeof(struct global_trie_node), Pg_str_in_use(Yap_pages_gt_node));
|
||||||
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
||||||
return Pg_str_in_use(GLOBAL_PAGES_gt_node) * sizeof(struct global_trie_node);
|
return Pg_str_in_use(Yap_pages_gt_node) * sizeof(struct global_trie_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1255,7 +1255,7 @@ static inline long show_statistics_global_trie_hashes(void) {
|
|||||||
gt_hash_ptr aux_ptr;
|
gt_hash_ptr aux_ptr;
|
||||||
long cont = 0;
|
long cont = 0;
|
||||||
|
|
||||||
pg_hd = Pg_free_pg(GLOBAL_PAGES_gt_hash);
|
pg_hd = Pg_free_pg(Yap_pages_gt_hash);
|
||||||
while (pg_hd) {
|
while (pg_hd) {
|
||||||
aux_ptr = PgHd_free_str(pg_hd);
|
aux_ptr = PgHd_free_str(pg_hd);
|
||||||
while (aux_ptr) {
|
while (aux_ptr) {
|
||||||
@ -1264,15 +1264,15 @@ static inline long show_statistics_global_trie_hashes(void) {
|
|||||||
}
|
}
|
||||||
pg_hd = PgHd_next(pg_hd);
|
pg_hd = PgHd_next(pg_hd);
|
||||||
}
|
}
|
||||||
TABLING_ERROR_CHECKING(statistics_global_trie_hashes, Pg_str_free(GLOBAL_PAGES_gt_hash) != cont);
|
TABLING_ERROR_CHECKING(statistics_global_trie_hashes, Pg_str_free(Yap_pages_gt_hash) != cont);
|
||||||
#endif /* DEBUG_TABLING */
|
#endif /* DEBUG_TABLING */
|
||||||
fprintf(Yap_stdout, " Global trie hashes: %10ld bytes (%ld pages and %ld structs in use)\n",
|
fprintf(Yap_stdout, " Global trie hashes: %10ld bytes (%ld pages and %ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_gt_hash) * sizeof(struct global_trie_hash), Pg_pg_alloc(GLOBAL_PAGES_gt_hash), Pg_str_in_use(GLOBAL_PAGES_gt_hash));
|
Pg_str_in_use(Yap_pages_gt_hash) * sizeof(struct global_trie_hash), Pg_pg_alloc(Yap_pages_gt_hash), Pg_str_in_use(Yap_pages_gt_hash));
|
||||||
#else
|
#else
|
||||||
fprintf(Yap_stdout, " Global trie hashes: %10ld bytes (%ld structs in use)\n",
|
fprintf(Yap_stdout, " Global trie hashes: %10ld bytes (%ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_gt_hash) * sizeof(struct global_trie_hash), Pg_str_in_use(GLOBAL_PAGES_gt_hash));
|
Pg_str_in_use(Yap_pages_gt_hash) * sizeof(struct global_trie_hash), Pg_str_in_use(Yap_pages_gt_hash));
|
||||||
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
||||||
return Pg_str_in_use(GLOBAL_PAGES_gt_hash) * sizeof(struct global_trie_hash);
|
return Pg_str_in_use(Yap_pages_gt_hash) * sizeof(struct global_trie_hash);
|
||||||
}
|
}
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
|
|
||||||
@ -1285,7 +1285,7 @@ static inline long show_statistics_or_frames(void) {
|
|||||||
or_fr_ptr aux_ptr;
|
or_fr_ptr aux_ptr;
|
||||||
long cont = 0;
|
long cont = 0;
|
||||||
|
|
||||||
pg_hd = Pg_free_pg(GLOBAL_PAGES_or_fr);
|
pg_hd = Pg_free_pg(Yap_pages_or_fr );
|
||||||
while (pg_hd) {
|
while (pg_hd) {
|
||||||
aux_ptr = PgHd_free_str(pg_hd);
|
aux_ptr = PgHd_free_str(pg_hd);
|
||||||
while (aux_ptr) {
|
while (aux_ptr) {
|
||||||
@ -1294,15 +1294,15 @@ static inline long show_statistics_or_frames(void) {
|
|||||||
}
|
}
|
||||||
pg_hd = PgHd_next(pg_hd);
|
pg_hd = PgHd_next(pg_hd);
|
||||||
}
|
}
|
||||||
YAPOR_ERROR_CHECKING(statistics_or_frames, Pg_str_free(GLOBAL_PAGES_or_fr) != cont);
|
YAPOR_ERROR_CHECKING(statistics_or_frames, Pg_str_free(Yap_pages_or_fr ) != cont);
|
||||||
#endif /* DEBUG_YAPOR */
|
#endif /* DEBUG_YAPOR */
|
||||||
fprintf(Yap_stdout, " Or-frames: %10ld bytes (%ld pages and %ld structs in use)\n",
|
fprintf(Yap_stdout, " Or-frames: %10ld bytes (%ld pages and %ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_or_fr) * sizeof(struct or_frame), Pg_pg_alloc(GLOBAL_PAGES_or_fr), Pg_str_in_use(GLOBAL_PAGES_or_fr));
|
Pg_str_in_use(Yap_pages_or_fr ) * sizeof(struct or_frame), Pg_pg_alloc(Yap_pages_or_fr ), Pg_str_in_use(Yap_pages_or_fr ));
|
||||||
#else
|
#else
|
||||||
fprintf(Yap_stdout, " Or-frames: %10ld bytes (%ld structs in use)\n",
|
fprintf(Yap_stdout, " Or-frames: %10ld bytes (%ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_or_fr) * sizeof(struct or_frame), Pg_str_in_use(GLOBAL_PAGES_or_fr));
|
Pg_str_in_use(Yap_pages_or_fr ) * sizeof(struct or_frame), Pg_str_in_use(Yap_pages_or_fr ));
|
||||||
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
||||||
return Pg_str_in_use(GLOBAL_PAGES_or_fr) * sizeof(struct or_frame);
|
return Pg_str_in_use(Yap_pages_or_fr ) * sizeof(struct or_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1313,7 +1313,7 @@ static inline long show_statistics_query_goal_solution_frames(void) {
|
|||||||
qg_sol_fr_ptr aux_ptr;
|
qg_sol_fr_ptr aux_ptr;
|
||||||
long cont = 0;
|
long cont = 0;
|
||||||
|
|
||||||
pg_hd = Pg_free_pg(GLOBAL_PAGES_qg_sol_fr);
|
pg_hd = Pg_free_pg(Yap_pages_qg_sol_fr );
|
||||||
while (pg_hd) {
|
while (pg_hd) {
|
||||||
aux_ptr = PgHd_free_str(pg_hd);
|
aux_ptr = PgHd_free_str(pg_hd);
|
||||||
while (aux_ptr) {
|
while (aux_ptr) {
|
||||||
@ -1322,15 +1322,15 @@ static inline long show_statistics_query_goal_solution_frames(void) {
|
|||||||
}
|
}
|
||||||
pg_hd = PgHd_next(pg_hd);
|
pg_hd = PgHd_next(pg_hd);
|
||||||
}
|
}
|
||||||
YAPOR_ERROR_CHECKING(statistics_query_goal_solution_frames, Pg_str_free(GLOBAL_PAGES_qg_sol_fr) != cont);
|
YAPOR_ERROR_CHECKING(statistics_query_goal_solution_frames, Pg_str_free(Yap_pages_qg_sol_fr ) != cont);
|
||||||
#endif /* DEBUG_YAPOR */
|
#endif /* DEBUG_YAPOR */
|
||||||
fprintf(Yap_stdout, " Query goal solution frames: %10ld bytes (%ld pages and %ld structs in use)\n",
|
fprintf(Yap_stdout, " Query goal solution frames: %10ld bytes (%ld pages and %ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_qg_sol_fr) * sizeof(struct query_goal_solution_frame), Pg_pg_alloc(GLOBAL_PAGES_qg_sol_fr), Pg_str_in_use(GLOBAL_PAGES_qg_sol_fr));
|
Pg_str_in_use(Yap_pages_qg_sol_fr ) * sizeof(struct query_goal_solution_frame), Pg_pg_alloc(Yap_pages_qg_sol_fr ), Pg_str_in_use(Yap_pages_qg_sol_fr ));
|
||||||
#else
|
#else
|
||||||
fprintf(Yap_stdout, " Query goal solution frames: %10ld bytes (%ld structs in use)\n",
|
fprintf(Yap_stdout, " Query goal solution frames: %10ld bytes (%ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_qg_sol_fr) * sizeof(struct query_goal_solution_frame), Pg_str_in_use(GLOBAL_PAGES_qg_sol_fr));
|
Pg_str_in_use(Yap_pages_qg_sol_fr ) * sizeof(struct query_goal_solution_frame), Pg_str_in_use(Yap_pages_qg_sol_fr ));
|
||||||
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
||||||
return Pg_str_in_use(GLOBAL_PAGES_qg_sol_fr) * sizeof(struct query_goal_solution_frame);
|
return Pg_str_in_use(Yap_pages_qg_sol_fr ) * sizeof(struct query_goal_solution_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1341,7 +1341,7 @@ static inline long show_statistics_query_goal_answer_frames(void) {
|
|||||||
qg_ans_fr_ptr aux_ptr;
|
qg_ans_fr_ptr aux_ptr;
|
||||||
long cont = 0;
|
long cont = 0;
|
||||||
|
|
||||||
pg_hd = Pg_free_pg(GLOBAL_PAGES_qg_ans_fr);
|
pg_hd = Pg_free_pg(Yap_pages_qg_ans_fr);
|
||||||
while (pg_hd) {
|
while (pg_hd) {
|
||||||
aux_ptr = PgHd_free_str(pg_hd);
|
aux_ptr = PgHd_free_str(pg_hd);
|
||||||
while (aux_ptr) {
|
while (aux_ptr) {
|
||||||
@ -1350,15 +1350,15 @@ static inline long show_statistics_query_goal_answer_frames(void) {
|
|||||||
}
|
}
|
||||||
pg_hd = PgHd_next(pg_hd);
|
pg_hd = PgHd_next(pg_hd);
|
||||||
}
|
}
|
||||||
YAPOR_ERROR_CHECKING(statistics_query_goal_answer_frames, Pg_str_free(GLOBAL_PAGES_qg_ans_fr) != cont);
|
YAPOR_ERROR_CHECKING(statistics_query_goal_answer_frames, Pg_str_free(Yap_pages_qg_ans_fr) != cont);
|
||||||
#endif /* DEBUG_YAPOR */
|
#endif /* DEBUG_YAPOR */
|
||||||
fprintf(Yap_stdout, " Query goal answer frames: %10ld bytes (%ld pages and %ld structs in use)\n",
|
fprintf(Yap_stdout, " Query goal answer frames: %10ld bytes (%ld pages and %ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_qg_ans_fr) * sizeof(struct query_goal_answer_frame), Pg_pg_alloc(GLOBAL_PAGES_qg_ans__fr), Pg_str_in_use(GLOBAL_PAGES_qg_ans_fr));
|
Pg_str_in_use(Yap_pages_qg_ans_fr) * sizeof(struct query_goal_answer_frame), Pg_pg_alloc(Yap_pages_qg_ans__fr), Pg_str_in_use(Yap_pages_qg_ans_fr));
|
||||||
#else
|
#else
|
||||||
fprintf(Yap_stdout, " Query goal answer frames: %10ld bytes (%ld structs in use)\n",
|
fprintf(Yap_stdout, " Query goal answer frames: %10ld bytes (%ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_qg_ans_fr) * sizeof(struct query_goal_answer_frame), Pg_str_in_use(GLOBAL_PAGES_qg_ans_fr));
|
Pg_str_in_use(Yap_pages_qg_ans_fr) * sizeof(struct query_goal_answer_frame), Pg_str_in_use(Yap_pages_qg_ans_fr));
|
||||||
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
||||||
return Pg_str_in_use(GLOBAL_PAGES_qg_ans_fr) * sizeof(struct query_goal_answer_frame);
|
return Pg_str_in_use(Yap_pages_qg_ans_fr) * sizeof(struct query_goal_answer_frame);
|
||||||
}
|
}
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
|
|
||||||
@ -1371,7 +1371,7 @@ static inline long show_statistics_suspension_frames(void) {
|
|||||||
susp_fr_ptr aux_ptr;
|
susp_fr_ptr aux_ptr;
|
||||||
long cont = 0;
|
long cont = 0;
|
||||||
|
|
||||||
pg_hd = Pg_free_pg(GLOBAL_PAGES_susp_fr);
|
pg_hd = Pg_free_pg(Yap_pages_susp_fr);
|
||||||
while (pg_hd) {
|
while (pg_hd) {
|
||||||
aux_ptr = PgHd_free_str(pg_hd);
|
aux_ptr = PgHd_free_str(pg_hd);
|
||||||
while (aux_ptr) {
|
while (aux_ptr) {
|
||||||
@ -1380,15 +1380,15 @@ static inline long show_statistics_suspension_frames(void) {
|
|||||||
}
|
}
|
||||||
pg_hd = PgHd_next(pg_hd);
|
pg_hd = PgHd_next(pg_hd);
|
||||||
}
|
}
|
||||||
OPTYAP_ERROR_CHECKING(statistics_suspension_frames, Pg_str_free(GLOBAL_PAGES_susp_fr) != cont);
|
OPTYAP_ERROR_CHECKING(statistics_suspension_frames, Pg_str_free(Yap_pages_susp_fr) != cont);
|
||||||
#endif /* DEBUG_OPTYAP */
|
#endif /* DEBUG_OPTYAP */
|
||||||
fprintf(Yap_stdout, " Suspension frames: %10ld bytes (%ld pages and %ld structs in use)\n",
|
fprintf(Yap_stdout, " Suspension frames: %10ld bytes (%ld pages and %ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_susp_fr) * sizeof(struct suspension_frame), Pg_pg_alloc(GLOBAL_PAGES_susp_fr), Pg_str_in_use(GLOBAL_PAGES_susp_fr));
|
Pg_str_in_use(Yap_pages_susp_fr) * sizeof(struct suspension_frame), Pg_pg_alloc(Yap_pages_susp_fr), Pg_str_in_use(Yap_pages_susp_fr));
|
||||||
#else
|
#else
|
||||||
fprintf(Yap_stdout, " Suspension frames: %10ld bytes (%ld structs in use)\n",
|
fprintf(Yap_stdout, " Suspension frames: %10ld bytes (%ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_susp_fr) * sizeof(struct suspension_frame), Pg_str_in_use(GLOBAL_PAGES_susp_fr));
|
Pg_str_in_use(Yap_pages_susp_fr) * sizeof(struct suspension_frame), Pg_str_in_use(Yap_pages_susp_fr));
|
||||||
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
||||||
return Pg_str_in_use(GLOBAL_PAGES_susp_fr) * sizeof(struct suspension_frame);
|
return Pg_str_in_use(Yap_pages_susp_fr) * sizeof(struct suspension_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1400,7 +1400,7 @@ static inline long show_statistics_table_subgoal_solution_frames(void) {
|
|||||||
tg_sol_fr_ptr aux_ptr;
|
tg_sol_fr_ptr aux_ptr;
|
||||||
long cont = 0;
|
long cont = 0;
|
||||||
|
|
||||||
pg_hd = Pg_free_pg(GLOBAL_PAGES_tg_sol_fr);
|
pg_hd = Pg_free_pg(Yap_pages_tg_sol_fr);
|
||||||
while (pg_hd) {
|
while (pg_hd) {
|
||||||
aux_ptr = PgHd_free_str(pg_hd);
|
aux_ptr = PgHd_free_str(pg_hd);
|
||||||
while (aux_ptr) {
|
while (aux_ptr) {
|
||||||
@ -1409,15 +1409,15 @@ static inline long show_statistics_table_subgoal_solution_frames(void) {
|
|||||||
}
|
}
|
||||||
pg_hd = PgHd_next(pg_hd);
|
pg_hd = PgHd_next(pg_hd);
|
||||||
}
|
}
|
||||||
OPTYAP_ERROR_CHECKING(statistics_table_subgoal_solution_frames, Pg_str_free(GLOBAL_PAGES_tg_sol_fr) != cont);
|
OPTYAP_ERROR_CHECKING(statistics_table_subgoal_solution_frames, Pg_str_free(Yap_pages_tg_sol_fr) != cont);
|
||||||
#endif /* DEBUG_OPTYAP */
|
#endif /* DEBUG_OPTYAP */
|
||||||
fprintf(Yap_stdout, " Table subgoal solution frames: %10ld bytes (%ld pages and %ld structs in use)\n",
|
fprintf(Yap_stdout, " Table subgoal solution frames: %10ld bytes (%ld pages and %ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame), Pg_pg_alloc(GLOBAL_PAGES_tg_sol_fr), Pg_str_in_use(GLOBAL_PAGES_tg_sol_fr));
|
Pg_str_in_use(Yap_pages_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame), Pg_pg_alloc(Yap_pages_tg_sol_fr), Pg_str_in_use(Yap_pages_tg_sol_fr));
|
||||||
#else
|
#else
|
||||||
fprintf(Yap_stdout, " Table subgoal solution frames: %10ld bytes (%ld structs in use)\n",
|
fprintf(Yap_stdout, " Table subgoal solution frames: %10ld bytes (%ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame), Pg_str_in_use(GLOBAL_PAGES_tg_sol_fr));
|
Pg_str_in_use(Yap_pages_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame), Pg_str_in_use(Yap_pages_tg_sol_fr));
|
||||||
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
||||||
return Pg_str_in_use(GLOBAL_PAGES_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame);
|
return Pg_str_in_use(Yap_pages_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1428,7 +1428,7 @@ static inline long show_statistics_table_subgoal_answer_frames(void) {
|
|||||||
tg_ans_fr_ptr aux_ptr;
|
tg_ans_fr_ptr aux_ptr;
|
||||||
long cont = 0;
|
long cont = 0;
|
||||||
|
|
||||||
pg_hd = Pg_free_pg(GLOBAL_PAGES_tg_ans_fr);
|
pg_hd = Pg_free_pg(Yap_pages_tg_ans_fr);
|
||||||
while (pg_hd) {
|
while (pg_hd) {
|
||||||
aux_ptr = PgHd_free_str(pg_hd);
|
aux_ptr = PgHd_free_str(pg_hd);
|
||||||
while (aux_ptr) {
|
while (aux_ptr) {
|
||||||
@ -1437,15 +1437,15 @@ static inline long show_statistics_table_subgoal_answer_frames(void) {
|
|||||||
}
|
}
|
||||||
pg_hd = PgHd_next(pg_hd);
|
pg_hd = PgHd_next(pg_hd);
|
||||||
}
|
}
|
||||||
OPTYAP_ERROR_CHECKING(statistics_table_subgoal_answer_frames, Pg_str_free(GLOBAL_PAGES_tg_ans_fr) != cont);
|
OPTYAP_ERROR_CHECKING(statistics_table_subgoal_answer_frames, Pg_str_free(Yap_pages_tg_ans_fr) != cont);
|
||||||
#endif /* DEBUG_OPTYAP */
|
#endif /* DEBUG_OPTYAP */
|
||||||
fprintf(Yap_stdout, " Table subgoal answer frames: %10ld bytes (%ld pages and %ld structs in use)\n",
|
fprintf(Yap_stdout, " Table subgoal answer frames: %10ld bytes (%ld pages and %ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame), Pg_pg_alloc(GLOBAL_PAGES_tg_ans_fr), Pg_str_in_use(GLOBAL_PAGES_tg_ans_fr));
|
Pg_str_in_use(Yap_pages_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame), Pg_pg_alloc(Yap_pages_tg_ans_fr), Pg_str_in_use(Yap_pages_tg_ans_fr));
|
||||||
#else
|
#else
|
||||||
fprintf(Yap_stdout, " Table subgoal answer frames: %10ld bytes (%ld structs in use)\n",
|
fprintf(Yap_stdout, " Table subgoal answer frames: %10ld bytes (%ld structs in use)\n",
|
||||||
Pg_str_in_use(GLOBAL_PAGES_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame), Pg_str_in_use(GLOBAL_PAGES_tg_ans_fr));
|
Pg_str_in_use(Yap_pages_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame), Pg_str_in_use(Yap_pages_tg_ans_fr));
|
||||||
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
#endif /* SHM_MEMORY_ALLOC_SCHEME */
|
||||||
return Pg_str_in_use(GLOBAL_PAGES_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame);
|
return Pg_str_in_use(Yap_pages_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame);
|
||||||
}
|
}
|
||||||
#endif /* TABLING_INNER_CUTS */
|
#endif /* TABLING_INNER_CUTS */
|
||||||
#endif /* YAPOR && TABLING */
|
#endif /* YAPOR && TABLING */
|
||||||
|
@ -33,7 +33,7 @@ void remap_memory(void);
|
|||||||
** opt.init.c **
|
** opt.init.c **
|
||||||
*************************/
|
*************************/
|
||||||
|
|
||||||
void Yap_init_global(int, int, int, int);
|
void Yap_init_optyap_global(int, int, int, int);
|
||||||
void Yap_init_local(void);
|
void Yap_init_local(void);
|
||||||
void make_root_frames(void);
|
void make_root_frames(void);
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
@ -90,7 +90,7 @@ void resume_suspension_frame(susp_fr_ptr, or_fr_ptr);
|
|||||||
|
|
||||||
|
|
||||||
/**************************
|
/**************************
|
||||||
** or.engine.c **
|
** or.copy_engine.c **
|
||||||
**************************/
|
**************************/
|
||||||
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
|
@ -157,10 +157,10 @@ struct global_locks {
|
|||||||
|
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
** Struct global_data **
|
* Struct optyap_global_data **
|
||||||
*********************************/
|
*********************************/
|
||||||
|
|
||||||
struct global_data{
|
struct optyap_global_data{
|
||||||
/* global data related to memory management */
|
/* global data related to memory management */
|
||||||
struct global_pages pages;
|
struct global_pages pages;
|
||||||
|
|
||||||
@ -170,9 +170,9 @@ struct global_data{
|
|||||||
int delayed_release_load;
|
int delayed_release_load;
|
||||||
int number_workers;
|
int number_workers;
|
||||||
int worker_pid[MAX_WORKERS];
|
int worker_pid[MAX_WORKERS];
|
||||||
#ifdef ACOW
|
#ifdef YAPOR_COW
|
||||||
int master_worker;
|
int master_worker;
|
||||||
#endif /* ACOW */
|
#endif /* YAPOR_COW */
|
||||||
|
|
||||||
/* global data related to or-performance */
|
/* global data related to or-performance */
|
||||||
realtime execution_time;
|
realtime execution_time;
|
||||||
@ -223,72 +223,72 @@ struct global_data{
|
|||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GLOBAL_MAX_PAGES (GLOBAL.pages.max_pages)
|
#define Yap_max_pages (Yap_optyap_data.pages.max_pages)
|
||||||
#define GLOBAL_PAGES_void (GLOBAL.pages.void_pages)
|
#define Yap_pages_void (Yap_optyap_data.pages.void_pages)
|
||||||
#define GLOBAL_PAGES_or_fr (GLOBAL.pages.or_frame_pages)
|
#define Yap_pages_or_fr (Yap_optyap_data.pages.or_frame_pages)
|
||||||
#define GLOBAL_PAGES_qg_sol_fr (GLOBAL.pages.query_goal_solution_frame_pages)
|
#define Yap_pages_qg_sol_fr (Yap_optyap_data.pages.query_goal_solution_frame_pages)
|
||||||
#define GLOBAL_PAGES_qg_ans_fr (GLOBAL.pages.query_goal_answer_frame_pages)
|
#define Yap_pages_qg_ans_fr (Yap_optyap_data.pages.query_goal_answer_frame_pages)
|
||||||
#define GLOBAL_PAGES_tg_sol_fr (GLOBAL.pages.table_subgoal_solution_frame_pages)
|
#define Yap_pages_tg_sol_fr (Yap_optyap_data.pages.table_subgoal_solution_frame_pages)
|
||||||
#define GLOBAL_PAGES_tg_ans_fr (GLOBAL.pages.table_subgoal_answer_frame_pages)
|
#define Yap_pages_tg_ans_fr (Yap_optyap_data.pages.table_subgoal_answer_frame_pages)
|
||||||
#define GLOBAL_PAGES_tab_ent (GLOBAL.pages.table_entry_pages)
|
#define Yap_pages_tab_ent (Yap_optyap_data.pages.table_entry_pages)
|
||||||
#define GLOBAL_PAGES_sg_fr (GLOBAL.pages.subgoal_frame_pages)
|
#define Yap_pages_sg_fr (Yap_optyap_data.pages.subgoal_frame_pages)
|
||||||
#define GLOBAL_PAGES_dep_fr (GLOBAL.pages.dependency_frame_pages)
|
#define Yap_pages_dep_fr (Yap_optyap_data.pages.dependency_frame_pages)
|
||||||
#define GLOBAL_PAGES_sg_node (GLOBAL.pages.subgoal_trie_node_pages)
|
#define Yap_pages_sg_node (Yap_optyap_data.pages.subgoal_trie_node_pages)
|
||||||
#define GLOBAL_PAGES_ans_node (GLOBAL.pages.answer_trie_node_pages)
|
#define Yap_pages_ans_node (Yap_optyap_data.pages.answer_trie_node_pages)
|
||||||
#define GLOBAL_PAGES_gt_node (GLOBAL.pages.global_trie_node_pages)
|
#define Yap_pages_gt_node (Yap_optyap_data.pages.global_trie_node_pages)
|
||||||
#define GLOBAL_PAGES_sg_hash (GLOBAL.pages.subgoal_trie_hash_pages)
|
#define Yap_pages_sg_hash (Yap_optyap_data.pages.subgoal_trie_hash_pages)
|
||||||
#define GLOBAL_PAGES_ans_hash (GLOBAL.pages.answer_trie_hash_pages)
|
#define Yap_pages_ans_hash (Yap_optyap_data.pages.answer_trie_hash_pages)
|
||||||
#define GLOBAL_PAGES_gt_hash (GLOBAL.pages.global_trie_hash_pages)
|
#define Yap_pages_gt_hash (Yap_optyap_data.pages.global_trie_hash_pages)
|
||||||
#define GLOBAL_PAGES_susp_fr (GLOBAL.pages.suspension_frame_pages)
|
#define Yap_pages_susp_fr (Yap_optyap_data.pages.suspension_frame_pages)
|
||||||
#define SCHEDULER_LOOP (GLOBAL.scheduler_loop)
|
#define Yap_scheduler_loop (Yap_optyap_data.scheduler_loop)
|
||||||
#define DELAYED_RELEASE_LOAD (GLOBAL.delayed_release_load)
|
#define Yap_delayed_release_load (Yap_optyap_data.delayed_release_load)
|
||||||
#define number_workers (GLOBAL.number_workers)
|
#define Yap_number_workers (Yap_optyap_data.number_workers)
|
||||||
#define worker_pid(worker) (GLOBAL.worker_pid[worker])
|
#define Yap_worker_pid(worker) (Yap_optyap_data.worker_pid[worker])
|
||||||
#define GLOBAL_master_worker (GLOBAL.master_worker)
|
#define Yap_master_worker (Yap_optyap_data.master_worker)
|
||||||
#define GLOBAL_execution_time (GLOBAL.execution_time)
|
#define Yap_execution_time (Yap_optyap_data.execution_time)
|
||||||
#define GLOBAL_best_times(time) (GLOBAL.best_execution_times[time])
|
#define Yap_best_times(time) (Yap_optyap_data.best_execution_times[time])
|
||||||
#define GLOBAL_number_goals (GLOBAL.number_of_executed_goals)
|
#define Yap_number_goals (Yap_optyap_data.number_of_executed_goals)
|
||||||
#define GLOBAL_performance_mode (GLOBAL.performance_mode)
|
#define Yap_performance_mode (Yap_optyap_data.performance_mode)
|
||||||
#if THREADS
|
#if THREADS
|
||||||
#define Get_GLOBAL_root_cp() offset_to_cptr(GLOBAL.root_choice_point_offset)
|
#define Get_Yap_root_cp() offset_to_cptr(Yap_optyap_data.root_choice_point_offset)
|
||||||
#define Set_GLOBAL_root_cp(bptr) (GLOBAL.root_choice_point_offset = cptr_to_offset(bptr))
|
#define Set_Yap_root_cp(bptr) (Yap_optyap_data.root_choice_point_offset = cptr_to_offset(bptr))
|
||||||
#else
|
#else
|
||||||
#define GLOBAL_root_cp (GLOBAL.root_choice_point)
|
#define Yap_root_cp (Yap_optyap_data.root_choice_point)
|
||||||
#define Get_GLOBAL_root_cp() (GLOBAL.root_choice_point)
|
#define Get_Yap_root_cp() (Yap_optyap_data.root_choice_point)
|
||||||
#define Set_GLOBAL_root_cp(bptr) (GLOBAL.root_choice_point = (bptr))
|
#define Set_Yap_root_cp(bptr) (Yap_optyap_data.root_choice_point = (bptr))
|
||||||
#endif
|
#endif
|
||||||
#define GLOBAL_root_or_fr (GLOBAL.root_or_frame)
|
#define Yap_root_or_fr (Yap_optyap_data.root_or_frame)
|
||||||
#define GLOBAL_bm_present_workers (GLOBAL.present_workers)
|
#define Yap_bm_present_workers (Yap_optyap_data.present_workers)
|
||||||
#define GLOBAL_bm_idle_workers (GLOBAL.idle_workers)
|
#define Yap_bm_idle_workers (Yap_optyap_data.idle_workers)
|
||||||
#define GLOBAL_bm_root_cp_workers (GLOBAL.root_cp_workers)
|
#define Yap_bm_root_cp_workers (Yap_optyap_data.root_cp_workers)
|
||||||
#define GLOBAL_bm_invisible_workers (GLOBAL.invisible_workers)
|
#define Yap_bm_invisible_workers (Yap_optyap_data.invisible_workers)
|
||||||
#define GLOBAL_bm_requestable_workers (GLOBAL.requestable_workers)
|
#define Yap_bm_requestable_workers (Yap_optyap_data.requestable_workers)
|
||||||
#define GLOBAL_bm_executing_workers (GLOBAL.executing_workers)
|
#define Yap_bm_executing_workers (Yap_optyap_data.executing_workers)
|
||||||
#define GLOBAL_bm_finished_workers (GLOBAL.finished_workers)
|
#define Yap_bm_finished_workers (Yap_optyap_data.finished_workers)
|
||||||
#define GLOBAL_bm_pruning_workers (GLOBAL.pruning_workers)
|
#define Yap_bm_pruning_workers (Yap_optyap_data.pruning_workers)
|
||||||
#define GLOBAL_LOCKS_bm_idle_workers (GLOBAL.locks.bitmap_idle_workers)
|
#define Yap_locks_bm_idle_workers (Yap_optyap_data.locks.bitmap_idle_workers)
|
||||||
#define GLOBAL_LOCKS_bm_root_cp_workers (GLOBAL.locks.bitmap_root_cp_workers)
|
#define Yap_locks_bm_root_cp_workers (Yap_optyap_data.locks.bitmap_root_cp_workers)
|
||||||
#define GLOBAL_LOCKS_bm_invisible_workers (GLOBAL.locks.bitmap_invisible_workers)
|
#define Yap_locks_bm_invisible_workers (Yap_optyap_data.locks.bitmap_invisible_workers)
|
||||||
#define GLOBAL_LOCKS_bm_requestable_workers (GLOBAL.locks.bitmap_requestable_workers)
|
#define Yap_locks_bm_requestable_workers (Yap_optyap_data.locks.bitmap_requestable_workers)
|
||||||
#define GLOBAL_LOCKS_bm_executing_workers (GLOBAL.locks.bitmap_executing_workers)
|
#define Yap_locks_bm_executing_workers (Yap_optyap_data.locks.bitmap_executing_workers)
|
||||||
#define GLOBAL_LOCKS_bm_finished_workers (GLOBAL.locks.bitmap_finished_workers)
|
#define Yap_locks_bm_finished_workers (Yap_optyap_data.locks.bitmap_finished_workers)
|
||||||
#define GLOBAL_LOCKS_bm_pruning_workers (GLOBAL.locks.bitmap_pruning_workers)
|
#define Yap_locks_bm_pruning_workers (Yap_optyap_data.locks.bitmap_pruning_workers)
|
||||||
#define GLOBAL_LOCKS_who_locked_heap (GLOBAL.locks.who_locked_heap)
|
#define Yap_locks_who_locked_heap (Yap_optyap_data.locks.who_locked_heap)
|
||||||
#define GLOBAL_LOCKS_heap_access (GLOBAL.locks.heap_access)
|
#define Yap_locks_heap_access (Yap_optyap_data.locks.heap_access)
|
||||||
#define GLOBAL_LOCKS_alloc_block (GLOBAL.locks.alloc_block)
|
#define Yap_locks_alloc_block (Yap_optyap_data.locks.alloc_block)
|
||||||
#define GLOBAL_branch(worker, depth) (GLOBAL.branch[worker][depth])
|
#define Yap_branch(worker, depth) (Yap_optyap_data.branch[worker][depth])
|
||||||
#define PARALLEL_EXECUTION_MODE (GLOBAL.parallel_execution_mode)
|
#define Yap_parallel_execution_mode (Yap_optyap_data.parallel_execution_mode)
|
||||||
#define GLOBAL_answers (GLOBAL.answers)
|
#define Yap_answers (Yap_optyap_data.answers)
|
||||||
#define GLOBAL_root_gt (GLOBAL.root_global_trie)
|
#define Yap_root_gt (Yap_optyap_data.root_global_trie)
|
||||||
#define GLOBAL_root_tab_ent (GLOBAL.root_table_entry)
|
#define Yap_root_tab_ent (Yap_optyap_data.root_table_entry)
|
||||||
#define GLOBAL_first_sg_fr (GLOBAL.first_subgoal_frame)
|
#define Yap_first_sg_fr (Yap_optyap_data.first_subgoal_frame)
|
||||||
#define GLOBAL_last_sg_fr (GLOBAL.last_subgoal_frame)
|
#define Yap_last_sg_fr (Yap_optyap_data.last_subgoal_frame)
|
||||||
#define GLOBAL_check_sg_fr (GLOBAL.check_subgoal_frame)
|
#define Yap_check_sg_fr (Yap_optyap_data.check_subgoal_frame)
|
||||||
#define GLOBAL_root_dep_fr (GLOBAL.root_dependency_frame)
|
#define Yap_root_dep_fr (Yap_optyap_data.root_dependency_frame)
|
||||||
#define GLOBAL_table_var_enumerator(index) (GLOBAL.table_var_enumerator[index])
|
#define Yap_table_var_enumerator(index) (Yap_optyap_data.table_var_enumerator[index])
|
||||||
#define GLOBAL_table_var_enumerator_addr(index) (GLOBAL.table_var_enumerator + (index))
|
#define Yap_table_var_enumerator_addr(index) (Yap_optyap_data.table_var_enumerator + (index))
|
||||||
#define GLOBAL_table_lock(index) (GLOBAL.table_lock[index])
|
#define Yap_table_lock(index) (Yap_optyap_data.table_lock[index])
|
||||||
#define GLOBAL_timestamp (GLOBAL.timestamp)
|
#define Yap_timestamp (Yap_optyap_data.timestamp)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ struct global_data{
|
|||||||
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
struct local_signals{
|
struct local_signals{
|
||||||
#if defined(ENV_COPY) || defined(THREADS)
|
#if defined(YAPOR_COPY) || defined(THREADS)
|
||||||
lockvar lock;
|
lockvar lock;
|
||||||
volatile enum {
|
volatile enum {
|
||||||
Q_idle = 0,
|
Q_idle = 0,
|
||||||
@ -307,7 +307,7 @@ struct local_signals{
|
|||||||
local = 3,
|
local = 3,
|
||||||
P_idle = 4
|
P_idle = 4
|
||||||
} P_fase, Q_fase;
|
} P_fase, Q_fase;
|
||||||
#endif /* ENV_COPY || THREADS */
|
#endif /* YAPOR_COPY || THREADS */
|
||||||
volatile enum {
|
volatile enum {
|
||||||
no_sharing = 0,
|
no_sharing = 0,
|
||||||
sharing = 1,
|
sharing = 1,
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
** ------------------ */
|
** ------------------ */
|
||||||
|
|
||||||
#include "Yap.h"
|
#include "Yap.h"
|
||||||
#ifdef ENV_COPY
|
#ifdef YAPOR_COPY
|
||||||
#ifdef HAVE_STRING_H
|
#ifdef HAVE_STRING_H
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif /* HAVE_STRING_H */
|
#endif /* HAVE_STRING_H */
|
||||||
@ -97,15 +97,15 @@ static void share_private_nodes(int worker_q);
|
|||||||
|
|
||||||
void make_root_choice_point(void) {
|
void make_root_choice_point(void) {
|
||||||
if (worker_id == 0) {
|
if (worker_id == 0) {
|
||||||
LOCAL_top_cp = GLOBAL_root_cp = OrFr_node(GLOBAL_root_or_fr) = B;
|
LOCAL_top_cp = Yap_root_cp = OrFr_node(Yap_root_or_fr) = B;
|
||||||
} else {
|
} else {
|
||||||
B = LOCAL_top_cp = GLOBAL_root_cp;
|
B = LOCAL_top_cp = Yap_root_cp;
|
||||||
B->cp_tr = TR = ((choiceptr) (worker_offset(0) + (CELL)(B)))->cp_tr;
|
B->cp_tr = TR = ((choiceptr) (worker_offset(0) + (CELL)(B)))->cp_tr;
|
||||||
}
|
}
|
||||||
B->cp_h = H0;
|
B->cp_h = H0;
|
||||||
B->cp_ap = GETWORK;
|
B->cp_ap = GETWORK;
|
||||||
B->cp_or_fr = GLOBAL_root_or_fr;
|
B->cp_or_fr = Yap_root_or_fr;
|
||||||
LOCAL_top_or_fr = GLOBAL_root_or_fr;
|
LOCAL_top_or_fr = Yap_root_or_fr;
|
||||||
LOCAL_load = 0;
|
LOCAL_load = 0;
|
||||||
Set_LOCAL_prune_request(NULL);
|
Set_LOCAL_prune_request(NULL);
|
||||||
BRANCH(worker_id, 0) = 0;
|
BRANCH(worker_id, 0) = 0;
|
||||||
@ -125,7 +125,7 @@ void free_root_choice_point(void) {
|
|||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
LOCAL_top_cp_on_stack =
|
LOCAL_top_cp_on_stack =
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
LOCAL_top_cp = GLOBAL_root_cp = OrFr_node(GLOBAL_root_or_fr) = (choiceptr) Yap_LocalBase;
|
LOCAL_top_cp = Yap_root_cp = OrFr_node(Yap_root_or_fr) = (choiceptr) Yap_LocalBase;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ int p_share_work(void) {
|
|||||||
|
|
||||||
if (! BITMAP_member(OrFr_members(REMOTE_top_or_fr(worker_q)), worker_id) ||
|
if (! BITMAP_member(OrFr_members(REMOTE_top_or_fr(worker_q)), worker_id) ||
|
||||||
B == REMOTE_top_cp(worker_q) ||
|
B == REMOTE_top_cp(worker_q) ||
|
||||||
(LOCAL_load <= DELAYED_RELEASE_LOAD && OrFr_nearest_livenode(LOCAL_top_or_fr) == NULL)) {
|
(LOCAL_load <= Yap_delayed_release_load && OrFr_nearest_livenode(LOCAL_top_or_fr) == NULL)) {
|
||||||
/* refuse sharing request */
|
/* refuse sharing request */
|
||||||
REMOTE_reply_signal(LOCAL_share_request) = no_sharing;
|
REMOTE_reply_signal(LOCAL_share_request) = no_sharing;
|
||||||
LOCAL_share_request = MAX_WORKERS;
|
LOCAL_share_request = MAX_WORKERS;
|
||||||
@ -242,7 +242,7 @@ int q_share_work(int worker_p) {
|
|||||||
|
|
||||||
/* make sharing request */
|
/* make sharing request */
|
||||||
LOCK_WORKER(worker_p);
|
LOCK_WORKER(worker_p);
|
||||||
if (BITMAP_member(GLOBAL_bm_idle_workers, worker_p) ||
|
if (BITMAP_member(Yap_bm_idle_workers, worker_p) ||
|
||||||
REMOTE_share_request(worker_p) != MAX_WORKERS) {
|
REMOTE_share_request(worker_p) != MAX_WORKERS) {
|
||||||
/* worker p is idle or has another request */
|
/* worker p is idle or has another request */
|
||||||
UNLOCK_WORKER(worker_p);
|
UNLOCK_WORKER(worker_p);
|
||||||
@ -321,6 +321,7 @@ sync_with_p:
|
|||||||
if (IN_BETWEEN(Yap_TrailBase, aux_cell, Yap_TrailTop)) {
|
if (IN_BETWEEN(Yap_TrailBase, aux_cell, Yap_TrailTop)) {
|
||||||
/* avoid frozen segments */
|
/* avoid frozen segments */
|
||||||
aux_tr = (tr_fr_ptr) aux_cell;
|
aux_tr = (tr_fr_ptr) aux_cell;
|
||||||
|
}
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
#ifdef MULTI_ASSIGNMENT_VARIABLES
|
#ifdef MULTI_ASSIGNMENT_VARIABLES
|
||||||
} else if (IsApplTerm(aux_cell)) {
|
} else if (IsApplTerm(aux_cell)) {
|
||||||
@ -356,7 +357,6 @@ sync_with_p:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------- **
|
/* ------------------------- **
|
||||||
** Local functions **
|
** Local functions **
|
||||||
** ------------------------- */
|
** ------------------------- */
|
||||||
@ -523,7 +523,7 @@ void share_private_nodes(int worker_q) {
|
|||||||
next_node_on_branch = sharing_node;
|
next_node_on_branch = sharing_node;
|
||||||
STACK_PUSH_UP(or_frame, stack);
|
STACK_PUSH_UP(or_frame, stack);
|
||||||
STACK_CHECK_EXPAND(stack, stack_limit);
|
STACK_CHECK_EXPAND(stack, stack_limit);
|
||||||
STACK_PUSH(sharing_node, stack);
|
STACK_PUSH_UP(sharing_node, stack);
|
||||||
STACK_CHECK_EXPAND(stack, stack_limit);
|
STACK_CHECK_EXPAND(stack, stack_limit);
|
||||||
sharing_node = consumer_cp;
|
sharing_node = consumer_cp;
|
||||||
dep_frame = DepFr_next(dep_frame);
|
dep_frame = DepFr_next(dep_frame);
|
||||||
@ -658,7 +658,7 @@ void share_private_nodes(int worker_q) {
|
|||||||
|
|
||||||
#ifdef DEBUG_OPTYAP
|
#ifdef DEBUG_OPTYAP
|
||||||
{ dep_fr_ptr aux_dep_fr = LOCAL_top_dep_fr;
|
{ dep_fr_ptr aux_dep_fr = LOCAL_top_dep_fr;
|
||||||
while(aux_dep_fr != GLOBAL_root_dep_fr) {
|
while(aux_dep_fr != Yap_root_dep_fr) {
|
||||||
choiceptr top_cp_on_branch;
|
choiceptr top_cp_on_branch;
|
||||||
top_cp_on_branch = DepFr_cons_cp(aux_dep_fr);
|
top_cp_on_branch = DepFr_cons_cp(aux_dep_fr);
|
||||||
while (YOUNGER_CP(top_cp_on_branch, B)) {
|
while (YOUNGER_CP(top_cp_on_branch, B)) {
|
||||||
@ -698,4 +698,4 @@ void share_private_nodes(int worker_q) {
|
|||||||
REMOTE_load(worker_q) = LOCAL_load = 0;
|
REMOTE_load(worker_q) = LOCAL_load = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* ENV_COPY */
|
#endif /* YAPOR_COPY */
|
@ -16,7 +16,7 @@
|
|||||||
** ------------------ */
|
** ------------------ */
|
||||||
|
|
||||||
#include "Yap.h"
|
#include "Yap.h"
|
||||||
#ifdef ACOW
|
#ifdef YAPOR_COW
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -230,4 +230,4 @@ void share_private_nodes(int worker_q) {
|
|||||||
REMOTE_load(worker_q) = LOCAL_load = 0;
|
REMOTE_load(worker_q) = LOCAL_load = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* ACOW */
|
#endif /* YAPOR_COW */
|
@ -58,7 +58,7 @@ void prune_shared_branch(choiceptr prune_cp) {
|
|||||||
LOCK_OR_FRAME(prune_or_fr);
|
LOCK_OR_FRAME(prune_or_fr);
|
||||||
members = OrFr_members(prune_or_fr);
|
members = OrFr_members(prune_or_fr);
|
||||||
BITMAP_delete(members, worker_id);
|
BITMAP_delete(members, worker_id);
|
||||||
for (i = 0; i < number_workers; i++) {
|
for (i = 0; i < Yap_number_workers; i++) {
|
||||||
if (BITMAP_member(members, i) && ltt == BRANCH_LTT(i, depth)) {
|
if (BITMAP_member(members, i) && ltt == BRANCH_LTT(i, depth)) {
|
||||||
CUT_send_prune_request(i, prune_cp);
|
CUT_send_prune_request(i, prune_cp);
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ void prune_shared_branch(choiceptr prune_cp) {
|
|||||||
LOCK_OR_FRAME(leftmost_or_fr);
|
LOCK_OR_FRAME(leftmost_or_fr);
|
||||||
members = OrFr_members(leftmost_or_fr);
|
members = OrFr_members(leftmost_or_fr);
|
||||||
BITMAP_delete(members, worker_id);
|
BITMAP_delete(members, worker_id);
|
||||||
for (i = 0; i < number_workers; i++) {
|
for (i = 0; i < Yap_number_workers; i++) {
|
||||||
if (BITMAP_member(members, i)) {
|
if (BITMAP_member(members, i)) {
|
||||||
if (ltt >= BRANCH_LTT(i, depth)) {
|
if (ltt >= BRANCH_LTT(i, depth)) {
|
||||||
CUT_send_prune_request(i, leftmost_cp->cp_b);
|
CUT_send_prune_request(i, leftmost_cp->cp_b);
|
||||||
@ -231,7 +231,7 @@ void prune_shared_branch(choiceptr prune_cp) {
|
|||||||
ltt = BRANCH_LTT(worker_id, depth);
|
ltt = BRANCH_LTT(worker_id, depth);
|
||||||
LOCK_OR_FRAME(leftmost_or_fr);
|
LOCK_OR_FRAME(leftmost_or_fr);
|
||||||
BITMAP_difference(members, OrFr_members(leftmost_or_fr), members);
|
BITMAP_difference(members, OrFr_members(leftmost_or_fr), members);
|
||||||
for (i = 0; i < number_workers; i++) {
|
for (i = 0; i < Yap_number_workers; i++) {
|
||||||
if (BITMAP_member(members, i)) {
|
if (BITMAP_member(members, i)) {
|
||||||
if (ltt > BRANCH_LTT(i, depth)) {
|
if (ltt > BRANCH_LTT(i, depth)) {
|
||||||
CUT_send_prune_request(i, leftmost_cp->cp_b);
|
CUT_send_prune_request(i, leftmost_cp->cp_b);
|
||||||
|
@ -17,22 +17,22 @@
|
|||||||
|
|
||||||
PBOp(getwork_first_time,e)
|
PBOp(getwork_first_time,e)
|
||||||
/* wait for a new parallel goal */
|
/* wait for a new parallel goal */
|
||||||
while (BITMAP_same(GLOBAL_bm_present_workers, GLOBAL_bm_finished_workers));
|
while (BITMAP_same(Yap_bm_present_workers, Yap_bm_finished_workers));
|
||||||
make_root_choice_point();
|
make_root_choice_point();
|
||||||
PUT_IN_EXECUTING(worker_id);
|
PUT_IN_EXECUTING(worker_id);
|
||||||
/* wait until everyone else is executing! */
|
/* wait until everyone else is executing! */
|
||||||
while (! BITMAP_same(GLOBAL_bm_present_workers, GLOBAL_bm_executing_workers));
|
while (! BITMAP_same(Yap_bm_present_workers, Yap_bm_executing_workers));
|
||||||
SCHEDULER_GET_WORK();
|
SCHEDULER_GET_WORK();
|
||||||
shared_end:
|
shared_end:
|
||||||
PUT_IN_FINISHED(worker_id);
|
PUT_IN_FINISHED(worker_id);
|
||||||
/* wait until everyone else is finished! */
|
/* wait until everyone else is finished! */
|
||||||
while (! BITMAP_same(GLOBAL_bm_present_workers, GLOBAL_bm_finished_workers));
|
while (! BITMAP_same(Yap_bm_present_workers, Yap_bm_finished_workers));
|
||||||
PUT_OUT_EXECUTING(worker_id);
|
PUT_OUT_EXECUTING(worker_id);
|
||||||
if (worker_id == 0) {
|
if (worker_id == 0) {
|
||||||
finish_yapor();
|
finish_yapor();
|
||||||
free_root_choice_point();
|
free_root_choice_point();
|
||||||
/* wait until no one is executing */
|
/* wait until no one is executing */
|
||||||
while (! BITMAP_empty(GLOBAL_bm_executing_workers));
|
while (! BITMAP_empty(Yap_bm_executing_workers));
|
||||||
goto fail;
|
goto fail;
|
||||||
} else {
|
} else {
|
||||||
PREG = GETWORK_FIRST_TIME;
|
PREG = GETWORK_FIRST_TIME;
|
||||||
|
@ -88,7 +88,7 @@ STD_PROTO(static inline qg_sol_fr_ptr CUT_prune_solution_frames, (qg_sol_fr_ptr,
|
|||||||
#define PUT_YAMOP_SEQ(INST) (INST)->u.Otapl.or_arg |= YAMOP_SEQ_FLAG
|
#define PUT_YAMOP_SEQ(INST) (INST)->u.Otapl.or_arg |= YAMOP_SEQ_FLAG
|
||||||
#define PUT_YAMOP_CUT(INST) (INST)->u.Otapl.or_arg |= YAMOP_CUT_FLAG
|
#define PUT_YAMOP_CUT(INST) (INST)->u.Otapl.or_arg |= YAMOP_CUT_FLAG
|
||||||
|
|
||||||
#define BRANCH(WORKER, DEPTH) GLOBAL_branch(WORKER, DEPTH)
|
#define BRANCH(WORKER, DEPTH) Yap_branch(WORKER, DEPTH)
|
||||||
#define BRANCH_LTT(WORKER, DEPTH) (BRANCH(WORKER, DEPTH) & YAMOP_LTT_BITS)
|
#define BRANCH_LTT(WORKER, DEPTH) (BRANCH(WORKER, DEPTH) & YAMOP_LTT_BITS)
|
||||||
#define BRANCH_CUT(WORKER, DEPTH) (BRANCH(WORKER, DEPTH) & YAMOP_CUT_FLAG)
|
#define BRANCH_CUT(WORKER, DEPTH) (BRANCH(WORKER, DEPTH) & YAMOP_CUT_FLAG)
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ STD_PROTO(static inline qg_sol_fr_ptr CUT_prune_solution_frames, (qg_sol_fr_ptr,
|
|||||||
SCHEDULER_GET_WORK(); \
|
SCHEDULER_GET_WORK(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ENV_COPY) || defined(SBA) || defined(THREADS)
|
#if defined(YAPOR_COPY) || defined(YAPOR_SBA) || defined(THREADS)
|
||||||
#define SCH_check_share_request() \
|
#define SCH_check_share_request() \
|
||||||
if (SCH_any_share_request) { \
|
if (SCH_any_share_request) { \
|
||||||
ASP = YENV; \
|
ASP = YENV; \
|
||||||
@ -143,13 +143,13 @@ STD_PROTO(static inline qg_sol_fr_ptr CUT_prune_solution_frames, (qg_sol_fr_ptr,
|
|||||||
p_share_work(); \
|
p_share_work(); \
|
||||||
setregs(); \
|
setregs(); \
|
||||||
}
|
}
|
||||||
#else /* ACOW */
|
#else /* YAPOR_COW */
|
||||||
#define SCH_check_share_request() \
|
#define SCH_check_share_request() \
|
||||||
if (SCH_any_share_request) { \
|
if (SCH_any_share_request) { \
|
||||||
if (! p_share_work()) \
|
if (! p_share_work()) \
|
||||||
goto shared_fail; \
|
goto shared_fail; \
|
||||||
}
|
}
|
||||||
#endif /* ENV_COPY || SBA || ACOW */
|
#endif /* YAPOR_COPY || YAPOR_SBA || YAPOR_COW */
|
||||||
|
|
||||||
#define SCH_check_requests() \
|
#define SCH_check_requests() \
|
||||||
SCH_check_prune_request(); \
|
SCH_check_prune_request(); \
|
||||||
@ -175,7 +175,7 @@ STD_PROTO(static inline qg_sol_fr_ptr CUT_prune_solution_frames, (qg_sol_fr_ptr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define CUT_wait_leftmost() \
|
#define CUT_wait_leftmost() \
|
||||||
if (PARALLEL_EXECUTION_MODE) { \
|
if (Yap_parallel_execution_mode) { \
|
||||||
/* parallel execution mode --> wait until leftmost */ \
|
/* parallel execution mode --> wait until leftmost */ \
|
||||||
int i, loop, depth, ltt; \
|
int i, loop, depth, ltt; \
|
||||||
bitmap members; \
|
bitmap members; \
|
||||||
@ -189,13 +189,13 @@ STD_PROTO(static inline qg_sol_fr_ptr CUT_prune_solution_frames, (qg_sol_fr_ptr,
|
|||||||
SCH_check_requests(); \
|
SCH_check_requests(); \
|
||||||
BITMAP_copy(members, OrFr_members(leftmost_or_fr)); \
|
BITMAP_copy(members, OrFr_members(leftmost_or_fr)); \
|
||||||
BITMAP_delete(members, worker_id); \
|
BITMAP_delete(members, worker_id); \
|
||||||
for (i = 0; i < number_workers; i++) { \
|
for (i = 0; i < Yap_number_workers; i++) { \
|
||||||
/* not leftmost in current frame if there is a */ \
|
/* not leftmost in current frame if there is a */ \
|
||||||
/* worker in a left branch and it is not idle or */ \
|
/* worker in a left branch and it is not idle or */ \
|
||||||
/* if it is idle it is in a younger node */ \
|
/* if it is idle it is in a younger node */ \
|
||||||
if (BITMAP_member(members, i) && \
|
if (BITMAP_member(members, i) && \
|
||||||
BRANCH_LTT(i, depth) > ltt && \
|
BRANCH_LTT(i, depth) > ltt && \
|
||||||
(! BITMAP_member(GLOBAL_bm_idle_workers, i) || \
|
(! BITMAP_member(Yap_bm_idle_workers, i) || \
|
||||||
leftmost_or_fr != REMOTE_top_or_fr(i))) { \
|
leftmost_or_fr != REMOTE_top_or_fr(i))) { \
|
||||||
loop = TRUE; \
|
loop = TRUE; \
|
||||||
break; \
|
break; \
|
||||||
@ -203,7 +203,7 @@ STD_PROTO(static inline qg_sol_fr_ptr CUT_prune_solution_frames, (qg_sol_fr_ptr,
|
|||||||
} \
|
} \
|
||||||
} while (loop); \
|
} while (loop); \
|
||||||
leftmost_or_fr = OrFr_nearest_leftnode(leftmost_or_fr); \
|
leftmost_or_fr = OrFr_nearest_leftnode(leftmost_or_fr); \
|
||||||
} while (leftmost_or_fr != GLOBAL_root_or_fr); \
|
} while (leftmost_or_fr != Yap_root_or_fr); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -214,27 +214,27 @@ STD_PROTO(static inline qg_sol_fr_ptr CUT_prune_solution_frames, (qg_sol_fr_ptr,
|
|||||||
|
|
||||||
static inline
|
static inline
|
||||||
void PUT_IN_EXECUTING(int w) {
|
void PUT_IN_EXECUTING(int w) {
|
||||||
LOCK(GLOBAL_LOCKS_bm_executing_workers);
|
LOCK(Yap_locks_bm_executing_workers);
|
||||||
BITMAP_insert(GLOBAL_bm_executing_workers, w);
|
BITMAP_insert(Yap_bm_executing_workers, w);
|
||||||
UNLOCK(GLOBAL_LOCKS_bm_executing_workers);
|
UNLOCK(Yap_locks_bm_executing_workers);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
void PUT_OUT_EXECUTING(int w) {
|
void PUT_OUT_EXECUTING(int w) {
|
||||||
LOCK(GLOBAL_LOCKS_bm_executing_workers);
|
LOCK(Yap_locks_bm_executing_workers);
|
||||||
BITMAP_delete(GLOBAL_bm_executing_workers, w);
|
BITMAP_delete(Yap_bm_executing_workers, w);
|
||||||
UNLOCK(GLOBAL_LOCKS_bm_executing_workers);
|
UNLOCK(Yap_locks_bm_executing_workers);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
void PUT_IN_FINISHED(int w) {
|
void PUT_IN_FINISHED(int w) {
|
||||||
LOCK(GLOBAL_LOCKS_bm_finished_workers);
|
LOCK(Yap_locks_bm_finished_workers);
|
||||||
BITMAP_insert(GLOBAL_bm_finished_workers, w);
|
BITMAP_insert(Yap_bm_finished_workers, w);
|
||||||
UNLOCK(GLOBAL_LOCKS_bm_finished_workers);
|
UNLOCK(Yap_locks_bm_finished_workers);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,18 +242,18 @@ void PUT_IN_FINISHED(int w) {
|
|||||||
#ifdef TABLING_INNER_CUTS
|
#ifdef TABLING_INNER_CUTS
|
||||||
static inline
|
static inline
|
||||||
void PUT_IN_PRUNING(int w) {
|
void PUT_IN_PRUNING(int w) {
|
||||||
LOCK(GLOBAL_LOCKS_bm_pruning_workers);
|
LOCK(Yap_locks_bm_pruning_workers);
|
||||||
BITMAP_insert(GLOBAL_bm_pruning_workers, w);
|
BITMAP_insert(Yap_bm_pruning_workers, w);
|
||||||
UNLOCK(GLOBAL_LOCKS_bm_pruning_workers);
|
UNLOCK(Yap_locks_bm_pruning_workers);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
void PUT_OUT_PRUNING(int w) {
|
void PUT_OUT_PRUNING(int w) {
|
||||||
LOCK(GLOBAL_LOCKS_bm_pruning_workers);
|
LOCK(Yap_locks_bm_pruning_workers);
|
||||||
BITMAP_delete(GLOBAL_bm_pruning_workers, w);
|
BITMAP_delete(Yap_bm_pruning_workers, w);
|
||||||
UNLOCK(GLOBAL_LOCKS_bm_pruning_workers);
|
UNLOCK(Yap_locks_bm_pruning_workers);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* TABLING_INNER_CUTS */
|
#endif /* TABLING_INNER_CUTS */
|
||||||
@ -266,18 +266,18 @@ void PUT_OUT_PRUNING(int w) {
|
|||||||
|
|
||||||
static inline
|
static inline
|
||||||
void PUT_IN_REQUESTABLE(int p) {
|
void PUT_IN_REQUESTABLE(int p) {
|
||||||
LOCK(GLOBAL_LOCKS_bm_requestable_workers);
|
LOCK(Yap_locks_bm_requestable_workers);
|
||||||
BITMAP_insert(GLOBAL_bm_requestable_workers, p);
|
BITMAP_insert(Yap_bm_requestable_workers, p);
|
||||||
UNLOCK(GLOBAL_LOCKS_bm_requestable_workers);
|
UNLOCK(Yap_locks_bm_requestable_workers);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
void PUT_OUT_REQUESTABLE(int p) {
|
void PUT_OUT_REQUESTABLE(int p) {
|
||||||
LOCK(GLOBAL_LOCKS_bm_requestable_workers);
|
LOCK(Yap_locks_bm_requestable_workers);
|
||||||
BITMAP_delete(GLOBAL_bm_requestable_workers, p);
|
BITMAP_delete(Yap_bm_requestable_workers, p);
|
||||||
UNLOCK(GLOBAL_LOCKS_bm_requestable_workers);
|
UNLOCK(Yap_locks_bm_requestable_workers);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,7 +379,7 @@ int CUT_last_worker_left_pending_prune(or_fr_ptr or_frame) {
|
|||||||
ltt = OrFr_pend_prune_ltt(or_frame);
|
ltt = OrFr_pend_prune_ltt(or_frame);
|
||||||
members = OrFr_members(or_frame);
|
members = OrFr_members(or_frame);
|
||||||
BITMAP_delete(members, worker_id);
|
BITMAP_delete(members, worker_id);
|
||||||
for (i = 0; i < number_workers; i++) {
|
for (i = 0; i < Yap_number_workers; i++) {
|
||||||
if (BITMAP_member(members, i) && BRANCH_LTT(i, depth) > ltt)
|
if (BITMAP_member(members, i) && BRANCH_LTT(i, depth) > ltt)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -402,7 +402,7 @@ or_fr_ptr CUT_leftmost_or_frame(void) {
|
|||||||
ltt = BRANCH_LTT(worker_id, depth);
|
ltt = BRANCH_LTT(worker_id, depth);
|
||||||
BITMAP_difference(members, OrFr_members(leftmost_or_fr), members);
|
BITMAP_difference(members, OrFr_members(leftmost_or_fr), members);
|
||||||
if (members)
|
if (members)
|
||||||
for (i = 0; i < number_workers; i++)
|
for (i = 0; i < Yap_number_workers; i++)
|
||||||
if (BITMAP_member(members, i) && BRANCH_LTT(i, depth) > ltt)
|
if (BITMAP_member(members, i) && BRANCH_LTT(i, depth) > ltt)
|
||||||
goto update_nearest_leftnode_data;
|
goto update_nearest_leftnode_data;
|
||||||
BITMAP_copy(members, OrFr_members(leftmost_or_fr));
|
BITMAP_copy(members, OrFr_members(leftmost_or_fr));
|
||||||
@ -436,12 +436,12 @@ or_fr_ptr CUT_leftmost_until(or_fr_ptr start_or_fr, int until_depth) {
|
|||||||
leftmost_or_fr = OrFr_nearest_leftnode(start_or_fr);
|
leftmost_or_fr = OrFr_nearest_leftnode(start_or_fr);
|
||||||
depth = OrFr_depth(leftmost_or_fr);
|
depth = OrFr_depth(leftmost_or_fr);
|
||||||
if (depth > until_depth) {
|
if (depth > until_depth) {
|
||||||
BITMAP_copy(prune_members, GLOBAL_bm_pruning_workers);
|
BITMAP_copy(prune_members, Yap_bm_pruning_workers);
|
||||||
BITMAP_delete(prune_members, worker_id);
|
BITMAP_delete(prune_members, worker_id);
|
||||||
ltt = BRANCH_LTT(worker_id, depth);
|
ltt = BRANCH_LTT(worker_id, depth);
|
||||||
BITMAP_intersection(members, prune_members, OrFr_members(leftmost_or_fr));
|
BITMAP_intersection(members, prune_members, OrFr_members(leftmost_or_fr));
|
||||||
if (members) {
|
if (members) {
|
||||||
for (i = 0; i < number_workers; i++) {
|
for (i = 0; i < Yap_number_workers; i++) {
|
||||||
if (BITMAP_member(members, i) &&
|
if (BITMAP_member(members, i) &&
|
||||||
BRANCH_LTT(i, depth) > ltt &&
|
BRANCH_LTT(i, depth) > ltt &&
|
||||||
EQUAL_OR_YOUNGER_CP(GetOrFr_node(leftmost_or_fr), REMOTE_pruning_scope(i)))
|
EQUAL_OR_YOUNGER_CP(GetOrFr_node(leftmost_or_fr), REMOTE_pruning_scope(i)))
|
||||||
@ -456,7 +456,7 @@ or_fr_ptr CUT_leftmost_until(or_fr_ptr start_or_fr, int until_depth) {
|
|||||||
ltt = BRANCH_LTT(worker_id, depth);
|
ltt = BRANCH_LTT(worker_id, depth);
|
||||||
BITMAP_intersection(members, prune_members, OrFr_members(leftmost_or_fr));
|
BITMAP_intersection(members, prune_members, OrFr_members(leftmost_or_fr));
|
||||||
if (members) {
|
if (members) {
|
||||||
for (i = 0; i < number_workers; i++) {
|
for (i = 0; i < Yap_number_workers; i++) {
|
||||||
if (BITMAP_member(members, i) &&
|
if (BITMAP_member(members, i) &&
|
||||||
BRANCH_LTT(i, depth) > ltt &&
|
BRANCH_LTT(i, depth) > ltt &&
|
||||||
EQUAL_OR_YOUNGER_CP(GetOrFr_node(leftmost_or_fr), REMOTE_pruning_scope(i))) {
|
EQUAL_OR_YOUNGER_CP(GetOrFr_node(leftmost_or_fr), REMOTE_pruning_scope(i))) {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
** ------------------ */
|
** ------------------ */
|
||||||
|
|
||||||
#include "Yap.h"
|
#include "Yap.h"
|
||||||
#ifdef SBA
|
#ifdef YAPOR_SBA
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "Yatom.h"
|
#include "Yatom.h"
|
||||||
#include "YapHeap.h"
|
#include "YapHeap.h"
|
@ -65,36 +65,36 @@ void PUT_NO_WORK_IN_UPPER_NODES(void) {
|
|||||||
|
|
||||||
static inline
|
static inline
|
||||||
void PUT_IDLE(int worker_num) {
|
void PUT_IDLE(int worker_num) {
|
||||||
LOCK(GLOBAL_LOCKS_bm_idle_workers);
|
LOCK(Yap_locks_bm_idle_workers);
|
||||||
BITMAP_insert(GLOBAL_bm_idle_workers, worker_num);
|
BITMAP_insert(Yap_bm_idle_workers, worker_num);
|
||||||
UNLOCK(GLOBAL_LOCKS_bm_idle_workers);
|
UNLOCK(Yap_locks_bm_idle_workers);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
void PUT_BUSY(int worker_num) {
|
void PUT_BUSY(int worker_num) {
|
||||||
LOCK(GLOBAL_LOCKS_bm_idle_workers);
|
LOCK(Yap_locks_bm_idle_workers);
|
||||||
BITMAP_delete(GLOBAL_bm_idle_workers, worker_num);
|
BITMAP_delete(Yap_bm_idle_workers, worker_num);
|
||||||
UNLOCK(GLOBAL_LOCKS_bm_idle_workers);
|
UNLOCK(Yap_locks_bm_idle_workers);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
void PUT_IN_ROOT_NODE(int worker_num) {
|
void PUT_IN_ROOT_NODE(int worker_num) {
|
||||||
LOCK(GLOBAL_LOCKS_bm_root_cp_workers);
|
LOCK(Yap_locks_bm_root_cp_workers);
|
||||||
BITMAP_insert(GLOBAL_bm_root_cp_workers, worker_num);
|
BITMAP_insert(Yap_bm_root_cp_workers, worker_num);
|
||||||
UNLOCK(GLOBAL_LOCKS_bm_root_cp_workers);
|
UNLOCK(Yap_locks_bm_root_cp_workers);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
void PUT_OUT_ROOT_NODE(int worker_num) {
|
void PUT_OUT_ROOT_NODE(int worker_num) {
|
||||||
LOCK(GLOBAL_LOCKS_bm_root_cp_workers);
|
LOCK(Yap_locks_bm_root_cp_workers);
|
||||||
BITMAP_delete(GLOBAL_bm_root_cp_workers, worker_num);
|
BITMAP_delete(Yap_bm_root_cp_workers, worker_num);
|
||||||
UNLOCK(GLOBAL_LOCKS_bm_root_cp_workers);
|
UNLOCK(Yap_locks_bm_root_cp_workers);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,21 +215,21 @@ int get_work(void) {
|
|||||||
SCH_refuse_share_request_if_any();
|
SCH_refuse_share_request_if_any();
|
||||||
|
|
||||||
counter = 0;
|
counter = 0;
|
||||||
BITMAP_difference(stable_busy, OrFr_members(LOCAL_top_or_fr), GLOBAL_bm_idle_workers);
|
BITMAP_difference(stable_busy, OrFr_members(LOCAL_top_or_fr), Yap_bm_idle_workers);
|
||||||
while (1) {
|
while (1) {
|
||||||
while (BITMAP_subset(GLOBAL_bm_idle_workers, OrFr_members(LOCAL_top_or_fr)) &&
|
while (BITMAP_subset(Yap_bm_idle_workers, OrFr_members(LOCAL_top_or_fr)) &&
|
||||||
Get_LOCAL_top_cp() != Get_GLOBAL_root_cp()) {
|
Get_LOCAL_top_cp() != Get_Yap_root_cp()) {
|
||||||
/* no busy workers here and below */
|
/* no busy workers here and below */
|
||||||
if (! move_up_one_node(NULL)) {
|
if (! move_up_one_node(NULL)) {
|
||||||
PUT_BUSY(worker_id);
|
PUT_BUSY(worker_id);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Get_LOCAL_top_cp() == Get_GLOBAL_root_cp()) {
|
if (Get_LOCAL_top_cp() == Get_Yap_root_cp()) {
|
||||||
if (! BITMAP_member(GLOBAL_bm_root_cp_workers, worker_id))
|
if (! BITMAP_member(Yap_bm_root_cp_workers, worker_id))
|
||||||
PUT_IN_ROOT_NODE(worker_id);
|
PUT_IN_ROOT_NODE(worker_id);
|
||||||
if (BITMAP_same(GLOBAL_bm_idle_workers, GLOBAL_bm_root_cp_workers) &&
|
if (BITMAP_same(Yap_bm_idle_workers, Yap_bm_root_cp_workers) &&
|
||||||
BITMAP_same(GLOBAL_bm_idle_workers, GLOBAL_bm_present_workers)) {
|
BITMAP_same(Yap_bm_idle_workers, Yap_bm_present_workers)) {
|
||||||
/* All workers are idle in root choicepoint. Execution
|
/* All workers are idle in root choicepoint. Execution
|
||||||
must finish as there is no available computation. */
|
must finish as there is no available computation. */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -247,15 +247,15 @@ int get_work(void) {
|
|||||||
PUT_BUSY(worker_id);
|
PUT_BUSY(worker_id);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (++counter == SCHEDULER_LOOP) {
|
if (++counter == Yap_scheduler_loop) {
|
||||||
if (search_for_hidden_shared_work(stable_busy)) {
|
if (search_for_hidden_shared_work(stable_busy)) {
|
||||||
PUT_BUSY(worker_id);
|
PUT_BUSY(worker_id);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
counter = 0;
|
counter = 0;
|
||||||
BITMAP_difference(stable_busy, OrFr_members(LOCAL_top_or_fr), GLOBAL_bm_idle_workers);
|
BITMAP_difference(stable_busy, OrFr_members(LOCAL_top_or_fr), Yap_bm_idle_workers);
|
||||||
} else {
|
} else {
|
||||||
BITMAP_minus(stable_busy, GLOBAL_bm_idle_workers);
|
BITMAP_minus(stable_busy, Yap_bm_idle_workers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -347,7 +347,7 @@ int move_up_one_node(or_fr_ptr nearest_livenode) {
|
|||||||
if (OrFr_suspensions(LOCAL_top_or_fr)) {
|
if (OrFr_suspensions(LOCAL_top_or_fr)) {
|
||||||
susp_fr_ptr resume_fr;
|
susp_fr_ptr resume_fr;
|
||||||
#ifdef TIMESTAMP_CHECK
|
#ifdef TIMESTAMP_CHECK
|
||||||
resume_fr = suspension_frame_to_resume(LOCAL_top_or_fr, ++GLOBAL_timestamp);
|
resume_fr = suspension_frame_to_resume(LOCAL_top_or_fr, ++Yap_timestamp);
|
||||||
#else
|
#else
|
||||||
resume_fr = suspension_frame_to_resume(LOCAL_top_or_fr);
|
resume_fr = suspension_frame_to_resume(LOCAL_top_or_fr);
|
||||||
#endif /* TIMESTAMP_CHECK */
|
#endif /* TIMESTAMP_CHECK */
|
||||||
@ -528,18 +528,18 @@ int get_work_below(void){
|
|||||||
bitmap busy_below, idle_below;
|
bitmap busy_below, idle_below;
|
||||||
|
|
||||||
worker_p = -1;
|
worker_p = -1;
|
||||||
big_load = DELAYED_RELEASE_LOAD;
|
big_load = Yap_delayed_release_load ;
|
||||||
BITMAP_difference(busy_below, OrFr_members(LOCAL_top_or_fr), GLOBAL_bm_idle_workers);
|
BITMAP_difference(busy_below, OrFr_members(LOCAL_top_or_fr), Yap_bm_idle_workers);
|
||||||
BITMAP_difference(idle_below, OrFr_members(LOCAL_top_or_fr), busy_below);
|
BITMAP_difference(idle_below, OrFr_members(LOCAL_top_or_fr), busy_below);
|
||||||
BITMAP_delete(idle_below, worker_id);
|
BITMAP_delete(idle_below, worker_id);
|
||||||
for (i = 0; i < number_workers; i++) {
|
for (i = 0; i < Yap_number_workers; i++) {
|
||||||
if (BITMAP_member(idle_below ,i) && YOUNGER_CP(REMOTE_top_cp(i), Get_LOCAL_top_cp()))
|
if (BITMAP_member(idle_below ,i) && YOUNGER_CP(REMOTE_top_cp(i), Get_LOCAL_top_cp()))
|
||||||
BITMAP_minus(busy_below, OrFr_members(REMOTE_top_or_fr(i)));
|
BITMAP_minus(busy_below, OrFr_members(REMOTE_top_or_fr(i)));
|
||||||
}
|
}
|
||||||
if (BITMAP_empty(busy_below))
|
if (BITMAP_empty(busy_below))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
/* choose the worker with highest load */
|
/* choose the worker with highest load */
|
||||||
for (i = 0 ; i < number_workers; i++) {
|
for (i = 0 ; i < Yap_number_workers; i++) {
|
||||||
if (BITMAP_member(busy_below ,i) && REMOTE_load(i) > big_load) {
|
if (BITMAP_member(busy_below ,i) && REMOTE_load(i) > big_load) {
|
||||||
worker_p = i;
|
worker_p = i;
|
||||||
big_load = REMOTE_load(i);
|
big_load = REMOTE_load(i);
|
||||||
@ -558,14 +558,14 @@ int get_work_above(void){
|
|||||||
bitmap visible_busy_above, visible_idle_above;
|
bitmap visible_busy_above, visible_idle_above;
|
||||||
|
|
||||||
worker_p = -1;
|
worker_p = -1;
|
||||||
big_load = DELAYED_RELEASE_LOAD;
|
big_load = Yap_delayed_release_load ;
|
||||||
BITMAP_difference(visible_busy_above, GLOBAL_bm_present_workers, OrFr_members(LOCAL_top_or_fr));
|
BITMAP_difference(visible_busy_above, Yap_bm_present_workers, OrFr_members(LOCAL_top_or_fr));
|
||||||
BITMAP_minus(visible_busy_above, GLOBAL_bm_invisible_workers);
|
BITMAP_minus(visible_busy_above, Yap_bm_invisible_workers);
|
||||||
BITMAP_copy(visible_idle_above, visible_busy_above);
|
BITMAP_copy(visible_idle_above, visible_busy_above);
|
||||||
BITMAP_minus(visible_busy_above, GLOBAL_bm_idle_workers);
|
BITMAP_minus(visible_busy_above, Yap_bm_idle_workers);
|
||||||
BITMAP_and(visible_idle_above, GLOBAL_bm_idle_workers);
|
BITMAP_and(visible_idle_above, Yap_bm_idle_workers);
|
||||||
BITMAP_insert(visible_busy_above, worker_id);
|
BITMAP_insert(visible_busy_above, worker_id);
|
||||||
for (i = 0 ; i < number_workers; i++) {
|
for (i = 0 ; i < Yap_number_workers; i++) {
|
||||||
if (BITMAP_member(visible_idle_above, i))
|
if (BITMAP_member(visible_idle_above, i))
|
||||||
BITMAP_minus(visible_busy_above, OrFr_members(REMOTE_top_or_fr(i)));
|
BITMAP_minus(visible_busy_above, OrFr_members(REMOTE_top_or_fr(i)));
|
||||||
}
|
}
|
||||||
@ -573,7 +573,7 @@ int get_work_above(void){
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
BITMAP_delete(visible_busy_above, worker_id);
|
BITMAP_delete(visible_busy_above, worker_id);
|
||||||
/* choose the worker with higher load */
|
/* choose the worker with higher load */
|
||||||
for (i = 0; i < number_workers; i++) {
|
for (i = 0; i < Yap_number_workers; i++) {
|
||||||
if (BITMAP_member(visible_busy_above ,i) && REMOTE_load(i) > big_load) {
|
if (BITMAP_member(visible_busy_above ,i) && REMOTE_load(i) > big_load) {
|
||||||
worker_p = i;
|
worker_p = i;
|
||||||
big_load = REMOTE_load(i);
|
big_load = REMOTE_load(i);
|
||||||
@ -582,14 +582,14 @@ int get_work_above(void){
|
|||||||
if (worker_p == -1)
|
if (worker_p == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
/* put workers invisibles */
|
/* put workers invisibles */
|
||||||
LOCK(GLOBAL_LOCKS_bm_invisible_workers);
|
LOCK(Yap_locks_bm_invisible_workers);
|
||||||
if (BITMAP_member(GLOBAL_bm_invisible_workers, worker_p)) {
|
if (BITMAP_member(Yap_bm_invisible_workers, worker_p)) {
|
||||||
UNLOCK(GLOBAL_LOCKS_bm_invisible_workers);
|
UNLOCK(Yap_locks_bm_invisible_workers);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
BITMAP_insert(GLOBAL_bm_invisible_workers, worker_id);
|
BITMAP_insert(Yap_bm_invisible_workers, worker_id);
|
||||||
BITMAP_insert(GLOBAL_bm_invisible_workers, worker_p);
|
BITMAP_insert(Yap_bm_invisible_workers, worker_p);
|
||||||
UNLOCK(GLOBAL_LOCKS_bm_invisible_workers);
|
UNLOCK(Yap_locks_bm_invisible_workers);
|
||||||
/* move up to cp with worker_p */
|
/* move up to cp with worker_p */
|
||||||
do {
|
do {
|
||||||
if (! move_up_one_node(NULL)) {
|
if (! move_up_one_node(NULL)) {
|
||||||
@ -597,10 +597,10 @@ int get_work_above(void){
|
|||||||
}
|
}
|
||||||
} while (! BITMAP_member(OrFr_members(LOCAL_top_or_fr), worker_p));
|
} while (! BITMAP_member(OrFr_members(LOCAL_top_or_fr), worker_p));
|
||||||
/* put workers visibles */
|
/* put workers visibles */
|
||||||
LOCK(GLOBAL_LOCKS_bm_invisible_workers);
|
LOCK(Yap_locks_bm_invisible_workers);
|
||||||
BITMAP_delete(GLOBAL_bm_invisible_workers, worker_id);
|
BITMAP_delete(Yap_bm_invisible_workers, worker_id);
|
||||||
BITMAP_delete(GLOBAL_bm_invisible_workers, worker_p);
|
BITMAP_delete(Yap_bm_invisible_workers, worker_p);
|
||||||
UNLOCK(GLOBAL_LOCKS_bm_invisible_workers);
|
UNLOCK(Yap_locks_bm_invisible_workers);
|
||||||
return (q_share_work(worker_p));
|
return (q_share_work(worker_p));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -610,11 +610,11 @@ int find_a_better_position(void){
|
|||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
int i;
|
int i;
|
||||||
bitmap busy_above, idle_above;
|
bitmap busy_above, idle_above;
|
||||||
BITMAP_difference(busy_above, GLOBAL_bm_present_workers, OrFr_members(LOCAL_top_or_fr));
|
BITMAP_difference(busy_above, Yap_bm_present_workers, OrFr_members(LOCAL_top_or_fr));
|
||||||
BITMAP_copy(idle_above, busy_above);
|
BITMAP_copy(idle_above, busy_above);
|
||||||
BITMAP_minus(busy_above, GLOBAL_bm_idle_workers);
|
BITMAP_minus(busy_above, Yap_bm_idle_workers);
|
||||||
BITMAP_and(idle_above, GLOBAL_bm_idle_workers);
|
BITMAP_and(idle_above, Yap_bm_idle_workers);
|
||||||
for (i = 0; i < number_workers; i++) {
|
for (i = 0; i < Yap_number_workers; i++) {
|
||||||
if (BITMAP_member(idle_above, i)) {
|
if (BITMAP_member(idle_above, i)) {
|
||||||
if (BITMAP_empty(busy_above))
|
if (BITMAP_empty(busy_above))
|
||||||
break;
|
break;
|
||||||
@ -640,17 +640,17 @@ int search_for_hidden_shared_work(bitmap stable_busy){
|
|||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
int i;
|
int i;
|
||||||
bitmap invisible_work, idle_below;
|
bitmap invisible_work, idle_below;
|
||||||
BITMAP_intersection(invisible_work, stable_busy, GLOBAL_bm_requestable_workers);
|
BITMAP_intersection(invisible_work, stable_busy, Yap_bm_requestable_workers);
|
||||||
BITMAP_intersection(idle_below, OrFr_members(LOCAL_top_or_fr), GLOBAL_bm_idle_workers);
|
BITMAP_intersection(idle_below, OrFr_members(LOCAL_top_or_fr), Yap_bm_idle_workers);
|
||||||
BITMAP_delete(idle_below, worker_id);
|
BITMAP_delete(idle_below, worker_id);
|
||||||
for (i = 0; i < number_workers; i++) {
|
for (i = 0; i < Yap_number_workers; i++) {
|
||||||
if (BITMAP_member(idle_below ,i) && YOUNGER_CP(REMOTE_top_cp(i), Get_LOCAL_top_cp()))
|
if (BITMAP_member(idle_below ,i) && YOUNGER_CP(REMOTE_top_cp(i), Get_LOCAL_top_cp()))
|
||||||
BITMAP_minus(invisible_work, OrFr_members(REMOTE_top_or_fr(i)));
|
BITMAP_minus(invisible_work, OrFr_members(REMOTE_top_or_fr(i)));
|
||||||
}
|
}
|
||||||
if (BITMAP_empty(invisible_work))
|
if (BITMAP_empty(invisible_work))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
/* choose the first available worker */
|
/* choose the first available worker */
|
||||||
for (i = 0; i < number_workers; i++ ) {
|
for (i = 0; i < Yap_number_workers; i++ ) {
|
||||||
if (BITMAP_member(invisible_work ,i))
|
if (BITMAP_member(invisible_work ,i))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -46,11 +46,6 @@
|
|||||||
static void share_private_nodes(int worker_q);
|
static void share_private_nodes(int worker_q);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------- **
|
|
||||||
** Local macros **
|
|
||||||
** ---------------------- */
|
|
||||||
|
|
||||||
/* -------------------------- **
|
/* -------------------------- **
|
||||||
** Global functions **
|
** Global functions **
|
||||||
** -------------------------- */
|
** -------------------------- */
|
||||||
@ -544,4 +539,4 @@ void share_private_nodes(int worker_q) {
|
|||||||
REMOTE_load(worker_q) = LOCAL_load = 0;
|
REMOTE_load(worker_q) = LOCAL_load = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* ENV_COPY */
|
#endif /* YAPOR_COPY */
|
@ -442,7 +442,7 @@
|
|||||||
find_leader_node(leader_cp, leader_dep_on_stack);
|
find_leader_node(leader_cp, leader_dep_on_stack);
|
||||||
store_consumer_node(tab_ent, sg_fr, leader_cp, leader_dep_on_stack);
|
store_consumer_node(tab_ent, sg_fr, leader_cp, leader_dep_on_stack);
|
||||||
#ifdef DEBUG_OPTYAP
|
#ifdef DEBUG_OPTYAP
|
||||||
if (PARALLEL_EXECUTION_MODE) {
|
if (Yap_parallel_execution_mode) {
|
||||||
choiceptr aux_cp;
|
choiceptr aux_cp;
|
||||||
aux_cp = B;
|
aux_cp = B;
|
||||||
while (YOUNGER_CP(aux_cp, Get_LOCAL_top_cp_on_stack()))
|
while (YOUNGER_CP(aux_cp, Get_LOCAL_top_cp_on_stack()))
|
||||||
@ -553,7 +553,7 @@
|
|||||||
find_leader_node(leader_cp, leader_dep_on_stack);
|
find_leader_node(leader_cp, leader_dep_on_stack);
|
||||||
store_consumer_node(tab_ent, sg_fr, leader_cp, leader_dep_on_stack);
|
store_consumer_node(tab_ent, sg_fr, leader_cp, leader_dep_on_stack);
|
||||||
#ifdef DEBUG_OPTYAP
|
#ifdef DEBUG_OPTYAP
|
||||||
if (PARALLEL_EXECUTION_MODE) {
|
if (Yap_parallel_execution_mode) {
|
||||||
choiceptr aux_cp;
|
choiceptr aux_cp;
|
||||||
aux_cp = B;
|
aux_cp = B;
|
||||||
while (YOUNGER_CP(aux_cp, Get_LOCAL_top_cp_on_stack()))
|
while (YOUNGER_CP(aux_cp, Get_LOCAL_top_cp_on_stack()))
|
||||||
@ -664,7 +664,7 @@
|
|||||||
find_leader_node(leader_cp, leader_dep_on_stack);
|
find_leader_node(leader_cp, leader_dep_on_stack);
|
||||||
store_consumer_node(tab_ent, sg_fr, leader_cp, leader_dep_on_stack);
|
store_consumer_node(tab_ent, sg_fr, leader_cp, leader_dep_on_stack);
|
||||||
#ifdef DEBUG_OPTYAP
|
#ifdef DEBUG_OPTYAP
|
||||||
if (PARALLEL_EXECUTION_MODE) {
|
if (Yap_parallel_execution_mode) {
|
||||||
choiceptr aux_cp;
|
choiceptr aux_cp;
|
||||||
aux_cp = B;
|
aux_cp = B;
|
||||||
while (YOUNGER_CP(aux_cp, Get_LOCAL_top_cp_on_stack()))
|
while (YOUNGER_CP(aux_cp, Get_LOCAL_top_cp_on_stack()))
|
||||||
@ -878,7 +878,7 @@
|
|||||||
/* new answer */
|
/* new answer */
|
||||||
#ifdef TABLING_INNER_CUTS
|
#ifdef TABLING_INNER_CUTS
|
||||||
/* check for potencial prunings */
|
/* check for potencial prunings */
|
||||||
if (! BITMAP_empty(GLOBAL_bm_pruning_workers)) {
|
if (! BITMAP_empty(Yap_bm_pruning_workers)) {
|
||||||
int until_depth, depth;
|
int until_depth, depth;
|
||||||
|
|
||||||
until_depth = OrFr_depth(SgFr_gen_top_or_fr(sg_fr));
|
until_depth = OrFr_depth(SgFr_gen_top_or_fr(sg_fr));
|
||||||
@ -888,7 +888,7 @@
|
|||||||
bitmap prune_members, members;
|
bitmap prune_members, members;
|
||||||
or_fr_ptr leftmost_or_fr, or_fr, nearest_or_fr;
|
or_fr_ptr leftmost_or_fr, or_fr, nearest_or_fr;
|
||||||
|
|
||||||
BITMAP_copy(prune_members, GLOBAL_bm_pruning_workers);
|
BITMAP_copy(prune_members, Yap_bm_pruning_workers);
|
||||||
BITMAP_delete(prune_members, worker_id);
|
BITMAP_delete(prune_members, worker_id);
|
||||||
ltt = BRANCH_LTT(worker_id, depth);
|
ltt = BRANCH_LTT(worker_id, depth);
|
||||||
BITMAP_intersection(members, prune_members, OrFr_members(LOCAL_top_or_fr));
|
BITMAP_intersection(members, prune_members, OrFr_members(LOCAL_top_or_fr));
|
||||||
@ -1213,7 +1213,7 @@
|
|||||||
}
|
}
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
#ifdef DEBUG_OPTYAP
|
#ifdef DEBUG_OPTYAP
|
||||||
if (PARALLEL_EXECUTION_MODE) {
|
if (Yap_parallel_execution_mode) {
|
||||||
choiceptr aux_cp;
|
choiceptr aux_cp;
|
||||||
OPTYAP_ERROR_CHECKING(completion, YOUNGER_CP(Get_LOCAL_top_cp(), Get_LOCAL_top_cp_on_stack()));
|
OPTYAP_ERROR_CHECKING(completion, YOUNGER_CP(Get_LOCAL_top_cp(), Get_LOCAL_top_cp_on_stack()));
|
||||||
aux_cp = chain_cp;
|
aux_cp = chain_cp;
|
||||||
@ -1284,7 +1284,7 @@
|
|||||||
}
|
}
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
#ifdef DEBUG_OPTYAP
|
#ifdef DEBUG_OPTYAP
|
||||||
if (PARALLEL_EXECUTION_MODE) {
|
if (Yap_parallel_execution_mode) {
|
||||||
choiceptr aux_cp;
|
choiceptr aux_cp;
|
||||||
OPTYAP_ERROR_CHECKING(completion, YOUNGER_CP(Get_LOCAL_top_cp(), Get_LOCAL_top_cp_on_stack()));
|
OPTYAP_ERROR_CHECKING(completion, YOUNGER_CP(Get_LOCAL_top_cp(), Get_LOCAL_top_cp_on_stack()));
|
||||||
aux_cp = chain_cp;
|
aux_cp = chain_cp;
|
||||||
@ -1381,7 +1381,7 @@
|
|||||||
|
|
||||||
if (SCH_top_shared_cp(B)) {
|
if (SCH_top_shared_cp(B)) {
|
||||||
#ifdef TIMESTAMP_CHECK
|
#ifdef TIMESTAMP_CHECK
|
||||||
timestamp = ++GLOBAL_timestamp;
|
timestamp = ++Yap_timestamp;
|
||||||
#endif /* TIMESTAMP_CHECK */
|
#endif /* TIMESTAMP_CHECK */
|
||||||
entry_owners = OrFr_owners(LOCAL_top_or_fr);
|
entry_owners = OrFr_owners(LOCAL_top_or_fr);
|
||||||
}
|
}
|
||||||
@ -1409,7 +1409,7 @@
|
|||||||
UNLOCK(DepFr_lock(dep_fr));
|
UNLOCK(DepFr_lock(dep_fr));
|
||||||
|
|
||||||
#ifdef DEBUG_OPTYAP
|
#ifdef DEBUG_OPTYAP
|
||||||
if (PARALLEL_EXECUTION_MODE) {
|
if (Yap_parallel_execution_mode) {
|
||||||
choiceptr aux_cp;
|
choiceptr aux_cp;
|
||||||
OPTYAP_ERROR_CHECKING(completion, Get_LOCAL_top_cp(), Get_LOCAL_top_cp_on_stack());
|
OPTYAP_ERROR_CHECKING(completion, Get_LOCAL_top_cp(), Get_LOCAL_top_cp_on_stack());
|
||||||
aux_cp = DepFr_cons_cp(dep_fr);
|
aux_cp = DepFr_cons_cp(dep_fr);
|
||||||
@ -1434,7 +1434,7 @@
|
|||||||
}
|
}
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
#ifdef DEBUG_OPTYAP
|
#ifdef DEBUG_OPTYAP
|
||||||
if (PARALLEL_EXECUTION_MODE) {
|
if (Yap_parallel_execution_mode) {
|
||||||
choiceptr aux_cp;
|
choiceptr aux_cp;
|
||||||
OPTYAP_ERROR_CHECKING(completion, YOUNGER_CP(Get_LOCAL_top_cp(), Get_LOCAL_top_cp_on_stack()));
|
OPTYAP_ERROR_CHECKING(completion, YOUNGER_CP(Get_LOCAL_top_cp(), Get_LOCAL_top_cp_on_stack()));
|
||||||
aux_cp = DepFr_cons_cp(dep_fr);
|
aux_cp = DepFr_cons_cp(dep_fr);
|
||||||
|
@ -111,10 +111,10 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
|
|||||||
#define MakeTableVarTerm(INDEX) ((INDEX) << NumberOfLowTagBits)
|
#define MakeTableVarTerm(INDEX) ((INDEX) << NumberOfLowTagBits)
|
||||||
#define VarIndexOfTableTerm(TERM) (((unsigned int) (TERM)) >> NumberOfLowTagBits)
|
#define VarIndexOfTableTerm(TERM) (((unsigned int) (TERM)) >> NumberOfLowTagBits)
|
||||||
#define VarIndexOfTerm(TERM) \
|
#define VarIndexOfTerm(TERM) \
|
||||||
((((CELL) (TERM)) - GLOBAL_table_var_enumerator(0)) / sizeof(CELL))
|
((((CELL) (TERM)) - Yap_table_var_enumerator(0)) / sizeof(CELL))
|
||||||
#define IsTableVarTerm(TERM) \
|
#define IsTableVarTerm(TERM) \
|
||||||
((CELL) (TERM)) >= GLOBAL_table_var_enumerator(0) && \
|
((CELL) (TERM)) >= Yap_table_var_enumerator(0) && \
|
||||||
((CELL) (TERM)) <= GLOBAL_table_var_enumerator(MAX_TABLE_VARS - 1)
|
((CELL) (TERM)) <= Yap_table_var_enumerator(MAX_TABLE_VARS - 1)
|
||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
#define PairTermMark NULL
|
#define PairTermMark NULL
|
||||||
#define CompactPairInit AbsPair((Term *) 0)
|
#define CompactPairInit AbsPair((Term *) 0)
|
||||||
@ -154,8 +154,8 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
|
|||||||
#define IS_GLOBAL_TRIE_HASH(NODE) (TrNode_entry(NODE) == GLOBAL_TRIE_HASH_MARK)
|
#define IS_GLOBAL_TRIE_HASH(NODE) (TrNode_entry(NODE) == GLOBAL_TRIE_HASH_MARK)
|
||||||
|
|
||||||
#define HASH_TABLE_LOCK(NODE) ((((unsigned long int) (NODE)) >> 5) & (TABLE_LOCK_BUCKETS - 1))
|
#define HASH_TABLE_LOCK(NODE) ((((unsigned long int) (NODE)) >> 5) & (TABLE_LOCK_BUCKETS - 1))
|
||||||
#define LOCK_TABLE(NODE) LOCK(GLOBAL_table_lock(HASH_TABLE_LOCK(NODE)))
|
#define LOCK_TABLE(NODE) LOCK(Yap_table_lock(HASH_TABLE_LOCK(NODE)))
|
||||||
#define UNLOCK_TABLE(NODE) UNLOCK(GLOBAL_table_lock(HASH_TABLE_LOCK(NODE)))
|
#define UNLOCK_TABLE(NODE) UNLOCK(Yap_table_lock(HASH_TABLE_LOCK(NODE)))
|
||||||
|
|
||||||
#define STACK_PUSH_UP(ITEM, STACK) *--(STACK) = (CELL)(ITEM)
|
#define STACK_PUSH_UP(ITEM, STACK) *--(STACK) = (CELL)(ITEM)
|
||||||
#define STACK_POP_UP(STACK) *--(STACK)
|
#define STACK_POP_UP(STACK) *--(STACK)
|
||||||
@ -290,8 +290,8 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
|
|||||||
SetMode_GlobalTrie(TabEnt_mode(TAB_ENT)); \
|
SetMode_GlobalTrie(TabEnt_mode(TAB_ENT)); \
|
||||||
TabEnt_subgoal_trie(TAB_ENT) = sg_node; \
|
TabEnt_subgoal_trie(TAB_ENT) = sg_node; \
|
||||||
TabEnt_hash_chain(TAB_ENT) = NULL; \
|
TabEnt_hash_chain(TAB_ENT) = NULL; \
|
||||||
TabEnt_next(TAB_ENT) = GLOBAL_root_tab_ent; \
|
TabEnt_next(TAB_ENT) = Yap_root_tab_ent; \
|
||||||
GLOBAL_root_tab_ent = TAB_ENT; \
|
Yap_root_tab_ent = TAB_ENT; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define new_subgoal_frame(SG_FR, CODE) \
|
#define new_subgoal_frame(SG_FR, CODE) \
|
||||||
@ -394,26 +394,26 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
|
|||||||
|
|
||||||
#ifdef LIMIT_TABLING
|
#ifdef LIMIT_TABLING
|
||||||
#define insert_into_global_sg_fr_list(SG_FR) \
|
#define insert_into_global_sg_fr_list(SG_FR) \
|
||||||
SgFr_previous(SG_FR) = GLOBAL_last_sg_fr; \
|
SgFr_previous(SG_FR) = Yap_last_sg_fr; \
|
||||||
SgFr_next(SG_FR) = NULL; \
|
SgFr_next(SG_FR) = NULL; \
|
||||||
if (GLOBAL_first_sg_fr == NULL) \
|
if (Yap_first_sg_fr == NULL) \
|
||||||
GLOBAL_first_sg_fr = SG_FR; \
|
Yap_first_sg_fr = SG_FR; \
|
||||||
else \
|
else \
|
||||||
SgFr_next(GLOBAL_last_sg_fr) = SG_FR; \
|
SgFr_next(Yap_last_sg_fr) = SG_FR; \
|
||||||
GLOBAL_last_sg_fr = SG_FR
|
Yap_last_sg_fr = SG_FR
|
||||||
#define remove_from_global_sg_fr_list(SG_FR) \
|
#define remove_from_global_sg_fr_list(SG_FR) \
|
||||||
if (SgFr_previous(SG_FR)) { \
|
if (SgFr_previous(SG_FR)) { \
|
||||||
if ((SgFr_next(SgFr_previous(SG_FR)) = SgFr_next(SG_FR)) != NULL) \
|
if ((SgFr_next(SgFr_previous(SG_FR)) = SgFr_next(SG_FR)) != NULL) \
|
||||||
SgFr_previous(SgFr_next(SG_FR)) = SgFr_previous(SG_FR); \
|
SgFr_previous(SgFr_next(SG_FR)) = SgFr_previous(SG_FR); \
|
||||||
else \
|
else \
|
||||||
GLOBAL_last_sg_fr = SgFr_previous(SG_FR); \
|
Yap_last_sg_fr = SgFr_previous(SG_FR); \
|
||||||
} else { \
|
} else { \
|
||||||
if ((GLOBAL_first_sg_fr = SgFr_next(SG_FR)) != NULL) \
|
if ((Yap_first_sg_fr = SgFr_next(SG_FR)) != NULL) \
|
||||||
SgFr_previous(SgFr_next(SG_FR)) = NULL; \
|
SgFr_previous(SgFr_next(SG_FR)) = NULL; \
|
||||||
else \
|
else \
|
||||||
GLOBAL_last_sg_fr = NULL; \
|
Yap_last_sg_fr = NULL; \
|
||||||
} \
|
} \
|
||||||
if (GLOBAL_check_sg_fr == SG_FR) \
|
if (Yap_check_sg_fr == SG_FR) \
|
||||||
GLOBAL_check_sg_fr = SgFr_previous(SG_FR)
|
GLOBAL_check_sg_fr = SgFr_previous(SG_FR)
|
||||||
#else
|
#else
|
||||||
#define insert_into_global_sg_fr_list(SG_FR)
|
#define insert_into_global_sg_fr_list(SG_FR)
|
||||||
@ -652,7 +652,7 @@ static inline void abolish_incomplete_subgoals(choiceptr prune_cp) {
|
|||||||
|
|
||||||
if (EQUAL_OR_YOUNGER_CP(DepFr_cons_cp(LOCAL_top_dep_fr), prune_cp)) {
|
if (EQUAL_OR_YOUNGER_CP(DepFr_cons_cp(LOCAL_top_dep_fr), prune_cp)) {
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
if (PARALLEL_EXECUTION_MODE)
|
if (Yap_parallel_execution_mode)
|
||||||
pruning_over_tabling_data_structures();
|
pruning_over_tabling_data_structures();
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
do {
|
do {
|
||||||
@ -666,7 +666,7 @@ static inline void abolish_incomplete_subgoals(choiceptr prune_cp) {
|
|||||||
while (LOCAL_top_sg_fr && EQUAL_OR_YOUNGER_CP(SgFr_gen_cp(LOCAL_top_sg_fr), prune_cp)) {
|
while (LOCAL_top_sg_fr && EQUAL_OR_YOUNGER_CP(SgFr_gen_cp(LOCAL_top_sg_fr), prune_cp)) {
|
||||||
sg_fr_ptr sg_fr;
|
sg_fr_ptr sg_fr;
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
if (PARALLEL_EXECUTION_MODE)
|
if (Yap_parallel_execution_mode)
|
||||||
pruning_over_tabling_data_structures();
|
pruning_over_tabling_data_structures();
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
sg_fr = LOCAL_top_sg_fr;
|
sg_fr = LOCAL_top_sg_fr;
|
||||||
|
@ -468,7 +468,7 @@ static void free_global_trie_branch(gt_node_ptr current_node) {
|
|||||||
if (num_nodes == 0) {
|
if (num_nodes == 0) {
|
||||||
FREE_HASH_BUCKETS(Hash_buckets(hash));
|
FREE_HASH_BUCKETS(Hash_buckets(hash));
|
||||||
FREE_GLOBAL_TRIE_HASH(hash);
|
FREE_GLOBAL_TRIE_HASH(hash);
|
||||||
if (parent_node != GLOBAL_root_gt) {
|
if (parent_node != Yap_root_gt) {
|
||||||
#ifdef GLOBAL_TRIE_FOR_SUBTERMS
|
#ifdef GLOBAL_TRIE_FOR_SUBTERMS
|
||||||
if (mode == TRAVERSE_MODE_NORMAL) {
|
if (mode == TRAVERSE_MODE_NORMAL) {
|
||||||
if (IsApplTerm(t)) {
|
if (IsApplTerm(t)) {
|
||||||
@ -506,7 +506,7 @@ static void free_global_trie_branch(gt_node_ptr current_node) {
|
|||||||
} else if (TrNode_next(current_node) == NULL) {
|
} else if (TrNode_next(current_node) == NULL) {
|
||||||
CHECK_DECREMENT_GLOBAL_TRIE_FOR_SUBTERMS_REFERENCE(t, mode);
|
CHECK_DECREMENT_GLOBAL_TRIE_FOR_SUBTERMS_REFERENCE(t, mode);
|
||||||
FREE_GLOBAL_TRIE_NODE(current_node);
|
FREE_GLOBAL_TRIE_NODE(current_node);
|
||||||
if (parent_node != GLOBAL_root_gt) {
|
if (parent_node != Yap_root_gt) {
|
||||||
#ifdef GLOBAL_TRIE_FOR_SUBTERMS
|
#ifdef GLOBAL_TRIE_FOR_SUBTERMS
|
||||||
if (mode == TRAVERSE_MODE_NORMAL) {
|
if (mode == TRAVERSE_MODE_NORMAL) {
|
||||||
if (IsApplTerm(t)) {
|
if (IsApplTerm(t)) {
|
||||||
@ -804,7 +804,7 @@ static void traverse_global_trie(gt_node_ptr current_node, char *str, int str_in
|
|||||||
|
|
||||||
|
|
||||||
static void traverse_global_trie_for_term(gt_node_ptr current_node, char *str, int *str_index, int *arity, int *mode, int type) {
|
static void traverse_global_trie_for_term(gt_node_ptr current_node, char *str, int *str_index, int *arity, int *mode, int type) {
|
||||||
if (TrNode_parent(current_node) != GLOBAL_root_gt)
|
if (TrNode_parent(current_node) != Yap_root_gt)
|
||||||
traverse_global_trie_for_term(TrNode_parent(current_node), str, str_index, arity, mode, type);
|
traverse_global_trie_for_term(TrNode_parent(current_node), str, str_index, arity, mode, type);
|
||||||
traverse_trie_node(TrNode_entry(current_node), str, str_index, arity, mode, type);
|
traverse_trie_node(TrNode_entry(current_node), str, str_index, arity, mode, type);
|
||||||
return;
|
return;
|
||||||
@ -1377,11 +1377,11 @@ void show_global_trie(int show_mode) {
|
|||||||
} else { /* SHOW_MODE_STRUCTURE */
|
} else { /* SHOW_MODE_STRUCTURE */
|
||||||
fprintf(Yap_stdout, "Global trie structure\n");
|
fprintf(Yap_stdout, "Global trie structure\n");
|
||||||
}
|
}
|
||||||
if (TrNode_child(GLOBAL_root_gt)) {
|
if (TrNode_child(Yap_root_gt)) {
|
||||||
char *str = (char *) malloc(sizeof(char) * SHOW_TABLE_STR_ARRAY_SIZE);
|
char *str = (char *) malloc(sizeof(char) * SHOW_TABLE_STR_ARRAY_SIZE);
|
||||||
int *arity = (int *) malloc(sizeof(int) * SHOW_TABLE_ARITY_ARRAY_SIZE);
|
int *arity = (int *) malloc(sizeof(int) * SHOW_TABLE_ARITY_ARRAY_SIZE);
|
||||||
arity[0] = 0;
|
arity[0] = 0;
|
||||||
traverse_global_trie(TrNode_child(GLOBAL_root_gt), str, 0, arity, TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST);
|
traverse_global_trie(TrNode_child(Yap_root_gt), str, 0, arity, TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST);
|
||||||
free(str);
|
free(str);
|
||||||
free(arity);
|
free(arity);
|
||||||
} else
|
} else
|
||||||
|
@ -831,7 +831,7 @@ static inline sg_node_ptr subgoal_search_loop(tab_ent_ptr tab_ent, sg_node_ptr c
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
#ifdef MODE_GLOBAL_TRIE_LOOP
|
#ifdef MODE_GLOBAL_TRIE_LOOP
|
||||||
gt_node_ptr current_node = GLOBAL_root_gt;
|
gt_node_ptr current_node = Yap_root_gt;
|
||||||
#endif /* MODE_GLOBAL_TRIE_LOOP */
|
#endif /* MODE_GLOBAL_TRIE_LOOP */
|
||||||
int subs_arity = *subs_arity_ptr;
|
int subs_arity = *subs_arity_ptr;
|
||||||
CELL *stack_vars = *stack_vars_ptr;
|
CELL *stack_vars = *stack_vars_ptr;
|
||||||
@ -856,7 +856,7 @@ static inline sg_node_ptr subgoal_search_loop(tab_ent_ptr tab_ent, sg_node_ptr c
|
|||||||
if (subs_arity == MAX_TABLE_VARS)
|
if (subs_arity == MAX_TABLE_VARS)
|
||||||
Yap_Error(INTERNAL_ERROR, TermNil, "subgoal_search_loop: MAX_TABLE_VARS exceeded");
|
Yap_Error(INTERNAL_ERROR, TermNil, "subgoal_search_loop: MAX_TABLE_VARS exceeded");
|
||||||
STACK_PUSH_UP(t, stack_vars);
|
STACK_PUSH_UP(t, stack_vars);
|
||||||
*((CELL *)t) = GLOBAL_table_var_enumerator(subs_arity);
|
*((CELL *)t) = Yap_table_var_enumerator(subs_arity);
|
||||||
t = MakeTableVarTerm(subs_arity);
|
t = MakeTableVarTerm(subs_arity);
|
||||||
subs_arity = subs_arity + 1;
|
subs_arity = subs_arity + 1;
|
||||||
SUBGOAL_CHECK_INSERT_ENTRY(tab_ent, current_node, t);
|
SUBGOAL_CHECK_INSERT_ENTRY(tab_ent, current_node, t);
|
||||||
@ -901,7 +901,7 @@ static inline sg_node_ptr subgoal_search_loop(tab_ent_ptr tab_ent, sg_node_ptr c
|
|||||||
STACK_PUSH_UP(t, stack_terms);
|
STACK_PUSH_UP(t, stack_terms);
|
||||||
}
|
}
|
||||||
#if defined(MODE_GLOBAL_TRIE_LOOP) && defined(GLOBAL_TRIE_FOR_SUBTERMS)
|
#if defined(MODE_GLOBAL_TRIE_LOOP) && defined(GLOBAL_TRIE_FOR_SUBTERMS)
|
||||||
} else if (current_node != GLOBAL_root_gt) {
|
} else if (current_node != Yap_root_gt) {
|
||||||
gt_node_ptr entry_node = subgoal_search_global_trie_terms_loop(t, &subs_arity, &stack_vars, stack_terms);
|
gt_node_ptr entry_node = subgoal_search_global_trie_terms_loop(t, &subs_arity, &stack_vars, stack_terms);
|
||||||
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node);
|
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node);
|
||||||
#endif /* MODE_GLOBAL_TRIE_LOOP && GLOBAL_TRIE_FOR_SUBTERMS */
|
#endif /* MODE_GLOBAL_TRIE_LOOP && GLOBAL_TRIE_FOR_SUBTERMS */
|
||||||
@ -918,13 +918,13 @@ static inline sg_node_ptr subgoal_search_loop(tab_ent_ptr tab_ent, sg_node_ptr c
|
|||||||
STACK_PUSH_UP(Deref(aux_pair[0]), stack_terms);
|
STACK_PUSH_UP(Deref(aux_pair[0]), stack_terms);
|
||||||
}
|
}
|
||||||
#if defined(MODE_GLOBAL_TRIE_LOOP) && defined(GLOBAL_TRIE_FOR_SUBTERMS)
|
#if defined(MODE_GLOBAL_TRIE_LOOP) && defined(GLOBAL_TRIE_FOR_SUBTERMS)
|
||||||
} else if (current_node != GLOBAL_root_gt) {
|
} else if (current_node != Yap_root_gt) {
|
||||||
gt_node_ptr entry_node = subgoal_search_global_trie_terms_loop(t, &subs_arity, &stack_vars, stack_terms);
|
gt_node_ptr entry_node = subgoal_search_global_trie_terms_loop(t, &subs_arity, &stack_vars, stack_terms);
|
||||||
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node);
|
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node);
|
||||||
#endif /* MODE_GLOBAL_TRIE_LOOP && GLOBAL_TRIE_FOR_SUBTERMS */
|
#endif /* MODE_GLOBAL_TRIE_LOOP && GLOBAL_TRIE_FOR_SUBTERMS */
|
||||||
#else /* ! TRIE_COMPACT_PAIRS */
|
#else /* ! TRIE_COMPACT_PAIRS */
|
||||||
#if defined(MODE_GLOBAL_TRIE_LOOP) && defined(GLOBAL_TRIE_FOR_SUBTERMS)
|
#if defined(MODE_GLOBAL_TRIE_LOOP) && defined(GLOBAL_TRIE_FOR_SUBTERMS)
|
||||||
if (current_node != GLOBAL_root_gt) {
|
if (current_node != Yap_root_gt) {
|
||||||
gt_node_ptr entry_node = subgoal_search_global_trie_terms_loop(t, &subs_arity, &stack_vars, stack_terms);
|
gt_node_ptr entry_node = subgoal_search_global_trie_terms_loop(t, &subs_arity, &stack_vars, stack_terms);
|
||||||
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node);
|
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node);
|
||||||
} else
|
} else
|
||||||
@ -1035,7 +1035,7 @@ static inline ans_node_ptr answer_search_loop(sg_fr_ptr sg_fr, ans_node_ptr curr
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
#ifdef MODE_GLOBAL_TRIE_LOOP
|
#ifdef MODE_GLOBAL_TRIE_LOOP
|
||||||
gt_node_ptr current_node = GLOBAL_root_gt;
|
gt_node_ptr current_node = Yap_root_gt;
|
||||||
#endif /* MODE_GLOBAL_TRIE_LOOP */
|
#endif /* MODE_GLOBAL_TRIE_LOOP */
|
||||||
int vars_arity = *vars_arity_ptr;
|
int vars_arity = *vars_arity_ptr;
|
||||||
#if ! defined(MODE_GLOBAL_TRIE_LOOP) || ! defined(GLOBAL_TRIE_FOR_SUBTERMS)
|
#if ! defined(MODE_GLOBAL_TRIE_LOOP) || ! defined(GLOBAL_TRIE_FOR_SUBTERMS)
|
||||||
@ -1066,7 +1066,7 @@ static inline ans_node_ptr answer_search_loop(sg_fr_ptr sg_fr, ans_node_ptr curr
|
|||||||
if (vars_arity == MAX_TABLE_VARS)
|
if (vars_arity == MAX_TABLE_VARS)
|
||||||
Yap_Error(INTERNAL_ERROR, TermNil, "answer_search_loop: MAX_TABLE_VARS exceeded");
|
Yap_Error(INTERNAL_ERROR, TermNil, "answer_search_loop: MAX_TABLE_VARS exceeded");
|
||||||
stack_vars_base[vars_arity] = t;
|
stack_vars_base[vars_arity] = t;
|
||||||
*((CELL *)t) = GLOBAL_table_var_enumerator(vars_arity);
|
*((CELL *)t) = Yap_table_var_enumerator(vars_arity);
|
||||||
t = MakeTableVarTerm(vars_arity);
|
t = MakeTableVarTerm(vars_arity);
|
||||||
ANSWER_CHECK_INSERT_ENTRY(sg_fr, current_node, t, _trie_retry_var + in_pair);
|
ANSWER_CHECK_INSERT_ENTRY(sg_fr, current_node, t, _trie_retry_var + in_pair);
|
||||||
vars_arity = vars_arity + 1;
|
vars_arity = vars_arity + 1;
|
||||||
@ -1118,7 +1118,7 @@ static inline ans_node_ptr answer_search_loop(sg_fr_ptr sg_fr, ans_node_ptr curr
|
|||||||
STACK_PUSH_UP(t, stack_terms);
|
STACK_PUSH_UP(t, stack_terms);
|
||||||
}
|
}
|
||||||
#if defined(MODE_GLOBAL_TRIE_LOOP) && defined(GLOBAL_TRIE_FOR_SUBTERMS)
|
#if defined(MODE_GLOBAL_TRIE_LOOP) && defined(GLOBAL_TRIE_FOR_SUBTERMS)
|
||||||
} else if (current_node != GLOBAL_root_gt) {
|
} else if (current_node != Yap_root_gt) {
|
||||||
gt_node_ptr entry_node = answer_search_global_trie_terms_loop(t, &vars_arity, stack_terms);
|
gt_node_ptr entry_node = answer_search_global_trie_terms_loop(t, &vars_arity, stack_terms);
|
||||||
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node);
|
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node);
|
||||||
#endif /* MODE_GLOBAL_TRIE_LOOP && GLOBAL_TRIE_FOR_SUBTERMS */
|
#endif /* MODE_GLOBAL_TRIE_LOOP && GLOBAL_TRIE_FOR_SUBTERMS */
|
||||||
@ -1137,13 +1137,13 @@ static inline ans_node_ptr answer_search_loop(sg_fr_ptr sg_fr, ans_node_ptr curr
|
|||||||
STACK_PUSH_UP(Deref(aux_pair[0]), stack_terms);
|
STACK_PUSH_UP(Deref(aux_pair[0]), stack_terms);
|
||||||
}
|
}
|
||||||
#if defined(MODE_GLOBAL_TRIE_LOOP) && defined(GLOBAL_TRIE_FOR_SUBTERMS)
|
#if defined(MODE_GLOBAL_TRIE_LOOP) && defined(GLOBAL_TRIE_FOR_SUBTERMS)
|
||||||
} else if (current_node != GLOBAL_root_gt) {
|
} else if (current_node != Yap_root_gt) {
|
||||||
gt_node_ptr entry_node = answer_search_global_trie_terms_loop(t, &vars_arity, stack_terms);
|
gt_node_ptr entry_node = answer_search_global_trie_terms_loop(t, &vars_arity, stack_terms);
|
||||||
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node);
|
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node);
|
||||||
#endif /* MODE_GLOBAL_TRIE_LOOP && GLOBAL_TRIE_FOR_SUBTERMS */
|
#endif /* MODE_GLOBAL_TRIE_LOOP && GLOBAL_TRIE_FOR_SUBTERMS */
|
||||||
#else /* ! TRIE_COMPACT_PAIRS */
|
#else /* ! TRIE_COMPACT_PAIRS */
|
||||||
#if defined(MODE_GLOBAL_TRIE_LOOP) && defined(GLOBAL_TRIE_FOR_SUBTERMS)
|
#if defined(MODE_GLOBAL_TRIE_LOOP) && defined(GLOBAL_TRIE_FOR_SUBTERMS)
|
||||||
if (current_node != GLOBAL_root_gt) {
|
if (current_node != Yap_root_gt) {
|
||||||
gt_node_ptr entry_node = answer_search_global_trie_terms_loop(t, &vars_arity, stack_terms);
|
gt_node_ptr entry_node = answer_search_global_trie_terms_loop(t, &vars_arity, stack_terms);
|
||||||
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node);
|
current_node = global_trie_check_insert_gt_entry(current_node, (Term) entry_node);
|
||||||
} else
|
} else
|
||||||
|
@ -54,17 +54,17 @@
|
|||||||
#error Do not explicitly define YAPOR
|
#error Do not explicitly define YAPOR
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
|
|
||||||
#if (defined(ENV_COPY) && (defined(ACOW) || defined(SBA))) || (defined(ACOW) && defined(SBA))
|
#if (defined(YAPOR_COPY) && (defined(YAPOR_COW) || defined(YAPOR_SBA))) || (defined(YAPOR_COW) && defined(YAPOR_SBA))
|
||||||
#error Do not define multiple or-parallel models
|
#error Do not define multiple or-parallel models
|
||||||
#endif /* (ENV_COPY && (ACOW || SBA)) || (ACOW && SBA) */
|
#endif /* (YAPOR_COPY && (YAPOR_COW || YAPOR_SBA)) || (YAPOR_COW && YAPOR_SBA) */
|
||||||
|
|
||||||
#if defined(ENV_COPY) || defined(ACOW) || defined(SBA)
|
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)
|
||||||
#define YAPOR 1
|
#define YAPOR 1
|
||||||
#endif /* ENV_COPY || ACOW || SBA */
|
#endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA */
|
||||||
|
|
||||||
#if defined(TABLING) && (defined(ACOW) || defined(SBA))
|
#if defined(TABLING) && (defined(YAPOR_COW) || defined(YAPOR_SBA))
|
||||||
#error Currently TABLING only works with ENV_COPY
|
#error Currently TABLING only works with YAPOR_COPY
|
||||||
#endif /* TABLING && (ACOW || SBA) */
|
#endif /* TABLING && (YAPOR_COW || YAPOR_SBA) */
|
||||||
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
#define FIXED_STACKS 1
|
#define FIXED_STACKS 1
|
||||||
@ -86,7 +86,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SBA
|
#ifdef YAPOR_SBA
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
#ifndef FROZEN_STACKS
|
#ifndef FROZEN_STACKS
|
||||||
#define FROZEN_STACKS 1
|
#define FROZEN_STACKS 1
|
||||||
@ -365,6 +365,7 @@ typedef CELL Term;
|
|||||||
|
|
||||||
#include "Regs.h"
|
#include "Regs.h"
|
||||||
|
|
||||||
|
|
||||||
#if defined(YAPOR) ||defined(THREADS)
|
#if defined(YAPOR) ||defined(THREADS)
|
||||||
#ifdef mips
|
#ifdef mips
|
||||||
#include <locks_mips_funcs.h>
|
#include <locks_mips_funcs.h>
|
||||||
@ -613,7 +614,7 @@ and RefOfTerm(t) : Term -> DBRef = ...
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if defined(SBA) && defined(__linux__)
|
#if defined(YAPOR_SBA) && defined(__linux__)
|
||||||
#define MBIT /* 0x20000000 */ MKTAG(0x1,0) /* mark bit */
|
#define MBIT /* 0x20000000 */ MKTAG(0x1,0) /* mark bit */
|
||||||
#else
|
#else
|
||||||
#define RBIT /* 0x20000000 */ MKTAG(0x1,0) /* relocation chain bit */
|
#define RBIT /* 0x20000000 */ MKTAG(0x1,0) /* relocation chain bit */
|
||||||
@ -642,7 +643,7 @@ inline EXTERN Term * VarOfTerm(Term t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
|
|
||||||
inline EXTERN Term MkVarTerm(void);
|
inline EXTERN Term MkVarTerm(void);
|
||||||
|
|
||||||
@ -825,8 +826,8 @@ inline EXTERN Int IntegerOfTerm(Term t)
|
|||||||
|
|
||||||
/*************** unification routines ***********************************/
|
/*************** unification routines ***********************************/
|
||||||
|
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
#include "or.sbaamiops.h"
|
#include "or.sba_amiops.h"
|
||||||
#else
|
#else
|
||||||
#include "amiops.h"
|
#include "amiops.h"
|
||||||
#endif
|
#endif
|
||||||
@ -1046,7 +1047,7 @@ extern int snoozing;
|
|||||||
#include "opt.proto.h"
|
#include "opt.proto.h"
|
||||||
#endif /* YAPOR || TABLING */
|
#endif /* YAPOR || TABLING */
|
||||||
|
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
#include "or.sbaunify.h"
|
#include "or.sba_unify.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ SDeref (Term a)
|
|||||||
{
|
{
|
||||||
Term *b = (Term *) a;
|
Term *b = (Term *) a;
|
||||||
a = *b;
|
a = *b;
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
if (a == (0))
|
if (a == (0))
|
||||||
return (CELL) b;
|
return (CELL) b;
|
||||||
#else
|
#else
|
||||||
@ -50,7 +50,7 @@ SDerefa (CELL * b)
|
|||||||
Term a = *b;
|
Term a = *b;
|
||||||
while (IsVarTerm (a))
|
while (IsVarTerm (a))
|
||||||
{
|
{
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
if (a == (0))
|
if (a == (0))
|
||||||
return (CELL) b;
|
return (CELL) b;
|
||||||
#else
|
#else
|
||||||
@ -69,7 +69,7 @@ SADerefa (CELL * b)
|
|||||||
Term a = *b;
|
Term a = *b;
|
||||||
while (IsVarTerm (a))
|
while (IsVarTerm (a))
|
||||||
{
|
{
|
||||||
#if SBA
|
#if YAPOR_SBA
|
||||||
if (a == (0))
|
if (a == (0))
|
||||||
return b;
|
return b;
|
||||||
#else
|
#else
|
||||||
|
6
configure
vendored
6
configure
vendored
@ -7492,13 +7492,13 @@ fi
|
|||||||
|
|
||||||
case "$orparallelism" in
|
case "$orparallelism" in
|
||||||
sba)
|
sba)
|
||||||
YAP_EXTRAS="$YAP_EXTRAS -DSBA=1"
|
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_SBA=1"
|
||||||
;;
|
;;
|
||||||
a-cow)
|
a-cow)
|
||||||
YAP_EXTRAS="$YAP_EXTRAS -DACOW=1"
|
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_COW=1"
|
||||||
;;
|
;;
|
||||||
yes|env-copy)
|
yes|env-copy)
|
||||||
YAP_EXTRAS="$YAP_EXTRAS -DENV_COPY=1"
|
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_COPY=1"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -1276,13 +1276,13 @@ fi
|
|||||||
|
|
||||||
case "$orparallelism" in
|
case "$orparallelism" in
|
||||||
sba)
|
sba)
|
||||||
YAP_EXTRAS="$YAP_EXTRAS -DSBA=1"
|
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_SBA=1"
|
||||||
;;
|
;;
|
||||||
a-cow)
|
a-cow)
|
||||||
YAP_EXTRAS="$YAP_EXTRAS -DACOW=1"
|
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_COW=1"
|
||||||
;;
|
;;
|
||||||
yes|env-copy)
|
yes|env-copy)
|
||||||
YAP_EXTRAS="$YAP_EXTRAS -DENV_COPY=1"
|
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_COPY=1"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -149,14 +149,14 @@ print_usage(void)
|
|||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
fprintf(stderr," -ts Maximum table space area in Mbytes (default: unlimited)\n");
|
fprintf(stderr," -ts Maximum table space area in Mbytes (default: unlimited)\n");
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
#if defined(ENV_COPY) || defined(ACOW) || defined(SBA)
|
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)
|
||||||
fprintf(stderr," -w Number of workers (default: %d)\n",
|
fprintf(stderr," -w Number of workers (default: %d)\n",
|
||||||
DEFAULT_NUMBERWORKERS);
|
DEFAULT_NUMBERWORKERS);
|
||||||
fprintf(stderr," -sl Loop scheduler executions before look for hiden shared work (default: %d)\n",
|
fprintf(stderr," -sl Loop scheduler executions before look for hiden shared work (default: %d)\n",
|
||||||
DEFAULT_SCHEDULERLOOP);
|
DEFAULT_SCHEDULERLOOP);
|
||||||
fprintf(stderr," -d Value of delayed release of load (default: %d)\n",
|
fprintf(stderr," -d Value of delayed release of load (default: %d)\n",
|
||||||
DEFAULT_DELAYEDRELEASELOAD);
|
DEFAULT_DELAYEDRELEASELOAD);
|
||||||
#endif /* ENV_COPY || ACOW || SBA */
|
#endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA */
|
||||||
/* nf: Preprocessor */
|
/* nf: Preprocessor */
|
||||||
/* fprintf(stderr," -DVar=Name Persistent definition\n"); */
|
/* fprintf(stderr," -DVar=Name Persistent definition\n"); */
|
||||||
fprintf(stderr,"\n");
|
fprintf(stderr,"\n");
|
||||||
@ -245,7 +245,7 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
|
|||||||
case 'q':
|
case 'q':
|
||||||
iap->QuietMode = TRUE;
|
iap->QuietMode = TRUE;
|
||||||
break;
|
break;
|
||||||
#if defined(ENV_COPY) || defined(ACOW) || defined(SBA)
|
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)
|
||||||
case 'w':
|
case 'w':
|
||||||
ssize = &(iap->NumberWorkers);
|
ssize = &(iap->NumberWorkers);
|
||||||
goto GetSize;
|
goto GetSize;
|
||||||
@ -258,7 +258,7 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
|
|||||||
case 'd':
|
case 'd':
|
||||||
if (!strcmp("dump-runtime-variables",p))
|
if (!strcmp("dump-runtime-variables",p))
|
||||||
return dump_runtime_variables();
|
return dump_runtime_variables();
|
||||||
#endif /* ENV_COPY || ACOW || SBA */
|
#endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA */
|
||||||
#ifdef USE_SOCKET
|
#ifdef USE_SOCKET
|
||||||
case 'c': /* running as client */
|
case 'c': /* running as client */
|
||||||
{
|
{
|
||||||
@ -386,12 +386,12 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
|
|||||||
case 's':
|
case 's':
|
||||||
case 'S':
|
case 'S':
|
||||||
ssize = &(iap->StackSize);
|
ssize = &(iap->StackSize);
|
||||||
#if defined(ENV_COPY) || defined(ACOW) || defined(SBA)
|
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)
|
||||||
if (p[1] == 'l') {
|
if (p[1] == 'l') {
|
||||||
p++;
|
p++;
|
||||||
ssize = &(iap->SchedulerLoop);
|
ssize = &(iap->SchedulerLoop);
|
||||||
}
|
}
|
||||||
#endif /* ENV_COPY || ACOW || SBA */
|
#endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA */
|
||||||
goto GetSize;
|
goto GetSize;
|
||||||
case 'a':
|
case 'a':
|
||||||
case 'A':
|
case 'A':
|
||||||
|
29
misc/GLOBALS
29
misc/GLOBALS
@ -19,49 +19,44 @@
|
|||||||
|
|
||||||
|
|
||||||
// Stuff that must be shared by all threads or workers
|
// Stuff that must be shared by all threads or workers
|
||||||
START_WORKER_SHARED
|
START_GLOBAL_DATA
|
||||||
|
|
||||||
/* multi-thread support */
|
/* multi-thread support */
|
||||||
#if THREADS
|
#if THREADS
|
||||||
/* number of threads and processes in system */
|
/* number of threads and processes in system */
|
||||||
UInt n_of_threads NOfThreads =1
|
UInt n_of_threads Yap_NOfThreads =1
|
||||||
/* number of threads created since start */
|
/* number of threads created since start */
|
||||||
UInt n_of_threads_created NOfThreadsCreated =1
|
UInt n_of_threads_created Yap_NOfThreadsCreated =1
|
||||||
/* total run time for dead threads */
|
/* total run time for dead threads */
|
||||||
UInt threads_total_time ThreadsTotalTime =0L
|
UInt threads_total_time Yap_ThreadsTotalTime =0L
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// multi-thread/ORP support
|
// multi-thread/ORP support
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
// protect long critical regions
|
// protect long critical regions
|
||||||
lockvar bgl BGL MkLock
|
lockvar bgl Yap_BGL MkLock
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// stack overflow expansion/gc control
|
// stack overflow expansion/gc control
|
||||||
int allow_local_expansion Yap_AllowLocalExpansion =TRUE
|
int allow_local_expansion Yap_AllowLocalExpansion =TRUE
|
||||||
int allow_global_expansion Yap_AllowGlobalExpansion =TRUE
|
int allow_global_expansion Yap_AllowGlobalExpansion =TRUE
|
||||||
int allow_trail_expansion Yap_AllowTrailExpansion =TRUE
|
int allow_trail_expansion Yap_AllowTrailExpansion =TRUE
|
||||||
UInt size_of_overflow SizeOfOverflow =0
|
UInt size_of_overflow Yap_SizeOfOverflow =0
|
||||||
// amount of space recovered in all garbage collections
|
// amount of space recovered in all garbage collections
|
||||||
UInt agc_last_call AGcLastCall =0
|
UInt agc_last_call Yap_AGcLastCall =0
|
||||||
// amount of space recovered in all garbage collections
|
// amount of space recovered in all garbage collections
|
||||||
UInt agc_threshold AGcThreshold =10000
|
UInt agc_threshold Yap_AGcThreshold =10000
|
||||||
Agc_hook agc_hook AGCHook =NULL
|
Agc_hook agc_hook Yap_AGCHook =NULL
|
||||||
|
|
||||||
// readline
|
|
||||||
#if HAVE_LIBREADLINE
|
|
||||||
char *readline_buf ReadlineBuf =NULL
|
|
||||||
char *readline_pos ReadlinePos =0L
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Threads Array
|
// Threads Array
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
lockvar thread_handles_lock ThreadHandlesLock MkLock
|
lockvar thread_handles_lock Yap_ThreadHandlesLock MkLock
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Ricardo's stuff
|
// Ricardo's stuff
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
struct global_data global GLOBAL void
|
struct optyap_global_data optyap_data Yap_optyap_data void
|
||||||
struct local_data remote[MAX_WORKERS] REMOTE void
|
struct local_data remote[MAX_WORKERS] REMOTE void
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -74,5 +69,5 @@ char **pl_argv Yap_PL_Argv =NULL
|
|||||||
// halt hooks
|
// halt hooks
|
||||||
struct halt_hook *yap_halt_hook Yap_HaltHooks =NULL
|
struct halt_hook *yap_halt_hook Yap_HaltHooks =NULL
|
||||||
|
|
||||||
END_WORKER_SHARED
|
END_GLOBAL_DATA
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ CELL** ip_top iptop =NULL
|
|||||||
#if GC_NO_TAGS
|
#if GC_NO_TAGS
|
||||||
char* b_p Yap_bp =NULL
|
char* b_p Yap_bp =NULL
|
||||||
#endif
|
#endif
|
||||||
#if defined(TABLING) || defined(SBA)
|
#if defined(TABLING) || defined(YAPOR_SBA)
|
||||||
struct trail_frame* wl_sTR sTR =NULL
|
struct trail_frame* wl_sTR sTR =NULL
|
||||||
struct trail_frame* wl_sTR0 sTR0 =NULL
|
struct trail_frame* wl_sTR0 sTR0 =NULL
|
||||||
struct trail_frame* new_tr new_TR =NULL
|
struct trail_frame* new_tr new_TR =NULL
|
||||||
|
@ -51,10 +51,10 @@ gen_struct(Inp,Out) :-
|
|||||||
Inp = "END_WORKER_LOCAL", !,
|
Inp = "END_WORKER_LOCAL", !,
|
||||||
Out = "} w_local;".
|
Out = "} w_local;".
|
||||||
gen_struct(Inp,Out) :-
|
gen_struct(Inp,Out) :-
|
||||||
Inp = "START_WORKER_SHARED", !,
|
Inp = "START_GLOBAL_DATA", !,
|
||||||
Out = "typedef struct worker_shared {".
|
Out = "typedef struct global_data {".
|
||||||
gen_struct(Inp,Out) :-
|
gen_struct(Inp,Out) :-
|
||||||
Inp = "END_WORKER_SHARED", !,
|
Inp = "END_GLOBAL_DATA", !,
|
||||||
Out = "} w_shared;".
|
Out = "} w_shared;".
|
||||||
gen_struct(Inp,Out) :-
|
gen_struct(Inp,Out) :-
|
||||||
Inp = "ATOMS", !,
|
Inp = "ATOMS", !,
|
||||||
@ -87,10 +87,10 @@ gen_dstruct(Inp,"") :-
|
|||||||
Inp = "END_WORKER_LOCAL", !,
|
Inp = "END_WORKER_LOCAL", !,
|
||||||
retract(globals(worker)).
|
retract(globals(worker)).
|
||||||
gen_dstruct(Inp,"") :-
|
gen_dstruct(Inp,"") :-
|
||||||
Inp = "START_WORKER_SHARED", !,
|
Inp = "START_GLOBAL_DATA", !,
|
||||||
assert(globals(all)).
|
assert(globals(all)).
|
||||||
gen_dstruct(Inp,"") :-
|
gen_dstruct(Inp,"") :-
|
||||||
Inp = "END_WORKER_SHARED", !,
|
Inp = "END_GLOBAL_DATA", !,
|
||||||
retract(globals(all)).
|
retract(globals(all)).
|
||||||
gen_dstruct(Inp,Out) :-
|
gen_dstruct(Inp,Out) :-
|
||||||
Inp = "ATOMS", !,
|
Inp = "ATOMS", !,
|
||||||
@ -122,7 +122,7 @@ fetch_name(Global) :-
|
|||||||
Global = "WL->".
|
Global = "WL->".
|
||||||
fetch_name(Global) :-
|
fetch_name(Global) :-
|
||||||
globals(worker_init), !,
|
globals(worker_init), !,
|
||||||
Global = "FOREIGN_WL(wid)->".
|
Global = "FOREIGN(wid)->".
|
||||||
fetch_name(Global) :-
|
fetch_name(Global) :-
|
||||||
Global = "Yap_heap_regs->".
|
Global = "Yap_heap_regs->".
|
||||||
|
|
||||||
@ -156,11 +156,11 @@ gen_hstruct(Inp,Out) :-
|
|||||||
Out = "}",
|
Out = "}",
|
||||||
retract(globals(worker_init)).
|
retract(globals(worker_init)).
|
||||||
gen_hstruct(Inp,Out) :-
|
gen_hstruct(Inp,Out) :-
|
||||||
Inp = "START_WORKER_SHARED", !,
|
Inp = "START_GLOBAL_DATA", !,
|
||||||
Out = "static void RestoreGlobal(void) {",
|
Out = "static void RestoreGlobal(void) {",
|
||||||
assert(globals(all)).
|
assert(globals(all)).
|
||||||
gen_hstruct(Inp,Out) :-
|
gen_hstruct(Inp,Out) :-
|
||||||
Inp = "END_WORKER_SHARED", !,
|
Inp = "END_GLOBAL_DATA", !,
|
||||||
Out = "}",
|
Out = "}",
|
||||||
retract(globals(all)).
|
retract(globals(all)).
|
||||||
gen_hstruct(Inp, Out) :-
|
gen_hstruct(Inp, Out) :-
|
||||||
@ -235,11 +235,11 @@ gen_init(Inp,Out) :-
|
|||||||
Out = "}",
|
Out = "}",
|
||||||
retract(globals(worker_init)).
|
retract(globals(worker_init)).
|
||||||
gen_init(Inp,Out) :-
|
gen_init(Inp,Out) :-
|
||||||
Inp = "START_WORKER_SHARED", !,
|
Inp = "START_GLOBAL_DATA", !,
|
||||||
Out = "static void InitGlobal(void) {",
|
Out = "static void InitGlobal(void) {",
|
||||||
assert(globals(all)).
|
assert(globals(all)).
|
||||||
gen_init(Inp,Out) :-
|
gen_init(Inp,Out) :-
|
||||||
Inp = "END_WORKER_SHARED", !,
|
Inp = "END_GLOBAL_DATA", !,
|
||||||
Out = "}",
|
Out = "}",
|
||||||
retract(globals(all)).
|
retract(globals(all)).
|
||||||
gen_init(Inp,Out) :-
|
gen_init(Inp,Out) :-
|
||||||
|
Reference in New Issue
Block a user